-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Languages]: Penrose grammar and syntax highlighting. #15179
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
base: master
Are you sure you want to change the base?
Conversation
the-mikedavis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the CI it looks like the repo fails to clone on Windows somehow?
languages.toml
Outdated
|
|
||
| [[grammar]] | ||
| name = "penrose" | ||
| source = {git="https://github.com/klukaszek/tree-sitter-penrose/", rev="dedf9e775d086f8912c5282234cbaefed0c5f8dc"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a license file to the repo and update the rev here when it is included?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed it up! I honestly thought tree-sitter cli had already produced the license file because of the init process.
languages.toml
Outdated
|
|
||
| [[language]] | ||
| name = "penrose" | ||
| scope = "source.{domain, substance, style}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| scope = "source.{domain, substance, style}" | |
| scope = "source.penrose" |
This key is currently not used for anything. It's meant to be more about the language (name) rather than file extensions though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use different captures for textobjects queries than Neovim, see https://docs.helix-editor.com/master/guides/textobject.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah thank you! Should be fixed now. Same goes for below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also use different captures for highlighting, see https://docs.helix-editor.com/master/themes.html#syntax-highlighting
For example @number should be @constant.numeric, @boolean can be @constant.builtin.boolean, etc..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^^
…te Helix captures. Updated rev in languages.toml after adding a LICENSE to the tree-sitter-penrose repo.
|
As for the Windows problem, it seems that the Penrose examples contained some SVG ZoneIdentifiers that should not have been there. Should be resolved on next run. |
Problem
I've recently been messing around with the Penrose diagramming language, but I've decided that I wanted to edit my files locally (with highlighting) without their proprietary editor, Vim, Sublime, or Emacs.
Solution
I've implemented a tree-sitter grammar with queries that seem to work with the majority of
.style,.domain, and.substancefiles (verified on official Penrose examples).These have been added to
runtime/queries/penrose/andlanguages.toml.Future
I might consider attempting a simple LSP using tower, but for the time being this is enough for me and matches their proprietary editor.
.style
.domain
.substance
Thanks for the awesome editor!