neoclide / coc-tsserver

Tsserver extension for coc.nvim that provide rich features like VSCode for javascript & typescript
MIT License
1.05k stars 68 forks source link

New File not automatically picked up. #393

Closed impguard closed 1 year ago

impguard commented 1 year ago

Curious if I'm missing a setting or a configuration detail.

coc-tsserver works great for the most part, but when I create a new file I run into two issues: (1) auto import doesn't pick it up and (2) manually importing results in a tsserver error 6307 (the file I'm importing is not listed within the file list of my project, telling me to include it via an include pattern in my tsconfig).

The file definitely is included though, a CocRestart will resolve this issue. However, CocRestart for this project takes a good 10 seconds since it's reasonably large. Totally fine for a startup but really painful everytime I'm creating a lot of files or refactoring.

Is this something that's just expected from tsserver or am I messing something up?

chemzqm commented 1 year ago

File creation are observed by tsserver, there is tsserver.watchOptions option might helps.

impguard commented 1 year ago

You are correct. It seems that the correct fix is to properly specify glob patterns in the tsconfig for tsserver to pick up:

"include": ["./src/**/*", "next-env.d.ts"],

I originally had:

"include": ["./src", "next-env.d.ts"],

which compiles fine but creates problems for tsserver it seems.

chemzqm commented 1 year ago

Some features of tsserver only work with saved files, checkout https://github.com/neoclide/coc-tsserver/blob/master/Readme.md#troubleshooting if you still have issue with that.