mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-01 05:51:32 +01:00
Do not suggest own file for path completion. Fix #57384
This commit is contained in:
@@ -54,6 +54,7 @@ export function getPathCompletionParticipant(
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
result.items = [...suggestions, ...result.items];
|
||||
}
|
||||
};
|
||||
@@ -66,8 +67,13 @@ function providePathSuggestions(pathValue: string, position: Position, range: Ra
|
||||
? fullValue.slice(0, position.character - (range.start.character + 1))
|
||||
: fullValue.slice(0, position.character - range.start.character);
|
||||
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, URI.parse(document.uri).fsPath, workspaceRoot);
|
||||
const fullValueRange = isValueQuoted ? shiftRange(range, 1, -1) : range;
|
||||
const replaceRange = pathToReplaceRange(valueBeforeCursor, fullValue, fullValueRange);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user