@@ -96,7 +96,17 @@ export class ScopeSupportTreeProvider
96
96
getScopeTypesWithSupport ( scopeSupport : ScopeSupport ) : ScopeSupportTreeItem [ ] {
97
97
return this . supportLevels
98
98
. filter ( ( supportLevel ) => supportLevel . support === scopeSupport )
99
- . map ( ( supportLevel ) => new ScopeSupportTreeItem ( supportLevel ) ) ;
99
+ . map ( ( supportLevel ) => new ScopeSupportTreeItem ( supportLevel ) )
100
+ . sort ( ( a , b ) => {
101
+ if (
102
+ a . scopeTypeInfo . isLanguageSpecific !==
103
+ b . scopeTypeInfo . isLanguageSpecific
104
+ ) {
105
+ return a . scopeTypeInfo . isLanguageSpecific ? - 1 : 1 ;
106
+ }
107
+
108
+ return a . label . localeCompare ( b . label ) ;
109
+ } ) ;
100
110
}
101
111
102
112
dispose ( ) {
@@ -130,7 +140,9 @@ function getSupportCategories(): SupportCategoryTreeItem[] {
130
140
}
131
141
132
142
class ScopeSupportTreeItem extends vscode . TreeItem {
133
- constructor ( scopeTypeInfo : ScopeTypeInfo ) {
143
+ public label : string ;
144
+
145
+ constructor ( public scopeTypeInfo : ScopeTypeInfo ) {
134
146
const label =
135
147
scopeTypeInfo . spokenForm . type === "error"
136
148
? "-"
@@ -139,6 +151,8 @@ class ScopeSupportTreeItem extends vscode.TreeItem {
139
151
140
152
super ( label , vscode . TreeItemCollapsibleState . None ) ;
141
153
154
+ this . label = label ;
155
+
142
156
this . description = description ;
143
157
144
158
if (
@@ -158,6 +172,10 @@ class ScopeSupportTreeItem extends vscode.TreeItem {
158
172
] ,
159
173
title : `Visualize ${ scopeTypeInfo . humanReadableName } ` ,
160
174
} ;
175
+
176
+ if ( scopeTypeInfo . isLanguageSpecific ) {
177
+ this . resourceUri = vscode . window . activeTextEditor ?. document . uri ;
178
+ }
161
179
}
162
180
}
163
181
0 commit comments