LSP not indexing new files

I have a LSP extension (WIP - https://github.com/GeneaLabs/panic-nova-intelephense) and have noticed that the LSP only indexes when the project is opened. Any files created after that are not indexed.

Is this something I need to trigger on my own in the LSP, or should that be handled by Nova? (And if I do need to trigger that, what is the best way to go about it?)

Thanks! :slight_smile:

Oh. That’s indeed a very good question. Does it help if you restart the LSP? I’m just curious — I could try it out but I’m lazy lol

Yes, restarting the LSP does index the newly-created files. It just seems odd that it has to be restarted, instead of Nova just retriggering the indexing.

Nova should be providing all the notifications the language server should need to track new files, but you have to be able to tap into the RPC communication to diagnose. Does you language server offer an RPC logging?

1 Like

Hi @jrf, thanks for weighing in. I don’t believe that logging is turned on, or is externally configurable – it’s installed via NPM and per the author only has internal logging available to him.

Is there something I can look for in the NPM package to see if this can be hooked into?

A truly generic solution would be to stick a proxy between Nova and the language server. Without googling anything first, I’d poke at haproxy or nginx at the tcp level, siphoning everything that goes through to a log file…

<googles>

This looks interesting https://github.com/tomusdrw/jsonrpc-proxy and learning a bit of Rust is kind of on my language bucket list.

I’d be shocked if Nova didn’t have the facility to log it all buried in there somewhere, though maybe not in release builds, and certainly not documented.

For the TypeScript extension I’ve used a simple shell script and tee to see what’s being sent back and forth. It doesn’t always work but might be a starting place.

Based on my interpretation of the LSP spec, the server is primarily in charge of indexing behavior. I’d expect it should be based on proper capability registration and notifications for the DidCreateFile notification.

I would agree with that assumption. However, it seems that Nova may not be implementing the registration capabilities fully, as commented on by Logan: LSP import action error