-
-
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
Fennel language support #3846
Comments
Did you install Helix with a package manager? Try |
it works thanks 😄 |
There is a pull request for Fennel support: #3851 |
The PR is stalled 'cause we already have tree-sitter-scheme (which might be weirdly huge?) and people were wondering if it would be preferable to have a single "lisp mode" or "sexpr mode" that handles any Lisp. I don't think that's a good idea 'cause lisps don't actually all have the same syntax... But I was thinking we might be able to do a "clojureish mode" that is Good Enough for Clojure, Fennel and Janet, and then a "True Lisp Mode" for Scheme, CL, LFE, etc. I want to try this out and see how well this works, no idea how easy it would be or not be to add partially-overlapping languages like that. If I don't have a proof of concept in two months though assume I've gotten distracted by shiny objects and wandered off. |
I dont think that is a good idea at all. Imagine we had a grammar for "c-like" languages, maybe you can develop an lsp that provides some basic autocomplete. You wouldn't want that to be used as your editor's grammar for typescript. |
Unifying the tree-sitter grammar among all Lisps is the kind of yak shaving I would expect from lispers but really a blocker on having adequate support for each of them. I here to +1 any kind of upstream support for Fennel. |
I feel like this is silly as a blocker for adding Fennel esp. considering this was not a problem for janet #9247. I'm not sure if merging all lisps into one grammar is a good idea because most of them do have some special quirks. The sentiment might have changed around this though (considering the janet one was merged without discussions) and it might be worthwhile submitting a new PR for this. I played around with the scheme and Clojure (which is much closer to Fennel than scheme) grammar but decided in the end to just use the fennel one since that works best. For completions sake, this is my current config that works quite well: xdg-config/helix/languages.toml [language-server.fennel-ls]
command = "fennel-ls"
[[language]]
name = "fennel"
scope = "source.fnl"
injection-regex = "(fennel|fnl)"
file-types = ["fnl"]
shebangs = ["fennel"]
roots = []
comment-token = ";"
indent = { tab-width = 2, unit = " " }
formatter = { command = "fnlfmt", args = ["-"] }
language-servers = [ "fennel-ls" ]
grammar = "fennel"
[[grammar]]
name = "fennel"
source = { git = "https://github.com/travonted/tree-sitter-fennel", rev = "15e4f8c417281768db17080c4447297f8ff5343a"} xdg-config/helix/runtime/queries/fennel/highlights.scm (from: #3851) (comment) @comment
[ "(" ")" "{" "}" "[" "]" ] @punctuation.bracket
[ ":" ":until" "&" "&as" "?" ] @punctuation.special
(nil) @constant.builtin
(vararg) @punctuation.special
(boolean) @constant.builtin.boolean
(number) @constant.numeric
(string) @string
(escape_sequence) @constant.character.escape
((symbol) @variable.builtin
(#match? @variable.builtin "^[$]"))
(binding) @symbol
[ "fn" "lambda" "hashfn" "#" ] @keyword.function
(fn name: [
(symbol) @function
(multi_symbol (symbol) @function .)
])
(lambda name: [
(symbol) @function
(multi_symbol (symbol) @function .)
])
(multi_symbol
"." @punctuation.delimiter
(symbol) @variable.other.member)
(multi_symbol_method
":" @punctuation.delimiter
(symbol) @function.method .)
[ "for" "each" ] @keyword.control.repeat
((symbol) @keyword.control.repeat
(#eq? @keyword.control.repeat
"while"))
[ "match" ] @keyword.control.conditional
((symbol) @keyword.control.conditional
(#match? @keyword.control.conditional "^(if|when)$"))
[ "global" "local" "let" "set" "var" "where" "or" ] @keyword
((symbol) @keyword
(#match? @keyword
"^(comment|do|doc|eval-compiler|lua|macros|quote|tset|values)$"))
((symbol) @keyword.control.import
(#match? @keyword.control.import
"^(require|require-macros|import-macros|include)$"))
[ "collect" "icollect" "accumulate" ] @function.macro
((symbol) @function.macro
(#match? @function.macro
"^(->|->>|-\\?>|-\\?>>|\\?\\.|doto|macro|macrodebug|partial|pick-args|pick-values|with-open)$"))
; Lua builtins
((symbol) @constant.builtin
(#match? @constant.builtin
"^(arg|_ENV|_G|_VERSION)$"))
((symbol) @function.builtin
(#match? @function.builtin
"^(assert|collectgarbage|dofile|error|getmetatable|ipairs|load|loadfile|loadstring|module|next|pairs|pcall|print|rawequal|rawget|rawlen|rawset|require|select|setfenv|setmetatable|tonumber|tostring|type|unpack|warn|xpcall)$"))
(list . (symbol) @function)
(list . (multi_symbol (symbol) @function .))
(symbol) @variable |
Hi, how to add Fennel language support?
at least syntax highlighting, i came across tree-sitter-fennel
and basic fennel lsp fennel-ls lsp completion work fine but i cannot build tree-sitter-fennel
try to setup locally as adding language
my languages.toml:
and try to
helix -g build
the output:
even with
sudo helix -g bulid
it ignore fennel tree-sitter, is there any mistake on my end? Thanks
The text was updated successfully, but these errors were encountered: