点击跳转到实现 为 VS Code 增加可点击的 CodeLens 按钮,补齐“无法直接鼠标点击跳转实现”的使用体验。
功能
在符号上方显示可点击按钮:
↙实现 / ↙实现(N)
↖接口
支持显示实现数量(N):
对“转到实现”动作,基于语言服务返回结果统计数量。
Go / Python 特化规则:
抽象/接口类符号:显示“转到实现”。
具体方法(以及 Go 的 struct/class 符号):显示“转到接口”。
其他语言保持通用规则。
运行时中英文本地化(跟随 VS Code 显示语言)。
安装
方式 1:从 VSIX 安装
打开 VS Code 命令面板:Extensions: Install from VSIX...
选择打包文件,例如:clicktoimpl-0.0.2.vsix
方式 2:开发调试
npm install
npm run compile
# 在 VS Code 中按 F5 启动 Extension Development Host
配置
clicktoimpl.symbolKinds
控制哪些符号类型显示 CodeLens。
类型:string[]
默认:["class", "interface", "method"]
可选值:
class
interface
method
function
property
说明:Go 中 struct 按 class 语义兼容处理。
命令
clicktoimpl.goToImplementationAtPosition
clicktoimpl.goToInterfaceAtPosition
一般无需手动执行,点击 CodeLens 即可触发。
已知说明
实现数量依赖语言服务(LSP)能力;不支持时会自动回退为不带数量的文案。
大文件场景下有查询上限保护,以避免过多实现查询造成卡顿。
ClickToImplementation
Click To Implementation adds clickable CodeLens actions in VS Code to bridge the gap where “Go to Implementation” is not directly mouse-clickable by default.
Features
Clickable CodeLens actions above symbols:
↙ Go to Implementation / ↙ Go to Implementation (N)
↗ Go to Interface
Implementation count support (N):
For implementation actions, counts locations returned by the language server.
Go/Python specialized behavior:
Interface/abstract-like symbols: show Go to Implementation.
Concrete methods (and Go struct/class symbols): show Go to Interface.
Other languages keep generic behavior.
Runtime localization for Chinese and English (follows VS Code display language).
Installation
Option 1: Install from VSIX
Open Command Palette: Extensions: Install from VSIX...
Select the package file, e.g. clicktoimpl-0.0.2.vsix
Option 2: Development mode
npm install
npm run compile
# Press F5 in VS Code to launch Extension Development Host
Configuration
clicktoimpl.symbolKinds
Controls which symbol kinds show CodeLens actions.
Type: string[]
Default: ["class", "interface", "method"]
Supported values:
class
interface
method
function
property
Note: Go struct is treated as class for compatibility.
Commands
clicktoimpl.goToImplementationAtPosition
clicktoimpl.goToInterfaceAtPosition
You usually do not need to run these manually; clicking the CodeLens triggers them.
Notes
Implementation count depends on language server support. If unavailable, the title gracefully falls back to the non-count version.
A per-render query cap is applied to avoid excessive implementation lookups in large files.