Skip to content

Commit

Permalink
chore: rename appMode and openAction for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
gadenbuie committed Apr 29, 2024
1 parent 3122ba4 commit 3c33b5e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
"default": true,
"markdownDescription": "Enable dev mode when running a Shiny for R app by running `shiny::devmode()` before launching the app."
},
"shiny.shinylive.mode": {
"shiny.shinylive.appMode": {
"type": "string",
"default": "ask",
"description": "Which Shinylive mode to use when creating a Shinylive app.",
Expand All @@ -169,7 +169,7 @@
"Editor mode displays the app alongside an editor and console."
]
},
"shiny.shinylive.action": {
"shiny.shinylive.openAction": {
"type": "string",
"default": "ask",
"description": "Choose the default action upon creating a Shinylive link.",
Expand Down
11 changes: 6 additions & 5 deletions src/shinylive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ async function createAndOpenShinyliveApp(
files: ShinyliveFile[],
language: ShinyliveLanguage = "py"
): Promise<string> {
const mode = await askUserForMode();
const mode = await askUserForAppMode();
const url = shinyliveUrlEncode({
language,
files,
Expand Down Expand Up @@ -300,7 +300,7 @@ async function askUserForOpenAction(): Promise<UserOpenAction> {
const prefAction =
vscode.workspace
.getConfiguration("shiny.shinylive")
.get<string>("action") || "ask";
.get<string>("openAction") || "ask";

if (["open", "copy"].includes(prefAction)) {
return prefAction as UserOpenAction;
Expand All @@ -320,11 +320,12 @@ async function askUserForOpenAction(): Promise<UserOpenAction> {
* @async
* @returns {Promise<ShinyliveMode>} One of `"app"` or `"editor"`.
*/
async function askUserForMode(): Promise<ShinyliveMode> {
async function askUserForAppMode(): Promise<ShinyliveMode> {
// first check if the user has set a default mode
const prefMode =
vscode.workspace.getConfiguration("shiny.shinylive").get<string>("mode") ||
"ask";
vscode.workspace
.getConfiguration("shiny.shinylive")
.get<string>("appMode") || "ask";

if (["app", "editor"].includes(prefMode)) {
return prefMode as ShinyliveMode;
Expand Down

0 comments on commit 3c33b5e

Please sign in to comment.