Skip to content

Commit b65f2f0

Browse files
authored
chore: bump version to 0.2.0 (#90) (#90)
* chore: Add Java to supported languages list * update version * feat: automatically install rust LSP server * fix: git error when installing pylsp * update * update pylsp submodule * update
1 parent 9befcce commit b65f2f0

File tree

9 files changed

+47
-31
lines changed

9 files changed

+47
-31
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[submodule "pylsp"]
22
path = pylsp
3-
url = git@github.com:Hoblovski/python-lsp-server.git
3+
url = https://github.com/Hoblovski/python-lsp-server.git
44
branch = abc

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,14 @@ $ exit
117117

118118
ABCoder currently supports the following languages:
119119

120-
| Language | Parser | Writer |
121-
| -------- | ----------- | ----------- |
122-
| Go |||
123-
| Rust || Coming Soon |
124-
| C || Coming Soon |
125-
| Python || Coming Soon |
126-
| TypeScript || Coming Soon |
120+
| Language | Parser | Writer |
121+
| -------- | ------ | ----------- |
122+
| Go |||
123+
| Rust || Coming Soon |
124+
| C || Coming Soon |
125+
| Python || Coming Soon |
126+
| JS/TS || Coming Soon |
127+
| Java || Coming Soon |
127128

128129

129130
# Getting Involved

docs/lsp-installation-en.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ To parse dependencies between symbols in a repository, the abcoder parser requir
44

55
The mapping between languages and language servers is as follows:
66

7-
| Language | Language Server | Executable |
8-
| -------- | ------------------------- | --------------- |
9-
| Go | Does not use LSP, uses built-in parser | / |
10-
| Rust | rust-analyzer | rust-analyzer |
11-
| Python | (Modified) python-lsp-server | pylsp |
12-
| C | clangd-18 | clangd-18 |
7+
| Language | Language Server | Essential Environment |
8+
| ---------- | ------------------------------------------------------------------ | --------------------- |
9+
| Go | NA | golang 1.23+ |
10+
| TypeScript | NA | node.js 20+ |
11+
| Rust | rust-analyzer (official) | rust-toolchain |
12+
| Python | pylsp ([modified](https://github.com/Hoblovski/python-lsp-server)) | Python 3.9+ |
13+
| C | clangd-18 (official) | clang 18+ |
14+
| Java | eclipse-jdtls (official) | java 17+ |
1315

1416
Ensure the corresponding executable is in PATH before running abcoder.
1517

docs/lsp-installation-zh.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44

55
语言和 language server 的对应关系如下
66

7-
| 语言 | Language server | 可执行文件 |
8-
| --- | --- | --- |
9-
| Go | 不使用 LSP,使用内置 parser | / |
10-
| Rust | rust-analyzer | rust-analyzer |
11-
| Python | (修改后的) python-lsp-server | pylsp |
12-
| C | clangd-18 | clangd-18 |
7+
| 语言 | Language server | 必要运行环境 |
8+
| ---------- | -------------------------------------------------------------- | -------------- |
9+
| Go | NA | golang 1.23+ |
10+
| TypeScript | NA | node.js 20+ |
11+
| Rust | rust-analyzer (官方) | rust-toolchain |
12+
| Python | pylsp ([修改](https://github.com/Hoblovski/python-lsp-server)) | python 3.9+ |
13+
| C | clangd-18 (官方) | clang 18+ |
14+
| Java | eclipse-jdtls (官方) | java 17+ |
1315

1416
按如下教程完成安装后,在运行 abcoder 前请确保 PATH 中有对应可执行文件
1517

lang/parse.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ func installLanguageServer(language uniast.Language) (string, error) {
192192
return cxx.InstallLanguageServer()
193193
case uniast.Python:
194194
return python.InstallLanguageServer()
195+
case uniast.Rust:
196+
return rust.InstallLanguageServer()
195197
default:
196198
return "", fmt.Errorf("auto installation not supported for language: %s", language)
197199
}

lang/python/lib.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,14 @@ func InstallLanguageServer() (string, error) {
6666
}
6767
// git submodule init
6868
log.Error("Installing pylsp...")
69-
if err := exec.Command("git", "submodule", "init").Run(); err != nil {
70-
log.Error("git submodule init failed: %v", err)
71-
return "", err
72-
}
73-
// git submodule update
74-
if err := exec.Command("git", "submodule", "update").Run(); err != nil {
75-
log.Error("git submodule update failed: %v", err)
69+
if err := exec.Command("git", "submodule", "update", "--remote", "--init", "-f").Run(); err != nil {
70+
log.Error("git clone failed: %v", err)
7671
return "", err
7772
}
7873
// python -m pip install -e projectRoot/pylsp
7974
log.Error("Running `python3 -m pip install -e pylsp/` .\nThis might take some time, make sure the network connection is ok.")
80-
if err := exec.Command("python3", "-m", "pip", "install", "-e", "pylsp/").Run(); err != nil {
81-
log.Error("python -m pip install failed: %v", err)
75+
if err := exec.Command("python3", "-m", "pip", "install", "--break-system-packages", "-e", "pylsp/").Run(); err != nil {
76+
log.Error("python3 -m pip install failed: %v", err)
8277
return "", err
8378
}
8479
if err := exec.Command("pylsp", "--version").Run(); err != nil {

lang/rust/repo.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ import (
2929

3030
const MaxWaitDuration = 5 * time.Minute
3131

32+
func InstallLanguageServer() (string, error) {
33+
log.Info("Installing rust-analyzer...")
34+
// check rustup exe exists
35+
if _, err := exec.LookPath("rustup"); err != nil {
36+
return "", fmt.Errorf("failed to find rustup, please install rustup first: https://rustup.rs")
37+
}
38+
if err := RunCmdInDir(".", "rustup", "component", "add", "rust-analyzer"); err != nil {
39+
return "", fmt.Errorf("failed to install rust-analyzer: %w", err)
40+
}
41+
return "rust-analyzer", nil
42+
}
43+
3244
func CheckRepo(repo string) (string, time.Duration) {
3345
// NOTICE: open the Cargo.toml file is required for Rust projects
3446
openfile := utils.FirstFile(repo, ".rs", filepath.Join(repo, "target"))

main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,12 @@ Action:
5757
agent run as an Agent for all repo ASTs (*.json) in the specific directory. WIP: only support code-analyzing at present.
5858
version print the version of abcoder
5959
Language:
60+
go for golang codes
6061
rust for rust codes
6162
cxx for c codes (cpp support is on the way)
62-
go for golang codes
6363
python for python codes
64+
ts for typescript codes
65+
js for javascript codes
6466
java for java codes
6567
`
6668

version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@
1717
package main
1818

1919
const (
20-
Version = "0.1.0"
20+
Version = "0.2.0"
2121
)

0 commit comments

Comments
 (0)