javascript-typescript-langserver icon indicating copy to clipboard operation
javascript-typescript-langserver copied to clipboard

Scanning "node_modules" slowing operations down

Open bschulte opened this issue 6 years ago • 8 comments

I'm using the Neovim plugin: LanguageClient-neovim to interact with this language server. Operations such as going to a definition or finding all references are slowed down a great deal since it seems the server scans through the node_modules folder during the operation. I end up getting a ton of messages such as:

[Warning] readFile /project-dir/node_modules/eslint-plugin-flowtype/node_modules/lodash/fp/__.js requested by TypeScript but content not available

Is there a way to ignore the node_modules folder during these type of operations?

bschulte avatar May 31 '18 17:05 bschulte

https://github.com/sourcegraph/javascript-typescript-langserver/issues/394 This is a hack though, not the real solution

whitebyte avatar Jun 14 '18 08:06 whitebyte

Does that hack even work though? Most of this LSP server ignores what you put in the excludes.

keyboardDrummer avatar Jun 19 '18 15:06 keyboardDrummer

Well, it wiorks for https://github.com/sourcegraph/javascript-typescript-langserver

whitebyte avatar Jun 20 '18 07:06 whitebyte

This makes LanguageClient-neovim unusable. +1 for some sort of exclude option.

bugeats avatar Jul 11 '18 20:07 bugeats

Still relevant, and that hack seem to only work for VSCode, not NeoVim.

maxnordlund avatar Dec 14 '18 09:12 maxnordlund

To be able to work with NeoVim and LanguageClient-neovim, right now I have to make sure to keep the code in a subdir next to node_modules (e.g. src) and then point it out as project root by having a rootmarker there. Either a .root file or for example App.js.

let g:LanguageClient_rootMarkers = ['App.js', '.git']

ripperapid avatar Jan 10 '19 18:01 ripperapid

@whitebyte

Well, it wiorks for https://github.com/sourcegraph/javascript-typescript-langserver

Are you sure about this? With logging turned on and javascript-typescript-langserver + LanguageClient-neovim, I still see a bunch of attempts to access files under node_modules like this one:

12:41:50 INFO reader-Some("typescript") src/rpcclient.rs:83 <= Some("typescript") {"jsonrpc":"2.0","method":"window/logMessage","params":{"type":2,"message":"readFile /Users/glh/code/corpus/node_modules/@types/jest-diff/index.d.ts requested by TypeScript but content not available"}}

(And that message is puzzling in any case, because the file exists on file system and has legit-looking contents to me.)

wincent avatar Jul 21 '19 10:07 wincent

@wincent no idea, this ticket is more than 1 year old and I already don't remember

whitebyte avatar Jul 22 '19 14:07 whitebyte