mirror of
https://github.com/Microsoft/vscode
synced 2024-10-04 02:14:06 +00:00
Configurations ${WorkSpace} autocomplete broken after update (#155713)
Configurations ${WorkSpace} autocomplete broken after update. Fixes #155638
This commit is contained in:
parent
ce5d92e998
commit
28be5d9906
|
@ -40,8 +40,8 @@ function registerVariableCompletions(pattern: string): vscode.Disposable {
|
|||
provideCompletionItems(document, position, _token) {
|
||||
const location = getLocation(document.getText(), document.offsetAt(position));
|
||||
if (isCompletingInsidePropertyStringValue(document, location, position)) {
|
||||
let range = document.getWordRangeAtPosition(position, /\$\{[^\}]*\}/);
|
||||
if (!range || range.end.isEqual(position) || range.start.isEqual(position)) {
|
||||
let range = document.getWordRangeAtPosition(position, /\$\{[^"\}]*\}?/);
|
||||
if (!range || range.start.isEqual(position) || range.end.isEqual(position) && document.getText(range).endsWith('}')) {
|
||||
range = new vscode.Range(position, position);
|
||||
}
|
||||
|
||||
|
|
|
@ -96,8 +96,8 @@ export class SettingsDocument {
|
|||
return completions;
|
||||
}
|
||||
|
||||
let range = this.document.getWordRangeAtPosition(pos, /\$\{[^\}]*\}/);
|
||||
if (!range || range.end.isEqual(pos) || range.start.isEqual(pos)) {
|
||||
let range = this.document.getWordRangeAtPosition(pos, /\$\{[^"\}]*\}?/);
|
||||
if (!range || range.start.isEqual(pos) || range.end.isEqual(pos) && this.document.getText(range).endsWith('}')) {
|
||||
range = new vscode.Range(pos, pos);
|
||||
}
|
||||
|
||||
|
|
|
@ -73,6 +73,20 @@ suite('Completions in settings.json', () => {
|
|||
const expected = { label: '${activeEditorMedium}', resultText };
|
||||
await testCompletion(testFile, 'jsonc', content, expected);
|
||||
}
|
||||
{ // replacing a partial variable
|
||||
const content = [
|
||||
'{',
|
||||
' "window.title": "${a|"',
|
||||
'}',
|
||||
].join('\n');
|
||||
const resultText = [
|
||||
'{',
|
||||
' "window.title": "${dirty}"',
|
||||
'}',
|
||||
].join('\n');
|
||||
const expected = { label: '${dirty}', resultText };
|
||||
await testCompletion(testFile, 'jsonc', content, expected);
|
||||
}
|
||||
{ // inserting a literal
|
||||
const content = [
|
||||
'{',
|
||||
|
@ -382,6 +396,32 @@ suite('Completions in launch.json', () => {
|
|||
const expected = { label: '${cwd}', resultText };
|
||||
await testCompletion(testFile, 'jsonc', content, expected);
|
||||
}
|
||||
{
|
||||
const content = [
|
||||
'{',
|
||||
' "version": "0.2.0",',
|
||||
' "configurations": [',
|
||||
' {',
|
||||
' "name": "Do It",',
|
||||
' "program": "${workspace|"',
|
||||
' }',
|
||||
' ]',
|
||||
'}',
|
||||
].join('\n');
|
||||
const resultText = [
|
||||
'{',
|
||||
' "version": "0.2.0",',
|
||||
' "configurations": [',
|
||||
' {',
|
||||
' "name": "Do It",',
|
||||
' "program": "${cwd}"',
|
||||
' }',
|
||||
' ]',
|
||||
'}',
|
||||
].join('\n');
|
||||
const expected = { label: '${cwd}', resultText };
|
||||
await testCompletion(testFile, 'jsonc', content, expected);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue