@@ -27,6 +27,7 @@ import {
2727} from './treeViewItems' ;
2828
2929const COPIED_STATE = 'copied' ;
30+ const SELECTED_STATE = 'selected' ;
3031
3132export class ProjectView implements TreeDataProvider < ProjectTreeItem > {
3233 private treeView : TreeView < ProjectTreeItem > ;
@@ -145,7 +146,7 @@ export class ProjectView implements TreeDataProvider<ProjectTreeItem> {
145146 if ( element . kind === ProjectTreeItemKind . project && element instanceof ProjectItem ) {
146147 const itemId = element . project . uri . fsPath ;
147148 const currentContext = element . treeItem . contextValue ?? '' ;
148- if ( this . stateManager ? .hasState ( itemId , COPIED_STATE ) ) {
149+ if ( this . stateManager . hasState ( itemId , COPIED_STATE ) ) {
149150 if ( ! currentContext . includes ( COPIED_STATE ) ) {
150151 element . treeItem . contextValue = currentContext + ';' + COPIED_STATE ;
151152 }
@@ -154,14 +155,27 @@ export class ProjectView implements TreeDataProvider<ProjectTreeItem> {
154155 }
155156 } else if ( element . kind === ProjectTreeItemKind . environment && element instanceof ProjectEnvironment ) {
156157 const itemId = element . environment . envId . id ;
157- const currentContext = element . treeItem . contextValue ?? '' ;
158- if ( this . stateManager ?. hasState ( itemId , COPIED_STATE ) ) {
158+ let currentContext = element . treeItem . contextValue ?? '' ;
159+
160+ // Handle copied state
161+ if ( this . stateManager . hasState ( itemId , COPIED_STATE ) ) {
159162 if ( ! currentContext . includes ( COPIED_STATE ) ) {
160- element . treeItem . contextValue = currentContext + ';' + COPIED_STATE ;
163+ currentContext = currentContext + ';' + COPIED_STATE ;
161164 }
162165 } else if ( currentContext . includes ( COPIED_STATE ) ) {
163- element . treeItem . contextValue = currentContext . replace ( ';' + COPIED_STATE , '' ) ;
166+ currentContext = currentContext . replace ( ';' + COPIED_STATE , '' ) ;
164167 }
168+
169+ // Handle selected state
170+ if ( this . stateManager . hasState ( itemId , SELECTED_STATE ) ) {
171+ if ( ! currentContext . includes ( SELECTED_STATE ) ) {
172+ currentContext = currentContext + ';' + SELECTED_STATE ;
173+ }
174+ } else if ( currentContext . includes ( SELECTED_STATE ) ) {
175+ currentContext = currentContext . replace ( ';' + SELECTED_STATE , '' ) ;
176+ }
177+
178+ element . treeItem . contextValue = currentContext ;
165179 }
166180 return element . treeItem ;
167181 }
0 commit comments