lerna-yarn-workspaces-example
lerna-yarn-workspaces-example copied to clipboard
VSCode auto complete not finding symbols
If you comment out the import
import { awesomeFn } from "@quramy/x-core";
from x-cli/src/main.ts
, and try to auto import it again by typing awesomeFn
somewhere in that file, VSCode doesn't find that symbol nor suggest it for auto import. Why is this?
We can see from the tsserver logs that the .d.ts
file from x-core
is not opened:
Info 53 [22:20:41.614] Running: *ensureProjectForOpenFiles*
Info 54 [22:20:41.614] Structure before ensureProjectForOpenFiles:
Info 55 [22:20:41.614] Project '/Users/aholvika/Code/typescript/lerna-yarn-workspaces-example/packages/x-cli/tsconfig.json' (Configured) 0
Info 55 [22:20:41.614] Files (21)
/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/lib.es6.d.ts
/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/lib.es5.d.ts
/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/lib.es2015.d.ts
/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/lib.dom.d.ts
/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/lib.dom.iterable.d.ts
/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/lib.webworker.importscripts.d.ts
/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/lib.scripthost.d.ts
/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/lib.es2015.core.d.ts
/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/lib.es2015.collection.d.ts
/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/lib.es2015.generator.d.ts
/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/lib.es2015.iterable.d.ts
/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/lib.es2015.promise.d.ts
/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/lib.es2015.proxy.d.ts
/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/lib.es2015.reflect.d.ts
/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/lib.es2015.symbol.d.ts
/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts
/Users/aholvika/Code/typescript/lerna-yarn-workspaces-example/node_modules/ava/types/generated.d.ts
/Users/aholvika/Code/typescript/lerna-yarn-workspaces-example/packages/x-cli/src/main.ts
/Users/aholvika/Code/typescript/lerna-yarn-workspaces-example/packages/x-cli/src/main.spec.ts
/Users/aholvika/Code/typescript/lerna-yarn-workspaces-example/node_modules/@types/node/inspector.d.ts
/Users/aholvika/Code/typescript/lerna-yarn-workspaces-example/node_modules/@types/node/index.d.ts
Adding a types
key to tsconfig.settings.json
seems to fix this:
"types" : ["@quramy/x-core"]
Adding the types field isn't really a fix since then other libraries or not found.
To me this issue is very strange because the types for x-core
are not found but types for other libraries are found.
Did you manage to find a solution to this?
The best I've got so far is adding
"typeRoots": ["node_modules/@types", "../x-core"],
however then VSCode imports relative paths (../x-core/dist/something
) instead of aliases (@quramy/x-core
)