提交 65b4157f 编写于 作者: I isidor

debug: always pass overwriteBefore for each Suggestion

fixes #14193
上级 86b2e52b
......@@ -173,7 +173,7 @@ export interface IStackFrame extends ITreeElement {
source: Source;
getScopes(): TPromise<IScope[]>;
restart(): TPromise<any>;
completions(text: string, position: Position): TPromise<ISuggestion[]>;
completions(text: string, position: Position, overwriteBefore: number): TPromise<ISuggestion[]>;
}
export interface IEnablement extends ITreeElement {
......
......@@ -354,7 +354,7 @@ export class StackFrame implements debug.IStackFrame {
return this.thread.process.session.restartFrame({ frameId: this.frameId });
}
public completions(text: string, position: Position): TPromise<ISuggestion[]> {
public completions(text: string, position: Position, overwriteBefore: number): TPromise<ISuggestion[]> {
if (!this.thread.process.session.configuration.capabilities.supportsCompletionsRequest) {
return TPromise.as([]);
}
......@@ -365,10 +365,11 @@ export class StackFrame implements debug.IStackFrame {
column: position.column,
line: position.lineNumber
}).then(response => {
return response && response.body && response.body.targets ? response.body.targets.map(item => ({
return response && response.body && response.body.targets ? response.body.targets.map(item => (<ISuggestion>{
label: item.label,
insertText: item.text || item.label,
type: item.type
type: item.type,
overwriteBefore: item.length || overwriteBefore
})) : [];
}, err => []);
}
......
......@@ -172,12 +172,12 @@ export class Repl extends Panel implements IPrivateReplService {
triggerCharacters: ['.'],
provideCompletionItems: (model: IReadOnlyModel, position: Position, token: CancellationToken): Thenable<modes.ISuggestResult> => {
const word = this.replInput.getModel().getWordAtPosition(position);
const overwriteBefore = word ? word.word.length : 0;
const text = this.replInput.getModel().getLineContent(position.lineNumber);
const focusedStackFrame = this.debugService.getViewModel().focusedStackFrame;
const completions = focusedStackFrame ? focusedStackFrame.completions(text, position) : TPromise.as([]);
const completions = focusedStackFrame ? focusedStackFrame.completions(text, position, overwriteBefore) : TPromise.as([]);
return wireCancellationToken(token, completions.then(suggestions => ({
currentWord: word ? word.word : '',
suggestions
suggestions: suggestions
})));
}
},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册