-
-
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 Vlang tree-sitter in the languages.toml #2526
Conversation
If you run With just the changes to the languages.toml, this will add the tree-sitter parser so you will be able to do syntax-tree based motion
That being said, this could be merged with just |
907437d
to
ba23734
Compare
I have updated the PR with the vanila highlight.scm. i'm mainly interested in highlighting and code navigation (as well as language server support), for indenting i would prefer to use Feel free to merge this PR and tweak the .scm if it looks good to you. thanks for the neat review! |
You can use this highlights.scm which has the scopes adjusted:(parameter_declaration
name: (identifier) @variable.parameter)
(function_declaration
name: (identifier) @function)
(function_declaration
receiver: (parameter_list)
name: (identifier) @function.method)
(call_expression
function: (identifier) @function)
(call_expression
function: (selector_expression
field: (identifier) @function.method))
(field_identifier) @variable.other.member
(selector_expression
field: (identifier) @variable.other.member)
(int_literal) @constant.numeric.integer
(interpreted_string_literal) @string
(rune_literal) @string
(escape_sequence) @constant.character.escape
[
(type_identifier)
(builtin_type)
(pointer_type)
(array_type)
] @type
[
(identifier)
(module_identifier)
(import_path)
] @variable
[
"as"
"asm"
"assert"
;"atomic"
;"break"
"const"
;"continue"
"defer"
"else"
"enum"
"fn"
"for"
"$for"
"go"
"goto"
"if"
"$if"
"import"
"in"
"!in"
"interface"
"is"
"!is"
"lock"
"match"
"module"
"mut"
"or"
"pub"
"return"
"rlock"
"select"
;"shared"
;"static"
"struct"
"type"
;"union"
"unsafe"
] @keyword
[
(true)
(false)
] @boolean
[
"."
","
":"
";"
] @punctuation.delimiter
[
"("
")"
"{"
"}"
"["
"]"
] @punctuation.bracket
(array) @punctuation.bracket
[
"++"
"--"
"+"
"-"
"*"
"/"
"%"
"~"
"&"
"|"
"^"
"!"
"&&"
"||"
"!="
"<<"
">>"
"<"
">"
"<="
">="
"+="
"-="
"*="
"/="
"&="
"|="
"^="
"<<="
">>="
"="
":="
"=="
"?"
"<-"
"$"
".."
"..."
] @operator
(comment) @comment Just highlight queries are fine - indent queries can be good if you want to tune indents but the default behavior is fine you're using a formatter as you say. Code navigation and format-on-save are done through the language server so you'll need to configure VLS in order to get those to work. |
* $ cargo xtask docgen * Name it v instead of vlang and add highlights.scm * Setup tabstop and vls
file-types = ["v", "vv"] | ||
shebangs = ["v run"] | ||
roots = ["v.mod"] | ||
language-server = { command = "vls", args = [] } |
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.
One note (not sure what we can do about this though):
There's already the command vls
for vue
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.
Hmm yeah I don't think there's much we can do about it on our end. I guess you can't develop in v and vue at the same time 😄
I think in other editors plugins might solve this if they install the language server binary local to the plugin. I'm not too worried about this though.
ready to merge? |
There's a snag with this that verilog is configured to use the same [[language]]
name = "verilog"
file-types = ["sv", "svh"]
Edit: hmm on second thought I don't think |
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.
Thanks for working on this!
Co-authored-by: pancake <[email protected]> Co-authored-by: Michael Davis <[email protected]>
Co-authored-by: pancake <[email protected]> Co-authored-by: Michael Davis <[email protected]>
Also accepts the ".vsh" extension: On the line of code: Line 1617 in 8dab8a0
|
No description provided.