Path Link
Turn file path strings in your source code into clickable links. Cmd/Ctrl+Click opens the target file.
It comes with one rule already in place for __inline('...'). Edit it, add more, or delete it.
Usage
__inline('../common-util/mtg_bridge/index.js')
The path gets an underline. Cmd/Ctrl+click opens it.
Setting
Everything lives in one array: pathLink.rules. Each entry is a regex with one capture group for the file path.
Already there after install:
"pathLink.rules": [
{ "pattern": "__inline\\(\\s*['\"](https://github.com/kkaticld/path-link/blob/HEAD/[^'\"]+)['\"]\\s*\\)" }
]
Add another:
"pathLink.rules": [
{ "pattern": "__inline\\(\\s*['\"](https://github.com/kkaticld/path-link/blob/HEAD/[^'\"]+)['\"]\\s*\\)" },
{ "pattern": "require\\(\\s*['\"](https://github.com/kkaticld/path-link/blob/HEAD/[^'\"]+)['\"]\\s*\\)" }
]
Remove the built-in one by deleting that entry.
Notes
- Paths resolve relative to the current file. Absolute paths are used as-is.
- If the target file does not exist, no link is created.
- Navigation only. It does not resolve symbol definitions.
中文
把源码里的文件路径字符串变成可点击的链接,Cmd/Ctrl+点击打开目标文件。
安装后 pathLink.rules 里已预置一条 __inline('...') 规则,可改、可删、可加。
配置项只有一个数组 pathLink.rules,每项是个正则,必须含一个捕获组指向文件路径。删掉数组项就等于不再识别 __inline。
路径按当前文件所在目录解析;文件不存在则不生成链接。本扩展只做文件跳转,不解析变量定义。