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 smali language support #9089

Merged
merged 1 commit into from
Dec 19, 2023
Merged

Conversation

evanrichter
Copy link
Contributor

No description provided.

@the-mikedavis the-mikedavis added S-waiting-on-review Status: Awaiting review from a maintainer. A-language-support Area: Support for programming/text languages labels Dec 15, 2023
runtime/queries/smali/highlights.scm Outdated Show resolved Hide resolved
runtime/queries/smali/highlights.scm Outdated Show resolved Hide resolved
runtime/queries/smali/highlights.scm Outdated Show resolved Hide resolved
@@ -0,0 +1 @@
(comment) @comment
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(comment) @comment
((comment) @injection.content
(#set! injection.language "comment"))

we follow tree-sitter for injections https://tree-sitter.github.io/tree-sitter/syntax-highlighting#language-injection, nvim has its own injection format

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made the change as suggested, and this reminded me to check goto_next_comment which I found doesn't work.

tree-sitter-subtree does report (comment) for comment lines, so I don't know what to check beyond that

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For that functionality you'll want to look into adding textobjects queries: https://docs.helix-editor.com/master/guides/textobject.html

runtime/queries/smali/locals.scm Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These look like nvim indent queries. See https://docs.helix-editor.com/master/guides/indent.html for writing Helix ones

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I did my best! smali does not use indentation too much (it's basically just a text representation of dalvik bytecode with gotos for control flow). But I checked the behavior with this example with the most indentation I could find and it seems correct:

.method public static updateDigest(Ljava/security/MessageDigest;Ljava/io/File;)V
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

languages.toml Outdated Show resolved Hide resolved
@the-mikedavis the-mikedavis added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from a maintainer. labels Dec 19, 2023
@the-mikedavis the-mikedavis added S-waiting-on-review Status: Awaiting review from a maintainer. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 19, 2023
@pascalkuthe pascalkuthe merged commit a98b8dd into helix-editor:master Dec 19, 2023
6 checks passed
dgkf pushed a commit to dgkf/helix that referenced this pull request Jan 30, 2024
mtoohey31 pushed a commit to mtoohey31/helix that referenced this pull request Jun 2, 2024
Vulpesx pushed a commit to Vulpesx/helix that referenced this pull request Jun 7, 2024
smortime pushed a commit to smortime/helix that referenced this pull request Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-language-support Area: Support for programming/text languages S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants