From 9bab7bfef6bad99d622bb7e0c62fa2164c5cfaba Mon Sep 17 00:00:00 2001 From: Robert Huang <56649783@qq.com> Date: Fri, 10 Mar 2023 16:42:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8add=20pathContainsWorkspaceFol?= =?UTF-8?q?der=20setting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 6 ++++++ package.nls.json | 3 ++- package.nls.zh-cn.json | 3 ++- src/utils.ts | 4 ++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 2576482..0486f8b 100644 --- a/package.json +++ b/package.json @@ -106,6 +106,12 @@ "default": "YYYY-MM-DD HH:mm:ss", "description": "%auto-header-plus.dateFormat%" }, + "auto-header-plus.pathContainsWorkspaceFolder": { + "order": 4, + "type": "boolean", + "default": true, + "description": "%auto-header-plus.pathContainsWorkspaceFolder%" + }, "auto-header-plus.commandTimesout": { "order": 5, "type": "integer", diff --git a/package.nls.json b/package.nls.json index 887dc14..134f30a 100644 --- a/package.nls.json +++ b/package.nls.json @@ -22,5 +22,6 @@ "auto-header-plus.lineWidth": "Line width, include the start and end, set to `0` to disable", "auto-header-plus.middleLineEnd": "Middle line end string", "auto-header-plus.middleLineStart": "Middle line start string", - "auto-header-plus.commandTimesout": "Command timeout, unit: ms" + "auto-header-plus.commandTimesout": "Command timeout, unit: ms", + "auto-header-plus.pathContainsWorkspaceFolder": "Path contains workspace folder name, disable it if your file path is too long, such as java maven project, only works in `RELATIVEPATH`" } diff --git a/package.nls.zh-cn.json b/package.nls.zh-cn.json index 896b671..6f6b6c4 100644 --- a/package.nls.zh-cn.json +++ b/package.nls.zh-cn.json @@ -22,5 +22,6 @@ "auto-header-plus.lineWidth": "行宽度, 包括开始和结束, 如果值为0, 则不会自动填充", "auto-header-plus.middleLineEnd": "中间行结束字符串", "auto-header-plus.middleLineStart": "中间行开始字符串", - "auto-header-plus.commandTimesout": "命令超时时间, 单位: ms" + "auto-header-plus.commandTimesout": "命令超时时间, 单位: ms", + "auto-header-plus.pathContainsWorkspaceFolder": "路径是否包含项目工作区文件夹,如果你的文件路径太长,可以关闭它,例如java maven项目,仅在`RELATIVEPATH`中生效" } diff --git a/src/utils.ts b/src/utils.ts index 2189c0c..2d7ae33 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -2,7 +2,7 @@ * @Author : Robert Huang<56649783@qq.com> * * @CreatedDate : 2023-02-04 20:40:57 * * @LastEditors : Robert Huang<56649783@qq.com> * - * @LastEditDate : 2023-03-10 16:36:06 * + * @LastEditDate : 2023-03-10 16:41:14 * * @FilePath : auto-header-plus/src/utils.ts * * @CopyRight : MerBleueAviation * *****************************************************************************/ @@ -193,7 +193,7 @@ const getPathValue = (key: string, uri: vscode.Uri): string => { case 'FULLPATH': return uri?.fsPath.replace(/\\/g, '/') || '' case 'RELATIVEPATH': { - return vscode.workspace.asRelativePath(uri, true).replace(/\\/g, '/') || '' + return config().get("pathContainsWorkspaceFolder") ? vscode.workspace.asRelativePath(uri, true).replace(/\\/g, '/') || '' : vscode.workspace.asRelativePath(uri, false).replace(/\\/g, '/') || '' } case 'SHORTNAMEPATH': return path.basename(uri?.fsPath.replace(/\\/g, '/')) || ''