move insert/replace range API to proposed

This commit is contained in:
Johannes Rieken 2019-10-24 14:39:32 +02:00
parent ec6d344197
commit fcb807c75f
4 changed files with 29 additions and 8 deletions

12
src/vs/vscode.d.ts vendored
View file

@ -3393,17 +3393,15 @@ declare module 'vscode' {
insertText?: string | SnippetString;
/**
* A range or a insert and replace range selecting the text that should be replaced by this completion item.
* A range of text that should be replaced by this completion item.
*
* When omitted, the range of the [current word](#TextDocument.getWordRangeAtPosition) is used as replace-range
* and as insert-range the start of the [current word](#TextDocument.getWordRangeAtPosition) to the
* current position is used.
* Defaults to a range from the start of the [current word](#TextDocument.getWordRangeAtPosition) to the
* current position.
*
* *Note 1:* A range must be a [single line](#Range.isSingleLine) and it must
* *Note:* The range must be a [single line](#Range.isSingleLine) and it must
* [contain](#Range.contains) the position at which completion has been [requested](#CompletionItemProvider.provideCompletionItems).
* *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.
*/
range?: Range | { insert: Range; replace: Range; };
range?: Range;
/**
* An optional set of characters that when pressed while this completion is active will accept it first and

View file

@ -997,4 +997,24 @@ declare module 'vscode' {
}
//#endregion
//#region joh, insert/replace completions: https://github.com/microsoft/vscode/issues/10266
export interface CompletionItem {
/**
* A range or a insert and replace range selecting the text that should be replaced by this completion item.
*
* When omitted, the range of the [current word](#TextDocument.getWordRangeAtPosition) is used as replace-range
* and as insert-range the start of the [current word](#TextDocument.getWordRangeAtPosition) to the
* current position is used.
*
* *Note 1:* A range must be a [single line](#Range.isSingleLine) and it must
* [contain](#Range.contains) the position at which completion has been [requested](#CompletionItemProvider.provideCompletionItems).
* *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.
*/
range2?: Range | { insert: Range; replace: Range; };
}
//#endregion
}

View file

@ -756,6 +756,8 @@ class SuggestAdapter {
range = item.textEdit.range;
} else if (item.range) {
range = item.range;
} else if (item.range2) {
range = item.range2;
}
if (range) {

View file

@ -1343,7 +1343,8 @@ export class CompletionItem implements vscode.CompletionItem {
preselect?: boolean;
insertText?: string | SnippetString;
keepWhitespace?: boolean;
range?: Range | { insert: Range; replace: Range; };
range?: Range;
range2?: Range | { insert: Range; replace: Range; };
commitCharacters?: string[];
textEdit?: TextEdit;
additionalTextEdits?: TextEdit[];