@@ -2,12 +2,14 @@ import { getWorkspaces } from "coder/site/src/api/api"
22import * as path from "path"
33import * 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