提交 fcb807c7 编写于 作者: J Johannes Rieken

move insert/replace range API to proposed

上级 ec6d3441
...@@ -3393,17 +3393,15 @@ declare module 'vscode' { ...@@ -3393,17 +3393,15 @@ declare module 'vscode' {
insertText?: string | SnippetString; 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 * Defaults to a range from the start of the [current word](#TextDocument.getWordRangeAtPosition) to the
* and as insert-range the start of the [current word](#TextDocument.getWordRangeAtPosition) to the * current position.
* current position is used.
* *
* *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). * [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 * An optional set of characters that when pressed while this completion is active will accept it first and
......
...@@ -997,4 +997,24 @@ declare module 'vscode' { ...@@ -997,4 +997,24 @@ declare module 'vscode' {
} }
//#endregion //#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
} }
...@@ -756,6 +756,8 @@ class SuggestAdapter { ...@@ -756,6 +756,8 @@ class SuggestAdapter {
range = item.textEdit.range; range = item.textEdit.range;
} else if (item.range) { } else if (item.range) {
range = item.range; range = item.range;
} else if (item.range2) {
range = item.range2;
} }
if (range) { if (range) {
......
...@@ -1343,7 +1343,8 @@ export class CompletionItem implements vscode.CompletionItem { ...@@ -1343,7 +1343,8 @@ export class CompletionItem implements vscode.CompletionItem {
preselect?: boolean; preselect?: boolean;
insertText?: string | SnippetString; insertText?: string | SnippetString;
keepWhitespace?: boolean; keepWhitespace?: boolean;
range?: Range | { insert: Range; replace: Range; }; range?: Range;
range2?: Range | { insert: Range; replace: Range; };
commitCharacters?: string[]; commitCharacters?: string[];
textEdit?: TextEdit; textEdit?: TextEdit;
additionalTextEdits?: TextEdit[]; additionalTextEdits?: TextEdit[];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册