LuaLS / LuaLS/lua-language-server
Renamed file considered deleted inside directory junction
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Lua
- Estrellas
- 4.4k
- Forks
- 442
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
### How are you using the lua-language-server?
NeoVim
### Which OS are you using?
Windows
### What is the issue affecting?
Other
### Expected Behaviour
LS correctly works with files inside directory junction or symlinks.
### Actual Behaviour
LS functionality stops working after saving such a file in editor.
### Reproduction steps
1. Enable LuaLS in NeoVim.
2. Put NeoVim config files inside directory junction. E.g. I have `init.lua` file in directory `C:\dev\dotfiles\nvim` and I've created the junction to that directory in `C:\Users\RobotComp.ru\AppData\Local\nvim`. NVim reads config files from `C:\Users\RobotComp.ru\AppData\Local\nvim`.
3. Open `init.lua` in NVim, change something and save it with `:w` command.
4. After that, **any interactions with LS stop working** (hover, go to definition, etc.)
5. If I re-edit file with `:e %` command, everything starts working again.
### Additional Notes
I did some research and found the following.
When saving `init.lua`, NVim renames it several times (to `init.lua~` and back). Don't know why.
The logs (see error.log) show that the `filewatch(rename)` function is called on LS, which calls `isExists()`.
And although the file exists, `isExists()` returns false, so the file is considered deleted, and the LS "forgets" about it.
More specifically, the problem occurs in `script/filewatch.lua:18`:
```
if res :string():gsub('^%w+:', string.lower)
~= path:string():gsub('^%w+:', string.lower) then
return false
end
```
Here, it turns out that `res` contains the actual path to the file (`C:\dev\dotfiles\nvim\init.lua`), and `path` contains the path with the junction (`C:\Users\RobotComp.ru\AppData\Local\nvim\init.lua`).
Commenting out these lines makes everything work correctly (see fixed.log). However, I didn't make a PR with such changes because I didn't fully understand why this path comparison was needed at all. It seems like it fixes some other bug?
Thanks in advance :)
### Log File
[00:20:20.415][debug][#0:script\filewatch.lua:98]: filewatch: rename C:\Users\RobotComp.ru\AppData\Local\nvim\init.lua
[00:20:20.415][debug][#0:script\filewatch.lua:98]: filewatch: modify C:\Users\RobotComp.ru\AppData\Local\nvim\init.lua
[00:20:20.415][debug][#0:script\filewatch.lua:98]: filewatch: rename C:\Users\RobotComp.ru\AppData\Local\nvim\init.lua~
**[00:20:20.415][debug][#0:script\workspace\workspace.lua:592]: FileChangeType.Deleted file:///c%3A/Users/RobotComp.ru/AppData/Local/nvim/init.lua**
[00:20:20.416][debug][#0:script\workspace\workspace.lua:592]: FileChangeType.Deleted file:///c%3A/Users/RobotComp.ru/AppData/Local/nvim/init.lua~
[error.log](https://github.com/user-attachments/files/22867004/error.log)
[fixed.log](https://github.com/user-attachments/files/22867005/fixed.log)
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Reproduce el problema en Windows con una configuración de NeoVim almacenada mediante una unión de directorios; después, lee script/filewatch.lua:18 y sigue el manejo del renombrado que se muestra en los logs. Se considera terminado cuando guardar init.lua ya no hace que el language server trate la ruta de la unión como eliminada, mientras hover y go-to-definition siguen funcionando.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- lua, neovim
- Área
- tooling
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 48/100