semantic-highlight.vim
semantic-highlight.vim copied to clipboard
julia-vim and syntax region
Hello,
I am trying to get semantic-highlight to work with julia-vim. See screenshot:

julia-vim parses code blocks, i.e., code inside () or [] or inside a function as regions, and this seems to throw off semantic-highlight in that variables inside don't get individually highlighted. Is there a good way to handle this?
Thanks!
Interesting. So to be clear, n_input on line 39 should be the same color as it is on line 23?
Hi @jaxbot, that's correct. It seems that anything quoted in brackets doesn't seem to be parsed correctly. (other examples are DT_FLOAT32 on line 27, n_classes on line 46, etc.) I've traced this down to the parsing not permeating into syntax regions, so I believe the behavior is not unique to interaction with julia-vim. Any thoughts?
I get the same type of problem with vim 7.3 under MacOS. It works great until we get inside parentheses, then it gives up trying to highlight.

Same problem with neovim 0.4. Even macros at the beginning to the line breaks SemanticHighlight for the whole remaining document (e.g. macro applied to functions)
Test file:
# trying a simple function
function mytestfn(arg1, arg2, arg3)
# do something
println("I'm inside `mytestfn`")
hello = 1
cat = 2
return minimum(hello, cat)
end
mytestfn(4, 5, 6)
hello = 2
mytest = 4
# trying a macro at the beginning
@views function macro_mytestfn(arg1, arg2, arg3)
# do something
println("I'm inside `macro_mytestfn`")
hello = 1
cat = 2
return minimum(hello, cat)
end
macro_mytestfn(4, 5, 6)
result:

An ugly workaround is to set the syntax file to python or something similar:
autocmd BufEnter *.jl :set syntax=python
By the way, I think the problem is in julia-vim and not in semantic highlight since the latter works on almost any language