-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 support for janet language #4617
Conversation
64ee0e5
to
3814987
Compare
f5b3559
to
7f54ceb
Compare
I'm sorry for the force pushes 😅 I forgot to add a few things and I didn't want to stack commits, so I rebased and pushed again. |
Since Janet is a lisp and looks a lot like clojure, I wonder if we can re-use the clojure or scheme parsers and only write new queries? |
Does "new queries" mean injections and highlights in |
Yep correct. To share the same parser you will need to change the languages.toml entry to remove the new |
Gotcha. Although, I do have a concern. Looking further into the syntax of all the 3 languages [ janet, clojure and scheme ], there seems to be quite a bit of difference between the 3 of them with respect to keywords and the general mechanics of the languages. Janet does sort of represent scheme and clojure in a way but I feel that it is different enough to have its own grammar (since reusing grammar may raise questionable results and/or errors in the language later?) Having said this, I could very well be wrong and I'm happy to correct myself if I am. If you feel that the grammar of clojure or scheme can be resused, then let me know, I'll make the necessary changes and add a new commit. |
@the-mikedavis [Sorry for the mention!] Any update on this PR? |
Hmm yeah, we might as well pull in a new grammar for this - when compiled, this parser is only 174KB. We can work on deduplicating grammars later, maybe we'll need to write a new grammar that's general enough to be used for any lisp. |
Alright! Is there any pending work to be done on my end? (I'm really sorry for going back and forth over this PR) 😅 |
Yep this still needs |
@the-mikedavis Is it alright if I reuse https://github.com/helix-editor/helix/blob/master/runtime/queries/clojure/highlights.scm with a bit of modification for janet atm? I know I'd told against it but I'm not finding enough time to roll out a new one for janet. |
Yep that would be fine as long as the syntax is close enough. You can set the grammar to use the clojure one and then inherit the highlights: # /languages.toml
[[language]]
name = "janet"
# .. other stuff ..
grammar = "clojure" then in ; inherits: clojure to use all of the clojure highlight patterns, or just use the patterns that are needed |
Thanks! Btw, How do i resolve the merge conflict? 😅 |
You can pull down the master branch from this repo and
(Or if you meant which side to take in the conflict: you can add both new entries so that you have [[language]]
name = "janet"
# ...
[[grammar]]
name = "janet"
# ...
[[language]]
name = "bicep"
# ...
[[grammar]]
name = "bicep" ) |
(first off, im really sorry for the delay) |
It sounds like you have uncommitted changes in your local branch. You should commit them first before running |
Since there aren't a lot of lines changed, starting from scratch like you said might be the easiest option. You can also try committing the local changes before the merge as @Plasma-Vortex says or stashing: |
Resolves : #4574