Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

HEREDOC syntax issues #485

Closed
Wuerfel21 opened this issue May 22, 2019 · 8 comments
Closed

HEREDOC syntax issues #485

Wuerfel21 opened this issue May 22, 2019 · 8 comments
Labels

Comments

@Wuerfel21
Copy link

Your environment

  • vscode-ruby version: 0.22.3
  • Ruby version: 2.5
  • Ruby version manager (if any):
  • VS Code version: 1.33.1
  • Operating System: Windows 7 64 bit
  • Using language server? not sure

Expected behavior

Correct syntax highlighting of HEREDOCS.

Actual behavior

All text that follows on the same line after a HEREDOC is treated as a string literal. (Issue #183 was already filed about this, but inexplicably got closed). Even worse, when there are multiple HEREDOCS on one line, only the first one's contents are recognized as a string literal.
image

@wingrunr21
Copy link
Collaborator

It inexplicably got closed because of stale issue clean up (which was clearly posted in the issue).

Can you please post what TM Scopes the grammar is matching for the offending syntax? Developer: Inspect TM Scopes tool in the command palette.

@Wuerfel21
Copy link
Author

For what token in particular? (I get a popup that displays a lot of info about the token under the cursor)
I think it'd make more sense for you to paste the code into an editor yourself:

p(<<~'SOMETEXT' , <<~OTHERTEXT, Time.now)
    test1 if unless else "foorbar"
SOMETEXT
    test2 if unless else "foobar"
OTHERTEXT

(GitHub has the same broken highlighting, nice)

@minkir014
Copy link

It maybe a problem with vs code. See this might help you solve the issue.
https://stackoverflow.com/questions/55614584/syntax-highlighting-of-vs-code-broken-with-heredoc

@wingrunr21
Copy link
Collaborator

@Wuerfel21 I think @minkir014 is right. The highlighting is based on older heredoc syntax.

When VSCode lands semantic highlighting support (meaning I can highlight based on the AST and not grammar regexes) this will be fixable. Otherwise, we'll need a fix pushed to the upstream atom/language-ruby grammar and I can pull it in.

@amerov
Copy link

amerov commented Oct 3, 2019

This bug comes from vscode microsoft/vscode#62812

@amerov
Copy link

amerov commented Oct 3, 2019

I played with this tree-sitter extension https://github.com/georgewfraser/vscode-tree-sitter it is ok with heredoc.

@wingrunr21
Copy link
Collaborator

It doesn’t support themes. If you are ok with its static theming the its an option. I also use tree sitter so when VSCode exposes the APIs to support TextMate scopes I can support this the same way

@github-actions
Copy link

github-actions bot commented Aug 8, 2020

This issue has not had activity for 30 days. It will be automatically closed in 7 days.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants