mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
fix command completions in keybindings.json
This commit is contained in:
parent
6e81c92e9b
commit
0172356a73
|
@ -18,7 +18,18 @@ export function activate(context) {
|
||||||
provideCompletionItems(document, position, token) {
|
provideCompletionItems(document, position, token) {
|
||||||
const location = getLocation(document.getText(), document.offsetAt(position));
|
const location = getLocation(document.getText(), document.offsetAt(position));
|
||||||
if (location.path[1] === 'command') {
|
if (location.path[1] === 'command') {
|
||||||
return commands.then(ids => ids.map(id => new vscode.CompletionItem(id, vscode.CompletionItemKind.Value)));
|
|
||||||
|
const range = document.getWordRangeAtPosition(position) || new vscode.Range(position, position);
|
||||||
|
|
||||||
|
return commands.then(ids => ids.map(id => {
|
||||||
|
const item = new vscode.CompletionItem(`"${id}"`);
|
||||||
|
item.kind = vscode.CompletionItemKind.Value;
|
||||||
|
item.textEdit = {
|
||||||
|
range,
|
||||||
|
newText: item.label
|
||||||
|
};
|
||||||
|
return item;
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue