Skip to content

Commit

Permalink
Merge branch 'v2.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
opensumi[bot] committed Nov 20, 2024
2 parents 2db69c7 + ba66e47 commit 9dfcd88
Show file tree
Hide file tree
Showing 13 changed files with 77 additions and 67 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "2.3.4"
"version": "2.3.5"
}
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@codeblitzjs/ide-cli",
"version": "2.3.4",
"version": "2.3.5",
"description": "@codeblitzjs/ide-cli",
"main": "lib/commander.js",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/code-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@codeblitzjs/ide-code-api",
"version": "2.3.4",
"version": "2.3.5",
"description": "@codeblitzjs/ide-code-api",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/code-service/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@codeblitzjs/ide-code-service",
"version": "2.3.4",
"version": "2.3.5",
"description": "@codeblitzjs/ide-code-service",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@codeblitzjs/ide-common",
"version": "2.3.4",
"version": "2.3.5",
"description": "@codeblitzjs/ide-common",
"main": "lib/index.js",
"typing": "lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@codeblitzjs/ide-core",
"version": "2.3.4",
"version": "2.3.5",
"description": "@codeblitzjs/ide-core",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/i18n/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@codeblitzjs/ide-i18n",
"version": "2.3.4",
"version": "2.3.5",
"description": "@codeblitzjs/ide-i18n",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@codeblitzjs/ide-plugin",
"version": "2.3.4",
"version": "2.3.5",
"description": "@codeblitzjs/ide-plugin",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/registry/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@codeblitzjs/ide-registry",
"version": "2.3.4",
"version": "2.3.5",
"description": "@codeblitzjs/ide-registry",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/startup/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@codeblitzjs/ide-startup",
"version": "2.3.4",
"version": "2.3.5",
"description": "@codeblitzjs/ide-startup",
"main": "lib/index.js",
"typing": "types/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/sumi-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@codeblitzjs/ide-sumi-core",
"version": "2.3.4",
"version": "2.3.5",
"description": "core",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
120 changes: 65 additions & 55 deletions packages/sumi-core/src/client/custom/file-tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ export class FileTreeCustomContribution
FILE_COMMANDS.PASTE_FILE,
FILE_COMMANDS.CUT_FILE,
];
// codeblitz2 webscm rename 功能和 delete 功能失效,先禁用掉
const DISABLE_COMMANDS = [
FILE_COMMANDS.RENAME_FILE,
FILE_COMMANDS.DELETE_FILE,
FILE_COMMANDS.CUT_FILE,
];

