Skip to content

Commit

Permalink
Fix registry key
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebailey committed Sep 18, 2023
1 parent a430b30 commit 3ebdfb6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/harness/incrementalUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function verifyDocumentRegistry(service: ts.server.ProjectService) {
if (!program) return;
const key = service.documentRegistry.getKeyForCompilationSettings(program.getCompilerOptions());
program.getSourceFiles().forEach(f => {
const keyWithMode = service.documentRegistry.getDocumentRegistryBucketKeyWithMode(key, f.impliedNodeFormat);
const keyWithMode = service.documentRegistry.getDocumentRegistryBucketKeyWithMode(key, f.impliedNodeFormat, service.jsDocParsingMode);
let mapForKeyWithMode = stats.get(keyWithMode);
let result: Map<ts.ScriptKind, number> | undefined;
if (mapForKeyWithMode === undefined) {
Expand Down
10 changes: 5 additions & 5 deletions src/services/documentRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export interface DocumentRegistry {

getKeyForCompilationSettings(settings: CompilerOptions): DocumentRegistryBucketKey;
/** @internal */
getDocumentRegistryBucketKeyWithMode(key: DocumentRegistryBucketKey, mode: ResolutionMode): DocumentRegistryBucketKeyWithMode;
getDocumentRegistryBucketKeyWithMode(key: DocumentRegistryBucketKey, mode: ResolutionMode, jsDocParsingMode: JSDocParsingMode | undefined): DocumentRegistryBucketKeyWithMode;
/**
* Informs the DocumentRegistry that a file is not needed any longer.
*
Expand Down Expand Up @@ -274,7 +274,7 @@ export function createDocumentRegistryInternal(useCaseSensitiveFileNames?: boole
};
sourceFileOptions.languageVersion = scriptTarget;
const oldBucketCount = buckets.size;
const keyWithMode = getDocumentRegistryBucketKeyWithMode(key, sourceFileOptions.impliedNodeFormat);
const keyWithMode = getDocumentRegistryBucketKeyWithMode(key, sourceFileOptions.impliedNodeFormat, jsDocParsingMode);
const bucket = getOrUpdate(buckets, keyWithMode, () => new Map());
if (tracing) {
if (buckets.size > oldBucketCount) {
Expand Down Expand Up @@ -367,7 +367,7 @@ export function createDocumentRegistryInternal(useCaseSensitiveFileNames?: boole
}

function releaseDocumentWithKey(path: Path, key: DocumentRegistryBucketKey, scriptKind?: ScriptKind, impliedNodeFormat?: ResolutionMode): void {
const bucket = Debug.checkDefined(buckets.get(getDocumentRegistryBucketKeyWithMode(key, impliedNodeFormat)));
const bucket = Debug.checkDefined(buckets.get(getDocumentRegistryBucketKeyWithMode(key, impliedNodeFormat, jsDocParsingMode)));
const bucketEntry = bucket.get(path)!;
const entry = getDocumentRegistryEntry(bucketEntry, scriptKind)!;
entry.languageServiceRefCount--;
Expand Down Expand Up @@ -404,6 +404,6 @@ function getKeyForCompilationSettings(settings: CompilerOptions): DocumentRegist
return getKeyForCompilerOptions(settings, sourceFileAffectingCompilerOptions) as DocumentRegistryBucketKey;
}

function getDocumentRegistryBucketKeyWithMode(key: DocumentRegistryBucketKey, mode: ResolutionMode) {
return (mode ? `${key}|${mode}` : key) as DocumentRegistryBucketKeyWithMode;
function getDocumentRegistryBucketKeyWithMode(key: DocumentRegistryBucketKey, mode: ResolutionMode, jsDocParsingMode: JSDocParsingMode | undefined) {
return `${key}|${mode ?? ""}|${jsDocParsingMode ?? ""}` as DocumentRegistryBucketKeyWithMode;
}

0 comments on commit 3ebdfb6

Please sign in to comment.