Skip to content

Commit 72fc111

Browse files
authored
Merge pull request #89 from arduino/megarefactoring
Huge refactoring of language server
2 parents 08181a1 + 52d96f0 commit 72fc111

35 files changed

+3895
-5067
lines changed

Diff for: .github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
- name: Install Go
3838
uses: actions/setup-go@v2
3939
with:
40-
go-version: '1.13'
40+
go-version: '1.16.9'
4141

4242
- name: Build and Test
4343
run: |

Diff for: .gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
.old
12
build.sh
2-
arduino-language-server*
3+
arduino-language-server*

Diff for: .vscode/launch.json

-21
This file was deleted.

Diff for: README.md

+16-8
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,28 @@ go test -v ./...
6262
```
6363
## Usage
6464

65-
To run the Arduino Language Server you need:
65+
The language server it's not intended for direct usage by humans via the command line terminal.
66+
The purpose of this program is to provide C++/.ino language-related functionality to the IDEs so, in general, it's the IDE that talks to the language server via stdin/stdout using the slightly modified JSONRPC protocol defined in the LSP specification.
67+
68+
The prerequisites to run the Arduino Language Server are:
6669

6770
- [Arduino CLI](https://github.com/arduino/arduino-cli)
71+
- [clangd](we suggest the builds here https://github.com/clangd/clangd/releases)
6872

69-
After building, call:
73+
To start the language server the IDE must provide the path to Arduino CLI and clangd with the following flags in addition to the target board FQBN:
7074

7175
```
72-
./arduino-language-server -cli-config <path-to-cli-config>
73-
```
74-
For example:
75-
```
76-
./arduino-language-server -cli-config $HOME/.arduino15/arduino-cli.yaml
76+
./arduino-language-server \
77+
-clangd /usr/local/bin/clangd \
78+
-cli /usr/local/bin/arduino-cli \
79+
-cli-config $HOME/.arduino15/arduino-cli.yaml \
80+
-fqbn arduino:mbed:nanorp2040connect
7781
```
78-
Note: If you do not have an Arduino CLI config file, you can create one by running:
82+
83+
The -fqbn flag represents the board you're actually working on (different boards may implement different features/API, if you change board you need to restart the language server with another fqbn).
84+
The support for the board must be installed with the `arduino-cli core install ...` command before starting the language server.
85+
86+
If you do not have an Arduino CLI config file, you can create one by running:
7987
```
8088
arduino-cli config init
8189
```

Diff for: go.mod

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
module github.com/arduino/arduino-language-server
22

3-
go 1.12
3+
go 1.16
44

55
require (
6-
github.com/arduino/arduino-cli v0.0.0-20201215104024-6a177ebf56f2
7-
github.com/arduino/go-paths-helper v1.5.0
8-
github.com/fatih/color v1.7.0
6+
github.com/arduino/arduino-cli v0.0.0-20211111113528-bf4a7844a79b
7+
github.com/arduino/go-paths-helper v1.6.1
8+
github.com/fatih/color v1.13.0
99
github.com/pkg/errors v0.9.1
10-
github.com/sourcegraph/jsonrpc2 v0.0.0-20200429184054-15c2290dcb37
11-
github.com/stretchr/testify v1.6.1
10+
github.com/stretchr/testify v1.7.0
11+
go.bug.st/json v1.15.6
12+
go.bug.st/lsp v0.0.0-20211202163946-3ad3994172a0
13+
google.golang.org/grpc v1.42.0
1214
)

Diff for: go.sum

+519-180
Large diffs are not rendered by default.

Diff for: handler/builder.go

-156
This file was deleted.

0 commit comments

Comments
 (0)