Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

File content not pre-loaded for some global declarations  #220

Closed
@tomv564

Description

@tomv564

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions