Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: vscode autoimport not working with pnpIgnorePatterns #3816

Closed
1 task done
andreialecu opened this issue Nov 29, 2021 · 3 comments · Fixed by #3817
Closed
1 task done

[Bug]: vscode autoimport not working with pnpIgnorePatterns #3816

andreialecu opened this issue Nov 29, 2021 · 3 comments · Fixed by #3817
Labels
bug Something isn't working

Comments

@andreialecu
Copy link
Contributor

Self-service

  • I'd be willing to implement a fix

Describe the bug

This is a recent regression I think, because it used to work.

I have a hybrid pnp/node_modules project root, where I'm using angular with the nm linker. The angular project is under a nm-packages directory and it is added to pnpIgnorePatterns.

Auto import is not working, and the tsserver.log has the reason for it:

Exception on executing command {"seq":26,"type":"request","command":"getCodeFixes","arguments":{"file":".../src/app/shared/services/players.service.ts","startLine":73,"startOffset":26,"endLine":73,"endOffset":37,"errorCodes":[2304]}}:

    Cannot read property 'findPackageLocator' of null

    TypeError: Cannot read property 'findPackageLocator' of null
        at tryGetModuleNameAsNodeModule (/.yarn/cache/typescript-patch-e9a14bf896-2f915f8ac1.zip/node_modules/typescript/lib/tsserver.js:114820:38)
        at Object.getModuleSpecifiers (/.yarn/cache/typescript-patch-e9a14bf896-2f915f8ac1.zip/node_modules/typescript/lib/tsserver.js:114491:33)
        at /.yarn/cache/typescript-patch-e9a14bf896-2f915f8ac1.zip/node_modules/typescript/lib/tsserver.js:142464:44
        at Object.flatMap (/.yarn/cache/typescript-patch-e9a14bf896-2f915f8ac1.zip/node_modules/typescript/lib/tsserver.js:515:25)
        at getNewImportFixes (/.yarn/cache/typescript-patch-e9a14bf896-2f915f8ac1.zip/node_modules/typescript/lib/tsserver.js:142463:23)
        at getFixesForAddImport (/.yarn/cache/typescript-patch-e9a14bf896-2f915f8ac1.zip/node_modules/typescript/lib/tsserver.js:142475:66)
        at getImportFixes (/.yarn/cache/typescript-patch-e9a14bf896-2f915f8ac1.zip/node_modules/typescript/lib/tsserver.js:142337:63)

To reproduce

Repro at:

https://github.com/andreialecu/repro-yarn-nm-pnp

Environment

➜ yarn dlx -q envinfo --preset jest

  System:
    OS: macOS 12.0.1
    CPU: (8) arm64 Apple M1
  Binaries:
    Node: 16.13.0 - /private/var/folders/9p/k1yqxx0d7rn1nlztg_wm7sbw0000gn/T/xfs-43ab1ee2/node
    Yarn: 3.1.0 - /private/var/folders/9p/k1yqxx0d7rn1nlztg_wm7sbw0000gn/T/xfs-43ab1ee2/yarn
    npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm


### Additional context

_No response_
@alamothe
Copy link

alamothe commented Dec 4, 2021

Hi, is this published yet?

I'm having a similar issue, but can't find any error in the logs, so not sure if it is the same. Thanks!

@merceyz
Copy link
Member

merceyz commented Dec 4, 2021

It's published as 3.2.0-rc.7

yarn set version canary && yarn

@alamothe
Copy link

alamothe commented Dec 7, 2021

Auto-import still not working with 3.2.0-rc.7 in a mixed PNP/NM repo inside a NM workspace.

If I open this workspace in a separate VSC (so, not open project root), it works.

Should I file a new issue?

EDIT: Apologies, I forgot to run yarn after yarn set version canary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants