Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

heredoc indentation/highlighting #15

Open
amba opened this issue Sep 17, 2017 · 8 comments
Open

heredoc indentation/highlighting #15

amba opened this issue Sep 17, 2017 · 8 comments
Labels
Font-lock Issues involving syntax highlighting and coloring indentation Issues involving indentation

Comments

@amba
Copy link

amba commented Sep 17, 2017

If I write the following (from Moritz Lentz's book)

        my $sth = self!db.prepare(qq:to/SELECT/);
        SELECT exitcode, timed_out, output
                                        FROM $table
                                        WHERE jobname = ?
                                        ORDER BY executed DESC
                                        LIMIT $count
                                        SELECT

perl6-mode does not recognize the here-doc and seams to indent and highlight its contents as perl6 code.

@tbrowder
Copy link
Member

tbrowder commented Sep 17, 2017

see issue #4, basically same problem: improper indentation (and I wish I knew how to fix it!)

@matiaslina matiaslina added indentation Issues involving indentation Font-lock Issues involving syntax highlighting and coloring labels May 2, 2020
@tbrowder
Copy link
Member

tbrowder commented Jan 5, 2021

This is really an irritating bug. I use heredocs a LOT and often find myself giving up and using vim to fix them!

@tbrowder tbrowder closed this as completed Jan 5, 2021
@tbrowder tbrowder reopened this Jan 5, 2021
@tbrowder
Copy link
Member

tbrowder commented Jan 5, 2021

Reopened after accidentally closing the issue.

@tbrowder tbrowder closed this as completed Jan 5, 2021
@tbrowder tbrowder reopened this Jan 5, 2021
@tbrowder
Copy link
Member

tbrowder commented Jan 5, 2021

I'm getting blurry vision. Sorry.

@MARTIMM
Copy link

MARTIMM commented Nov 26, 2021

A bit golfed down which works for me but with an error

Potential difficulties:
    Asked to remove 32 spaces, but the shortest indent is 0 spaces
    at /home/marcel/Languages/Raku/Projects/question-answer/x.raku:12
    ------>                                 SELECT⏏<EOL>
use v6;

my Str $table = 'my-table';
my Int $count = 10;

my Str $x = qq:to/SELECT/;
SELECT exitcode, timed_out, output
                                FROM $table
                                WHERE jobname = ?
                                ORDER BY executed DESC
                                LIMIT $count
                                SELECT

note $x;

@tbrowder
Copy link
Member

If there is a blank line before the SELECT (I can't see clearly), try removing it.

@MARTIMM
Copy link

MARTIMM commented Nov 27, 2021

There is no blank line before any of the two SELECTs. The error is thrown because the last SELECT is 32 characters indented while the leftmost word is at char column 0. To get it right, the last SELECT should also be at col 0.

@Digicrat
Copy link

Digicrat commented Mar 3, 2022

Any progress on this?

The issue seems to be that heredoc/qq quotes are effectively unsupported with any unmatched quotation or bracket (escaped or not) inside getting interpreted by raku-mode as raku code and not part of the quoted string.

I'm working on a raku script that autogenerates C code, and I've had to disable raku-mode entirely instead of fighting the auto-correction and incorrect highlighting. ie the following will throw off both the indentation and paren-matching:

my Str $rtv = qq:to/END/;
  \} else \{
       // do something
   \}
END

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Font-lock Issues involving syntax highlighting and coloring indentation Issues involving indentation
Projects
None yet
Development

No branches or pull requests

5 participants