mirror of
https://github.com/ezolenko/rollup-plugin-typescript2.git
synced 2025-12-08 19:06:16 +00:00
optim(cache): don't check imports for syntactic diagnostics (#389)
- Per the TS LS Wiki (https://github.com/microsoft/TypeScript/wiki/Using-the-Language-Service-API#design-goals), syntactic diagnostics only need to parse the specific file in question - since syntax is independent of imports; imports only affect semantics
This commit is contained in:
parent
e75d97a758
commit
70c6e253e8
@ -247,7 +247,8 @@ export class TsCache
|
||||
|
||||
private getDiagnostics(type: string, cache: ICache<IDiagnostics[]>, id: string, snapshot: tsTypes.IScriptSnapshot, check: () => tsTypes.Diagnostic[]): IDiagnostics[]
|
||||
{
|
||||
return this.getCached(cache, id, snapshot, true, () => convertDiagnostic(type, check()));
|
||||
// don't need to check imports for syntactic diagnostics (per https://github.com/microsoft/TypeScript/wiki/Using-the-Language-Service-API#design-goals)
|
||||
return this.getCached(cache, id, snapshot, type === "semantic", () => convertDiagnostic(type, check()));
|
||||
}
|
||||
|
||||
private getCached<CacheType>(cache: ICache<CacheType>, id: string, snapshot: tsTypes.IScriptSnapshot, checkImports: boolean, convert: () => CacheType): CacheType
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user