mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-19 10:41:56 -05:00
Ensure AutoImportProviderProject can share source files with main program (#44274)
* Ensure AutoImportProviderProject can share source files with main program * Revert package-lock change * Add back reclassified options
This commit is contained in:
@@ -879,7 +879,13 @@ namespace FourSlash {
|
||||
nameToEntries.set(entry.name, [entry]);
|
||||
}
|
||||
else {
|
||||
if (entries.some(e => e.source === entry.source && this.deepEqual(e.data, entry.data))) {
|
||||
if (entries.some(e =>
|
||||
e.source === entry.source &&
|
||||
e.data?.exportName === entry.data?.exportName &&
|
||||
e.data?.fileName === entry.data?.fileName &&
|
||||
e.data?.moduleSpecifier === entry.data?.moduleSpecifier &&
|
||||
e.data?.ambientModuleName === entry.data?.ambientModuleName
|
||||
)) {
|
||||
this.raiseError(`Duplicate completions for ${entry.name}`);
|
||||
}
|
||||
entries.push(entry);
|
||||
@@ -1280,16 +1286,6 @@ namespace FourSlash {
|
||||
|
||||
}
|
||||
|
||||
private deepEqual(a: unknown, b: unknown) {
|
||||
try {
|
||||
this.assertObjectsEqual(a, b);
|
||||
return true;
|
||||
}
|
||||
catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public verifyDisplayPartsOfReferencedSymbol(expected: ts.SymbolDisplayPart[]) {
|
||||
const referencedSymbols = this.findReferencesAtCaret()!;
|
||||
|
||||
|
||||
@@ -1928,20 +1928,25 @@ namespace ts.server {
|
||||
}
|
||||
}
|
||||
|
||||
/*@internal*/
|
||||
static readonly compilerOptionsOverrides: CompilerOptions = {
|
||||
diagnostics: false,
|
||||
skipLibCheck: true,
|
||||
sourceMap: false,
|
||||
types: ts.emptyArray,
|
||||
lib: ts.emptyArray,
|
||||
noLib: true,
|
||||
};
|
||||
|
||||
/*@internal*/
|
||||
static create(dependencySelection: PackageJsonAutoImportPreference, hostProject: Project, moduleResolutionHost: ModuleResolutionHost, documentRegistry: DocumentRegistry): AutoImportProviderProject | undefined {
|
||||
if (dependencySelection === PackageJsonAutoImportPreference.Off) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const compilerOptions: CompilerOptions = {
|
||||
const compilerOptions = {
|
||||
...hostProject.getCompilerOptions(),
|
||||
noLib: true,
|
||||
diagnostics: false,
|
||||
skipLibCheck: true,
|
||||
types: ts.emptyArray,
|
||||
lib: ts.emptyArray,
|
||||
sourceMap: false,
|
||||
...this.compilerOptionsOverrides,
|
||||
};
|
||||
|
||||
const rootNames = this.getRootFileNames(dependencySelection, hostProject, moduleResolutionHost, compilerOptions);
|
||||
|
||||
@@ -302,6 +302,15 @@ namespace ts.projectSystem {
|
||||
assert.isDefined(projectService.configuredProjects.get("/packages/a/tsconfig.json")!.getPackageJsonAutoImportProvider());
|
||||
assert.isDefined(projectService.configuredProjects.get("/packages/a/tsconfig.json")!.getPackageJsonAutoImportProvider());
|
||||
});
|
||||
|
||||
it("Can use the same document registry bucket key as main program", () => {
|
||||
for (const option of sourceFileAffectingCompilerOptions) {
|
||||
assert(
|
||||
!hasProperty(server.AutoImportProviderProject.compilerOptionsOverrides, option.name),
|
||||
`'${option.name}' may cause AutoImportProviderProject not to share source files with main program`
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function setup(files: File[]) {
|
||||
|
||||
Reference in New Issue
Block a user