jose-elias-alvarez / nvim-lsp-ts-utils

Utilities to improve the TypeScript development experience for Neovim's built-in LSP client.
The Unlicense
438 stars 18 forks source link

Check for package.json first #44

Closed andreicorpo closed 3 years ago

andreicorpo commented 3 years ago

Hi! Awesome plugin, it was pretty much the only thing I was missing from vs code.

I did notice something tho. I was wondering why the plugin would not pick up my project's prettier and I noticed that you first look for the .git folder for finding root and just after that looking for package.json in this file .

Swithing them seems to work. It now picks up my project's prettier.

If you would like, I could open a PR. πŸ˜„

jose-elias-alvarez commented 3 years ago

Thanks for the positive feedback! Fundamentally, I think what we need is to split the current buffer.root method. I'm thinking something likegit_root (for features that depend on Git, like file watching) and project_root (for features that depend on node_modules).

If you're up for it, I'd definitely appreciate a PR.

vuki656 commented 3 years ago

Isn't this going to break functionality on microservice repos where there are multiple package.json files?

I think it would make more sense to have a priority list: first check for package.json, if not found, .git, if not found then etc...

jose-elias-alvarez commented 3 years ago

That's actually how it works at the moment – it just prioritizes the project's Git root. I don't know much about complex repository structure, but I agree that always prioritizing package.json seems like it'll lead to better results (and now that I think about it, I don't think it'll cause issues for file watching).

I've used up all my OSS time for the week, so I'd be happy to see a PR, but if not I'll take care of it myself this weekend.

jose-elias-alvarez commented 3 years ago

Closed in f88ebf779eb08739cbc902ee3b22d1ddf3cab459.