Skip to content

Huge refactoring of language server #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 76 commits into from
Dec 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
1942ec4
Big refactoring to get rid of all legacy lsp/jsonrpc2 stuff
cmaglie Oct 27, 2021
99fa3a8
removed old LSP lib
cmaglie Oct 28, 2021
2e2166a
Renamed INOHandler to INOLanguageServer
cmaglie Oct 28, 2021
63c7ad1
Major improvement in logging
cmaglie Oct 29, 2021
dec44e9
Introduced lsp.Client/Server and big improvement in logging
cmaglie Nov 4, 2021
07011ac
Reorganized repository
cmaglie Nov 4, 2021
6cceaac
Better isolation of LSPClient/LSPServer
cmaglie Nov 4, 2021
be08b32
Handled events 'shutdown' and 'exit'
cmaglie Nov 4, 2021
270c49c
Made logging color more coherent
cmaglie Nov 4, 2021
cfd57dd
Improved progress logging
cmaglie Nov 4, 2021
fca69e3
removed dependency
cmaglie Nov 5, 2021
83860ca
Load CPP symbols only after adding the file
cmaglie Nov 5, 2021
a82b525
Renamed fields and improved didChange handling
cmaglie Nov 8, 2021
fb4b242
improved logging and some refactorings
cmaglie Nov 8, 2021
592b11b
fix: when rebuilding sketch file send a didSave notification instead …
cmaglie Nov 8, 2021
7f463d8
Renamed InoMapper -< SketchMapper
cmaglie Nov 9, 2021
14274fa
Addded missing options in ServerCapabilities
cmaglie Nov 9, 2021
ccbc0c6
Fixed wrong condition in SignatureHelp handler
cmaglie Nov 9, 2021
df25ec5
send DidChange notification together with DidSave
cmaglie Nov 9, 2021
0073fd3
Added error color in loggin to make errors more visible
cmaglie Nov 9, 2021
c8d2e5e
Refactoring of the builder
cmaglie Nov 9, 2021
f0a3a30
Do not send full text in didSave notification to clangd
cmaglie Nov 9, 2021
b30c074
Factored initializeWorkbench function
cmaglie Nov 9, 2021
162db7f
Factored out clang starter
cmaglie Nov 9, 2021
ff7d9bd
Updating go.mod
cmaglie Nov 9, 2021
98bbd42
Fixed synchronization problem with clangd
cmaglie Nov 10, 2021
d0c0168
Moved textutils in lsp package, slightly improved logging
cmaglie Nov 10, 2021
ad47a52
change go.mod
cmaglie Nov 10, 2021
43755fd
BIG REFACTOR: build sketch is triggered on every change
cmaglie Nov 11, 2021
84c418a
Removed outdated launch config
cmaglie Nov 11, 2021
e709702
updated dependencies
cmaglie Nov 15, 2021
27c3eb6
Use arduino-cli RPC to ger sketch compiled
cmaglie Nov 15, 2021
87d8a62
Added profiler in debug mode
cmaglie Nov 15, 2021
e13dcc8
Added logging of failing builds
cmaglie Nov 16, 2021
0869a5f
Terminate LS if we are unable to start clangd
cmaglie Nov 17, 2021
3ba5af0
Factored configuration paramaters for the language server
cmaglie Nov 18, 2021
387a275
Added command line options to allow daemon connection
cmaglie Nov 18, 2021
8291147
Allow querying datafolder via gprc
cmaglie Nov 18, 2021
a2942cd
Correctly handle shutdown
cmaglie Nov 18, 2021
e01da53
Fixed Hover coordinates; started refactoring jargon (ino/cpp -> ide/c…
cmaglie Nov 19, 2021
a1bfd83
Fixed Highlight coordinates; continued refactoring jargon (ino/cpp ->…
cmaglie Nov 19, 2021
e2637a2
Moved completed conversion functions to separate files
cmaglie Nov 19, 2021
1cc4c0c
Some more moving/renaming of functions
cmaglie Nov 22, 2021
b515c35
Dramatically simplified diagnostics conversion
cmaglie Nov 22, 2021
00590aa
Refactored and rationalized in-preprocessed section updates
cmaglie Nov 22, 2021
c8ad100
Made proper error for UnknownURI
cmaglie Nov 22, 2021
d9872e2
Moved documentSymbol handlers in the proper place
cmaglie Nov 22, 2021
f590f7a
Fixed format and selection-format; still refactoring/renaming
cmaglie Nov 23, 2021
1ca00ec
Updated go version used by gh-actions build workflow
cmaglie Nov 23, 2021
fd61ed4
Fixed typos
cmaglie Nov 23, 2021
aea355d
Dramatically simplified ide2ClangTextDocumentPositionParams
cmaglie Nov 23, 2021
08c8827
Some more renaming
cmaglie Nov 23, 2021
de32cd3
Refactored and simplified TextDocumentCompletionReqFromIDE
cmaglie Nov 23, 2021
5189b8b
Fixed TextDocumentHoverReqFromIDE handling of null ranges
cmaglie Nov 23, 2021
ceb1c21
Fixed TextDocumentSignatureHelpReqFromIDE
cmaglie Nov 23, 2021
d46307c
Adjusted advertised server capabilities
cmaglie Nov 24, 2021
a5d6bfd
More variable naming adjustments...
cmaglie Nov 24, 2021
76cda4a
Refactored and straighted up TextDocumentDocumentSymbolReqFromIDE
cmaglie Nov 24, 2021
525f6a8
Some refactoring of CodeActions handling, still work in progres...
cmaglie Nov 26, 2021
a684850
Reorganization of didClose (wip)
cmaglie Nov 29, 2021
5446598
Completed refactoring of didChange message handler
cmaglie Nov 29, 2021
de600c5
Handling of non-standard $/setTraceNotification message
cmaglie Nov 30, 2021
cf3008d
Correct handling of diagnostics from .cpp/.h
cmaglie Nov 30, 2021
975d40f
Correct handling of textchanges in .cpp/.h
cmaglie Dec 1, 2021
a8ccf12
Inlined didClose method
cmaglie Dec 1, 2021
b5031d3
Fixed line conversion for .cpp/.h
cmaglie Dec 1, 2021
6847aa5
Ensure write-lock for text-format
cmaglie Dec 1, 2021
71dd136
Partial refactoring of CodeAction conversions subroutines
cmaglie Dec 2, 2021
5ee9731
Handle ctags failing to report the correct line number
cmaglie Dec 2, 2021
b3d9169
Do not block on clangd notification
cmaglie Dec 3, 2021
bd5ee6b
Handle rename symbol
cmaglie Dec 3, 2021
4b8b569
Do not rename if the operation spans out of the sketch
cmaglie Dec 3, 2021
83d82b5
Remove unsupported showMessage message... oops
cmaglie Dec 3, 2021
4cbf9f3
Handle special case in text-edits
cmaglie Dec 9, 2021
287e8ba
Canonicalize dataDir path before passing it to clangd
cmaglie Dec 10, 2021
52d96f0
updated README
cmaglie Dec 13, 2021
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: '1.13'
go-version: '1.16.9'

- name: Build and Test
run: |
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.old
build.sh
arduino-language-server*
arduino-language-server*
21 changes: 0 additions & 21 deletions .vscode/launch.json

This file was deleted.

24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,28 @@ go test -v ./...
```
## Usage

To run the Arduino Language Server you need:
The language server it's not intended for direct usage by humans via the command line terminal.
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.

The prerequisites to run the Arduino Language Server are:

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

After building, call:
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:

```
./arduino-language-server -cli-config <path-to-cli-config>
```
For example:
```
./arduino-language-server -cli-config $HOME/.arduino15/arduino-cli.yaml
./arduino-language-server \
-clangd /usr/local/bin/clangd \
-cli /usr/local/bin/arduino-cli \
-cli-config $HOME/.arduino15/arduino-cli.yaml \
-fqbn arduino:mbed:nanorp2040connect
```
Note: If you do not have an Arduino CLI config file, you can create one by running:

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).
The support for the board must be installed with the `arduino-cli core install ...` command before starting the language server.

If you do not have an Arduino CLI config file, you can create one by running:
```
arduino-cli config init
```
Expand Down
14 changes: 8 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
module github.com/arduino/arduino-language-server

go 1.12
go 1.16

require (
github.com/arduino/arduino-cli v0.0.0-20201215104024-6a177ebf56f2
github.com/arduino/go-paths-helper v1.5.0
github.com/fatih/color v1.7.0
github.com/arduino/arduino-cli v0.0.0-20211111113528-bf4a7844a79b
github.com/arduino/go-paths-helper v1.6.1
github.com/fatih/color v1.13.0
github.com/pkg/errors v0.9.1
github.com/sourcegraph/jsonrpc2 v0.0.0-20200429184054-15c2290dcb37
github.com/stretchr/testify v1.6.1
github.com/stretchr/testify v1.7.0
go.bug.st/json v1.15.6
go.bug.st/lsp v0.0.0-20211202163946-3ad3994172a0
google.golang.org/grpc v1.42.0
)
699 changes: 519 additions & 180 deletions go.sum

Large diffs are not rendered by default.

156 changes: 0 additions & 156 deletions handler/builder.go

This file was deleted.

Loading