File content not pre-loaded for some global declarations #220
Description
tslib
When using the importHelpers: true
compiler option and have installed tslib
, the TS compiler requests content from node_modules/tslib/tslib.d.ts
.
This is not recognised as a global declaration path, and it appears that ensureReferencedFiles never receives a reference to it either, so the content is never fetched.
Adding the pattern to util.ts
's globalTSPatterns
made tslib resolve successfully.
typeRoots and types
The default typeRoot is at least node_modules/@types
, we currently limit this to the node directory? (see /node_modules\/(?:\@|%40)types\/node\/
in globalTSPatterns
)
Furthermore, adding typeRoots
to tsconfig's compiler options can override this default.
This means typings from other locations (eg. typeRoots: ["./mytypes", "../mysharedtypes"]
) should be loaded instead.
Finally, the typings
field overrides typeRoots
, so when specified as types: ['node']
, then the language server should not need to load content for node_modules/@types/not_the_node_package/index.d.ts
See https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
Both these dependencies cannot be properly be discovered until the tsconfig.json is parsed, it might be helpful to move some content-preloading logic to ProjectConfiguration instead.