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

Use janet-simple grammar for Janet #9247

Merged
merged 7 commits into from
Jan 28, 2024
Merged

Conversation

sogaiu
Copy link
Contributor

@sogaiu sogaiu commented Jan 5, 2024

Following up on this comment, this PR is mostly about using the tree-sitter-janet-simple grammar for Janet support along with a syntax highligting query file.

It also adds some bits for janet-format -- a formatter for Janet that comes with the spork library.


I am aware of 2 grammars [1] for Janet and each took a slightly different approach from the other. The one that's part of this PR is used in nvim-treesitter, difftastic, and there is code to use it from Emacs as well.

Due to historical reasons, this one is named "tree-sitter-janet-simple" (internally janet_simple -- to avoid name collisions) and IIUC that means the value for name in languages.toml needs to be janet-simple (under both [[language]] and [[grammar]]). Or, at least, that's what made it work for me. Please point out if that should be changed and if so how :)

LSP support for Janet is still maturing and although I did get it to work with some degree of success, I didn't feel the time was right yet.


[1] Here is the other one for reference.

@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. A-language-support Area: Support for programming/text languages labels Jan 8, 2024
@sogaiu
Copy link
Contributor Author

sogaiu commented Jan 9, 2024

Does squashing to a single commit and force-pushing sound ok?

@archseer
Copy link
Member

archseer commented Jan 9, 2024

No need to manually squash, we'll squash when merging

@sogaiu
Copy link
Contributor Author

sogaiu commented Jan 9, 2024

I don't understand this error:

 Error: "Failed to parse highlights.scm queries for janet: Query error at 5:2. Invalid node type long_str_lit"
Error: Process completed with exit code 1.

I guess the line in question is this one.

I think long_str_lit is a valid node in the grammar.

I don't see any error via :log-open when I view a .janet file -- would an error show up there if there were a problem with highlights.scm?

Any hints as to what I might be missing?

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 need to remove the original [[language]] block for janet. It's overriding grammar to use the clojure one which is causing the queries to fail (since they aren't valid for the clojure grammar)

@the-mikedavis
Copy link
Member

You should see the same error printed to the log when opening a janet file. You need to run helix via cargo run to build these changes though - they won't affect any instances of Helix you installed from a package manager or from source

@sogaiu
Copy link
Contributor Author

sogaiu commented Jan 10, 2024

Thanks for the hints.

Looks like an extra section got added back here.

I guess my bad for putting the new section elsewhere and removing the old one before the merge (^^;

Sorry about that.

@the-mikedavis
Copy link
Member

(The CI failures are unrelated - it's caused by a sourcehut outage)

@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 Jan 11, 2024
@archseer archseer merged commit f5b67d9 into helix-editor:master Jan 28, 2024
6 checks passed
dgkf pushed a commit to dgkf/helix that referenced this pull request Jan 30, 2024
* Use janet-simple grammar for Janet

* Update book

* Tweak language name and related

* Rename janet-simple to janet in book

* Remove spurious language section for janet

* Drop quote_lit and qq_lit related highlighting

---------

Co-authored-by: sogaiu <[email protected]>
Co-authored-by: Blaž Hrastnik <[email protected]>
postsolar pushed a commit to postsolar/helix that referenced this pull request Apr 4, 2024
* Use janet-simple grammar for Janet

* Update book

* Tweak language name and related

* Rename janet-simple to janet in book

* Remove spurious language section for janet

* Drop quote_lit and qq_lit related highlighting

---------

Co-authored-by: sogaiu <[email protected]>
Co-authored-by: Blaž Hrastnik <[email protected]>
mtoohey31 pushed a commit to mtoohey31/helix that referenced this pull request Jun 2, 2024
* Use janet-simple grammar for Janet

* Update book

* Tweak language name and related

* Rename janet-simple to janet in book

* Remove spurious language section for janet

* Drop quote_lit and qq_lit related highlighting

---------

Co-authored-by: sogaiu <[email protected]>
Co-authored-by: Blaž Hrastnik <[email protected]>
Vulpesx pushed a commit to Vulpesx/helix that referenced this pull request Jun 7, 2024
* Use janet-simple grammar for Janet

* Update book

* Tweak language name and related

* Rename janet-simple to janet in book

* Remove spurious language section for janet

* Drop quote_lit and qq_lit related highlighting

---------

Co-authored-by: sogaiu <[email protected]>
Co-authored-by: Blaž Hrastnik <[email protected]>
smortime pushed a commit to smortime/helix that referenced this pull request Jul 10, 2024
* Use janet-simple grammar for Janet

* Update book

* Tweak language name and related

* Rename janet-simple to janet in book

* Remove spurious language section for janet

* Drop quote_lit and qq_lit related highlighting

---------

Co-authored-by: sogaiu <[email protected]>
Co-authored-by: Blaž Hrastnik <[email protected]>
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.

3 participants