File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3393,17 +3393,15 @@ declare module 'vscode' {
33933393 insertText ?: string | SnippetString ;
33943394
33953395 /**
3396- * A range or a insert and replace range selecting the text that should be replaced by this completion item.
3396+ * A range of text that should be replaced by this completion item.
33973397 *
3398- * When omitted, the range of the [current word](#TextDocument.getWordRangeAtPosition) is used as replace-range
3399- * and as insert-range the start of the [current word](#TextDocument.getWordRangeAtPosition) to the
3400- * current position is used.
3398+ * Defaults to a range from the start of the [current word](#TextDocument.getWordRangeAtPosition) to the
3399+ * current position.
34013400 *
3402- * *Note 1 :* A range must be a [single line](#Range.isSingleLine) and it must
3401+ * *Note:* The range must be a [single line](#Range.isSingleLine) and it must
34033402 * [contain](#Range.contains) the position at which completion has been [requested](#CompletionItemProvider.provideCompletionItems).
3404- * *Note 2:* A insert range must be a prefix of a replace range, that means it must be contained and starting at the same position.
34053403 */
3406- range ?: Range | { insert : Range ; replace : Range ; } ;
3404+ range ?: Range ;
34073405
34083406 /**
34093407 * An optional set of characters that when pressed while this completion is active will accept it first and
Original file line number Diff line number Diff line change @@ -997,4 +997,24 @@ declare module 'vscode' {
997997 }
998998
999999 //#endregion
1000+
1001+ //#region joh, insert/replace completions: https://github.com/microsoft/vscode/issues/10266
1002+
1003+ export interface CompletionItem {
1004+
1005+ /**
1006+ * A range or a insert and replace range selecting the text that should be replaced by this completion item.
1007+ *
1008+ * When omitted, the range of the [current word](#TextDocument.getWordRangeAtPosition) is used as replace-range
1009+ * and as insert-range the start of the [current word](#TextDocument.getWordRangeAtPosition) to the
1010+ * current position is used.
1011+ *
1012+ * *Note 1:* A range must be a [single line](#Range.isSingleLine) and it must
1013+ * [contain](#Range.contains) the position at which completion has been [requested](#CompletionItemProvider.provideCompletionItems).
1014+ * *Note 2:* A insert range must be a prefix of a replace range, that means it must be contained and starting at the same position.
1015+ */
1016+ range2 ?: Range | { insert : Range ; replace : Range ; } ;
1017+ }
1018+
1019+ //#endregion
10001020}
Original file line number Diff line number Diff line change @@ -756,6 +756,8 @@ class SuggestAdapter {
756756 range = item . textEdit . range ;
757757 } else if ( item . range ) {
758758 range = item . range ;
759+ } else if ( item . range2 ) {
760+ range = item . range2 ;
759761 }
760762
761763 if ( range ) {
Original file line number Diff line number Diff line change @@ -1343,7 +1343,8 @@ export class CompletionItem implements vscode.CompletionItem {
13431343 preselect ?: boolean ;
13441344 insertText ?: string | SnippetString ;
13451345 keepWhitespace ?: boolean ;
1346- range ?: Range | { insert : Range ; replace : Range ; } ;
1346+ range ?: Range ;
1347+ range2 ?: Range | { insert : Range ; replace : Range ; } ;
13471348 commitCharacters ?: string [ ] ;
13481349 textEdit ?: TextEdit ;
13491350 additionalTextEdits ?: TextEdit [ ] ;
You can’t perform that action at this time.
0 commit comments