mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge pull request #32028 from microsoft/referencesPrototypeSourceFile
For editing experience, use source instead of .d.ts files from project references
This commit is contained in:
@@ -1149,10 +1149,10 @@ namespace ts {
|
||||
useCaseSensitiveFileNames: () => useCaseSensitiveFileNames,
|
||||
getCurrentDirectory: () => currentDirectory,
|
||||
getProgram,
|
||||
fileExists: host.fileExists && (f => host.fileExists!(f)),
|
||||
readFile: host.readFile && ((f, encoding) => host.readFile!(f, encoding)),
|
||||
getDocumentPositionMapper: host.getDocumentPositionMapper && ((generatedFileName, sourceFileName) => host.getDocumentPositionMapper!(generatedFileName, sourceFileName)),
|
||||
getSourceFileLike: host.getSourceFileLike && (f => host.getSourceFileLike!(f)),
|
||||
fileExists: maybeBind(host, host.fileExists),
|
||||
readFile: maybeBind(host, host.readFile),
|
||||
getDocumentPositionMapper: maybeBind(host, host.getDocumentPositionMapper),
|
||||
getSourceFileLike: maybeBind(host, host.getSourceFileLike),
|
||||
log
|
||||
});
|
||||
|
||||
@@ -1250,6 +1250,12 @@ namespace ts {
|
||||
if (host.resolveTypeReferenceDirectives) {
|
||||
compilerHost.resolveTypeReferenceDirectives = (...args) => host.resolveTypeReferenceDirectives!(...args);
|
||||
}
|
||||
if (host.setResolvedProjectReferenceCallbacks) {
|
||||
compilerHost.setResolvedProjectReferenceCallbacks = callbacks => host.setResolvedProjectReferenceCallbacks!(callbacks);
|
||||
}
|
||||
if (host.useSourceOfProjectReferenceRedirect) {
|
||||
compilerHost.useSourceOfProjectReferenceRedirect = () => host.useSourceOfProjectReferenceRedirect!();
|
||||
}
|
||||
|
||||
const documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
|
||||
const options: CreateProgramOptions = {
|
||||
|
||||
@@ -70,6 +70,11 @@ namespace ts {
|
||||
if (!sourceFile) return undefined;
|
||||
|
||||
const program = host.getProgram()!;
|
||||
// If this is source file of project reference source (instead of redirect) there is no generated position
|
||||
if (program.isSourceOfProjectReferenceRedirect(sourceFile.fileName)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const options = program.getCompilerOptions();
|
||||
const outPath = options.outFile || options.out;
|
||||
|
||||
|
||||
@@ -234,6 +234,10 @@ namespace ts {
|
||||
getDocumentPositionMapper?(generatedFileName: string, sourceFileName?: string): DocumentPositionMapper | undefined;
|
||||
/* @internal */
|
||||
getSourceFileLike?(fileName: string): SourceFileLike | undefined;
|
||||
/* @internal */
|
||||
setResolvedProjectReferenceCallbacks?(callbacks: ResolvedProjectReferenceCallbacks): void;
|
||||
/* @internal */
|
||||
useSourceOfProjectReferenceRedirect?(): boolean;
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
|
||||
Reference in New Issue
Block a user