From 44ab06e5fafb3d7795d3706e474eedd187ccc83d Mon Sep 17 00:00:00 2001 From: Yan Zhang Date: Thu, 21 Jul 2022 17:32:17 +0800 Subject: [PATCH] add shortcut to reload all maven projects (#847) Signed-off-by: Yan Zhang --- package.json | 17 ++++++++++++++++- package.nls.json | 3 ++- package.nls.zh-cn.json | 3 ++- package.nls.zh-tw.json | 3 ++- src/extension.ts | 5 +++++ 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index f21f6d3..9df1033 100644 --- a/package.json +++ b/package.json @@ -230,6 +230,12 @@ "command": "maven.favorites", "title": "%contributes.commands.maven.favorites%", "category": "Maven" + }, + { + "command": "maven.java.projectConfiguration.update", + "title": "%contributes.commands.maven.java.projectConfiguration.update%", + "icon": "$(sync)", + "category": "Maven" } ], "views": { @@ -359,6 +365,10 @@ { "command": "maven.goal.execute", "when": "isWorkspaceTrusted" + }, + { + "command": "maven.java.projectConfiguration.update", + "when": "false" } ], "explorer/context": [ @@ -374,6 +384,11 @@ } ], "view/title": [ + { + "command": "maven.java.projectConfiguration.update", + "when": "view == mavenProjects && javaLSReady", + "group": "navigation@05" + }, { "command": "maven.view.flat", "when": "view == mavenProjects && config.maven.view != flat", @@ -392,7 +407,7 @@ { "command": "maven.explorer.refresh", "when": "view == mavenProjects", - "group": "navigation@2" + "group": "overflow@2" } ], "view/item/context": [ diff --git a/package.nls.json b/package.nls.json index ef95c8d..9838201 100644 --- a/package.nls.json +++ b/package.nls.json @@ -41,5 +41,6 @@ "configuration.maven.settingsFile": "Specifies the absolute path of your maven configuration file, the default value is ~/.m2/settings.xml", "configuration.maven.dependency.enableConflictDiagnostics": "Specify whether to show diagnostics for conflict dependencies.", "configuration.maven.projectOpenBehavior": "Default method of opening newly created project.", - "configuration.maven.explorer.projectName": "Format of project node name shown in Maven explorer." + "configuration.maven.explorer.projectName": "Format of project node name shown in Maven explorer.", + "contributes.commands.maven.java.projectConfiguration.update": "Reload All Maven Projects" } diff --git a/package.nls.zh-cn.json b/package.nls.zh-cn.json index 3f8a4ef..0159ad0 100644 --- a/package.nls.zh-cn.json +++ b/package.nls.zh-cn.json @@ -41,5 +41,6 @@ "configuration.maven.settingsFile": "指定 maven 配置文件的绝对路径, 默认是 ~/.m2/settings.xml", "configuration.maven.dependency.enableConflictDiagnostics": "指定是否在 POM 文件中显示依赖冲突。", "configuration.maven.projectOpenBehavior": "新建项目的默认打开方式。", - "configuration.maven.explorer.projectName": "Maven 项目名称的显示格式。" + "configuration.maven.explorer.projectName": "Maven 项目名称的显示格式。", + "contributes.commands.maven.java.projectConfiguration.update": "重新加载所有 Maven 项目" } diff --git a/package.nls.zh-tw.json b/package.nls.zh-tw.json index 27a5abb..acde3e4 100644 --- a/package.nls.zh-tw.json +++ b/package.nls.zh-tw.json @@ -41,5 +41,6 @@ "configuration.maven.settingsFile": "指定 maven 設定文件的絕對路徑,預設是 ~/.m2/settings.xml", "configuration.maven.dependency.enableConflictDiagnostics": "指定是否在 POM 文件中顯示相依套件衝突。", "configuration.maven.projectOpenBehavior": "新建專案的預設打開方式。", - "configuration.maven.explorer.projectName": "Maven 專案名稱節點的格式。" + "configuration.maven.explorer.projectName": "Maven 專案名稱節點的格式。", + "contributes.commands.maven.java.projectConfiguration.update": "重新載入所有 Maven 專案" } diff --git a/src/extension.ts b/src/extension.ts index ed49991..f095f23 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -145,6 +145,11 @@ async function doActivate(_operationId: string, context: vscode.ExtensionContext // register artifact searcher if Java language server is activated if (isJavaExtEnabled()) { registerArtifactSearcher(context); + + // Reload All Maven Projects in JDTLS, impl in upstream + registerCommand(context, "maven.java.projectConfiguration.update", () => { + vscode.commands.executeCommand("java.projectConfiguration.update", mavenExplorerProvider.mavenProjectNodes.map(n => Uri.file(n.pomPath))); + }) } // diagnostic