From 9fb7516ea71701d0d3ffa2ab6cad64a398dd8f00 Mon Sep 17 00:00:00 2001 From: Yi Duan Date: Sat, 20 Sep 2025 18:12:45 +0800 Subject: [PATCH 1/7] chore: Add Java to supported languages list --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 867c06ef..1b84938e 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,7 @@ ABCoder currently supports the following languages: | C | ✅ | Coming Soon | | Python | ✅ | Coming Soon | | TypeScript | ✅ | Coming Soon | +| Java | ✅ | Coming Soon | # Getting Involved From 282db4e228cb3db3fed176456bce480c6c589932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E4=BB=AA?= Date: Sat, 20 Sep 2025 22:58:22 +0800 Subject: [PATCH 2/7] update version --- README.md | 16 ++++++++-------- docs/lsp-installation-en.md | 14 ++++++++------ docs/lsp-installation-zh.md | 14 ++++++++------ version.go | 2 +- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 1b84938e..530830b9 100644 --- a/README.md +++ b/README.md @@ -117,14 +117,14 @@ $ exit ABCoder currently supports the following languages: -| Language | Parser | Writer | -| -------- | ----------- | ----------- | -| Go | ✅ | ✅ | -| Rust | ✅ | Coming Soon | -| C | ✅ | Coming Soon | -| Python | ✅ | Coming Soon | -| TypeScript | ✅ | Coming Soon | -| Java | ✅ | Coming Soon | +| Language | Parser | Writer | +| ---------- | ------ | ----------- | +| Go | ✅ | ✅ | +| Rust | ✅ | Coming Soon | +| C | ✅ | Coming Soon | +| Python | ✅ | Coming Soon | +| TypeScript | ✅ | Coming Soon | +| Java | ✅ | Coming Soon | # Getting Involved diff --git a/docs/lsp-installation-en.md b/docs/lsp-installation-en.md index 13b6862f..d43bc82d 100644 --- a/docs/lsp-installation-en.md +++ b/docs/lsp-installation-en.md @@ -4,12 +4,14 @@ To parse dependencies between symbols in a repository, the abcoder parser requir The mapping between languages and language servers is as follows: -| Language | Language Server | Executable | -| -------- | ------------------------- | --------------- | -| Go | Does not use LSP, uses built-in parser | / | -| Rust | rust-analyzer | rust-analyzer | -| Python | (Modified) python-lsp-server | pylsp | -| C | clangd-18 | clangd-18 | +| Language | Language Server | Essential Environment | +| ---------- | ------------------------------------------------------------------------------------- | --------------------- | +| Go | NA | golang 1.23+ | +| TypeScript | NA | node.js 20+ | +| Rust | rust-analyzer (official) | rust-toolchain | +| Python | pylsp ( [modified](https://github.com/Hoblovski/python-lsp-server) based on official) | Python 3.9+ | +| C | clangd-18 (official) | clang 18+ | +| Java | eclipse-jdtls (official) | openjdk 17+ | Ensure the corresponding executable is in PATH before running abcoder. diff --git a/docs/lsp-installation-zh.md b/docs/lsp-installation-zh.md index 5e9d7553..e5539d80 100644 --- a/docs/lsp-installation-zh.md +++ b/docs/lsp-installation-zh.md @@ -4,12 +4,14 @@ 语言和 language server 的对应关系如下 -| 语言 | Language server | 可执行文件 | -| --- | --- | --- | -| Go | 不使用 LSP,使用内置 parser | / | -| Rust | rust-analyzer | rust-analyzer | -| Python | (修改后的) python-lsp-server | pylsp | -| C | clangd-18 | clangd-18 | +| 语言 | Language server | 必要运行环境 | +| ---------- | ---------------------------------------------------------------------- | -------------- | +| Go | NA | golang 1.23+ | +| TypeScript | NA | node.js 20+ | +| Rust | rust-analyzer (官方) | rust-toolchain | +| Python | pylsp (基于官方[修改](https://github.com/Hoblovski/python-lsp-server)) | Python 3.9+ | +| C | clangd-18 (官方) | clang 18+ | +| Java | eclipse-jdtls (官方) | openjdk 17+ | 按如下教程完成安装后,在运行 abcoder 前请确保 PATH 中有对应可执行文件 diff --git a/version.go b/version.go index cfba6b04..d48fcd7e 100644 --- a/version.go +++ b/version.go @@ -17,5 +17,5 @@ package main const ( - Version = "0.1.0" + Version = "0.1.3" ) From 9c004c8f96209db12407c47ea7a660c2fedb144f Mon Sep 17 00:00:00 2001 From: "duanyi.aster" Date: Tue, 23 Sep 2025 10:55:10 +0800 Subject: [PATCH 3/7] feat: automatically install rust LSP server --- lang/parse.go | 2 ++ lang/rust/repo.go | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/lang/parse.go b/lang/parse.go index 7dcc22d5..ba7acd51 100644 --- a/lang/parse.go +++ b/lang/parse.go @@ -192,6 +192,8 @@ func installLanguageServer(language uniast.Language) (string, error) { return cxx.InstallLanguageServer() case uniast.Python: return python.InstallLanguageServer() + case uniast.Rust: + return rust.InstallLanguageServer() default: return "", fmt.Errorf("auto installation not supported for language: %s", language) } diff --git a/lang/rust/repo.go b/lang/rust/repo.go index 0bf2c041..ab32058a 100644 --- a/lang/rust/repo.go +++ b/lang/rust/repo.go @@ -29,6 +29,17 @@ import ( const MaxWaitDuration = 5 * time.Minute +func InstallLanguageServer() (string, error) { + // check rustup exe exists + if _, err := exec.LookPath("rustup"); err != nil { + return "", fmt.Errorf("failed to find rustup, please install rustup first: https://rustup.rs") + } + if err := RunCmdInDir(".", "rustup", "component", "add", "rust-analyzer"); err != nil { + return "", fmt.Errorf("failed to install rust-analyzer: %w", err) + } + return "rust-analyzer", nil +} + func CheckRepo(repo string) (string, time.Duration) { // NOTICE: open the Cargo.toml file is required for Rust projects openfile := utils.FirstFile(repo, ".rs", filepath.Join(repo, "target")) From d6121d3f0d5d0de6773e8b0dc7885391d00dae5d Mon Sep 17 00:00:00 2001 From: "duanyi.aster" Date: Tue, 23 Sep 2025 11:25:01 +0800 Subject: [PATCH 4/7] fix: git error when installing pylsp --- lang/python/lib.go | 9 ++------- pylsp | 2 +- version.go | 2 +- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/lang/python/lib.go b/lang/python/lib.go index 17b15a91..e791cb94 100644 --- a/lang/python/lib.go +++ b/lang/python/lib.go @@ -66,13 +66,8 @@ func InstallLanguageServer() (string, error) { } // git submodule init log.Error("Installing pylsp...") - if err := exec.Command("git", "submodule", "init").Run(); err != nil { - log.Error("git submodule init failed: %v", err) - return "", err - } - // git submodule update - if err := exec.Command("git", "submodule", "update").Run(); err != nil { - log.Error("git submodule update failed: %v", err) + if err := exec.Command("git", "clone", "https://github.com/Hoblovski/python-lsp-server.git", "pylsp").Run(); err != nil { + log.Error("git clone failed: %v", err) return "", err } // python -m pip install -e projectRoot/pylsp diff --git a/pylsp b/pylsp index 0e1ed4c2..902fb5b3 160000 --- a/pylsp +++ b/pylsp @@ -1 +1 @@ -Subproject commit 0e1ed4c2785b5ff98148ded317b062ec31b932fc +Subproject commit 902fb5b3c91f96f6302d9639a296733451584679 diff --git a/version.go b/version.go index d48fcd7e..29c9c209 100644 --- a/version.go +++ b/version.go @@ -17,5 +17,5 @@ package main const ( - Version = "0.1.3" + Version = "0.2.0" ) From 306cacdb9ef284f2f1d51522197c3aec60e4eb4c Mon Sep 17 00:00:00 2001 From: "duanyi.aster" Date: Tue, 23 Sep 2025 11:42:59 +0800 Subject: [PATCH 5/7] update --- lang/rust/repo.go | 1 + 1 file changed, 1 insertion(+) diff --git a/lang/rust/repo.go b/lang/rust/repo.go index ab32058a..21e69b7f 100644 --- a/lang/rust/repo.go +++ b/lang/rust/repo.go @@ -30,6 +30,7 @@ import ( const MaxWaitDuration = 5 * time.Minute func InstallLanguageServer() (string, error) { + log.Info("Installing rust-analyzer...") // check rustup exe exists if _, err := exec.LookPath("rustup"); err != nil { return "", fmt.Errorf("failed to find rustup, please install rustup first: https://rustup.rs") From 317fdc45679318c2020a48088dac706f203b82b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E4=BB=AA?= Date: Tue, 23 Sep 2025 13:30:32 +0800 Subject: [PATCH 6/7] update pylsp submodule --- .gitmodules | 2 +- lang/python/lib.go | 6 +++--- pylsp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitmodules b/.gitmodules index 51d3ee3c..45907e2c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "pylsp"] path = pylsp - url = git@github.com:Hoblovski/python-lsp-server.git + url = https://github.com/Hoblovski/python-lsp-server.git branch = abc diff --git a/lang/python/lib.go b/lang/python/lib.go index e791cb94..9b93288b 100644 --- a/lang/python/lib.go +++ b/lang/python/lib.go @@ -66,14 +66,14 @@ func InstallLanguageServer() (string, error) { } // git submodule init log.Error("Installing pylsp...") - if err := exec.Command("git", "clone", "https://github.com/Hoblovski/python-lsp-server.git", "pylsp").Run(); err != nil { + if err := exec.Command("git", "submodule", "update", "--remote", "--init", "-f").Run(); err != nil { log.Error("git clone failed: %v", err) return "", err } // python -m pip install -e projectRoot/pylsp log.Error("Running `python3 -m pip install -e pylsp/` .\nThis might take some time, make sure the network connection is ok.") - if err := exec.Command("python3", "-m", "pip", "install", "-e", "pylsp/").Run(); err != nil { - log.Error("python -m pip install failed: %v", err) + if err := exec.Command("python3", "-m", "pip", "install", "--break-system-packages", "-e", "pylsp/").Run(); err != nil { + log.Error("python3 -m pip install failed: %v", err) return "", err } if err := exec.Command("pylsp", "--version").Run(); err != nil { diff --git a/pylsp b/pylsp index 902fb5b3..0e1ed4c2 160000 --- a/pylsp +++ b/pylsp @@ -1 +1 @@ -Subproject commit 902fb5b3c91f96f6302d9639a296733451584679 +Subproject commit 0e1ed4c2785b5ff98148ded317b062ec31b932fc From ec25a0bd6b5c08b985137db781a93a2cceea56b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E4=BB=AA?= Date: Tue, 23 Sep 2025 13:36:55 +0800 Subject: [PATCH 7/7] update --- README.md | 16 ++++++++-------- docs/lsp-installation-en.md | 16 ++++++++-------- docs/lsp-installation-zh.md | 16 ++++++++-------- main.go | 4 +++- 4 files changed, 27 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 530830b9..4e363f0c 100644 --- a/README.md +++ b/README.md @@ -117,14 +117,14 @@ $ exit ABCoder currently supports the following languages: -| Language | Parser | Writer | -| ---------- | ------ | ----------- | -| Go | ✅ | ✅ | -| Rust | ✅ | Coming Soon | -| C | ✅ | Coming Soon | -| Python | ✅ | Coming Soon | -| TypeScript | ✅ | Coming Soon | -| Java | ✅ | Coming Soon | +| Language | Parser | Writer | +| -------- | ------ | ----------- | +| Go | ✅ | ✅ | +| Rust | ✅ | Coming Soon | +| C | ✅ | Coming Soon | +| Python | ✅ | Coming Soon | +| JS/TS | ✅ | Coming Soon | +| Java | ✅ | Coming Soon | # Getting Involved diff --git a/docs/lsp-installation-en.md b/docs/lsp-installation-en.md index d43bc82d..4046e464 100644 --- a/docs/lsp-installation-en.md +++ b/docs/lsp-installation-en.md @@ -4,14 +4,14 @@ To parse dependencies between symbols in a repository, the abcoder parser requir The mapping between languages and language servers is as follows: -| Language | Language Server | Essential Environment | -| ---------- | ------------------------------------------------------------------------------------- | --------------------- | -| Go | NA | golang 1.23+ | -| TypeScript | NA | node.js 20+ | -| Rust | rust-analyzer (official) | rust-toolchain | -| Python | pylsp ( [modified](https://github.com/Hoblovski/python-lsp-server) based on official) | Python 3.9+ | -| C | clangd-18 (official) | clang 18+ | -| Java | eclipse-jdtls (official) | openjdk 17+ | +| Language | Language Server | Essential Environment | +| ---------- | ------------------------------------------------------------------ | --------------------- | +| Go | NA | golang 1.23+ | +| TypeScript | NA | node.js 20+ | +| Rust | rust-analyzer (official) | rust-toolchain | +| Python | pylsp ([modified](https://github.com/Hoblovski/python-lsp-server)) | Python 3.9+ | +| C | clangd-18 (official) | clang 18+ | +| Java | eclipse-jdtls (official) | java 17+ | Ensure the corresponding executable is in PATH before running abcoder. diff --git a/docs/lsp-installation-zh.md b/docs/lsp-installation-zh.md index e5539d80..f3503fbd 100644 --- a/docs/lsp-installation-zh.md +++ b/docs/lsp-installation-zh.md @@ -4,14 +4,14 @@ 语言和 language server 的对应关系如下 -| 语言 | Language server | 必要运行环境 | -| ---------- | ---------------------------------------------------------------------- | -------------- | -| Go | NA | golang 1.23+ | -| TypeScript | NA | node.js 20+ | -| Rust | rust-analyzer (官方) | rust-toolchain | -| Python | pylsp (基于官方[修改](https://github.com/Hoblovski/python-lsp-server)) | Python 3.9+ | -| C | clangd-18 (官方) | clang 18+ | -| Java | eclipse-jdtls (官方) | openjdk 17+ | +| 语言 | Language server | 必要运行环境 | +| ---------- | -------------------------------------------------------------- | -------------- | +| Go | NA | golang 1.23+ | +| TypeScript | NA | node.js 20+ | +| Rust | rust-analyzer (官方) | rust-toolchain | +| Python | pylsp ([修改](https://github.com/Hoblovski/python-lsp-server)) | python 3.9+ | +| C | clangd-18 (官方) | clang 18+ | +| Java | eclipse-jdtls (官方) | java 17+ | 按如下教程完成安装后,在运行 abcoder 前请确保 PATH 中有对应可执行文件 diff --git a/main.go b/main.go index 83885554..762aa38b 100644 --- a/main.go +++ b/main.go @@ -57,10 +57,12 @@ Action: agent run as an Agent for all repo ASTs (*.json) in the specific directory. WIP: only support code-analyzing at present. version print the version of abcoder Language: + go for golang codes rust for rust codes cxx for c codes (cpp support is on the way) - go for golang codes python for python codes + ts for typescript codes + js for javascript codes java for java codes `