Skip to content

[rush] Rush's node_modules structure is not resolved in vscode correctly #955

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

Closed
nfour opened this issue Nov 22, 2018 · 13 comments
Closed
Labels
external issue The root cause is with an external component that needs a fix or workaround

Comments

@nfour
Copy link

nfour commented Nov 22, 2018

First up, I'm not sure if this is the right place for this report, but it's likely going to be relevant to the contributers here.

Problem

My team has run into a curious issue with rush's node module structure and vscode.

When trying to auto-import node modules within a project, intellisense will not locate dependencies.

This also results in the editor's TS server crashing intermittently.

Reproduction

Rush setups tested:

  • v5.5.2 / v5.3.0
  • node 6 / node 10
  • vscode v1.28.2 / insiders
  • with either of: npm, yarn or pnpm (all latest)

You can replicate this issue within web-build-tools itself.

Open https://github.com/Microsoft/web-build-tools/blob/master/libraries/ts-command-line/src/index.ts

And type Colors in the top level (from the colors module). You shouldn't be able to resolve the symbol.

eg.

Colors

export {
  CommandLineAction,
  ICommandLineActionOptions
} from './CommandLineAction';

Workaround

If you execute the below script to replace symlinks with real files:

mv node_modules node_modules_old
rsync node_modules_old/ node_modules/ -a --copy-links -v

Everything should work as expected.

@octogonz
Copy link
Collaborator

I'm not able to repro this issue.

Which folder do you open using VS Code? The libraries/ts-command-line folder? Or the root of the repository?

When I type Colors it doesn't work, but I think that's expected. Whereas if I type import * as colors from 'colors'; and then colors., the IntelliSense works fine.

@octogonz octogonz added needs design The next step is for someone to propose the details of an approach for solving the problem needs more info We can't proceed because we need a better repro or an answer to a question and removed needs design The next step is for someone to propose the details of an approach for solving the problem labels Nov 22, 2018
@nfour
Copy link
Author

nfour commented Nov 22, 2018

@pgonzal

Seems like you reproduced it nicely! Expected behaviour is that typing Colo should prompt an auto-import autocomplete, or an autofix bubble to add the import statement.

Colors is one of the exported types from that library and it shouldn't matter what directory you're in.

I mean like so:

const foo: Colors = {};

export {
  CommandLineAction,
  ICommandLineActionOptions
} from './CommandLineAction';

The issue of crashing I corrected in the OP. Intermittently the TS server appears to crash and restart within the editor, but it's not clear how to reproduce that issue.

@octogonz
Copy link
Collaborator

@nfour did you try looking at the TS Server log to see if any errors are being reported?

@octogonz
Copy link
Collaborator

BTW I was able to repro this using const foo: Color = {}; (not Colors).

@zomble
Copy link

zomble commented Nov 27, 2018

@octogonz
Copy link
Collaborator

Great, thanks!

@octogonz octogonz added external issue The root cause is with an external component that needs a fix or workaround and removed needs more info We can't proceed because we need a better repro or an answer to a question labels Nov 27, 2018
@octogonz
Copy link
Collaborator

I marked this as external for now, since it appears to be a problem with VS Code (or TypeScript?). But we'll keep this issue open to track it.

@octogonz
Copy link
Collaborator

@nfour did you try to collect a TS Server log? That might be helpful...

@nfour
Copy link
Author

nfour commented Nov 28, 2018

@pgonzal I recall not seeing anything in VSCode's TS Server output panel whenever I had these issues but of course I haven't had it set to verbose. The developer tools console also didn't show anything out of wack. Nor did trying to profile vscode.

I'll check again with verbose and update if that changes though.

Great to see this is reproducible and it's getting some attention!

@nfour
Copy link
Author

nfour commented Mar 28, 2019

I want to give an update:

  • [email protected]+ no longer spins noticeable CPU cycles with rush 5.5 and pnpm
  • Auto-import of arbitrary dependencies still does not work - however - those that are rush linked do indeed show up in import suggestions

@halfnibble
Copy link
Contributor

Based off of the last comment here, I think we may need to work with the VSCode team.
microsoft/TypeScript#28689 (comment)

@totomakers
Copy link

totomakers commented Sep 7, 2019

Any update for this ?

Quick update: Webstorm solve correctly import :)

@iclanton
Copy link
Member

This issue is stale at this point and microsoft/TypeScript#28689 (comment) is closed. If this is still a problem, please consider opening a new issue

@github-project-automation github-project-automation bot moved this from Needs triage to Closed in Bug Triage Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external issue The root cause is with an external component that needs a fix or workaround
Projects
Archived in project
Development

No branches or pull requests

6 participants