Skip to content

Commit be85208

Browse files
eirikhmchristianalfoni
authored andcommitted
feat(overmind): use VS Code cache, remove old script file
1 parent bf14045 commit be85208

File tree

2 files changed

+36
-38
lines changed

2 files changed

+36
-38
lines changed

packages/node_modules/overmind-devtools-vscode/src/DevtoolsPanel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export class DevtoolsPanel {
88
public static viewType = 'overmindDevtools'
99

1010
// keeps track of location for overmind-devetools js bundle
11-
public static scriptFile: any = null
11+
// public static scriptFile: any = null
1212

1313
private readonly _panel: vscode.WebviewPanel
1414

packages/node_modules/overmind-devtools-vscode/src/extension.ts

Lines changed: 35 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,52 @@
11
import * as vscode from 'vscode'
22
import { DevtoolsPanel } from './DevtoolsPanel'
33
import * as path from 'path'
4-
54
import { log } from './utils/Logger'
65

7-
class TempStorage {
8-
private storage: any = {}
9-
public get(key: string): Promise<any> {
10-
return new Promise((resolve, reject) => {
11-
resolve(this.storage[key] || undefined)
12-
})
13-
}
6+
// this method is called when your extension is activated
7+
// your extension is activated the very first time the command is executed
8+
export function activate(context: vscode.ExtensionContext) {
9+
const storage = {
10+
get(key:string){
11+
return new Promise((resolve) => {
12+
resolve(context.workspaceState.get(key))
13+
})
14+
},
1415

15-
public set(key: string, value: any) {
16-
return new Promise((resolve, reject) => {
17-
this.storage[key] = value
18-
resolve()
19-
})
20-
}
16+
set (key:string, value: any)
17+
{
18+
return new Promise((resolve) => {
19+
context.workspaceState.update(key, value)
20+
resolve()
21+
})
22+
},
2123

22-
public clear() {
23-
return new Promise((resolve, reject) => {
24-
this.storage = {}
25-
resolve()
26-
})
24+
clear()
25+
{
26+
return new Promise((resolve) => {
27+
resolve()
28+
})
29+
}
2730
}
28-
}
2931

30-
const storage = new TempStorage()
32+
const DevtoolBackend = require('overmind-devtools-client/DevtoolBackend')
33+
DevtoolBackend.create({
34+
port: 3031,
35+
onRelaunch() {
36+
console.log('relaunch')
37+
},
38+
storage,
39+
})
3140

32-
const DevtoolBackend = require('overmind-devtools-client/DevtoolBackend')
33-
DevtoolBackend.create({
34-
port: 3031,
35-
onRelaunch() {
36-
console.log('relaunch')
37-
},
38-
storage,
39-
})
4041

41-
// this method is called when your extension is activated
42-
// your extension is activated the very first time the command is executed
43-
export function activate(context: vscode.ExtensionContext) {
4442
context.subscriptions.push(
4543
vscode.commands.registerCommand('overmind-devtools.start', () => {
46-
const onDiskPath = vscode.Uri.file(
47-
path.join(context.extensionPath, 'devtoolsDist', 'bundle.js')
48-
)
49-
const scriptFile = onDiskPath.with({ scheme: 'vscode-resource' })
44+
// const onDiskPath = vscode.Uri.file(
45+
// path.join(context.extensionPath, '../overmind-devtools-client/dist/', 'bundle.js')
46+
// )
47+
// const scriptFile = onDiskPath.with({ scheme: 'vscode-resource' })
5048

51-
DevtoolsPanel.scriptFile = scriptFile
49+
// DevtoolsPanel.scriptFile = scriptFile
5250
DevtoolsPanel.createOrShow(context.extensionPath) // refactor to keep local reference to panel
5351
})
5452
)

0 commit comments

Comments
 (0)