💄
This commit is contained in:
parent
592fa5cdaf
commit
86d848d8e7
3 changed files with 37 additions and 22 deletions
|
@ -163,12 +163,6 @@
|
|||
"category": "Git",
|
||||
"icon": "$(discard)"
|
||||
},
|
||||
{
|
||||
"command": "git.rename",
|
||||
"title": "%command.rename%",
|
||||
"category": "Git",
|
||||
"icon": "$(discard)"
|
||||
},
|
||||
{
|
||||
"command": "git.cleanAll",
|
||||
"title": "%command.cleanAll%",
|
||||
|
@ -187,6 +181,12 @@
|
|||
"category": "Git",
|
||||
"icon": "$(discard)"
|
||||
},
|
||||
{
|
||||
"command": "git.rename",
|
||||
"title": "%command.rename%",
|
||||
"category": "Git",
|
||||
"icon": "$(discard)"
|
||||
},
|
||||
{
|
||||
"command": "git.commit",
|
||||
"title": "%command.commit%",
|
||||
|
@ -616,6 +616,10 @@
|
|||
"command": "git.cleanAllUntracked",
|
||||
"when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"
|
||||
},
|
||||
{
|
||||
"command": "git.rename",
|
||||
"when": "false"
|
||||
},
|
||||
{
|
||||
"command": "git.commit",
|
||||
"when": "config.git.enabled && !git.missing && gitOpenRepositoryCount != 0"
|
||||
|
@ -1332,11 +1336,16 @@
|
|||
],
|
||||
"explorer/context": [
|
||||
{
|
||||
"command": "git.rename",
|
||||
"group": "7_modification",
|
||||
"submenu": "git.explorer",
|
||||
"group": "7_git",
|
||||
"when": "config.git.enabled && !git.missing && !explorerResourceIsRoot"
|
||||
}
|
||||
],
|
||||
"git.explorer": [
|
||||
{
|
||||
"command": "git.rename"
|
||||
}
|
||||
],
|
||||
"git.commit": [
|
||||
{
|
||||
"command": "git.commit",
|
||||
|
@ -1555,6 +1564,10 @@
|
|||
]
|
||||
},
|
||||
"submenus": [
|
||||
{
|
||||
"id": "git.explorer",
|
||||
"label": "%submenu.explorer%"
|
||||
},
|
||||
{
|
||||
"id": "git.commit",
|
||||
"label": "%submenu.commit%"
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
"command.unstage": "Unstage Changes",
|
||||
"command.unstageAll": "Unstage All Changes",
|
||||
"command.unstageSelectedRanges": "Unstage Selected Ranges",
|
||||
"command.rename": "Rename (Git)",
|
||||
"command.rename": "Rename",
|
||||
"command.clean": "Discard Changes",
|
||||
"command.cleanAll": "Discard All Changes",
|
||||
"command.cleanAllTracked": "Discard All Tracked Changes",
|
||||
|
@ -176,6 +176,7 @@
|
|||
"config.timeline.date": "Controls which date to use for items in the Timeline view",
|
||||
"config.timeline.date.committed": "Use the committed date",
|
||||
"config.timeline.date.authored": "Use the authored date",
|
||||
"submenu.explorer": "Git",
|
||||
"submenu.commit": "Commit",
|
||||
"submenu.commit.amend": "Amend",
|
||||
"submenu.commit.signoff": "Sign Off",
|
||||
|
|
|
@ -921,22 +921,23 @@ export class CommandCenter {
|
|||
|
||||
@command('git.rename', { repository: true })
|
||||
async rename(repository: Repository, fromUri: Uri): Promise<void> {
|
||||
this.outputChannel.appendLine(`git.rename ${fromUri.fsPath}`);
|
||||
|
||||
const rootPath = workspace.rootPath;
|
||||
const fromPath = workspace.asRelativePath(fromUri);
|
||||
const fromBasename = path.basename(fromPath);
|
||||
const toPath = await window.showInputBox({
|
||||
value: fromPath,
|
||||
valueSelection: [fromPath.length - fromBasename.length, fromPath.length]
|
||||
});
|
||||
if (!toPath?.trim()) {
|
||||
if (!fromUri) {
|
||||
return;
|
||||
}
|
||||
|
||||
const fullToPath = path.join(rootPath || '', toPath);
|
||||
this.outputChannel.appendLine(`git.rename from ${fromPath} to ${fullToPath}`);
|
||||
await repository.move(fromPath, fullToPath);
|
||||
const from = path.relative(repository.root, fromUri.path);
|
||||
let to = await window.showInputBox({
|
||||
value: from,
|
||||
valueSelection: [from.length - path.basename(from).length, from.length]
|
||||
});
|
||||
|
||||
to = to?.trim();
|
||||
|
||||
if (!to) {
|
||||
return;
|
||||
}
|
||||
|
||||
await repository.move(from, to);
|
||||
}
|
||||
|
||||
@command('git.stage')
|
||||
|
|
Loading…
Reference in a new issue