Pluto.jl icon indicating copy to clipboard operation
Pluto.jl copied to clipboard

Syntax highlighting error involving range and macro

Open chunjiw opened this issue 2 years ago • 1 comments

This code

@amacro begin
    x = a : b:c
end

renders like image

I'm using Pluto 0.19.0, Julia 1.7.2

chunjiw avatar Apr 26 '22 22:04 chunjiw

Another minimal example: image

chunjiw avatar Apr 26 '22 22:04 chunjiw

Same thing with a, = (b) syntax:

@time let
	for i in 1:5
		x, = (2)
	end
end

Looks like this, with end keywords not highlighted:

bug

end become correctly highlighted when parentheses in (2) are removed:

@time let
	for i in 1:5
		x, = 2
	end
end

x, = fn(2)

Only the last end keyword will be mis-highlighted when this syntax is used:

@time let
	for i in 1:5
		x, = fn(2)
	end
end

bug2

Without range syntax

Try this code (indentation is important!):

@time let
	for i in [1,2]
	x, = (2)
	end
end

This is highlighted like this:

bug3

Now place the cursor before the innermost end and press Backspace. Pluto will suddenly recognize this weirdly aligned end as belonging to for and highlight it correctly:

bug4

Versions

  • Pluto v0.19.25
  • Julia v1.9.0

ForceBru avatar May 12 '23 22:05 ForceBru