microsoft / microsoft/vscode-cpptools
Getting function arguments to align automatically when hitting enter
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 6.2k
- Fork
- 1.7k
- Merge medio
- 14h 46m
- PR unite (30g)
- 61
Descrizione
Type: LanguageService
Describe the bug
- OS and Version: Mac OS Mojave 10.14.6
- VS Code Version: 1.46.1
- C/C++ Extension Version: 0.28.3
- Other extensions you installed (and if the issue persists after disabling them):
- All Autocomplete
- Microsoft C/C++ official
- Better C++ Syntax
- Hungry Delete
The issue persists even when running code --disable-extensions
Supposed I have code like this:
myFunction(arg1, arg2, arg3);
In Sublime Text, when I put the cursor in front of the arg2 and hit enter, the rest of the function call moves down a line and arg2 lines up with arg1 like so:
myFunction(arg1,
arg2, arg3);
However, if I do the same in VS Code, the arg2 lines up to the current indentation level:
myFunction(arg1,
arg2, arg3);
I can repeatedly hit the tab key to move it over 4 spaces at a time, but since the start of arg1 is 11 spaces away, I either have to deal with a slight misalignment like so:
myFunction(arg1,
arg2, arg3);
or I have to use the spacebar as well as the tab key to align it just right.
If I simply bring arg2 to the next level and use "Format Selection", I get everything to align perfectly. However, I was wondering if there's any way to get this behavior to occur automatically by hitting enter.
Note that I don't want "Format Document" to run automatically; I want to keep the rest of the file as is and just have things line up as I move them to new lines.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
L'issue non indica alcun file o test, ma identifica il C++ LanguageService e il comportamento esistente di Format Selection. Inizia individuando la gestione dell'indentazione durante Enter/a capo e confrontala con la formattazione; il lavoro è completato quando gli argomenti delle funzioni vengono allineati automaticamente durante Enter senza formattare il resto del documento.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- cpp, typescript
- Ambito
- developer-experience, tooling
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100