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 asm (assembler) language support based on tree-sitter-asm #7692

Closed
wants to merge 1 commit into from

Conversation

devyn
Copy link
Contributor

@devyn devyn commented Jul 20, 2023

The tree-sitter-asm syntax is more suitable for generic assembly language, including GNU assembler syntax, than the NASM-specific one.

This changes extensions for NASM so that asm syntax is used for ".s" and ".S" files, which are commonly used with the GNU assembler, and ".asm" and ".nasm" for NASM which are more commonly used with that.


The only thing I'm not sure about is tree-sitter-asm had highlight queries in the package already, so I just copied those but appended the LICENSE file to the beginning. Since it's MIT license I hope this is not a problem, but unfortunately I'm not the author of tree-sitter-asm so I can't help you with that. It would probably be more ideal if helix could also include highlight queries from git while building the grammars rather than having to be in the main helix repo.

The tree-sitter-asm syntax is more suitable for generic assembly
language, including GNU assembler syntax, than the NASM-specific one.

This changes extensions for NASM so that asm syntax is used for ".s"
and ".S" files, which are commonly used with the GNU assembler, and
".asm" and ".nasm" for NASM which are more commonly used with that.

[[grammar]]
name = "asm"
source = { git = "https://github.com/rush-rs/tree-sitter-asm.git", rev = "36dc26acc7818920de2e103e20a9f42358caf926" }
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
source = { git = "https://github.com/rush-rs/tree-sitter-asm.git", rev = "36dc26acc7818920de2e103e20a9f42358caf926" }
source = { git = "https://github.com/rush-rs/tree-sitter-asm", rev = "36dc26acc7818920de2e103e20a9f42358caf926" }

Copy link
Member

Choose a reason for hiding this comment

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

The highlights should use helix's capture names: https://docs.helix-editor.com/master/themes.html#syntax-highlighting

It looks like they're currently using nvim-like captures. For example (int) @number should be (int) @constant.numeric.integer.

kind: (_) @function.call)

; Comments
(line_comment) @comment @spell
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
(line_comment) @comment @spell
(line_comment) @comment

@the-mikedavis
Copy link
Member

This is superseded by #8291

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants