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

Explorer refresh issue again #24995

Closed
jcrben opened this issue Apr 19, 2017 · 4 comments
Closed

Explorer refresh issue again #24995

jcrben opened this issue Apr 19, 2017 · 4 comments
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code)

Comments

@jcrben
Copy link

jcrben commented Apr 19, 2017

Reviving #19377

It's possible I'm misunderstand the design. If the explorer is intended to stay in sync and does so, why have a refresh button? Saw the discussion at #17354 (comment).

  • VSCode Version: Version 1.12.0 (1.12.0) (running OSS Dev)
  • OS Version: OSX 10.11.5 (15F34)

Steps to Reproduce:

  1. Open up the vscode repository.
  2. Open node_modues folder in explorer and navigate to around rcedit to see the proper location.
  3. Toggle internal terminal and run npm install react-grid-layout --save
  4. Notice that react-grid-layout has not showed up.
  5. Click the refresh button in top right of explorer. Notice that react-grid-layout now appears. Incidentally, refresh is a jarring experience and you lose your place in the editor.

I built it from source (is there a live or hot reload functionality? or at least an automatic restart? didn't seem to have it) and dropped a few console logs in the explorerView.ts file. It seems to run shouldRefreshFromEvent() when I add and delete; noticed it getting as far as https://github.com/Microsoft/vscode/blob/a9c372aa55243b8c6e181c337504861df54bba66/src/vs/workbench/parts/files/browser/views/explorerView.ts#L556.

Happy to do some more investigating if nececcary but I'd prefer to get livereload or even the debugger working first...

@bpasero
Copy link
Member

bpasero commented Apr 19, 2017

The refresh button has 2 purposes:

  • bring the explorer back in sync when there are changes from non watched folders (from the files.watcherExclude setting)
  • same when the file watcher fails to receive events

In your case, since by default we ignore node_modules changes, it explains your issue. We avoid watching potential large folders to prevent event spam.

image

Also note that file watching can always fail, there can be cases where the OS does not deliver an event.

@bpasero bpasero closed this as completed Apr 19, 2017
@bpasero bpasero added the *question Issue represents a question, should be posted to StackOverflow (VS Code) label Apr 19, 2017
@jcrben
Copy link
Author

jcrben commented Apr 19, 2017

Thanks! I'll think I'll customize that to remove it from the list.

@jcrben
Copy link
Author

jcrben commented May 22, 2017

Seems the refresh button isn't refreshing my node_modules folder (Version 1.12.2 (1.12.2) 19222cd). This is when node_modules is still in the watcherExclude list. I'll make a report if I get the chance to dig deeper into it.

@mattflix
Copy link

mattflix commented Jun 24, 2017

In your case, since by default we ignore node_modules changes

Ack! I wish tools would stop making these bad assumptions about node_modules.

I finally figured out that VS Code wasn't refreshing all my file changes because my folder structure was this:

/node_modules
    /vscode-project-folder-1
    /vscode-project-folder-2
    /vscode-project-folder-3

I had purposely located all three projects under a top-level folder called "node_modules" so that I could benefit from the Node Module Resolution Algorithm between them. That is, while I worked on these three related projects, the projects could refer to each other's output as if they had been installed somewhere.

I keep running across tools and libraries, including VS Code, that assume there is "one" node_modules folder that matters and that it should always be ignored, or other special rules applied to it.

Yes, you should probably ignore the node_modules folder at the root of any given VS Code project, but don't ignore other node_modules or apply the same rules to them!

It is infuriating to find these types of "magical" behaviors permeating the Node eco-system. The magic is usually wrong and, when it messes things up, it is mysterious, and takes ages to find out where it is coming from.

In this case, after hours of banging my head, it was only @bpasero's off-handed comment above that lead me to discover that VS Code "magically" ignores file system changes in anything called "node_modules".

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code)
Projects
None yet
Development

No branches or pull requests

3 participants