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

Add backtick to list of quote characters for syntax highlighting. #859

Merged
merged 2 commits into from Nov 7, 2021
Merged

Conversation

jan-imbi
Copy link
Contributor

@jan-imbi jan-imbi commented Nov 7, 2021

What problem did you solve?

Backticks are a legal way to quote strings in R. Added backticks to list of quote characters for syntax highlighting.

Screenshot

Before:
before
After:
after

Copy link
Member

@renkun-ken renkun-ken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works nicely! LGTM.

Thanks!

@ManuelHentschel
Copy link
Member

If I'm not mistaken, backticks don't delimit strings but rather non-standard variable names. So maybe this should be highlighted as some kind of variable name (e.g. "general-variables") instead?

@jan-imbi
Copy link
Contributor Author

jan-imbi commented Nov 7, 2021

If I'm not mistaken, backticks don't delimit strings but rather non-standard variable names. So maybe this should be highlighted as some kind of variable name (e.g. "general-variables") instead?

I think you are correct, from the documentation of ?Quotes:

## Backticks are used for non-standard variable names.
## (See make.names and ?Reserved for what counts as
## non-standard.)

I think the following should work:

  {
      "begin": "`",
      "beginCaptures": {
          "0": {
              "name": "punctuation.definition.string.begin.r"
          }
      },
      "end": "`",
      "endCaptures": {
          "0": {
              "name": "punctuation.definition.string.end.r"
          }
      },
      "name": "variable.parameter.r",
      "patterns": [
          {
              "match": "\\\\.",
              "name": "variable.parameter.r"
          }
      ]
  }

@renkun-ken
Copy link
Member

Yes, it should be "general-variables". The last commit looks good now.

Copy link
Member

@ManuelHentschel ManuelHentschel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@renkun-ken renkun-ken merged commit f99fdd7 into REditorSupport:master Nov 7, 2021
ElianHugh pushed a commit to ElianHugh/vscode-R that referenced this pull request May 12, 2022
…ditorSupport#859)

* Add backtick to list of quote characters for syntax highlighting.

* backticks denote nonstandard variable names and should therefore be coloured like variables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants