Skip to content

Commit ebb7109

Browse files
committed
fixup: clean everything up
1 parent 94e0d7d commit ebb7109

File tree

4 files changed

+16
-30
lines changed

4 files changed

+16
-30
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"views": {
4646
"coder": [
4747
{
48-
"id": "nodeDependencies",
48+
"id": "coderRemote",
4949
"name": "Workspaces",
5050
"icon": "media/logo.svg",
5151
"contextualTitle": "Coder Remote",
@@ -55,12 +55,12 @@
5555
},
5656
"viewsWelcome": [
5757
{
58-
"view": "nodeDependencies",
58+
"view": "coderRemote",
5959
"contents": "Coder is a platform that provisions remote development environments. \n[Login](command:coder.login)",
6060
"when": "!coder.authenticated && coder.loaded"
6161
},
6262
{
63-
"view": "nodeDependencies",
63+
"view": "coderRemote",
6464
"contents": "You're logged in! \n[Open Workspace](command:coder.open)",
6565
"when": "coder.authenticated && coder.loaded"
6666
}

src/commands.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import axios from "axios"
22
import { getUser, getWorkspaces } from "coder/site/src/api/api"
33
import { Workspace } from "coder/site/src/api/typesGenerated"
44
import * as vscode from "vscode"
5-
import { OutlineProvider } from "./outline"
5+
import { OutlineProvider } from "./workspaces"
66
import { Remote } from "./remote"
77
import { Storage } from "./storage"
88

@@ -173,10 +173,6 @@ export class Commands {
173173
} else {
174174
selected = opened[0]
175175
}
176-
// TODO figure out why we'e getting
177-
// Failed to parse remote port from server output
178-
// [16:01:51.489] Resolver error: Error:
179-
console.log("here are the values", remoteAuthority, selected.folderUri.path)
180176

181177
await vscode.commands.executeCommand(
182178
"vscode.openFolder",

src/extension.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ import { getUser } from "coder/site/src/api/api"
44
import * as module from "module"
55
import * as vscode from "vscode"
66
import { Commands } from "./commands"
7-
import { OutlineProvider } from "./outline"
87
import { Remote } from "./remote"
98
import { Storage } from "./storage"
9+
import { WorkspacesProvider } from "./workspaces"
1010

1111
export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
1212
const output = vscode.window.createOutputChannel("Coder")
13-
const nodeDependenciesProvider = new OutlineProvider([], ctx)
13+
const workspacesProvider = new WorkspacesProvider()
1414
const storage = new Storage(output, ctx.globalState, ctx.secrets, ctx.globalStorageUri, ctx.logUri)
1515
await storage.init()
1616

17-
vscode.window.registerTreeDataProvider("nodeDependencies", nodeDependenciesProvider)
17+
vscode.window.registerTreeDataProvider("nodeDependencies", workspacesProvider)
1818

1919
getUser()
2020
.then(() => {
@@ -54,7 +54,7 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
5454
},
5555
})
5656

57-
const commands = new Commands(storage, nodeDependenciesProvider)
57+
const commands = new Commands(storage, workspacesProvider)
5858

5959
vscode.commands.registerCommand("coder.login", commands.login.bind(commands))
6060
vscode.commands.registerCommand("coder.logout", commands.logout.bind(commands))

src/outline.ts renamed to src/workspaces.ts

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ import { getWorkspaces } from "coder/site/src/api/api"
22
import * as path from "path"
33
import * as vscode from "vscode"
44

5-
export class OutlineProvider implements vscode.TreeDataProvider<any> {
5+
export class WorkspacesProvider implements vscode.TreeDataProvider<Workspace> {
66
private _onDidChangeTreeData: vscode.EventEmitter<Workspace | undefined | void> = new vscode.EventEmitter<
77
Workspace | undefined | void
88
>()
99
readonly onDidChangeTreeData: vscode.Event<Workspace | undefined | void> = this._onDidChangeTreeData.event
10-
constructor(private outline: any, private context: vscode.ExtensionContext) {}
10+
constructor() {
11+
// intentional blank link for ESLint
12+
}
1113

1214
refresh(): void {
1315
this._onDidChangeTreeData.fire()
@@ -17,14 +19,11 @@ export class OutlineProvider implements vscode.TreeDataProvider<any> {
1719
return element
1820
}
1921

20-
async getChildren(element?: Workspace): Promise<Workspace[]> {
21-
// TODO - make request to get requests
22-
// then resolve with workspaces as children
23-
// otherwise resolve with empty array
24-
// TODO create dummy data and show those
22+
async getChildren(): Promise<Workspace[]> {
2523
const workspaces = await getWorkspaces({
2624
q: "owner:me",
2725
}).catch(() => {
26+
// TODO: we should probably warn or error here
2827
return
2928
})
3029

@@ -44,18 +43,10 @@ export class OutlineProvider implements vscode.TreeDataProvider<any> {
4443

4544
return Promise.resolve(items)
4645
} else {
46+
// TODO: should we issue a warning new workspaces found?
47+
// Or return a link to create a new Workspace from the dashboard?
4748
return Promise.resolve([])
4849
}
49-
50-
// TODO - if error, what do we do?
51-
52-
// TODO - if you login does it refresh the view?
53-
// same thing with logout
54-
// if (element) {
55-
// return Promise.resolve(element.children)
56-
// } else {
57-
// return Promise.resolve(this.outline)
58-
// }
5950
}
6051
}
6152

@@ -71,7 +62,6 @@ export class Workspace extends vscode.TreeItem {
7162
this.tooltip = `${this.label}`
7263
}
7364

74-
// this.iconId iconPath = this.iconId
7565
iconPath = {
7666
light: path.join(__filename, "..", "..", "media", "dependency.svg"),
7767
dark: path.join(__filename, "..", "..", "media", "dependency.svg"),

0 commit comments

Comments
 (0)