You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure if I should post it here, but the tree-sitter build-in neovim doesn't support rescript. It's a great improvement for color highlight and other plugins features ( I think about blankline or telescope preview for example).
With the recent release of nvim 0.5, it's now a must have.
Posting it here, as vs code took the opposite way to deprecied tree-sitter so it primaly focus neovim. Also, the current highlight syntax have some issue, it can fixed it at least for neovim, in what it seems to be an easier way than through LSP.
I will probably not have time to take care of it, but I post it here for the record anymway.
Reacted by Matheus Ashton Silva, Tamim Arafat, Shukhrat Mukimov and weakish
Reacted by Mathieu H, Bruno Santos and Matheus Ashton Silva
Awesome ! You rock, that's a good start :) First look, one thing is missing is function definition and call. But definitely cool !
Did you submit it to the official nvim tresitter ?
Did you submit it to the official nvim tresitter ?
No. I wanted to give it some trial among rescripters because I suspect it’s incomplete yet and it would be harder to manage within 3-rd party repo (or how things done, I don’t know).
I’m not sure how practical it is for FP-like language:
Array.map(myFunc) // Tree-sitter have no idea that myFunc is a function, so will not highlight
Array.map(myFunc(_)) // The same thing, but will highlight
// ... so the same thing highlights differently
// Another case
let fn1 = (x, y) => { blabla } // Will highlight fn1
let fn2 = someHighOrderFunc(fn1) // Will not highlight fn1
// Another case
let myHof = (fn) => {
let x = fn(1, 2, 3) // Should fn be highlighted as @parameter.reference or @function?
// ...
}
I haven’t found yet a description or discussion on this topic. Things are clear for languages like C where functions live in another land, but not so clear for FP. Need to take a look at parsers for similar langs.
Also, I dunno how things work, but :Telescope treesitter don't show anything. Just to let you know
Another reason for me to finally try Telescope. Thank you!
Array.map(myFunc) // Tree-sitter have no idea that myFunc is a function, so will not highlight
Array.map(myFunc(_)) // The same thing, but will highlight
// ... so the same thing highlights differently
The second is a function call, so it make sense to me that this one is highlight. The first one is a variable, so.. also make sense to me that it's not highlight.
// Another case
let myHof = (fn) => {
let x = fn(1, 2, 3) // Should fn be highlighted as @parameter.reference or @function?
// ...
}
Good catch.. I think like @parameter.reference make more sense.. I guess ? but that's just my opinion..
To be honest, I was only considering:
let f1 = (x) => x
let a = 2
a->f1 (f1 should be highlight)
So I guess we need to think more about it..
Definitely something we should talk about, it's not as obvious as I though.
Activity
nkrkv commentedon Aug 25, 2021
Here’s my take https://github.com/nkrkv/nvim-treesitter-rescript
kinooyume commentedon Aug 25, 2021
Awesome ! You rock, that's a good start :) First look, one thing is missing is function definition and call. But definitely cool !
Did you submit it to the official nvim tresitter ?
nkrkv commentedon Aug 25, 2021
Thank you!
🤔 they are here:
Or do you mean their highlighting queries?
No. I wanted to give it some trial among rescripters because I suspect it’s incomplete yet and it would be harder to manage within 3-rd party repo (or how things done, I don’t know).
kinooyume commentedon Aug 25, 2021
I mean their highlight yeap
kinooyume commentedon Aug 25, 2021
Also, I dunno how things work, but
:Telescope treesitterdon't show anything. Just to let you knownkrkv commentedon Aug 25, 2021
I’m not sure how practical it is for FP-like language:
I haven’t found yet a description or discussion on this topic. Things are clear for languages like C where functions live in another land, but not so clear for FP. Need to take a look at parsers for similar langs.
Another reason for me to finally try Telescope. Thank you!
kinooyume commentedon Aug 25, 2021
The second is a function call, so it make sense to me that this one is highlight. The first one is a variable, so.. also make sense to me that it's not highlight.
Good catch.. I think like @parameter.reference make more sense.. I guess ? but that's just my opinion..
To be honest, I was only considering:
So I guess we need to think more about it..
Definitely something we should talk about, it's not as obvious as I though.
Maybe have a look at the ocaml way ?
code: https://github.com/tree-sitter/tree-sitter-ocaml/blob/master/queries/highlights.scm
example: https://github.com/tree-sitter/tree-sitter-ocaml/blob/master/test/highlight/functions.ml