microsoft / microsoft/vscode-cpptools
Indentation broken with multiline literal initializer expressions
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Bug type: Language Service
On Linux with VSCode 1.66.2 and C/C++ Extension Pack 1.1.0, I'm seeing the following:
char **argv = {"foo",<enter>
|
i.e., pressing enter after the first line puts the cursor in column 1, without any indentation. This is wrong, an open brace should result in at least some level of indentation.
Moreover, after manually indenting:
char **argv = {"foo",
NULL};<enter>
|
i.e, now the cursor is indented at the wrong level (since there no longer is any open brace).
Note that selecting the area and formatting it with "Format Selection" gives the correct result.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the multiline literal initializer in VS Code on Linux using the C/C++ extension, then trace the language-service indentation path for Enter and compare it with Format Selection. Confirm that pressing Enter preserves brace-based indentation and does not retain indentation after the closing brace, then add or update regression coverage for both cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100