0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-04 01:44:26 -05:00

perf(lsp): make auto-imports a little faster (#28106)

This commit is contained in:
David Sherret 2025-02-17 08:55:01 -05:00 committed by GitHub
parent fe55e3e573
commit 36933fb0b8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 12 deletions

View file

@ -125170,14 +125170,6 @@ function changeCompilerHostLikeToUseCache(host, toPath3, getSourceFile) {
}
return sourceFile;
} : void 0;
host.fileExists = (fileName) => {
const key = toPath3(fileName);
const value = fileExistsCache.get(key);
if (value !== void 0) return value;
const newValue = originalFileExists.call(host, fileName);
fileExistsCache.set(key, !!newValue);
return newValue;
};
if (originalWriteFile) {
host.writeFile = (fileName, data, ...rest) => {
const key = toPath3(fileName);
@ -165768,10 +165760,6 @@ function getDefaultCommitCharacters(isNewIdentifierLocation) {
return allCommitCharacters;
}
function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext, includeSymbol = false) {
return spanned("Tsc::getCompletionsAtPosition", () => getCompletionsAtPositionInner(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext, includeSymbol));
}
function getCompletionsAtPositionInner(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext, includeSymbol = false) {
var _a;
const { previousToken } = getRelevantTokens(position, sourceFile);
if (triggerCharacter && !isInString(sourceFile, position, previousToken) && !isValidTrigger(sourceFile, triggerCharacter, previousToken, position)) {

View file

@ -732,6 +732,12 @@ const hostImpl = {
}
return scriptSnapshot;
},
getNearestAncestorDirectoryWithPackageJson() {
// always return `undefined` in order to short-circuit
// a codepath in the TypeScript compiler that always
// ends up returning `undefined` in Deno anyway
return undefined;
},
};
// these host methods are super noisy (often thousands of calls per TSC request)