✨ Language-Aware Automatic Indentation
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Review the current editor indentation behavior described in the issue, then compare TextMate's language-grammar handling and the cited VSCode behavior. Done means automatic indentation and outdentation follow the active language grammar, are configurable per language, can be disabled, and retain manual indentation controls.
Written by the indexing model from the issue text.
Description
Description
It would be great if CodeEdit, given instructions from the language grammar in use for the open file, were able to automatically indent and outdent lines as you type based on accepted style standards. For example, an "if" statement, "for" loop, etc. in most languages would cause the following lines to be indented once, then the closing bracket or statement would be outdented to line up with the original "if" or "for" statement. This functionality should be adjustable by editing settings for the language and able to be disabled entirely for those that prefer manual indentation.
TextMate is a good example to look at for reasonable behavior. The language grammars it uses to handle this functionality are also plist files and very easy to read to see how it's being done. Some plugins also enable this behavior in VSCode, though it's implemented inconsistently there.
Alternatives Considered
Most editors use manual indentation, which I assume CodeEdit will eventually support. Right now it only supports tabbing in (and does at least maintain that indent), but you cannot shift+tab out or use command+[ or command+] to outdent/indent (respectively) lines or selected blocks. Manual indentation works, and should be an option for those who wish to indent in ways inconsistent with language standards, but is far slower than automatic indentation.
Additional Context
No response
Screenshots
Here's an example of TextMate auto-indenting and outdenting a for loop in a shell script (bash). The second line is automatically indented to my configured tab stop, then once I finish typing "done" it outdents it to match for. This also works correctly if "do" is placed on its own line.
https://github.com/user-attachments/assets/76d5a013-7428-4764-8357-e5bdb6b179c8
- Dominant language
- Swift
- Stars
- 23k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Getting set up
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.
More from CodeEditApp/CodeEdit
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
CodeEditApp/CodeEdit#2190 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 15/100
CodeEditApp/CodeEdit#2195 · 8 reactions ·
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 35/100
CodeEditApp/CodeEdit#2185 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
CodeEditApp/CodeEdit#2181 ·
-
creashes on startingOpenbug
Difficulty 4/5 3-5 days Newbie friendliness 35/100
CodeEditApp/CodeEdit#2180 ·
All issues in CodeEditApp/CodeEdit
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
solana-foundation/pay-kit#341 ·
Maintainers usually reply within 1 day
-
area:dictation bug P2
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
uttrflow/uttrflow-swift#1584 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
521xueweihan/HelloGitHub#3779 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
🎉 Add OmniDockOpenaddition
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
jaywcjlove/awesome-mac#3009 ·
Maintainers usually reply within 5 days