mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 20:26:08 +00:00
Do not suggest dot files in html/css. Fix #46780
This commit is contained in:
@@ -69,10 +69,15 @@ function providePathSuggestions(pathValue: string, position: Position, range: Ra
|
||||
const workspaceRoot = resolveWorkspaceRoot(document, workspaceFolders);
|
||||
const currentDocFsPath = URI.parse(document.uri).fsPath;
|
||||
|
||||
const paths = providePaths(valueBeforeCursor, currentDocFsPath, workspaceRoot).filter(p => {
|
||||
// Exclude current doc's path
|
||||
return path.resolve(currentDocFsPath, '../', p) !== currentDocFsPath;
|
||||
});
|
||||
const paths = providePaths(valueBeforeCursor, currentDocFsPath, workspaceRoot)
|
||||
.filter(p => {
|
||||
// Exclude current doc's path
|
||||
return path.resolve(currentDocFsPath, '../', p) !== currentDocFsPath;
|
||||
})
|
||||
.filter(p => {
|
||||
// Exclude paths that start with `.`
|
||||
return p[0] !== '.';
|
||||
});
|
||||
|
||||
const fullValueRange = isValueQuoted ? shiftRange(range, 1, -1) : range;
|
||||
const replaceRange = pathToReplaceRange(valueBeforeCursor, fullValue, fullValueRange);
|
||||
|
||||
@@ -193,4 +193,14 @@ suite('Completions', () => {
|
||||
]
|
||||
}, testSCSSUri, folders, 'scss');
|
||||
});
|
||||
|
||||
test('Completion should ignore files/folders starting with dot', function () {
|
||||
let testUri = Uri.file(path.resolve(__dirname, '../../test/pathCompletionFixtures/about/about.css')).toString();
|
||||
let folders = [{ name: 'x', uri: Uri.file(path.resolve(__dirname, '../../test')).toString() }];
|
||||
|
||||
assertCompletions('html { background-image: url("../|")', {
|
||||
count: 4
|
||||
}, testUri, folders);
|
||||
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,4 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
Reference in New Issue
Block a user