microsoft / microsoft/TypeScript

Expand and shrink selection around JavaScript `if-elseif-else` statements

Aperta
#56,432 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Awaiting More Feedback Domain: LS: Smart-Select Suggestion
Lingua principale
Go
Stelle
111k
Fork
14.4k
Merge medio
1g 19h
PR unite (30g)
117

Descrizione

Acknowledgement
  • I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.
Comment

I am unsure if this is a bug or a feature request.

The expand and shrink selection does not work as expected around if-elseif-else statments.

    const a = 1;
    if (a === 1) {
      // foo
    } else if (a === 2) {
      // fii
    } else {
      // fum
    }

Actual behavior

Place the cursor between else if and try to expand selection. It expands like this.

Start
image

Middle (few more expansions needed to get here)
image

End (only one more expansion from the one above)
image

Expected behavior

I expected it to select it like this, starting from Middle above:

image
image
image
image

Additional context

VS Code version: Code 1.84.1 (2b35e1e6d88f1ce073683991d1eff5284a32690f, 2023-11-06T12:35:59.022Z)
OS version: Windows_NT x64 10.0.19045
Modes:
Remote OS version: Linux x64 5.4.0-166-generic

System Info
Item Value
CPUs 11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz (8 x 2611)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 31.69GB (17.72GB free)
Process Argv --crash-reporter-id e332dab4-91ea-49d1-8a1f-d8f6e06fa4e1
Screen Reader no
VM 0%
Item Value
Remote SSH: vm
OS Linux x64 5.4.0-166-generic
CPUs Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz (8 x 2394)
Memory (System) 31.32GB (23.28GB free)
VM 50%
Extensions (35)
Extension Author (truncated) Version
jest-snippets and 1.9.1
remote-containers ms- 0.321.0
remote-ssh ms- 0.107.0
remote-ssh-edit ms- 0.86.0
remote-wsl ms- 0.81.8
vscode-remote-extensionpack ms- 0.24.0
remote-explorer ms- 0.4.1
remote-server ms- 1.5.0
highlight-matching-tag vin 0.11.0
browserslist web 1.1.0
vscode-openapi 42C 4.18.6
lit-html bie 1.11.1
ruff cha 2023.44.0
vale-vscode chr 0.17.5
vscode-markdownlint Dav 0.52.0
vscode-eslint dba 2.4.2
gitlens eam 14.4.1
prettier-vscode esb 10.1.0
code-runner for 0.12.1
go gol 0.39.1
path-autocomplete ion 1.25.0
vscode-azureresourcegroups ms- 0.7.5
vscode-cosmosdb ms- 0.20.0
vscode-docker ms- 1.27.0
vscode-kubernetes-tools ms- 1.3.15
python ms- 2023.20.0
vscode-pylance ms- 2023.11.10
azure-account ms- 0.11.6
vscode-yaml red 1.14.0
vscode-direnv Rub 0.0.2
code-spell-checker str 3.0.1
vscode-stylelint sty 1.3.0
even-better-toml tam 0.19.2
shellcheck tim 0.34.0
vscode-proto3 zxh 0.5.5
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes627:30244334
vslsvsres303:30308271
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscorecescf:30445987
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
py29gd2263cf:30880073
vscaat:30438848
vsclangdc:30486549
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30695312
azure-dev_surveyonecf:30548226
2e4cg342:30602488
f6dab269:30613381
showlangstatbar:30737416
pythonfmttext:30731395
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
pythonnosmt12:30797651
pythonidxpt:30866567
pythonnoceb:30805159
synctok:30869157
dsvsc013:30795093
dsvsc014:30804076
dsvsc015:30845448
pythontestfixt:30871694
pythonregdiag2cf:30871583
pyreplss2:30879913
pythonmypyd1:30879173
pythoncet00cf:30874137
pythontbext0:30879054
dsvsc017cf:30880893
aa_t_chat:30882232

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

Riproduci il comportamento segnalato di espansione e riduzione della selezione in VS Code utilizzando l'esempio JavaScript con if/else-if/else dell'issue. Confronta gli intervalli di selezione effettivi e previsti mostrati negli screenshot, quindi traccia il comportamento di selezione dell'editor per determinare il punto di ingresso interessato. Il lavoro è completato quando la selezione si espande e si riduce attraverso la struttura condizionale come previsto.

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

Valutazione

Stack tecnologico
javascript
Ambito
tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.