Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
| 功能 | 说明 |
| --- | --- |
| 跳转到定义 | 类型、方法、构造器、字段、枚举常量、局部变量、参数、类型参数、注解及其属性;按导入、同包、通配导入、嵌套、继承链、调用参数个数和实参类型解析,支持调用链 `a.b().c` 和 `Foo.<T>bar()` |
| 实现 / 父类双向跳转 | 接口/父类向下跳转到实现类与重写方法(`textDocument/implementation`),实现类/重写方法向上跳回接口与父类声明(`javaNavigation/superDeclarations`),并在行首绘制绿色 `I↓`/`I↑` 与蓝色 `O↓`/`O↑` 导航图标 |
| Lombok | `@Data`/`@Getter`/`@Setter` 生成的访问器跳到字段,`@Builder`、`@Slf4j`、构造器注解跳到注解本身(与 JDT LS 一致) |
| 跳进 JDK | 项目里找不到的名字到本机 JDK 的 `src.zip` 里找,`String`、`List`、`hashCode()` 等都能跳,并能在 JDK 源码里继续跳 |
| 跳进依赖库 | Maven 项目的依赖(含传递依赖)从本地仓库读:下载过 `-sources.jar` 的打开源码,否则打开从 `.class` 生成的签名存根(类、成员类、字段、构造器、方法,参数名取自调试信息),并能在里面继续跳;`@Schema(description = ...)`、`log.info(...)`、`StrUtil.isEmpty(...)` 都能跳 |
Expand Down Expand Up @@ -146,16 +147,19 @@ go run ./cmd/nav-bench -h # 在真实项目上测命中率、延迟和
`testdata/stubs`,并把 `stubFormat` 加一,让旧版本解压的副本不再被复用。

`dist/` 里每个平台一个 zip(`darwin-arm64`、`darwin-x64`、`windows-x64`、`windows-arm64`),包内只有
`plugin.json`、`bin/java-navigation`(Windows 是 `bin/java-navigation.exe`,对应平台包的 `plugin.json` 也写这个路径)、
`LICENSE` 和 `THIRD_PARTY_NOTICES.md`。
`plugin.json`、`bin/java-navigation`(Windows 是 `bin/java-navigation.exe`,对应平台包的 `plugin.json` 为语言服务器与 `--backend` 后端均写这个路径)、
`LICENSE`、`THIRD_PARTY_NOTICES.md` 和 `vendor/LICENSE`。

语言服务器可以单独运行调试:
语言服务器和后端都可以单独运行调试:

```sh
go run ./cmd/java-navigation --state-dir /tmp/jn-state # 通过 stdin/stdout 说 LSP,日志写 stderr
go run ./cmd/java-navigation --backend # 以 Lithe 插件后端运行(经 litheLogging 上报日志,不写 stderr)
go run ./cmd/java-navigation --version
```

双向导航后端复用随仓固定的 Go SDK(见 `sdk.lock.json`),将高频收集 `javaNavigation.collect` 设为静默成功、用户点击 `javaNavigation.invoke` 作为关键操作由 SDK 自动记 `INFO`,注册或上下文读取失败通过 `degraded` 上报受控类别(`nav.actions_registration_failed`、`nav.contexts_unavailable`),不写本地文件也不输出路径或源码。

## 发布

推送与 `plugin.json` 版本一致的 tag `v<version>`,`release.yml` 会打包并创建 GitHub Release。
Expand Down
6 changes: 6 additions & 0 deletions THIRD_PARTY_NOTICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,9 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```

## Lithe Plugin Go SDK

- Source: https://github.com/Lithe-IDEA/Lithe-core-rust (`shared/plugins/sdk/go/lithe`, revision `0d79e17fde389f559bcb3eeeb11baace13895576`)
- Used in: `internal/lithesdk/lithe/` (copied verbatim from upstream without modifications; checksums pinned in `sdk.lock.json`)
- License: see `vendor/LICENSE`
5 changes: 5 additions & 0 deletions cmd/java-navigation/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"os"
"runtime/debug"

"github.com/Lithe-IDEA/lithe-plugin-java-navigation/internal/backend"
"github.com/Lithe-IDEA/lithe-plugin-java-navigation/internal/deps"
"github.com/Lithe-IDEA/lithe-plugin-java-navigation/internal/jdk"
"github.com/Lithe-IDEA/lithe-plugin-java-navigation/internal/lsp"
Expand All @@ -36,12 +37,16 @@ func main() {
printVersion := flag.Bool("version", false, "print the version and exit")
noJDK := flag.Bool("no-jdk", false, "do not navigate into the JDK's sources")
noDeps := flag.Bool("no-dependencies", false, "do not navigate into dependency jars (Maven dependencies and the jars the project keeps)")
runBackend := flag.Bool("backend", false, "run as a Lithe plugin backend over stdio")
flag.Bool("stdio", true, "speak LSP over standard input and output (the only transport)")
flag.Parse()
if *printVersion {
fmt.Println("java-navigation", version)
return
}
if *runBackend {
os.Exit(backend.Run(version))
}
// Standard output carries the protocol; diagnostics go to standard error,
// which the host records in the server's log.
logger := log.New(os.Stderr, "java-navigation: ", log.LstdFlags|log.Lmsgprefix)
Expand Down
13 changes: 13 additions & 0 deletions docs/releases/v0.2.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Java Support Lite 0.2.0

## 中文

- 新增接口、父类、方法与实现类/子类之间的双向跳转:语言服务器实现 `textDocument/implementation`、`javaNavigation/superDeclarations` 与 `javaNavigation/markers`,支持双向查找与反向子类型关系解析。
- 通过同二进制 `--backend` 轻量后端向编辑器行号栏提供语义导航图标:绿色 `I↓` / `I↑`(接口实现)与蓝色 `O↓` / `O↑`(继承重写),并按宿主能力在旧版宿主上自动回退为通用导航图标;需要 Lithe 桌面端 0.8.17 或更高版本以获得完整交互体验。

---

## English

- Add bidirectional navigation between interfaces, superclasses, methods, and their implementations/subclasses: implement `textDocument/implementation`, `javaNavigation/superDeclarations`, and `javaNavigation/markers` with reverse subtype graph resolution.
- Provide IDEA-style editor gutter icons (`I↓` / `I↑` in green for interface implementations and `O↓` / `O↑` in blue for inheritance overrides) via the single-binary `--backend` mode, falling back to generic navigation icons on older hosts; Lithe Desktop 0.8.17 or later is recommended for full gutter icon support.
Loading
Loading