LuaLS / LuaLS/lua-language-server

Adding a new workspace folder breaks things

Ouverte
#1,974 10 commentaires 2 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

bug Info Needed
Langage dominant
Lua
Étoiles
4.4k
Forks
442
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

### 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_

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par reproduire la séquence signalée : initialisez avec un répertoire racine, envoyez workspace/didChangeWorkspaceFolders et ouvrez un fichier dans le dossier ajouté. Étudiez ensuite le comportement de workspace/diagnostic/refresh et de la résolution des modules require. Le travail est terminé lorsque les diagnostics, les chemins affichés au survol et les complétions fonctionnent dans le nouvel espace de travail sans redémarrer Neovim ni dépendre d’actualisations manuelles.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
lua, neovim
Domaine
devtools
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.