File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6666 "title" : " Toggle features" ,
6767 "category" : " Ruby LSP"
6868 },
69+ {
70+ "command" : " rubyLsp.displayAddons" ,
71+ "title" : " Display addons" ,
72+ "category" : " Ruby LSP"
73+ },
6974 {
7075 "command" : " rubyLsp.runTest" ,
7176 "title" : " Run current test" ,
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ export enum Command {
1818 RunTestInTerminal = "rubyLsp.runTestInTerminal" ,
1919 DebugTest = "rubyLsp.debugTest" ,
2020 ShowSyntaxTree = "rubyLsp.showSyntaxTree" ,
21+ DisplayAddons = "rubyLsp.displayAddons" ,
2122}
2223
2324export interface RubyInterface {
Original file line number Diff line number Diff line change @@ -214,6 +214,33 @@ export class RubyLsp {
214214 ) ,
215215 ) ;
216216 } ) ,
217+ vscode . commands . registerCommand ( Command . DisplayAddons , async ( ) => {
218+ const client = this . currentActiveWorkspace ( ) ?. lspClient ;
219+
220+ if ( ! client || ! client . addons ) {
221+ return ;
222+ }
223+
224+ const options : vscode . QuickPickItem [ ] = client . addons
225+ . sort ( ( addon ) => {
226+ // Display errored addons last
227+ if ( addon . errored ) {
228+ return 1 ;
229+ }
230+
231+ return - 1 ;
232+ } )
233+ . map ( ( addon ) => {
234+ const icon = addon . errored ? "$(error)" : "$(pass)" ;
235+ return {
236+ label : `${ icon } ${ addon . name } ` ,
237+ } ;
238+ } ) ;
239+
240+ await vscode . window . showQuickPick ( options , {
241+ placeHolder : "Addons (readonly)" ,
242+ } ) ;
243+ } ) ,
217244 vscode . commands . registerCommand ( Command . ToggleFeatures , async ( ) => {
218245 // Extract feature descriptions from our package.json
219246 const enabledFeaturesProperties =
Original file line number Diff line number Diff line change @@ -196,10 +196,11 @@ export class AddonsStatus extends StatusItem {
196196 } else if ( workspace . lspClient . addons . length === 0 ) {
197197 this . item . text = "Addons: none" ;
198198 } else {
199- const addonNames = workspace . lspClient . addons . map ( ( addon ) =>
200- addon . errored ? `${ addon . name } (errored)` : `${ addon . name } ` ,
201- ) ;
202- this . item . text = `Addons: ${ addonNames . join ( ", " ) } ` ;
199+ this . item . text = `Addons: ${ workspace . lspClient . addons . length } ` ;
200+ this . item . command = {
201+ title : "Details" ,
202+ command : Command . DisplayAddons ,
203+ } ;
203204 }
204205 }
205206}
Original file line number Diff line number Diff line change @@ -305,15 +305,17 @@ suite("StatusItems", () => {
305305 assert . strictEqual ( status . item . text , "Addons: none" ) ;
306306 } ) ;
307307
308- test ( "Status displays addon names and errored status " , ( ) => {
308+ test ( "Status displays addon count and command to list commands " , ( ) => {
309309 workspace . lspClient ! . addons = [
310310 { name : "foo" , errored : false } ,
311311 { name : "bar" , errored : true } ,
312312 ] ;
313313
314314 status . refresh ( workspace ) ;
315315
316- assert . strictEqual ( status . item . text , "Addons: foo, bar (errored)" ) ;
316+ assert . strictEqual ( status . item . text , "Addons: 2" ) ;
317+ assert . strictEqual ( status . item . command ?. title , "Details" ) ;
318+ assert . strictEqual ( status . item . command . command , Command . DisplayAddons ) ;
317319 } ) ;
318320 } ) ;
319321} ) ;
You can’t perform that action at this time.
0 commit comments