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

Basic language support for Fennel. Might even work. #13260

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

icefoxen
Copy link

@icefoxen icefoxen commented Apr 3, 2025

Closes #3846 . After pondering it (for two years) it seems obvious that having a single grammar that tries to cover multiple Lisps is silly.

There are two different tree-sitter parsers for Fennel mentioned in that issue:

This PR has mostly-arbitrarily chosen the second one. There's also several different highlights.scm options, I've mostly chosen the most recent one but tried to incorporate bits and pieces from the others where I could find them.

Closes helix-editor#3846 .

There are two different tree-sitter parsers for Fennel mentioned in that issue:

 * https://github.com/travonted/tree-sitter-fennel
 * https://github.com/alexmozaidze/tree-sitter-fennel

This PR has arbitrarily chosen the second one.  There's also several different
`highlights.scm` options, I've mostly chosen the most recent one but tried to
incorporate bits and pieces from the others.
@icefoxen icefoxen changed the title Basic support for Fennel. Might even work. Basic language support for Fennel. Might even work. Apr 3, 2025
@micampe
Copy link

micampe commented Apr 4, 2025

also need to add fnlm to the file types.

@icefoxen
Copy link
Author

icefoxen commented Apr 4, 2025

Added, thanks.

Copy link
Member

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

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

You can run cargo xtask docgen and commit the changes to fix the docs CI.

Might even work.

I realize this statement is probably meant as a joke but you have tested this patch, right? You can use cargo run to run a debug build which will use these queries.

languages.toml Outdated
[[grammar]]
name = "fennel"
source.git = "https://github.com/alexmozaidze/tree-sitter-fennel"
source.rev = "ea4a536bca8997e30b22709f210f44f97e75bf7d"
Copy link
Member

Choose a reason for hiding this comment

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

It looks like this revision is fairly old. Is there any reason not to use the latest commit?

Simon Heath and others added 2 commits April 8, 2025 15:26
@icefoxen
Copy link
Author

icefoxen commented Apr 8, 2025

Jokes aside, yes I've tested it, but probably not as thoroughly as I should. Lots of my PR's come out of catharsis and then get mopped up after the fact if it turns out that anyone is actually interested in them. I swear I got this to work via some kind of cursed flailing around, but upon trying again to do it right better, it doesn't seem to do the syntax highlighting.

$ HELIX_RUNTIME=~/tmp/helix/runtime cargo run -- --health fennel
Configured language servers:
  ✓ fennel-ls: ~/.local/bin/fennel-ls
Configured debug adapter: None
Configured formatter: fnlfmt
Binary for formatter: ~/.local/bin/fnlfmt
Tree-sitter parser: ✓
Highlight queries: ✓
Textobject queries: ✘
Indent queries: ✘

Off to a good start? helix/runtime/queries/fennel/highlights.scm is present and Helix claims the language is set to fennel, but no highlighting. Any pointers on how to debug this?

@uncenter
Copy link
Contributor

uncenter commented Apr 8, 2025

I'm getting this cryptic log error, of which I've seen before and not exactly sure how to solve 😓

2025-04-08T16:25:31.777 helix_core::syntax [ERROR] Could not parse queries for language "fennel". Are your grammars out of sync? Try running 'hx --grammar fetch' and 'hx --grammar build'. This query could not be parsed: QueryError { row: 132, column: 7, offset: 3284, message: "", kind: NodeType }

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.

Fennel language support
4 participants