FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Heredoc after comment not highlighted · Issue #422 · vim-ruby/vim-ruby · GitHub

Repository navigation

Heredoc after comment not highlighted #422

Description

A heredoc following a comment that ends with a full-stop . is not highlighted properly.

    let(:source) do
      # Empty lines should make no difference.
      <<~RUBY
        if #{condition}
          #{body}

        end
      RUBY
    end

Removing the full-stop . at the end of the comment allows the heredoc to be highlighted as expected:

Unfortunately, I can't think of a way to fix this in a well-performing manner as I think it would require look-behind assertions to check if the preceding dot is part of a comment.

Activity

  1. AndrewRadev commented on Aug 3, 2020

    Member

    Damn, that's a good catch. Unfortunately, I have no idea how to fix it.

    To provide an explanation for the next reader, the problem is that we already do negative lookbehind to figure out if this is really a heredoc. Here's one example of something that is not a heredoc:

    FOO = "bar"
    result = [].<<FOO

    And so we have a regex that checks that we don't have . (among other things) before the heredoc. Unfortunately, I don't know of any way to avoid this for comments. Maybe Doug Kearns will think of something, but I think this will likely have to be left as an open isssue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL