Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "Edit Project Path" command #775

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,10 @@
"command": "_projectManager.editTags",
"title": "%projectManager.commands.editTags.title%"
},
{
"command": "_projectManager.editProjectPath",
"title": "%projectManager.commands.editProjectPath.title%"
},
{
"command": "projectManager.whatsNew",
"title": "%projectManager.commands.whatsNew.title%"
Expand Down
3 changes: 2 additions & 1 deletion package.nls.cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"projectManager.commands.deleteProject.title": "Smazat projekt",
"projectManager.commands.renameProject.title": "Přejmenovat projekt",
"projectManager.commands.editTags.title": "Upravit značky",
"projectManager.commands.editProjectPath.title": "Upravit cestu projektu",
"projectManager.commands.viewAsTags#sideBarFavorites.title": "Zobrazit jako značky",
"projectManager.commands.viewAsList#sideBarFavorites.title": "Zobrazit jako seznam",
"projectManager.submenus.viewAndSort#sideBarFavorites.title": "Zobrazit a třídit",
Expand Down Expand Up @@ -82,4 +83,4 @@
"projectManager.configuration.openInCurrentWindowIfEmpty.description": "Označuje, zda příkaz \"Nové okno\" otevře projekt v aktuálním okně, je-li prázdný.",
"projectManager.configuration.confirmSwitchOnActiveWindow.description": "Řídí, zda má rozšíření žádat o potvrzení při otevírání projektů v aktivním okně.",
"projectManager.configuration.tags.description": "Označuje seznam značek, které můžete použít k uspořádání projektů"
}
}
3 changes: 2 additions & 1 deletion package.nls.fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"projectManager.commands.deleteProject.title": "Supprimer le projet",
"projectManager.commands.renameProject.title": "Renommer le projet",
"projectManager.commands.editTags.title": "Modifier les étiquettes",
"projectManager.commands.editProjectPath.title": "Modifier le chemin du projet",
"projectManager.commands.viewAsTags#sideBarFavorites.title": "Voir en tant qu'étiquettes",
"projectManager.commands.viewAsList#sideBarFavorites.title": "Voir comme liste",
"projectManager.submenus.viewAndSort#sideBarFavorites.title": "Afficher et trier",
Expand Down Expand Up @@ -99,4 +100,4 @@
"projectManager.walkthroughs.exclusiveSideBar.description": "Une barre latérale exclusive avec tout ce dont vous avez besoin pour une meilleure productivité.\n[Ouvrir la barre latérale](command:_projectManager.openSideBar)",
"projectManager.walkthroughs.workingWithRemotes.title": "Travailler à distance",
"projectManager.walkthroughs.workingWithRemotes.description": "L'extension prend en charge les scénarios de [développement à distance] (https://code.visualstudio.com/docs/remote/remote-overview), et vous pouvez choisir comment l'utiliser, en fonction de vos besoins."
}
}
3 changes: 2 additions & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"projectManager.commands.deleteProject.title": "Delete Project",
"projectManager.commands.renameProject.title": "Rename Project",
"projectManager.commands.editTags.title": "Edit Tags",
"projectManager.commands.editProjectPath.title": "Edit Project Path",
"projectManager.commands.viewAsTags#sideBarFavorites.title": "View as Tags",
"projectManager.commands.viewAsList#sideBarFavorites.title": "View as List",
"projectManager.submenus.viewAndSort#sideBarFavorites.title": "View & Sort",
Expand Down Expand Up @@ -110,4 +111,4 @@
"projectManager.walkthroughs.exclusiveSideBar.description": "An exclusive Side Bar with everything you need for great productivity.\n[Open Side Bar](command:_projectManager.openSideBar)",
"projectManager.walkthroughs.workingWithRemotes.title": "Working with Remotes",
"projectManager.walkthroughs.workingWithRemotes.description": "The extension support [Remote Development](https://code.visualstudio.com/docs/remote/remote-overview) scenarios, and you may choose how to use it, depending on your needs."
}
}
3 changes: 2 additions & 1 deletion package.nls.pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"projectManager.commands.deleteProject.title": "Excluir Projeto",
"projectManager.commands.renameProject.title": "Renomear Projeto",
"projectManager.commands.editTags.title": "Editar Etiquetas",
"projectManager.commands.editProjectPath.title": "Editar Caminho do Projeto",
"projectManager.commands.viewAsTags#sideBarFavorites.title": "Exibir como Etiquetas",
"projectManager.commands.viewAsList#sideBarFavorites.title": "Exibir como Lista",
"projectManager.submenus.viewAndSort#sideBarFavorites.title": "Exibir & Ordenação",
Expand Down Expand Up @@ -110,4 +111,4 @@
"projectManager.walkthroughs.exclusiveSideBar.description": "Uma Barra Lateral exclusiva com tudo que você precisa para aumentar sua produtividade.\n[Abrir Barra Lateral](command:_projectManager.openSideBar)",
"projectManager.walkthroughs.workingWithRemotes.title": "Trabalhando com Remotos",
"projectManager.walkthroughs.workingWithRemotes.description": "A extensão suporta cenários de [Desenvolvimento Remoto](https://code.visualstudio.com/docs/remote/remote-overview), e você pode escolher como usar, dependendo das suas necessidades."
}
}
3 changes: 2 additions & 1 deletion package.nls.ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"projectManager.commands.deleteProject.title": "Удалить проект",
"projectManager.commands.renameProject.title": "Переименовать проект",
"projectManager.commands.editTags.title": "Отредактировать тэги",
"projectManager.commands.editProjectPath.title": "Изменить путь проекта",
"projectManager.commands.viewAsTags#sideBarFavorites.title": "Просмотреть как теги",
"projectManager.commands.viewAsList#sideBarFavorites.title": "Просмотреть как список",
"projectManager.submenus.viewAndSort#sideBarFavorites.title": "Просмотр и сортировка",
Expand Down Expand Up @@ -82,4 +83,4 @@
"projectManager.configuration.openInCurrentWindowIfEmpty.description": "Указывает, открывает ли команда «Новое окно» проект в текущем пустом окне.",
"projectManager.configuration.confirmSwitchOnActiveWindow.description": "Определяет, должно ли расширение запрашивать подтверждение при открытии проектов в активном окне.",
"projectManager.configuration.tags.description": "Указывает список тегов, которые вы можете использовать для организации ваших проектов."
}
}
1 change: 1 addition & 0 deletions package.nls.zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"projectManager.commands.deleteProject.title": "删除项目",
"projectManager.commands.renameProject.title": "重命名项目",
"projectManager.commands.editTags.title": "编辑标签",
"projectManager.commands.editProjectPath.title": "编辑项目路径",
"projectManager.commands.viewAsTags#sideBarFavorites.title": "作为标签查看",
"projectManager.commands.viewAsList#sideBarFavorites.title": "以列表形式查看",
"projectManager.submenus.viewAndSort#sideBarFavorites.title": "查看与排序",
Expand Down
3 changes: 2 additions & 1 deletion package.nls.zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"projectManager.commands.deleteProject.title": "刪除項目",
"projectManager.commands.renameProject.title": "重命名項目",
"projectManager.commands.editTags.title": "編輯標簽",
"projectManager.commands.editProjectPath.title": "編輯項目路徑",
"projectManager.commands.viewAsTags#sideBarFavorites.title": "作為標簽查看",
"projectManager.commands.viewAsList#sideBarFavorites.title": "以列表形式查看",
"projectManager.submenus.viewAndSort#sideBarFavorites.title": "查看和排序",
Expand Down Expand Up @@ -99,4 +100,4 @@
"projectManager.walkthroughs.exclusiveSideBar.description": "專屬側邊欄包含您實現高效工作所需的一切。\n[打開側邊欄](command:_projectManager.openSideBar)",
"projectManager.walkthroughs.workingWithRemotes.title": "使用遠程工作",
"projectManager.walkthroughs.workingWithRemotes.description": "該擴展支持 [遠程開發](https://code.visualstudio.com/docs/remote/remote-overview) 場景,您可以根據需要選擇如何使用它。"
}
}
21 changes: 20 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export async function activate(context: vscode.ExtensionContext) {
vscode.commands.registerCommand("_projectManager.deleteProject", (node) => deleteProject(node));
vscode.commands.registerCommand("_projectManager.renameProject", (node) => renameProject(node));
vscode.commands.registerCommand("_projectManager.editTags", (node) => editTags(node));
vscode.commands.registerCommand("_projectManager.editProjectPath", (node) => editProjectPath(node));
vscode.commands.registerCommand("projectManager.addToFavorites", (node) => saveProject(node));
vscode.commands.registerCommand("_projectManager.toggleProjectEnabled", (node) => toggleProjectEnabled(node));

Expand Down Expand Up @@ -475,6 +476,24 @@ export async function activate(context: vscode.ExtensionContext) {
}
}

async function editProjectPath(node: any) {

const project = projectStorage.existsWithRootPath(node.command.arguments[0]);
if (!project) {
return;
}

const projectDetails = await getProjectDetails(project.name, project.rootPath);
if (!projectDetails) {
return;
}

projectStorage.updateRootPath(project.name, projectDetails.path);
projectStorage.save();
providerManager.updateTreeViewStorage();
vscode.window.showInformationMessage(l10n.t("Project updated!"));
}

function toggleProjectEnabled(node: any, askForUndo = true) {
const projectName: string = node.command.arguments[1];
const enabled: boolean = projectStorage.toggleEnabled(projectName);
Expand Down Expand Up @@ -513,4 +532,4 @@ export function deactivate() {
// }

locators.dispose();
}
}