LuaLS / LuaLS/lua-language-server
Wrong edit range for param completions
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Lua
- Sterne
- 4.4k
- Forks
- 442
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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
- Create
test.luain 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 - Use neovim to edit
test.lua - Try to call
test_funcat the end of the file with a list parameter:test_func({ ... }) - Completions provided by lua-language-server are shown inside the curly braces
- 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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduziere das Problem anhand des Beispiels test.lua und Neovim, wobei du dich auf die Bearbeitungsbereiche der Vervollständigung für einen Parameter mit dem Typ my_type|my_type[] konzentrierst. Verfolge, wie der Vervollständigungsbereich berechnet wird, wenn sich das Argument innerhalb geschweifter Klammern befindet. Als abgeschlossen gilt die Aufgabe, wenn die Auswahl einer Vervollständigung nur den Wert innerhalb der Klammern ersetzt und die umgebende Listensyntax erhält.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- lua, neovim
- Bereich
- developer-experience, tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 58/100