CodeEditApp / CodeEditApp/CodeEdit

✨ Language-Aware Automatic Indentation

Đang mở
#1,918 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement settings
Ngôn ngữ chính
Swift
Star
23k
Fork
1.2k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### 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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Xem xét hành vi thụt lề hiện tại của editor được mô tả trong issue, sau đó so sánh cách TextMate xử lý grammar của ngôn ngữ với hành vi VSCode được dẫn lại. Được xem là hoàn tất khi việc tự động thụt lề và bỏ thụt lề tuân theo grammar của ngôn ngữ đang hoạt động, có thể cấu hình theo từng ngôn ngữ, có thể vô hiệu hóa và vẫn giữ các điều khiển thụt lề thủ công.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
bash, swift
Lĩnh vực
tooling
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.