mirror of
https://github.com/denoland/deno.git
synced 2025-03-04 09:57:11 -05:00
perf(lsp): make auto-imports a little faster (#28106)
This commit is contained in:
parent
fe55e3e573
commit
36933fb0b8
2 changed files with 6 additions and 12 deletions
12
cli/tsc/00_typescript.js
vendored
12
cli/tsc/00_typescript.js
vendored
|
@ -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)) {
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue