Skip to content

Commit 395be90

Browse files
author
Étienne Lévesque
committed
Merge branch 'master' of https://github.com/elixir-lsp/elixir-ls into test_code_lens
2 parents d938be9 + 3acc1fd commit 395be90

26 files changed

+870
-331
lines changed

.github/workflows/release-asset.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Elixir CI
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
name: Create draft release
11+
runs-on: ubuntu-latest
12+
outputs:
13+
upload_url: ${{steps.create_release.outputs.upload_url}}
14+
15+
steps:
16+
- name: Create Release
17+
id: create_release
18+
uses: actions/create-release@v1
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
with:
22+
tag_name: ${{ github.ref }}
23+
release_name: Release ${{ github.ref }}
24+
draft: true
25+
prerelease: false
26+
27+
build:
28+
name: Build and publish release asset
29+
runs-on: ubuntu-latest
30+
needs: release
31+
32+
strategy:
33+
matrix:
34+
include:
35+
- elixir-version: '1.11'
36+
otp-version: '23.1'
37+
- elixir-version: '1.10.4'
38+
otp-version: '23.1'
39+
- elixir-version: '1.9'
40+
otp-version: '22.3'
41+
- elixir-version: '1.8.2'
42+
otp-version: '21.3'
43+
default: true
44+
45+
steps:
46+
- uses: actions/checkout@v2
47+
- name: Set up Elixir
48+
uses: actions/setup-elixir@v1
49+
with:
50+
elixir-version: ${{ matrix.elixir-version }}
51+
otp-version: ${{ matrix.otp-version }}
52+
53+
- name: Restore dependencies cache
54+
uses: actions/cache@v2
55+
with:
56+
path: deps
57+
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
58+
restore-keys: ${{ runner.os }}-mix-
59+
60+
- name: Install dependencies
61+
run: mix deps.get
62+
63+
- name: Build release
64+
run: |
65+
mkdir ./release
66+
mix compile
67+
MIX_ENV=prod mix elixir_ls.release -o ./release
68+
zip -jr elixir-ls.zip ./release
69+
70+
- name: Upload Release Asset
71+
uses: actions/upload-release-asset@v1
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
with:
75+
upload_url: ${{ needs.release.outputs.upload_url }}
76+
asset_path: ./elixir-ls.zip
77+
asset_name: elixir-ls-${{ matrix.elixir-version }}.zip
78+
asset_content_type: application/zip
79+
80+
- name: Upload Default Release Asset
81+
if: ${{ matrix.default == true }}
82+
uses: actions/upload-release-asset@v1
83+
env:
84+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85+
with:
86+
upload_url: ${{ needs.release.outputs.upload_url }}
87+
asset_path: ./elixir-ls.zip
88+
asset_name: elixir-ls.zip
89+
asset_content_type: application/zip

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ matrix:
3030
elixir: 1.8.2
3131
- otp_release: 22.3
3232
elixir: 1.9.4
33-
- otp_release: 23.0.3
34-
elixir: 1.10.3
33+
- otp_release: 23.0.4
34+
elixir: 1.10.4
35+
- otp_release: 23.0.4
36+
elixir: 1.11.1
3537
env:
3638
- CHECK_FORMATTED=1
3739
- RUN_DIALYZER=1

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
### Unreleased
22

