0

This is an issue I've been facing for about a month already. My TS LSP is getting constantly reloaded for certain projects and I can't find a fix for it. I'm constantly getting an Initializing JS/TS language features....

According to the log this happens due to some kind of updates to the tscofnig.json file, but there's nothing that updates it, I don't see any writes to the file or anything.

What I already tried:

  • LazyNvim and Astro distros;
  • My own configuration based on lazy.nvim;
  • Disabled every plugin except for lsp-config and mason;
  • Tried pure nvim config with Packer and only lsp-config;
  • Tried two different LSP's: tsserver and vtsls;

On the other hand VSCode doesn't seem to have this issue in those projects that are causing problems in nvim.

The only thing I found is that this happens for projects with TS 4.9 and above, no issues with TS 4.2 and below. Although, I haven't found any relevant information about incompatibility between tsserver/vtsls and latest versions of TypeScript.

Here's the log message after which the project is getting reloaded:

Info 1525 [16:30:00.888] event:
    {"seq":0,"type":"event","event":"projectLoadingStart","body":{"projectName":"[path-to-project]/tsconfig.json","reason":"Change in config file detected"}}

System:

  • MacBook Pro M1 Max
  • macOS Sonoma
  • nvim 0.9.2

Let me know if I can bring any more information to debug it.

2 Answers 2

0

I wish I could put this in a comment, as I'm not sure it really justifies an "answer", but I don't have enough reputation.

My VSCode was doing this prior to being away from work for 1.5 weeks, and I got back today and it's now working. It's possible something happened with our repo while I was gone that fixed this, but one thing I did today was update my .NET Core Runtime for an unrelated issue, so you could check that. I removed 6.0.16 and 5.0.17 from my PC and installed 7.0.12. I did do a cursory look through a diff of our repo from 2 weeks ago and didn't see anything Typescript related or package.json related that I would expect to have fixed this. That's not to say it isn't possible that some commit in that time fixed it.

In my search for a solution a few weeks ago I came across https://github.com/microsoft/TypeScript/issues/51927, which was the only open ticket I could find relating to this issue. I see that someone posted a potential solution in that thread 2 weeks ago, so you could try that as well.

Sign up to request clarification or add additional context in comments.

4 Comments

thank you for the comment! .NET doesn't seem to be a case for me though as I'm on a mac. should've mentioned that in the question. also, thank you for the link, I also stumbled across this issue, but as of now it doesn't seem to contain any solutions
@nick.skriabin I did realize today that I only have this issue when I have package.json open. We have a lot of scripts in there, so maybe the linter is trying to resolve all the dependencies and isn't able to. Not sure if it will be useful to you, but if someone comes across this, these are all the typescript/javascript-related references in our package.json: "typescript": "^5.2.2" "react-docgen-typescript-plugin": "^1.0.5" "@typescript-eslint/eslint-plugin": "^5.61.0" "@typescript-eslint/parser": "^5.61.0"
that’s an interesting find indeed, thank you! i’ll check the configs I have
I just realized that it only happens to me when the tsconfig.json is not committed to the repository. quite a weird thing but I can live with that for now
0

It turned out to be git related for some reason. I haven’t figured it out completely, but whenever I commit changes to tsconfig.json the problem disappears and LSP works just fine. I can live with that for now and gonna accept this answer until (if ever) somebody post a real solution.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.