LuaLS / LuaLS/lua-language-server

Adding a new workspace folder breaks things

Aperta
#1,974 10 commenti 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug Info Needed
Lingua principale
Lua
Stelle
4.4k
Fork
442
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### How are you using the lua-language-server?

NeoVim

### Which OS are you using?

Windows

### What is the issue affecting?

Completion, Diagnostics/Syntax Checking, Hover, Libraries

### Expected Behaviour

Addding new workspace folders should not break anything.

### Actual Behaviour

Right now, adding a new workspace folder breaks two things, diagnostics and require statements:

- You can fix the diagnostic errors by hooking to the `workspace/diagnostic/refresh` handler to manually refresh it, but even then this is very unreliable and prone to not working:
https://github.com/neovim/nvim-lspconfig/issues/2366

- `require` statements that refers to modules in the new workspace folder also does not resolve correctly (hovering over the module string will display the byte length, instead of the resolved path). This means that completions from the required module will also be missing. So far I can't find any way to fix this without restarting neovim entirely.

Other LSP servers doesn't have this problem. Adding a new workspace folder should _just_ work without any additional steps.

### Reproduction steps

1. Initialize the LSP server with a root directory
2. Add a new workspace folder using `workspace/didChangeWorkspaceFolders`
3. Opening a file from that workspace folder results in diagnostic errors and modules not being resolved correctly

### Additional Notes

_No response_

### Log File

_No response_

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo la sequenza segnalata: inizializza con una directory radice, invia workspace/didChangeWorkspaceFolders e apri un file nella cartella aggiunta. Indaga quindi sul comportamento di workspace/diagnostic/refresh e della risoluzione dei moduli require. Il lavoro è completo quando diagnostica, percorsi mostrati al passaggio del mouse e completamenti funzionano nel nuovo workspace senza riavviare Neovim né affidarsi ad aggiornamenti manuali.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
lua, neovim
Ambito
devtools
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.