3+
### v0.6.2: 15 November 2020
4+
5+
Improvements:
6+
- Add setup.bat support for windows (thanks [E14](https://github.com/E14)) [#374](https://github.com/elixir-lsp/elixir-ls/pull/374)
7+
- Add a message when done fetching deps [#380](https://github.com/elixir-lsp/elixir-ls/pull/380)
8+
9+
Changes:
10+
- Remove query prefixes from workspace symbol search (the functionality is now longer supported by VSCode) (thanks [Łukasz Samson](https://github.com/lukaszsamson)) [#396](https://github.com/elixir-lsp/elixir-ls/pull/396)
11+
12+
Bug Fixes:
13+
- Fix formatting on windows (thanks [Po Chen](https://github.com/princemaple)) [#375](https://github.com/elixir-lsp/elixir-ls/pull/375)
14+
- Improve formatting speed (thanks [Matt Baker](https://github.com/mattbaker)) [#390](https://github.com/elixir-lsp/elixir-ls/pull/390)
15+
- Fix warnings and errors around starting wx (thanks [Łukasz Samson](https://github.com/lukaszsamson)) [#388](https://github.com/elixir-lsp/elixir-ls/pull/388)
16+
- This fixes an issue when running ElixirLS in VSCode remote dev containers
17+
18+
Housekeeping:
19+
- Add GitHub action to auto-publish releases (thanks [Po Chen](https://github.com/princemaple)) [#384](https://github.com/elixir-lsp/elixir-ls/pull/384)
20+
- Spec compliance, race condition fixes, and more tests (thanks [Łukasz Samson](https://github.com/lukaszsamson)) [#399](https://github.com/elixir-lsp/elixir-ls/pull/399)
21+
22+
VSCode:
23+
- Bump deps and switch to newer vscode platform version (thanks [Łukasz Samson](https://github.com/lukaszsamson)) [#148](https://github.com/elixir-lsp/vscode-elixir-ls/pull/148)
24+
- Subscribe Copy Debug Info command for disposal (thanks [Tan Jay Jun](https://github.com/jayjun)) [#149](https://github.com/elixir-lsp/vscode-elixir-ls/pull/149)
25+
- Turn files in stack traces into clickable links (thanks [Tan Jay Jun](https://github.com/jayjun)) [#152](https://github.com/elixir-lsp/vscode-elixir-ls/pull/152)
26+
327
### v0.6.1: 4 October 2020
428

529
VSCode:

README.md

Lines changed: 44 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Note: On first run Dialyzer will build a PLT cache which will take a considerabl
4141
| Emacs | [eglot](https://github.com/joaotavora/eglot) | |
4242
| Kate | [built-in LSP Client plugin](https://kate-editor.org/post/2020/2020-01-01-kate-lsp-client-status/) | Does not support debugger |
4343
| Sublime Text | [LSP-elixir](https://github.com/sublimelsp/LSP-elixir) | Does not support debugger |
44+
| Nova | [nova-elixir-ls](https://github.com/raulchedrese/nova-elixir-ls) | |
4445

4546
Feel free to create and publish your own client packages and add them to this list!
4647

@@ -117,6 +118,44 @@ In order to debug modules in `.exs` files (such as tests), they must be specifie
117118
}
118119
```
119120

121+
In order to debug a single test or a single test file it is currently necessary to modify `taskArgs` and make sure no other tests are requred in `requireFiles`.
122+
123+
```
124+
{
125+
"type": "mix_task",
126+
"name": "mix test",
127+
"request": "launch",
128+
"task": "test",
129+
"taskArgs": ["tests/some_test.exs:123"],
130+
"projectDir": "${workspaceRoot}",
131+
"requireFiles": [
132+
"test/**/test_helper.exs",
133+
"test/some_test.exs"
134+
]
135+
}
136+
```
137+
138+
Please note that due to `:int` limitation NIF modules cannot be interpreted and need to be excluded via `excludeModules` option. This option can be also used to disable interpreting for some modules when it is not desirable e.g. when performance is not satisfactory.
139+
140+
```
141+
{
142+
"type": "mix_task",
143+
"name": "mix test",
144+
"request": "launch",
145+
"task": "test",
146+
"taskArgs": ["--trace"],
147+
"projectDir": "${workspaceRoot}",
148+
"requireFiles": [
149+
"test/**/test_helper.exs",
150+
"test/**/*_test.exs"
151+
],
152+
"excludeModules": [
153+
":some_nif",
154+
"Some.SlowModule"
155+
]
156+
}
157+
```
158+
120159
## Automatic builds and error reporting
121160

122161
Builds are performed automatically when files are saved. If you want this to happen automatically when you type, you can turn on "autosave" in your IDE.
@@ -158,25 +197,7 @@ The completions include:
158197

159198
## Workspace Symbols
160199

161-
With Dialyzer integration enabled ElixirLS will build an index of symbols (modules, functions, types and callbacks). The symbols are taken from the current workspace, all dependencies and stdlib (Elixir and erlang). This feature enables quick navigation to symbol definitions. However due to sheer number of different symbols and fuzzy search utilized by the provider, ElixirLS uses query prefixes to improve search results relevance.
162-
163-
Use the following rules when navigating to workspace symbols:
164-
* no prefix - search for modules
165-
* `:erl`
166-
* `Enu`
167-
* `f ` prefix - search for functions
168-
* `f inse`
169-
* `f :ets.inse`
170-
* `f Enum.cou`
171-
* `f count/0`
172-
* `t ` prefix - search for types
173-
* `t t/0`
174-
* `t :erlang.time_u`
175-
* `t DateTime.`
176-
* `c ` prefix - search for callbacks
177-
* `c handle_info`
178-
* `c GenServer.in`
179-
* `c :gen_statem`
200+
With Dialyzer integration enabled ElixirLS will build an index of symbols (modules, functions, types and callbacks). The symbols are taken from the current workspace, all dependencies and stdlib (Elixir and erlang). This feature enables quick navigation to symbol definitions.
180201

181202
## Troubleshooting
182203

@@ -196,6 +217,8 @@ If you get an error like the following immediately on startup:
196217

197218
and you installed Elixir and Erlang from the Erlang Solutions repository, you may not have a full installation of erlang. This can be solved with `sudo apt-get install esl-erlang`. Originally reported in [#208](https://github.com/elixir-lsp/elixir-ls/issues/208).
198219

220+
On fedora if you only install the elixir package you will not have a full erlang installation, this can be fixed by running `sudo dnf install erlang` (reported in [#231](https://github.com/elixir-lsp/elixir-ls/issues/231))
221+
199222
## Known Issues/Limitations
200223

201224
* `.exs` files don't return compilation errors
@@ -221,6 +244,8 @@ if available, but that may not be what you want or need. Therefore, prior to exe
221244
`$XDG_CONFIG_HOME/elixir_ls/setup.sh` (e.g. `~/.config/elixir_ls/setup.sh`), if available. The environment variable
222245
`ELS_MODE` is set to either `debugger` or `language_server` to help you decide what to do inside the script, if needed.
223246

247+
Note: for windows the local setup script path is `%APPDATA%/elixir_ls/setup.bat` (which is often `C:\Users\<username>\AppData\Roaming\elixir_ls`)
248+
224249
## Acknowledgements and related projects
225250

226251
ElixirLS isn't the first frontend-independent server for Elixir language support. The original was [Alchemist Server](https://github.com/tonini/alchemist-server/), which powers the [Alchemist](https://github.com/tonini/alchemist.el) plugin for Emacs. Another project, [Elixir Sense](https://github.com/elixir-lsp/elixir_sense), builds upon Alchemist and powers the [Elixir plugin for Atom](https://github.com/msaraiva/atom-elixir) as well as another VS Code plugin, [VSCode Elixir](https://github.com/fr1zle/vscode-elixir). ElixirLS uses Elixir Sense for several code insight features. Credit for those projects goes to their respective authors.

apps/elixir_ls_debugger/lib/debugger/server.ex

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,33 @@ defmodule ElixirLS.Debugger.Server do
6464
end
6565

6666
@impl GenServer
67+
def handle_cast({:receive_packet, request(_, "disconnect") = packet}, state) do
68+
Output.send_response(packet, %{})
69+
{:noreply, state, {:continue, :disconnect}}
70+
end
71+
6772
def handle_cast({:receive_packet, request(_, _) = packet}, state) do
6873
try do
69-
{response_body, state} = handle_request(packet, state)
70-
Output.send_response(packet, response_body)
71-
{:noreply, state}
74+
if state.client_info == nil do
75+
case packet do
76+
request(_, "initialize") ->
77+
{response_body, state} = handle_request(packet, state)
78+
Output.send_response(packet, response_body)
79+
{:noreply, state}
80+
81+
request(_, command) ->
82+
raise ServerError,
83+
message: "invalidRequest",
84+
format: "Debugger request {command} was not expected",
85+
variables: %{
86+
"command" => command
87+
}
88+
end
89+
else
90+
{response_body, state} = handle_request(packet, state)
91+
Output.send_response(packet, response_body)
92+
{:noreply, state}
93+
end
7294
rescue
7395
e in ServerError ->
7496
Output.send_error_response(packet, e.message, e.format, e.variables)
@@ -112,11 +134,16 @@ defmodule ElixirLS.Debugger.Server do
112134
{:noreply, %{state | task_ref: nil}}
113135
end
114136

115-
# If we get the disconnect request from the client, we send :disconnect to the server so it will
137+
# If we get the disconnect request from the client, we continue with :disconnect so the server will
116138
# die right after responding to the request
117139
@impl GenServer
118-
def handle_info(:disconnect, state) do
119-
System.halt(0)
140+
def handle_continue(:disconnect, state) do
141+
unless Application.get_env(:elixir_ls_debugger, :test_mode) do
142+
System.halt(0)
143+
else
144+
Process.exit(self(), {:exit_code, 0})
145+
end
146+
120147
{:noreply, state}
121148
end
122149

@@ -129,10 +156,19 @@ defmodule ElixirLS.Debugger.Server do
129156

130157
## Helpers
131158

132-
defp handle_request(initialize_req(_, client_info), state) do
159+
defp handle_request(initialize_req(_, client_info), %{client_info: nil} = state) do
133160
{capabilities(), %{state | client_info: client_info}}
134161
end
135162

163+
defp handle_request(initialize_req(_, _client_info), _state) do
164+
raise ServerError,
165+
message: "invalidRequest",
166+
format: "Debugger request {command} was not expected",
167+
variables: %{
168+
"command" => "initialize"
169+
}
170+
end
171+
136172
defp handle_request(launch_req(_, config), state) do
137173
{_, ref} = spawn_monitor(fn -> initialize(config) end)
138174

@@ -293,11 +329,6 @@ defmodule ElixirLS.Debugger.Server do
293329
{%{"result" => inspect(result), "variablesReference" => 0}, state}
294330
end
295331

296-
defp handle_request(request(_, "disconnect"), state) do
297-
send(self(), :disconnect)
298-
{%{}, state}
299-
end
300-
301332
defp handle_request(continue_req(_, thread_id), state) do
302333
pid = state.threads[thread_id]
303334
state = remove_paused_process(state, pid)
@@ -383,6 +414,10 @@ defmodule ElixirLS.Debugger.Server do
383414
defp evaluate_code_expression(expr, bindings, timeout) do
384415
task =
385416
Task.async(fn ->
417+
receive do
418+
:continue -> :ok
419+
end
420+
386421
try do
387422
{term, _bindings} = Code.eval_string(expr, bindings)
388423
term
@@ -392,6 +427,7 @@ defmodule ElixirLS.Debugger.Server do
392427
end)
393428

394429
Process.unlink(task.pid)
430+
send(task.pid, :continue)
395431

396432
result = Task.yield(task, timeout) || Task.shutdown(task)
397433

apps/elixir_ls_debugger/mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ defmodule ElixirLS.Debugger.Mixfile do
44
def project do
55
[
66
app: :elixir_ls_debugger,
7-
version: "0.6.0",
7+
version: "0.6.2",
88
build_path: "../../_build",
99
config_path: "../../config/config.exs",
1010
deps_path: "../../deps",

0 commit comments

Comments
 (0)