{"action":"created","issue":{"url":"https://api.github.com/repos/vim-perl/vim-perl/issues/255","repository_url":"https://api.github.com/repos/vim-perl/vim-perl","labels_url":"https://api.github.com/repos/vim-perl/vim-perl/issues/255/labels{/name}","comments_url":"https://api.github.com/repos/vim-perl/vim-perl/issues/255/comments","events_url":"https://api.github.com/repos/vim-perl/vim-perl/issues/255/events","html_url":"https://github.com/vim-perl/vim-perl/pull/255","id":305386246,"number":255,"title":"Add support for indented heredocs in perl","user":{"login":"roflcopter4","id":15476346,"avatar_url":"https://avatars2.githubusercontent.com/u/15476346?v=4","gravatar_id":"","url":"https://api.github.com/users/roflcopter4","html_url":"https://github.com/roflcopter4","followers_url":"https://api.github.com/users/roflcopter4/followers","following_url":"https://api.github.com/users/roflcopter4/following{/other_user}","gists_url":"https://api.github.com/users/roflcopter4/gists{/gist_id}","starred_url":"https://api.github.com/users/roflcopter4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roflcopter4/subscriptions","organizations_url":"https://api.github.com/users/roflcopter4/orgs","repos_url":"https://api.github.com/users/roflcopter4/repos","events_url":"https://api.github.com/users/roflcopter4/events{/privacy}","received_events_url":"https://api.github.com/users/roflcopter4/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-03-15T01:39:57Z","updated_at":"2018-03-16T08:30:04Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/vim-perl/vim-perl/pulls/255","html_url":"https://github.com/vim-perl/vim-perl/pull/255","diff_url":"https://github.com/vim-perl/vim-perl/pull/255.diff","patch_url":"https://github.com/vim-perl/vim-perl/pull/255.patch"},"body":"Perl v5.26 added support for indented heredocs with the new operator '<<~', as in:\r\n```\r\nif ( something ) {\r\n    my $foo = <<~ 'BAR';\r\n    blah blah blah\r\n    this $variable won't be syntax highlighted\r\n    BAR\r\n    if ( something further ) {\r\n        my $baz = <<~ \"QUX\";\r\n        but $this one will\r\n        QUX\r\n    }\r\n}\r\n```\r\nAt present vim syntax highlighting doesn't support this. In fact it gets rather confused. I tried to fix this in the simplest way possible, which was to allow the heredoc syntax highlighting to recognize either '<<' or '<<~' as valid operators, and to no longer require the end of document symbol to be at the start of the line. This seems to have worked. All the prove tests passed, and everything seems ok in a few canned scripts I wrote to test it out.\r\nThe only notable problem is that (Neo)Vim doesn't immediately switch the highlighting from 'string only' to an interpolated string (with variables highlighted) if the heredoc is suddenly changed from single to double quote, and vice versa. It does figure it out after a few moments though, and seems to have no problem normally - only when the type is changed after the fact."},"comment":{"url":"https://api.github.com/repos/vim-perl/vim-perl/issues/comments/373639920","html_url":"https://github.com/vim-perl/vim-perl/pull/255#issuecomment-373639920","issue_url":"https://api.github.com/repos/vim-perl/vim-perl/issues/255","id":373639920,"user":{"login":"roflcopter4","id":15476346,"avatar_url":"https://avatars2.githubusercontent.com/u/15476346?v=4","gravatar_id":"","url":"https://api.github.com/users/roflcopter4","html_url":"https://github.com/roflcopter4","followers_url":"https://api.github.com/users/roflcopter4/followers","following_url":"https://api.github.com/users/roflcopter4/following{/other_user}","gists_url":"https://api.github.com/users/roflcopter4/gists{/gist_id}","starred_url":"https://api.github.com/users/roflcopter4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roflcopter4/subscriptions","organizations_url":"https://api.github.com/users/roflcopter4/orgs","repos_url":"https://api.github.com/users/roflcopter4/repos","events_url":"https://api.github.com/users/roflcopter4/events{/privacy}","received_events_url":"https://api.github.com/users/roflcopter4/received_events","type":"User","site_admin":false},"created_at":"2018-03-16T08:30:04Z","updated_at":"2018-03-16T08:30:04Z","author_association":"NONE","body":"I tried that piece of code in Neovim and it worked fine on my system. I was initially confused but I have (I think) figured out the problem. I didn't actually think this somewhat crude hack would be accepted, so I added a file to my after/syntax directory that contained a slightly modified form of this code. The version I uploaded definitely doesn't work - after removing that file it fails for me too.\r\n\r\nThe way I have it done in that file is about the crudest way possible. I copied the whole thing, added in the syntax for the indented heredoc, called it \"region perlHereDoc2\", and added the appropriate highlight link. Doing it this way does actually work. Defining the two forms as two totally different syntactic elements allows them both to be possible and unambiguous due to the different operator.\r\n\r\nNow that I think about it, I'm not sure how you would get around that in just one go. I actually uploaded the code in this form, but duplicating it like that is pretty ugly."}}
{"actor":{"display_login":"roflcopter4"}}