4
4
import * as vscode from "vscode" ;
5
5
import { LanguageClient , RequestType } from "vscode-languageclient" ;
6
6
import { IFeature } from "../feature" ;
7
+ import { Logger } from "../logging" ;
7
8
8
9
// TODO: Document this export: https://github.com/PowerShell/vscode-powershell/pull/1406#discussion_r209325655
9
10
// TODO: Also use something other than any if possible... We may have already addressed this with a previous attempt.
@@ -14,13 +15,13 @@ export class GetCommandsFeature implements IFeature {
14
15
private languageClient : LanguageClient ;
15
16
private commandsExplorerProvider : CommandsExplorerProvider ;
16
17
17
- constructor ( ) {
18
+ constructor ( private log : Logger ) {
18
19
this . command = vscode . commands . registerCommand ( "PowerShell.RefreshCommandsExplorer" , ( ) => {
19
20
if ( this . languageClient === undefined ) {
20
- // TODO: Log error message
21
+ this . log . writeAndShowError ( `<${ GetCommandsFeature . name } >: ` +
22
+ "Unable to instantiate; language client undefined." ) ;
21
23
return ;
22
24
}
23
- // TODO: Refactor network code out of constructor
24
25
this . languageClient . sendRequest ( GetAllCommandsRequestType , "" ) . then ( ( result ) => {
25
26
this . commandsExplorerProvider . powerShellCommands = result . map ( toCommand ) ;
26
27
this . commandsExplorerProvider . refresh ( ) ;
@@ -102,10 +103,8 @@ class Command extends vscode.TreeItem {
102
103
} ;
103
104
}
104
105
105
- public async getChildren ( element ) : Promise < Command [ ] > {
106
+ public async getChildren ( element ? ) : Promise < Command [ ] > {
106
107
return [ ] ;
107
- // TODO: Determine why we're returning an empty array...
108
- // I think it's because we have to return something and
109
- // we're not actually using the tree view part just yet...
108
+ // Returning an empty array because we need to return something.
110
109
}
111
110
}
0 commit comments