vscode-R icon indicating copy to clipboard operation
vscode-R copied to clipboard

Update source of R grammar

Open andycraig opened this issue 5 years ago • 7 comments

@Ikuyadeu @randy3k In the R grammar file https://github.com/Ikuyadeu/vscode-R/blob/master/syntax/r.json it says, "This file has been converted from https://github.com/randy3k/R-Box/blob/master/syntax/R%20Extended.sublime-syntax If you want to provide a fix or improvement, please create a pull request against the original repository. Once accepted there, we are happy to receive an update request".

https://github.com/randy3k/R-Box is deprecated in favour of https://github.com/REditorSupport/sublime-ide-r but as far as I can tell that doesn’t contain an R grammar file. Is this the new source of the R grammar? https://github.com/REditorSupport/atom-language-r/blob/master/grammars/r.cson

andycraig avatar Feb 11 '20 01:02 andycraig

The R syntax of R-Box/R-IDE has been merged into Sublime Text official repo.

This is my newest PR to the repo: https://github.com/sublimehq/Packages/pull/2250 It is still pending to be merged though.

randy3k avatar Feb 11 '20 01:02 randy3k

@randy3k Thank you!

I will update the URL in the grammar file.

andycraig avatar Feb 11 '20 01:02 andycraig

Can we solve the grammar inconsistencies such as #144 and something like ns$.__NAMESPACE__.$lazydata where __NAMESPACE__ is falsely considered incorrect?

renkun-ken avatar Feb 11 '20 01:02 renkun-ken

Hmm, it looks like sublime-syntax is more expressive than TextMate grammar so it may not be possible to automatically convert between them anymore.

@renkun-ken #144 is what I was thinking of. I’m pretty sure I know how to fix it and I’m wondering where the fix should go.

andycraig avatar Feb 11 '20 05:02 andycraig

I don’t think sublime-syntax can be automatically converted to a TextMate grammar, and it unfortunately doesn’t sound like there is any movement towards supporting sublime-syntax in VSCode: https://github.com/microsoft/vscode/issues/5408

I propose that we remove the link in https://github.com/Ikuyadeu/vscode-R/blob/master/syntax/r.json and modify it directly when we want to change the highlighting.

If anyone has a better approach please suggest it! If not, I’ll do a PR for this in a week or so.

andycraig avatar Feb 22 '20 01:02 andycraig

This looks related to #120, btw.

hongooi73 avatar May 20 '20 08:05 hongooi73

here's my VSCode extension to help with authoring TextMate grammars https://marketplace.visualstudio.com/items?itemName=RedCMD.tmlanguage-syntax-highlighter

RedCMD avatar Aug 17 '25 09:08 RedCMD