Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0cb8ba1

Browse filesBrowse files
committed
updated configuration setup
1 parent 01856cc commit 0cb8ba1
Copy full SHA for 0cb8ba1

6 files changed

+32-9Lines changed: 32 additions & 9 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎vscode/package.json‎

Copy file name to clipboardExpand all lines: vscode/package.json
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,9 @@
375375
{
376376
"command": "extension.devicescript.openSimulators"
377377
},
378+
{
379+
"command": "extension.devicescript.configure"
380+
},
378381
{
379382
"command": "extension.devicescript.pickDeviceScriptManager"
380383
},
@@ -461,6 +464,12 @@
461464
"title": "Add Board...",
462465
"category": "DeviceScript"
463466
},
467+
{
468+
"command": "extension.devicescript.configure",
469+
"title": "Configure...",
470+
"category": "DeviceScript",
471+
"icon": "$(settings-gear)"
472+
},
464473
{
465474
"command": "extension.devicescript.pickDeviceScriptManager",
466475
"title": "Pick DeviceScript device",
Collapse file

‎vscode/sampleprj/packages/sampleprj/src/cloud.ts‎

Copy file name to clipboardExpand all lines: vscode/sampleprj/packages/sampleprj/src/cloud.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CloudAdapter, Register, Temperature } from "@devicescript/core"
1+
import { CloudAdapter, Temperature } from "@devicescript/core"
22

33
const cloud = new CloudAdapter()
44
const thermo = new Temperature()
Collapse file

‎vscode/src/activateDeviceScript.ts‎

Copy file name to clipboardExpand all lines: vscode/src/activateDeviceScript.ts
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ export function activateDeviceScript(context: vscode.ExtensionContext) {
3636

3737
// build
3838
subscriptions.push(
39+
vscode.commands.registerCommand(
40+
"extension.devicescript.configure",
41+
async () => await extensionState.configure()
42+
),
3943
vscode.commands.registerCommand(
4044
"extension.devicescript.device.identify",
4145
async (item: JDomDeviceTreeItem) => {
Collapse file

‎vscode/src/devtoolsserver.ts‎

Copy file name to clipboardExpand all lines: vscode/src/devtoolsserver.ts
+11-6Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ export class DeveloperToolsManager extends JDEventSource {
296296
if (this._projectFolder) this.kill()
297297
this._projectFolder = folder
298298
this.emit(CHANGE)
299+
await this.saveProjectFolder()
299300
}
300301
}
301302

@@ -314,7 +315,7 @@ export class DeveloperToolsManager extends JDEventSource {
314315
}
315316
}
316317

317-
async pickProject(): Promise<vscode.Uri> {
318+
private async pickProject(): Promise<vscode.Uri> {
318319
// try sorted
319320
const dir = this.extensionState.state.get<string>(PROJECT_FOLDER_KEY)
320321
if (dir) {
@@ -355,7 +356,7 @@ export class DeveloperToolsManager extends JDEventSource {
355356
}
356357
)
357358
const res = await vscode.window.showQuickPick(items, {
358-
title: "Choose a project",
359+
title: "Pick a DeviceScript project",
359360
})
360361
return res?.data
361362
}
@@ -369,10 +370,7 @@ export class DeveloperToolsManager extends JDEventSource {
369370
}
370371

371372
// store current folder
372-
await this.extensionState.state.update(
373-
PROJECT_FOLDER_KEY,
374-
this._projectFolder.fsPath
375-
)
373+
await this.saveProjectFolder()
376374

377375
try {
378376
this.connectionState = ConnectionState.Connecting
@@ -394,6 +392,13 @@ export class DeveloperToolsManager extends JDEventSource {
394392
}
395393
}
396394

395+
private async saveProjectFolder() {
396+
await this.extensionState.state.update(
397+
PROJECT_FOLDER_KEY,
398+
this._projectFolder?.fsPath
399+
)
400+
}
401+
397402
start(): Promise<void> {
398403
return (
399404
this._terminalPromise ||
Collapse file

‎vscode/src/mainstatusbar.ts‎

Copy file name to clipboardExpand all lines: vscode/src/mainstatusbar.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function activateMainStatusBar(
1313
vscode.StatusBarAlignment.Right,
1414
120
1515
)
16-
statusBarItem.command = "extension.devicescript.pickDeviceScriptManager"
16+
statusBarItem.command = "extension.devicescript.configure"
1717
const updateStatusBar = () => {
1818
const service = extensionState.deviceScriptManager
1919
const mgr = service?.device
@@ -41,7 +41,7 @@ export function activateMainStatusBar(
4141
${
4242
mgr
4343
? `Deploy and Debug on device ${mgr.shortId}`
44-
: `Click to pick a DeviceScript device`
44+
: `Click to pick a DeviceScript project`
4545
}
4646
4747
---
Collapse file

‎vscode/src/state.ts‎

Copy file name to clipboardExpand all lines: vscode/src/state.ts
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,11 @@ export class DeviceScriptExtensionState extends JDEventSource {
483483
return res?.data
484484
}
485485

486+
async configure() {
487+
await this.devtools.setProjectFolder(undefined)
488+
await this.devtools.start()
489+
}
490+
486491
async pickDeviceScriptManager(skipUpdate?: boolean): Promise<JDService> {
487492
const { simulatorScriptManagerId } = this
488493
const cid = this.state.get(STATE_CURRENT_DEVICE) as string

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.