LuaLS / LuaLS/lua-language-server

"Expand Selection" doesn't expand to strings or scopes

Offen
#3,455 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Lua
Sterne
4.4k
Forks
442
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

I use VScode's "Expand Selection" command a lot to copy strings around, but when I try to use it on Lua strings, it expands the selection a lot more than just the string I'm on.

Actual behavior

Suppose my cursor is inside the word example:

hs.alert(prefix .. " an exam|ple string " .. suffix)

1st call to Expand Selection selects the word:

hs.alert(prefix .. " an example string " .. suffix)

2nd call to Expand Selection selects everything between () instead of the full string:

hs.alert(prefix .. " an example string " .. suffix)

Expected behavior

2nd call to Expand Selection should select just the string:

hs.alert(prefix .. " an example string " .. suffix)

In JavaScript, I noticed it even has two steps for the string, the inner part of the string, then the outer:

alert(prefix + " an example string " + suffix)

alert(prefix + "an example string" + suffix)

alert(prefix + " an example string " + suffix)

That would also work!

Similar scenarios

Scopes are also currently skipped:

local myFunction = function () ret|urn true end

local myFunction = function () return true end <- 1st call selects the word

local myFunction = function () return true end <- expected: 2nd call selects the function scope

local myFunction = function () return true end <- actual: 2nd call selects the line instead

Same for Object.property:

Object.property = true

Object.property = true <- expected

Object.property = true <- actual

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, die Implementierung von Expand Selection und alle Tests zu finden, die die Erweiterung der Auswahl abdecken; das Issue nennt keine bestimmten Dateien oder Einstiegspunkte. Stelle die Beispiele für Lua-Strings, Funktionsbereiche und Object.property nach und füge anschließend Abdeckung hinzu, die zeigt, dass aufeinanderfolgende Erweiterungen die erwarteten Konstrukte auswählen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
lua
Bereich
devtools, tooling
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Aktiv
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
65/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.