LuaLS / LuaLS/lua-language-server

Wrong edit range for param completions

Abierto
#3,273 1 comentario 3 reacciones 0 asignados Ver en GitHub

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?

Linux

What is the issue affecting?

Completion

Expected Behaviour

For parameters that can either be a single value or a list T|T[], when already in a table, the completion range should not include surrounding curly braces.

Actual Behaviour

The completion edit range provided by lua-language-server for parameters seems to always include the entire parameter, which causes issues when completing params that can be either a single value or a list, for example, T|T[].

Reproduction steps
  1. Create test.lua in the test dir with the following content:
    ---@alias my_type 'a'|'b'
    
    ---@param arg my_type|my_type[]
    local function test_func(arg)
      return arg
    end
    
  2. Use neovim to edit test.lua
  3. Try to call test_func at the end of the file with a list parameter: test_func({ ... })
  4. Completions provided by lua-language-server are shown inside the curly braces
  5. Selecting one of the completions replaces the whole parameter, including the surrounding curly braces.

https://github.com/user-attachments/assets/d69214e9-b069-4554-b4ab-770e2fb50632

Additional Notes

I have also reported to the blink.cmp but the maintainer thinks that it is a lua-language-server's issue: https://github.com/Saghen/blink.cmp/issues/2179

Log File

No response

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Reproduce el problema usando el ejemplo test.lua y Neovim, centrándote en los rangos de edición de la finalización para un parámetro tipado como my_type|my_type[]. Rastrea cómo se calcula el rango de finalización cuando el argumento está dentro de llaves. Se considera terminado cuando seleccionar una finalización reemplaza únicamente el valor dentro de las llaves y conserva la sintaxis de lista circundante.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
lua, neovim
Área
developer-experience, tooling
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Tranquilo
Claridad
Bien especificado
Aptitud para principiantes
58/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.