LuaLS / LuaLS/lua-language-server

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

Aperta
#3,455 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Lua
Stelle
4.4k
Fork
442
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia individuando l’implementazione di Expand Selection e tutti i test che coprono l’espansione della selezione; l’issue non indica file o punti di ingresso specifici. Riproduci gli esempi di stringhe Lua, ambito di funzione e Object.property, quindi aggiungi la copertura che mostri che le espansioni successive selezionano i costrutti attesi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
lua
Ambito
devtools, tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Attiva
Chiarezza
Abbastanza chiara
Idoneità per principianti
65/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.