( monacoSite: MonacoSite, model: monaco.editor.ITextModel | string )
| 96 | // Some environments like Databricks will include extraneous text, such as %sql |
| 97 | // as the first line. We need to trim this out. |
| 98 | function getValueAndStartOffset( |
| 99 | monacoSite: MonacoSite, |
| 100 | model: monaco.editor.ITextModel | string |
| 101 | ): { value: string; utf16Offset: number } { |
| 102 | const originalValue = typeof model === 'string' ? model : model.getValue(); |
| 103 | if (monacoSite !== OMonacoSite.DATABRICKS || !originalValue.startsWith('%')) { |
| 104 | return { value: originalValue, utf16Offset: 0 }; |
| 105 | } |
| 106 | const indexofNewline = originalValue.indexOf('\n'); |
| 107 | const indexOfSecondLine = indexofNewline === -1 ? originalValue.length : indexofNewline + 1; |
| 108 | // TODO(prem): This is going to let completions start at the end of %python lines, etc. |
| 109 | // https://github.com/Exafunction/Exafunction/pull/3652#discussion_r1102165558 |
| 110 | return { value: originalValue.substring(indexOfSecondLine), utf16Offset: indexOfSecondLine }; |
| 111 | } |
| 112 | |
| 113 | function createInlineCompletionItem( |
| 114 | monacoSite: MonacoSite, |
no outgoing calls
no test coverage detected