Sublime Forum

Herodoc text format is broken

#1

Herodoc text format is completely broken in sublime text (Ruby).

On build version 3126 after I use this format, the whole code below is highlighted like it is a part of the string.

This behavior ruin the whole experience of using the Sublime Text on the projects where Herodoc format is used.

On build version 3114 was working slightly better, but still not fully correct. First text variable was highlighted correctly, but rest of them not. But at least it was not ruining the highlight for the rest of my code.

0 Likes

#2
0 Likes

#3

Hi, thank you for the link, but there is a little bit different situation described.
I’m not asking to fix the text formatting INSIDE the herodoc formatted block. My main problem is that the whole page of text AFTER this block is highlited like a string.

The best resolution would be to return the old behavior, like on image below.

It is much better to have no code highlighting for herodoc block, then ruin the code highlighting for the whole file after the metod call. Is that possible?

0 Likes

#4

hey, anybody? please, the problem is really critical for the projects that have to use herodoc format.
If herodoc parsing can’t be fixed that is fine, just remove the highlighting for the herodoc format entirely. Otherwice the ST is just not usable any more.

0 Likes

#5

I’ve done a bit of testing in build 3126, and can see the following:

  • using the same HEREDOC name works fine
  • using different HEREDOC names on the same line causes ST to need them to be closed in the FILO order, as described in the issue I linked to earlier, as opposed to the correct FIFO order needed by Ruby.

so you can change your

func(<<-var1, <<-var2, <<-var3)
    some text 1
var1
    some text 2
var2
    some text 3
var3

to

func(<<-var, <<-var, <<-var)
    some text 1
var
    some text 2
var
    some text 3
var

to workaround the problem.

0 Likes

#6

Thank you for the reply. Will keep it mind. Unfortunately I cannot use this workaround either, since method variables have to be named differently. Otherwice “some text 1”, “some text 2” … might be misplaced, and it is also makes the code harder to read.

For now I just created a patch for Ruby.sublime-syntax that is disabling the heredoc syntax entirely for my ST installation.

1 Like

#7

I have found the PR that introduce this regression. As a new user I can’t leave a link here…

It is a commit 1dbd6455e3e16909cee04c49050a3366a1e1e6b9
for Ruby.sublime-syntax file

[Ruby] Support code on same line as heredoc begin token
@wbond committed on Jun 8

Is it possible to ask @wbond to take a look?

1 Like

#8

Posting an issue at https://github.com/sublimehq/Packages/issues is the best way to make sure this gets looked at. Trying to keep track of todos on this forum doesn’t really work very well.

2 Likes