semantic-highlight.vim icon indicating copy to clipboard operation
semantic-highlight.vim copied to clipboard

julia-vim and syntax region

Open rcnlee opened this issue 9 years ago • 5 comments
trafficstars

Hello,

I am trying to get semantic-highlight to work with julia-vim. See screenshot: screenshot from 2016-06-22 22-12-29

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!

rcnlee avatar Jun 23 '16 06:06 rcnlee

Interesting. So to be clear, n_input on line 39 should be the same color as it is on line 23?

jaxbot avatar Jun 29 '16 06:06 jaxbot

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?

rcnlee avatar Jun 29 '16 06:06 rcnlee

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. image

DeanHougen avatar Feb 19 '17 00:02 DeanHougen

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: immagine

00sapo avatar May 01 '21 06:05 00sapo

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

00sapo avatar May 01 '21 15:05 00sapo