mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-01 05:51:32 +01:00
Fix #46644
This commit is contained in:
@@ -118,9 +118,9 @@ function pathToSuggestion(p: string, replaceRange: Range): CompletionItem {
|
||||
|
||||
if (isDir) {
|
||||
return {
|
||||
label: p,
|
||||
label: escapePath(p),
|
||||
kind: CompletionItemKind.Folder,
|
||||
textEdit: TextEdit.replace(replaceRange, p),
|
||||
textEdit: TextEdit.replace(replaceRange, escapePath(p)),
|
||||
command: {
|
||||
title: 'Suggest',
|
||||
command: 'editor.action.triggerSuggest'
|
||||
@@ -128,13 +128,18 @@ function pathToSuggestion(p: string, replaceRange: Range): CompletionItem {
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
label: p,
|
||||
label: escapePath(p),
|
||||
kind: CompletionItemKind.File,
|
||||
textEdit: TextEdit.replace(replaceRange, p)
|
||||
textEdit: TextEdit.replace(replaceRange, escapePath(p))
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Escape https://www.w3.org/TR/CSS1/#url
|
||||
function escapePath(p: string) {
|
||||
return p.replace(/(\s|\(|\)|,|"|')/g, '\\$1');
|
||||
}
|
||||
|
||||
function resolveWorkspaceRoot(activeDoc: TextDocument, workspaceFolders: WorkspaceFolder[]): string | undefined {
|
||||
for (let i = 0; i < workspaceFolders.length; i++) {
|
||||
if (startsWith(activeDoc.uri, workspaceFolders[i].uri)) {
|
||||
|
||||
Reference in New Issue
Block a user