tsgo preview: fails to show import suggestions for node modules and packages that are linked through PNPM workspaces
Opened this issue ยท 8 comments
Steps to reproduce
Try importing any module from node_modules or pnpm linked workspaces
Behavior with typescript@5.8
We get import suggestions for the modules
Behavior with tsgo
We don't get any import suggestions
Do you have a repo or example we could test?
cc @donprasetiyo, @AlokTakshak from comments on #1084
This seems to only work for non-nodemodules files. Is this intentional?
This is also true for packages that are linked through PNPM workspaces.
For the time being, yes. There's two related featuresthat could be causing what you're seeing
packageJsonAutoImportProvider: At the moment, the LS can only see files that are in the current project, so if you are trying to make a reference to a node modules package (or any other kind of package) that is not yet referenced in your current project, auto imports will not be able to see the new package.- cross project LS: We also don't have cross project support for any of the LS features yet.
Both are currently being worked on.
This means that autoimports should work on already referenced files, so you've already referenced the package in your project, but you can't get new auto-imports for that package, please provide a repo so we can take a look!
Do you have a repo or example we could test?
The repo used in #836 should illustrate it:
The expected behavior would be that an import from @vaadin/button/vaadin-button.js is proposed for Button.
By contrast an auto-import is proposed for SemVer - semver being imported from nmp and not symlinked on locale.
Steps to reproduce
git clone git@github.com:christophe-g/tsgo-test-linked-dep.git
git clone --depth 1 git@github.com:vaadin/web-components.git
cd tsgo-test-linked-dep
pnpm i
open in VScode with typescriptteam.native-preview extension
Dependencies
"dependencies": {
"@vaadin/button": "file:../web-components/packages/button",
"semver": "^7.7.1"
}Using bun with linker = "isolated" does not work as well
In my case I have an error:
[Error - 12:09:09 PM] Request textDocument/completion failed.
Message: InternalError: panic handling request textDocument/completion: runtime error: slice bounds out of range [148:147]
Code: -32603
[12:09:21.861] Processed 1 file changes in 0s
======== Cloning snapshot 8 ========
[12:09:21.861] Reason: RequestedLanguageService (pending file changes) - [file:///c%3A/Users/julio/Documents/code/RELAND/src/client.tsx]
[12:09:21.861] DidChangeFiles
[12:09:21.861] Checking for changes affecting config files
[12:09:21.861] Summarizing file changes
[12:09:21.861] Checking if any changed files are config files
[12:09:21.861] Marking project c:/Users/julio/Documents/code/RELAND/tsconfig.json as dirty due to changes in c:/users/julio/documents/code/reland/src/client.tsx
[12:09:21.861] DidRequestFile
[12:09:21.861] Acquiring config for project
[12:09:21.861] CompilerHost
[12:09:21.865] Program update for c:/Users/julio/Documents/code/RELAND/tsconfig.json completed in 3.9985ms
[12:09:21.866] Finished cloning snapshot 8 into snapshot 9 in 4.9989ms
@iisaduan Are you working on this issue? I have a rough draft that fixes this issue. If not, I'll try to open a PR.