const isContextMenuFile = () => {
return (
Expand All @@ -103,54 +109,58 @@ export class FileTreeCustomContribution
if (this.runtimeConfig.scmFileTree) {
SCMFileCommand.forEach((cmd) => {
commands.unregisterCommand(cmd.id);
if (DISABLE_COMMANDS.includes(cmd)) {
// 禁用命令需要注册一个空函数
commands.registerCommand(cmd);
}
});
const exitFilterMode = () => {
if (this.fileTreeService.filterMode) {
this.fileTreeService.toggleFilterMode();
}
};
commands.registerCommand<ExplorerContextCallback>(FILE_COMMANDS.RENAME_FILE, {
execute: (uri) => {
exitFilterMode();
if (!uri) {
if (this.fileTreeModelService.contextMenuFile) {
uri = this.fileTreeModelService.contextMenuFile.uri;
} else if (this.fileTreeModelService.focusedFile) {
uri = this.fileTreeModelService.focusedFile.uri;
} else {
return;
}
}
this.fileTreeModelService.renamePrompt(uri);
},
isEnabled: () => !Directory.is(this.fileTreeModelService.contextMenuFile),
isVisible: () => isContextMenuFile(),
});
// commands.registerCommand<ExplorerContextCallback>(FILE_COMMANDS.RENAME_FILE, {
// execute: (uri) => {
// exitFilterMode();
// if (!uri) {
// if (this.fileTreeModelService.contextMenuFile) {
// uri = this.fileTreeModelService.contextMenuFile.uri;
// } else if (this.fileTreeModelService.focusedFile) {
// uri = this.fileTreeModelService.focusedFile.uri;
// } else {
// return;
// }
// }
// this.fileTreeModelService.renamePrompt(uri);
// },
// isEnabled: () => !Directory.is(this.fileTreeModelService.contextMenuFile),
// isVisible: () => isContextMenuFile(),
// });

commands.registerCommand<ExplorerContextCallback>(FILE_COMMANDS.DELETE_FILE, {
execute: (_, uris) => {
exitFilterMode();
if (!uris) {
if (this.fileTreeModelService.focusedFile) {
this.willDeleteUris.push(this.fileTreeModelService.focusedFile.uri);
} else if (
this.fileTreeModelService.selectedFiles
&& this.fileTreeModelService.selectedFiles.length > 0
) {
this.willDeleteUris = this.willDeleteUris.concat(
this.fileTreeModelService.selectedFiles.map((file) => file.uri),
);
} else {
return;
}
} else {
this.willDeleteUris = this.willDeleteUris.concat(uris);
}
return this.deleteThrottler.queue<void>(this.doDelete.bind(this));
},
isEnabled: () => !Directory.is(this.fileTreeModelService.contextMenuFile),
isVisible: () => isContextMenuFile(),
});
// commands.registerCommand<ExplorerContextCallback>(FILE_COMMANDS.DELETE_FILE, {
// execute: (_, uris) => {
// exitFilterMode();
// if (!uris) {
// if (this.fileTreeModelService.focusedFile) {
// this.willDeleteUris.push(this.fileTreeModelService.focusedFile.uri);
// } else if (
// this.fileTreeModelService.selectedFiles
// && this.fileTreeModelService.selectedFiles.length > 0
// ) {
// this.willDeleteUris = this.willDeleteUris.concat(
// this.fileTreeModelService.selectedFiles.map((file) => file.uri),
// );
// } else {
// return;
// }
// } else {
// this.willDeleteUris = this.willDeleteUris.concat(uris);
// }
// return this.deleteThrottler.queue<void>(this.doDelete.bind(this));
// },
// isEnabled: () => !Directory.is(this.fileTreeModelService.contextMenuFile),
// isVisible: () => isContextMenuFile(),
// });

commands.registerCommand<ExplorerContextCallback>(FILE_COMMANDS.COPY_FILE, {
execute: (_, uris) => {
Expand All @@ -167,20 +177,20 @@ export class FileTreeCustomContribution
isVisible: () => isContextMenuFile() || isFocusedFile(),
});

commands.registerCommand<ExplorerContextCallback>(FILE_COMMANDS.CUT_FILE, {
execute: (_, uris) => {
if (uris && uris.length) {
this.fileTreeModelService.cutFile(uris);
} else {
const selectedUris = this.fileTreeModelService.selectedFiles.map((file) => file.uri);
if (selectedUris && selectedUris.length) {
this.fileTreeModelService.cutFile(selectedUris);
}
}
},
isEnabled: () => !Directory.is(this.fileTreeModelService.contextMenuFile),
isVisible: () => isContextMenuFile() || isFocusedFile(),
});
// commands.registerCommand<ExplorerContextCallback>(FILE_COMMANDS.CUT_FILE, {
// execute: (_, uris) => {
// if (uris && uris.length) {
// this.fileTreeModelService.cutFile(uris);
// } else {
// const selectedUris = this.fileTreeModelService.selectedFiles.map((file) => file.uri);
// if (selectedUris && selectedUris.length) {
// this.fileTreeModelService.cutFile(selectedUris);
// }
// }
// },
// isEnabled: () => !Directory.is(this.fileTreeModelService.contextMenuFile),
// isVisible: () => isContextMenuFile() || isFocusedFile(),
// });

commands.registerCommand<ExplorerContextCallback>(FILE_COMMANDS.PASTE_FILE, {
execute: (uri) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/toolkit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@codeblitzjs/ide-toolkit",
"version": "2.3.4",
"version": "2.3.5",
"description": "@codeblitzjs/ide-toolkit",
"main": "index.js",
"files": [
Expand Down

0 comments on commit 9dfcd88

Please sign in to comment.