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

Tweak settings #1235

Merged
merged 2 commits into from
Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions R/session/vsc.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ load_settings <- function() {
vsc.object_timeout = session$objectTimeout,
vsc.globalenv = session$watchGlobalEnvironment,
vsc.plot = setting(session$viewers$viewColumn$plot, Disable = FALSE),
vsc.dev.args = c(width = plot$devArgs$width, height = plot$devArgs$height),
Copy link
Member

@renkun-ken renkun-ken Oct 24, 2022

Choose a reason for hiding this comment

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

The option is used as following:

dev_args <- getOption("vsc.dev.args")
do.call(png, c(list(filename = plot_file), dev_args))

Maybe it makes more sense to just keep it as a list and not just limited to width and height.

vsc.browser = setting(session$viewers$viewColumn$browser, Disable = FALSE),
vsc.viewer = setting(session$viewers$viewColumn$viewer, Disable = FALSE),
vsc.page_viewer = setting(session$viewers$viewColumn$pageViewer, Disable = FALSE),
Expand Down
54 changes: 40 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1287,32 +1287,32 @@
"r.rpath.windows": {
"type": "string",
"default": "",
"description": "Path to an R executable for Windows. Must be \"vanilla\" R, not radian etc.!"
"description": "Path to an R executable to launch R background processes (Windows). Must be \"vanilla\" R, not radian etc.!"
},
"r.rpath.mac": {
"type": "string",
"default": "",
"description": "Path to an R executable for macOS. Must be \"vanilla\" R, not radian etc.!"
"description": "Path to an R executable to launch R background processes (macOS). Must be \"vanilla\" R, not radian etc.!"
},
"r.rpath.linux": {
"type": "string",
"default": "",
"description": "Path to an R executable for Linux. Must be \"vanilla\" R, not radian etc.!"
"description": "Path to an R executable to launch R background processes (Linux). Must be \"vanilla\" R, not radian etc.!"
},
"r.rterm.windows": {
"type": "string",
"default": "",
"description": "R path for Windows. Can also be radian etc."
"description": "R path for interactive terminals (Windows). Can also be radian etc."
},
"r.rterm.mac": {
"type": "string",
"default": "",
"description": "R path for macOS. Can also be radian etc."
"description": "R path for interactive terminals (macOS). Can also be radian etc."
},
"r.rterm.linux": {
"type": "string",
"default": "",
"description": "R path for Linux. Can also be radian etc."
"description": "R path for interactive terminals (Linux). Can also be radian etc."
},
"r.rterm.option": {
"type": "array",
Expand Down Expand Up @@ -1397,7 +1397,7 @@
"r.rmarkdown.enableCodeLens": {
"type": "boolean",
"default": true,
"description": "Enable RMarkdown CodeLens, which are inline commands/buttons e.g. 'Run Chunk | Run Above' shown on the first line of each code chunk.\n\n- Click the buttons to run commands.\n- Hover on the buttons to show tooltips.\n- CodeLens commands are customizable via settings UI (Rmarkdown: Code Lens commands) or settings.json `r.rmarkdown.codeLensCommands`"
"markdownDescription": "Enable RMarkdown CodeLens, which are inline commands/buttons e.g. 'Run Chunk | Run Above' shown on the first line of each code chunk.\n\n- Click the buttons to run commands.\n- Hover on the buttons to show tooltips.\n- CodeLens commands are customizable via `#r.rmarkdown.codeLensCommands#` or settings.json `r.rmarkdown.codeLensCommands`"
},
"r.rmarkdown.chunkBackgroundColor": {
"type": "string",
Expand Down Expand Up @@ -1533,7 +1533,7 @@
"r.source.encoding": {
"type": "string",
"default": "UTF-8",
"description": "An optional encoding to pass to R when executing the file, i.e. 'source(FILE, encoding=ENCODING)'."
"markdownDescription": "An optional encoding to pass to R when executing the file, i.e. `source(FILE, encoding=ENCODING)`."
},
"r.source.focus": {
"type": "string",
Expand All @@ -1543,7 +1543,12 @@
"terminal",
"none"
],
"description": "What to show/focus after running code. Set to 'editor' or 'terminal' to show the terminal. Set to 'none' to not show the terminal."
"enumDescriptions": [
"Focus editor when sending code to terminal",
"Focus terminal when sending code to terminal",
"Do not show terminal when sending code to terminal"
],
"description": "What to show/focus after sending code to terminal."
},
"r.alwaysUseActiveTerminal": {
"type": "boolean",
Expand Down Expand Up @@ -1687,7 +1692,7 @@
},
"view": {
"type": "string",
"description": "Which view column to show the WebView triggered by View()? \n\nChanges the option 'vsc.plot' in R.",
"description": "Which view column to show the WebView triggered by View()? \n\nChanges the option 'vsc.view' in R.",
"enum": [
"Two",
"Active",
Expand Down Expand Up @@ -1725,7 +1730,7 @@
"r.rtermSendDelay": {
"type": "integer",
"default": 8,
"description": "Delay in milliseconds before sending each line to rterm (only applies if r.bracketedPaste is false)"
"markdownDescription": "Delay in milliseconds before sending each line to rterm. Requires `#r.bracketedPaste#` to be `false`."
},
"r.workspaceViewer.showObjectSize": {
"type": "boolean",
Expand All @@ -1745,7 +1750,7 @@
"r.liveShare.timeout": {
"type": "integer",
"default": 10000,
"description": "Time in milliseconds before aborting attempt to connect to Live Share API"
"description": "Time in milliseconds before aborting attempt to connect to Live Share API."
},
"r.liveShare.defaults.commandForward": {
"type": "boolean",
Expand All @@ -1762,6 +1767,27 @@
"default": false,
"description": "Default boolean value for automatically sharing R browser ports with guests."
},
"r.plot.devArgs" :{
"type": "object",
"markdownDescription": "The arguments for the png device to replay user graphics to show in VSCode. Requires `#r.plot.useHttpgd#` to be set to `false`. \n\nChanges the option `vsc.dev.args` in R.",
"default": {
"width": 800,
ElianHugh marked this conversation as resolved.
Show resolved Hide resolved
"height": 1200
},
"properties": {
"width": {
"type": "number",
"description": "Width of the graphic device.",
"default": 800
},
"height": {
"type": "number",
"description": "Height of the graphic device.",
"default": 1200
}
},
"additionalProperties": false
Copy link
Member

Choose a reason for hiding this comment

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

Maybe more arguments could be allowed here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, seeing how it leads to a call to png, that's a good point. If we remove the restriction, the settings UI will fallback to the "edit in JSON" dialog. I'm not sure if that's ideal? I think there's an argument to be made that if dots is required, people can use the R option. Alternatively, we could have '...' dots as an item for passing further args

Copy link
Member

Choose a reason for hiding this comment

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

I think this one is good enough. Let's revisit if somebody complains.

},
"r.plot.useHttpgd": {
"type": "boolean",
"default": false,
Expand All @@ -1778,7 +1804,7 @@
"Match background and primary stroke color to the current color theme (Or apply custom CSS overwrites, if specified in `#r.plot.customStyleOverwrites#`)",
"Use original colors"
],
"markdownDescription": "Which color theme to use when launching the plot viewer."
"markdownDescription": "Which color theme to use when launching the httpgd plot viewer."
},
"r.plot.defaults.plotPreviewLayout": {
"type": "string",
Expand All @@ -1798,7 +1824,7 @@
"r.plot.defaults.fullWindowMode": {
"type": "boolean",
"default": false,
"markdownDescription": "Whether to use full window mode when launching the plot viewer."
"markdownDescription": "Whether to use full window mode when launching the httpgd plot viewer."
},
"r.plot.timing.resizeInterval": {
"type": "number",
Expand Down