@@ -78,6 +78,12 @@ export class FileTreeCustomContribution
7878 FILE_COMMANDS . PASTE_FILE ,
7979 FILE_COMMANDS . CUT_FILE ,
8080 ] ;
81+ // codeblitz2 webscm rename 功能和 delete 功能失效,先禁用掉
82+ const DISABLE_COMMANDS = [
83+ FILE_COMMANDS . RENAME_FILE ,
84+ FILE_COMMANDS . DELETE_FILE ,
85+ FILE_COMMANDS . CUT_FILE ,
86+ ] ;
8187
8288 const isContextMenuFile = ( ) => {
8389 return (
@@ -103,54 +109,58 @@ export class FileTreeCustomContribution
103109 if ( this . runtimeConfig . scmFileTree ) {
104110 SCMFileCommand . forEach ( ( cmd ) => {
105111 commands . unregisterCommand ( cmd . id ) ;
112+ if ( DISABLE_COMMANDS . includes ( cmd ) ) {
113+ // 禁用命令需要注册一个空函数
114+ commands . registerCommand ( cmd ) ;
115+ }
106116 } ) ;
107117 const exitFilterMode = ( ) => {
108118 if ( this . fileTreeService . filterMode ) {
109119 this . fileTreeService . toggleFilterMode ( ) ;
110120 }
111121 } ;
112- commands . registerCommand < ExplorerContextCallback > ( FILE_COMMANDS . RENAME_FILE , {
113- execute : ( uri ) => {
114- exitFilterMode ( ) ;
115- if ( ! uri ) {
116- if ( this . fileTreeModelService . contextMenuFile ) {
117- uri = this . fileTreeModelService . contextMenuFile . uri ;
118- } else if ( this . fileTreeModelService . focusedFile ) {
119- uri = this . fileTreeModelService . focusedFile . uri ;
120- } else {
121- return ;
122- }
123- }
124- this . fileTreeModelService . renamePrompt ( uri ) ;
125- } ,
126- isEnabled : ( ) => ! Directory . is ( this . fileTreeModelService . contextMenuFile ) ,
127- isVisible : ( ) => isContextMenuFile ( ) ,
128- } ) ;
122+ // commands.registerCommand<ExplorerContextCallback>(FILE_COMMANDS.RENAME_FILE, {
123+ // execute: (uri) => {
124+ // exitFilterMode();
125+ // if (!uri) {
126+ // if (this.fileTreeModelService.contextMenuFile) {
127+ // uri = this.fileTreeModelService.contextMenuFile.uri;
128+ // } else if (this.fileTreeModelService.focusedFile) {
129+ // uri = this.fileTreeModelService.focusedFile.uri;
130+ // } else {
131+ // return;
132+ // }
133+ // }
134+ // this.fileTreeModelService.renamePrompt(uri);
135+ // },
136+ // isEnabled: () => !Directory.is(this.fileTreeModelService.contextMenuFile),
137+ // isVisible: () => isContextMenuFile(),
138+ // });
129139
130- commands . registerCommand < ExplorerContextCallback > ( FILE_COMMANDS . DELETE_FILE , {
131- execute : ( _ , uris ) => {
132- exitFilterMode ( ) ;
133- if ( ! uris ) {
134- if ( this . fileTreeModelService . focusedFile ) {
135- this . willDeleteUris . push ( this . fileTreeModelService . focusedFile . uri ) ;
136- } else if (
137- this . fileTreeModelService . selectedFiles
138- && this . fileTreeModelService . selectedFiles . length > 0
139- ) {
140- this . willDeleteUris = this . willDeleteUris . concat (
141- this . fileTreeModelService . selectedFiles . map ( ( file ) => file . uri ) ,
142- ) ;
143- } else {
144- return ;
145- }
146- } else {
147- this . willDeleteUris = this . willDeleteUris . concat ( uris ) ;
148- }
149- return this . deleteThrottler . queue < void > ( this . doDelete . bind ( this ) ) ;
150- } ,
151- isEnabled : ( ) => ! Directory . is ( this . fileTreeModelService . contextMenuFile ) ,
152- isVisible : ( ) => isContextMenuFile ( ) ,
153- } ) ;
140+ // commands.registerCommand<ExplorerContextCallback>(FILE_COMMANDS.DELETE_FILE, {
141+ // execute: (_, uris) => {
142+ // exitFilterMode();
143+ // if (!uris) {
144+ // if (this.fileTreeModelService.focusedFile) {
145+ // this.willDeleteUris.push(this.fileTreeModelService.focusedFile.uri);
146+ // } else if (
147+ // this.fileTreeModelService.selectedFiles
148+ // && this.fileTreeModelService.selectedFiles.length > 0
149+ // ) {
150+ // this.willDeleteUris = this.willDeleteUris.concat(
151+ // this.fileTreeModelService.selectedFiles.map((file) => file.uri),
152+ // );
153+ // } else {
154+ // return;
155+ // }
156+ // } else {
157+ // this.willDeleteUris = this.willDeleteUris.concat(uris);
158+ // }
159+ // return this.deleteThrottler.queue<void>(this.doDelete.bind(this));
160+ // },
161+ // isEnabled: () => !Directory.is(this.fileTreeModelService.contextMenuFile),
162+ // isVisible: () => isContextMenuFile(),
163+ // });
154164
155165 commands . registerCommand < ExplorerContextCallback > ( FILE_COMMANDS . COPY_FILE , {
156166 execute : ( _ , uris ) => {
@@ -167,20 +177,20 @@ export class FileTreeCustomContribution
167177 isVisible : ( ) => isContextMenuFile ( ) || isFocusedFile ( ) ,
168178 } ) ;
169179
170- commands . registerCommand < ExplorerContextCallback > ( FILE_COMMANDS . CUT_FILE , {
171- execute : ( _ , uris ) => {
172- if ( uris && uris . length ) {
173- this . fileTreeModelService . cutFile ( uris ) ;
174- } else {
175- const selectedUris = this . fileTreeModelService . selectedFiles . map ( ( file ) => file . uri ) ;
176- if ( selectedUris && selectedUris . length ) {
177- this . fileTreeModelService . cutFile ( selectedUris ) ;
178- }
179- }
180- } ,
181- isEnabled : ( ) => ! Directory . is ( this . fileTreeModelService . contextMenuFile ) ,
182- isVisible : ( ) => isContextMenuFile ( ) || isFocusedFile ( ) ,
183- } ) ;
180+ // commands.registerCommand<ExplorerContextCallback>(FILE_COMMANDS.CUT_FILE, {
181+ // execute: (_, uris) => {
182+ // if (uris && uris.length) {
183+ // this.fileTreeModelService.cutFile(uris);
184+ // } else {
185+ // const selectedUris = this.fileTreeModelService.selectedFiles.map((file) => file.uri);
186+ // if (selectedUris && selectedUris.length) {
187+ // this.fileTreeModelService.cutFile(selectedUris);
188+ // }
189+ // }
190+ // },
191+ // isEnabled: () => !Directory.is(this.fileTreeModelService.contextMenuFile),
192+ // isVisible: () => isContextMenuFile() || isFocusedFile(),
193+ // });
184194
185195 commands . registerCommand < ExplorerContextCallback > ( FILE_COMMANDS . PASTE_FILE , {
186196 execute : ( uri ) => {
0 commit comments