Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add indent queries for Java #7789

Closed
pengshao opened this issue Jul 30, 2023 · 1 comment · Fixed by #7844
Closed

Add indent queries for Java #7789

pengshao opened this issue Jul 30, 2023 · 1 comment · Fixed by #7844
Labels
A-indent Area: Indentation A-language-support Area: Support for programming/text languages C-enhancement Category: Improvements E-easy Call for participation: Experience needed to fix: Easy / not much E-has-instructions Call for participation: Has instructions for fixing the issue and opening a PR

Comments

@pengshao
Copy link

Summary

The indentation works correct when pressing Enter in a closed {}, but in an already expanded {..}, the cursor aligns with { instead of { + 4 spaces.

For example. If I hit enter at this cursor location, it correctly places cursor at expanded location

(hit enter now)
image
(all looks good)
image

On the other hand, if I hit "o" at any where on the function definition line, the cursor however is placed at wrong location:
(hit o)
image
(it aligns with the function definition block, not the expected place)
image

This seems only happens to Java. For rust for example it works normally.

Reproduction Steps

No response

Helix log

No response

Platform

Linux

Terminal Emulator

kitty 0.29.2

Helix Version

helix 23.05 (57952c4)

@pengshao pengshao added the C-bug Category: This is a bug label Jul 30, 2023
@pascalkuthe
Copy link
Member

pascalkuthe commented Jul 31, 2023

the reason for this behavior is that Java is currently missing indent queries. Without indent queries indent is very limited and will have many rough edges. Adding indent queries shouldn't be hard, the indent queries for other languages can be used as an example (plus the grammar may contain some indent queries that can be used as an example)

@pascalkuthe pascalkuthe changed the title Indentation for Java wrong for new lines (pressing o) Add indent queries for Java Jul 31, 2023
@pascalkuthe pascalkuthe added C-enhancement Category: Improvements E-easy Call for participation: Experience needed to fix: Easy / not much E-has-instructions Call for participation: Has instructions for fixing the issue and opening a PR A-language-support Area: Support for programming/text languages A-indent Area: Indentation and removed C-bug Category: This is a bug labels Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-indent Area: Indentation A-language-support Area: Support for programming/text languages C-enhancement Category: Improvements E-easy Call for participation: Experience needed to fix: Easy / not much E-has-instructions Call for participation: Has instructions for fixing the issue and opening a PR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants