Skip to content

Commit

Permalink
Merge pull request #1479 from posit-dev/more-r-language-config
Browse files Browse the repository at this point in the history
Add more R language config
  • Loading branch information
juliasilge authored Oct 4, 2023
2 parents 1bce527 + ffb5ec4 commit cfc347f
Show file tree
Hide file tree
Showing 3 changed files with 170 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"],
["`", "`"],
["$", "$"]
],
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
"autoClosingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"],
["`", "`"]
],
"comments": {
"lineComment": "#"
}
}
29 changes: 29 additions & 0 deletions extensions/positron-r/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@
"R",
"r"
],
"filenames": [
"NAMESPACE"
],
"configuration": "./language-configuration/r-language-configuration.json"
},
{
Expand All @@ -200,6 +203,27 @@
".lintr"
],
"configuration": "./language-configuration/dcf-language-configuration.json"
},
{
"id": "r-pkg-docs",
"aliases": [
"R documentation",
"r documentation"
],
"extensions": [
".rd",
".Rd"
],
"configuration": "./language-configuration/r-docs-language-configuration.json"
},
{
"id": "json",
"aliases": [
"renv lockfile"
],
"filenames": [
"renv.lock"
]
}
],
"grammars": [
Expand All @@ -215,6 +239,11 @@
"embeddedLanguages": {
"meta.embedded.block.r": "r"
}
},
{
"language": "r-pkg-docs",
"scopeName": "source.rdocs",
"path": "./syntaxes/rd.tmLanguage.json"
}
],
"keybindings": [
Expand Down
114 changes: 114 additions & 0 deletions extensions/positron-r/syntaxes/rd.tmLanguage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
{
"scopeName": "source.rdocs",
"fileTypes": [
"rd",
"Rd"
],
"patterns": [
{
"begin": "((\\\\)(?:alias|docType|keyword|name|title|description|value|note|concept|keyword|details|format|references|source|arguments|seealso|author))(\\{)",
"beginCaptures": {
"1": {
"name": "keyword.other.section.rd"
},
"2": {
"name": "punctuation.definition.function.rd"
},
"3": {
"name": "punctuation.definition.arguments.begin.rd"
}
},
"contentName": "entity.name.tag.rd",
"end": "(\\})",
"endCaptures": {
"1": {
"name": "punctuation.definition.arguments.end.rd"
}
},
"name": "meta.section.rd",
"patterns": [
{
"include": "$self"
}
]
},
{
"begin": "((\\\\)(?:usage))(\\{)(?:\\n)?",
"beginCaptures": {
"1": {
"name": "keyword.other.usage.rd"
},
"2": {
"name": "punctuation.definition.function.rd"
},
"3": {
"name": "punctuation.definition.arguments.begin.rd"
}
},
"contentName": "source.r.embedded",
"end": "(\\})",
"endCaptures": {
"1": {
"name": "punctuation.definition.arguments.end.rd"
}
},
"name": "meta.usage.rd",
"patterns": [
{
"include": "source.r"
}
]
},
{
"begin": "((\\\\)(?:examples))(\\{)(?:\\n)?",
"beginCaptures": {
"1": {
"name": "keyword.other.examples.rd"
},
"2": {
"name": "punctuation.definition.function.rd"
},
"3": {
"name": "punctuation.definition.arguments.begin.rd"
}
},
"contentName": "source.r.embedded",
"end": "(^\\}$)",
"endCaptures": {
"1": {
"name": "punctuation.definition.arguments.end.rd"
}
},
"name": "meta.examples.rd",
"patterns": [
{
"include": "source.r"
}
]
},
{
"begin": "((\\\\)(?:author))(\\{)(?:\\n)?",
"beginCaptures": {
"1": {
"name": "keyword.other.author.rd"
},
"2": {
"name": "punctuation.definition.function.rd"
},
"3": {
"name": "punctuation.definition.arguments.begin.rd"
}
},
"end": "(\\})",
"endCaptures": {
"1": {
"name": "punctuation.definition.arguments.end.rd"
}
},
"name": "meta.author.rd"
},
{
"include": "text.tex.latex"
}
]
}

0 comments on commit cfc347f

Please sign in to comment.