Skip to content

Commit 6c4e40c

Browse files
committed
docs: docs on how to install LSP
1 parent 88f4701 commit 6c4e40c

File tree

3 files changed

+94
-39
lines changed

3 files changed

+94
-39
lines changed

README.md

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ see [UniAST Specification](docs/uniast-zh.md)
2525

2626

2727
# Quick Start
28-
It is easiest to start with Golang. For other languages, see language specific installations below.
29-
3028
## Use ABCoder as a MCP server
3129

3230
1. Install ABCoder:
@@ -41,13 +39,15 @@ It is easiest to start with Golang. For other languages, see language specific i
4139
abcoder parse {language} {repo-path} > xxx.json
4240
```
4341

44-
For example:
42+
For example, to parse a Go repository:
4543

4644
```bash
4745
git clone https://github.com/cloudwego/localsession.git localsession
4846
abcoder parse go localsession -o /abcoder-asts/localsession.json
4947
```
5048

49+
To parse repositories in other languages, [install the corresponding langauge server first](./docs/lsp-installation-en.md).
50+
5151
3. Integrate ABCoder's MCP tools into your AI agent.
5252
5353
```json
@@ -113,49 +113,17 @@ $ exit
113113

114114
- NOTICE: This feature is Work-In-Progress. It only supports code analysis at present.
115115

116-
117116
# Supported Languages
118117

119118
ABCoder currently supports the following languages:
120119

121120
| Language | Parser | Writer |
122121
| -------- | ----------- | ----------- |
123-
| Go |||
124-
| Rust || Coming Soon |
125-
| C |||
126-
| Python | Coming Soon | Coming Soon |
127-
128-
# Language Specific Installations
129-
## Python
130-
* Install the language server: a custom pylsp (as a git submodule).
131-
You might use conda or venv to keep a separate python package environment.
132-
```bash
133-
$ git submodule init
134-
$ git submodule update
135-
$ cd pylsp
136-
$ pip install -e . # you might do this in a separate conda/venv environment
137-
$ export PATH=$(realpath ./bin):$PATH
138-
$ pylsp --version # verify pylsp installation is successful
139-
```
140-
141-
* Verify the installation:
142-
```
143-
# start from abcoder repository root dir
144-
$ go build
145-
$ ./
146-
```
122+
| Go |||
123+
| Rust || Coming Soon |
124+
| C || Coming Soon |
125+
| Python || Coming Soon |
147126

148-
## Rust
149-
* Install the rust language via [rustup](https://www.rust-lang.org/tools/install).
150-
* Install the language server: rust-analyzer:
151-
```bash
152-
$ rustup component add rust-analyzer
153-
```
154-
* Verify installation:
155-
```bash
156-
$ go build
157-
$ ./abcoder parse rust testdata/rust2
158-
```
159127

160128
# Getting Involved
161129

docs/lsp-installation-cn.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Language server 安装
2+
为了解析仓库中符号之间的依赖,abcoder parser 需要使用各语言的 language server。
3+
运行 parser 之前请安装对应的 language server。
4+
5+
语言和 language server 的对应关系如下
6+
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 |
13+
14+
按如下教程完成安装后,在运行 abcoder 前请确保 PATH 中有对应可执行文件
15+
16+
## Rust
17+
* 先通过 [rustup](https://www.rust-lang.org/tools/install) 安装 Rust 语言
18+
* 安装 rust-analyzer
19+
```bash
20+
$ rustup component add rust-analyzer
21+
$ rust-analyzer --version # 验证安装成功
22+
```
23+
24+
## Python
25+
* 安装 Python 3.9+
26+
* 从 git submodule 安装 pylsp
27+
```bash
28+
$ git submodule init
29+
$ git submodule update
30+
$ cd pylsp
31+
$ pip install -e . # 可以考虑在单独的 conda/venv 环境中执行
32+
$ export PATH=$(realpath ./bin):$PATH # 放到 .rc 文件里,或每次运行 abcoder 前都设置一下
33+
$ pylsp --version # 验证安装成功
34+
```
35+
36+
## C
37+
* ubuntu 24.04 或以后版本: 可以直接从 apt 安装
38+
```bash
39+
$ sudo apt install clangd-18
40+
```
41+
42+
* 其他发行版:手动编译、或从 [llvm 官方网站](https://releases.llvm.org/download.html) 下载预编译的版本。
43+
clangd 在 clang-tools-extra 中。
44+

docs/lsp-installation-en.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Language Server Installation
2+
3+
To parse dependencies between symbols in a repository, the abcoder parser requires the use of language servers for various languages. Please install the corresponding language server before running the parser.
4+
5+
The mapping between languages and language servers is as follows:
6+
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 |
13+
14+
Ensure the corresponding executable is in PATH before running abcoder.
15+
16+
## Rust
17+
* First, install the Rust language via [rustup](https://www.rust-lang.org/tools/install).
18+
* Install rust-analyzer:
19+
```bash
20+
$ rustup component add rust-analyzer
21+
$ rust-analyzer --version # Verify successful installation
22+
```
23+
24+
## Python
25+
* Install Python 3.9+
26+
* Install pylsp from the git submodule:
27+
```bash
28+
$ git submodule init
29+
$ git submodule update
30+
$ cd pylsp
31+
$ pip install -e . # Consider executing in a separate conda/venv environment
32+
$ export PATH=$(realpath ./bin):$PATH # Add this to your .rc file, or set it before each abcoder run
33+
$ pylsp --version # Verify successful installation
34+
```
35+
36+
## C
37+
* Ubuntu 24.04 or later: Install directly from apt:
38+
```bash
39+
$ sudo apt install clangd-18
40+
```
41+
42+
* Other distributions: Use a manual installation.
43+
Or download a pre-compiled version from the [LLVM official website](https://releases.llvm.org/download.html). clangd is in `clang-tools-extra`.

0 commit comments

Comments
 (0)