feat: 支持文件路径标签带行号点击跳转
- 前端解析 file.v:1-2 格式,提取文件名和行号 - 新增 openFilePathTag 命令,支持智能文件查找 - 修复模板字符串中正则表达式转义问题 - 不影响现有 openFile 和 diff 功能
This commit is contained in:
@ -46,10 +46,21 @@ export function getFilePathTagScript(): string {
|
||||
return `
|
||||
// 处理文件路径标签点击
|
||||
function handleFilePathClick(filePath) {
|
||||
vscode.postMessage({
|
||||
command: 'openFile',
|
||||
filePath: filePath
|
||||
});
|
||||
// 解析文件路径,支持 file.v:5-8 格式
|
||||
const match = filePath.match(/^(.+?):(\\d+)-(\\d+)$/);
|
||||
if (match) {
|
||||
vscode.postMessage({
|
||||
command: 'openFilePathTag',
|
||||
filePath: match[1],
|
||||
startLine: parseInt(match[2]),
|
||||
endLine: parseInt(match[3])
|
||||
});
|
||||
} else {
|
||||
vscode.postMessage({
|
||||
command: 'openFilePathTag',
|
||||
filePath: filePath
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 创建文件路径标签
|
||||
|
||||
Reference in New Issue
Block a user