Skip to content

Commit 27e7e83

Browse files
committed
reaname debugger app to debug adapter
make project organization more standard
1 parent 724d172 commit 27e7e83

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+391
-492
lines changed

.formatter.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
],
77
subdirectories: [
88
"apps/elixir_ls_utils",
9-
"apps/elixir_ls_debugger",
9+
"apps/debug_adapter",
1010
"apps/language_server"
1111
]
1212
]

DEVELOPMENT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ It's easiest to test ElixirLS with [VSCode extension](https://github.com/elixir-
2626

2727
### Local release
2828

29-
You can run a local release of language server and debugger with launch scripts from `scripts` directory with `ELS_LOCAL=1` environment variable. This will make the install script use source, lockfile and config from the local ElixirLS directory.
29+
You can run a local release of language server and debug adapter with launch scripts from `scripts` directory with `ELS_LOCAL=1` environment variable. This will make the install script use source, lockfile and config from the local ElixirLS directory.
3030

3131
```shell
3232
cd path/to/my_project

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@ Note: On its first run, Dialyzer will build a PLT cache. This will take a consi
3434
| ------------ | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
3535
| BBEdit | [bbpackage](https://github.com/chipotle/Elixir.bbpackage) | |
3636
| Emacs | [eglot](https://github.com/joaotavora/eglot) | |
37-
| Emacs | [lsp-mode](https://github.com/emacs-lsp/lsp-mode) | Supports debugger via [dap-mode](https://github.com/yyoncho/dap-mode) |
37+
| Emacs | [lsp-mode](https://github.com/emacs-lsp/lsp-mode) | Supports debug adapter via [dap-mode](https://github.com/yyoncho/dap-mode) |
3838
| Kakoune | [kak-lsp](https://github.com/kak-lsp/kak-lsp) | [Limitations](https://github.com/kak-lsp/kak-lsp/#limitations) |
39-
| Kate | [built-in LSP Client plugin](https://kate-editor.org/post/2020/2020-01-01-kate-lsp-client-status/) | Does not support debugger |
40-
| Neovim | [coc.nvim](https://github.com/neoclide/coc.nvim) | Does not support debugger |
41-
| Neovim | [nvim-dap](https://github.com/mfussenegger/nvim-dap) | Supports debugger only |
42-
| Neovim | [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) | Does not support debugger |
39+
| Kate | [built-in LSP Client plugin](https://kate-editor.org/post/2020/2020-01-01-kate-lsp-client-status/) | Does not support debug adapter |
40+
| Neovim | [coc.nvim](https://github.com/neoclide/coc.nvim) | Does not support debug adapter |
41+
| Neovim | [nvim-dap](https://github.com/mfussenegger/nvim-dap) | Supports debug adapter only |
42+
| Neovim | [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) | Does not support debug adapter |
4343
| Nova | [nova-elixir-ls](https://github.com/raulchedrese/nova-elixir-ls) | |
44-
| Sublime Text | [LSP-elixir](https://github.com/sublimelsp/LSP-elixir) | Does not support debugger |
45-
| Vim/Neovim | [ALE](https://github.com/w0rp/ale) | Does not support debugger or @spec suggestions |
46-
| Vim/Neovim | [elixir-lsp/coc-elixir](https://github.com/elixir-lsp/coc-elixir) | Does not support debugger |
47-
| Vim/Neovim | [vim-lsp](https://github.com/prabirshrestha/vim-lsp) | Does not support debugger |
44+
| Sublime Text | [LSP-elixir](https://github.com/sublimelsp/LSP-elixir) | Does not support debug adapter |
45+
| Vim/Neovim | [ALE](https://github.com/w0rp/ale) | Does not support debug adapter or @spec suggestions |
46+
| Vim/Neovim | [elixir-lsp/coc-elixir](https://github.com/elixir-lsp/coc-elixir) | Does not support debug adapter |
47+
| Vim/Neovim | [vim-lsp](https://github.com/prabirshrestha/vim-lsp) | Does not support debug adapter |
4848
| VS Code | [elixir-lsp/vscode-elixir-ls](https://github.com/elixir-lsp/vscode-elixir-ls) | Supports all ElixirLS features |
4949

5050
Please feel free to create and publish your own client packages and add them to this list!
@@ -125,7 +125,7 @@ It is generally recommended to install Elixir and Erlang via [ASDF](https://gith
125125

126126
## Debugger support
127127

128-
ElixirLS provides debugger support adhering to the [Debug Adapter Protocol](https://microsoft.github.io/debug-adapter-protocol/), which is closely related to the Language Server Protocol.
128+
ElixirLS provides debug adapter support adhering to the [Debug Adapter Protocol](https://microsoft.github.io/debug-adapter-protocol/), which is closely related to the Language Server Protocol.
129129

130130
When debugging in Elixir or Erlang, only modules that have been "interpreted" (using `:int.ni/1` or `:int.i/1`) will accept breakpoints or show up in stack traces. The debugger in ElixirLS automatically interprets all modules in the Mix project and its dependencies before launching the Mix task. Therefore, you can set breakpoints anywhere in your project or dependency modules.
131131

@@ -175,7 +175,7 @@ To debug Phoenix applications using ElixirLS, you can use the following launch c
175175
}
176176
```
177177

178-
Please make sure that `startApps` is not set to `true`. To clarify, `startApps` is a configuration option in the ElixirLS debugger. It controls whether or not to start the applications in the Mix project before running the task. In the case of Phoenix applications, setting `startApps` to `true` can interfere with the application's normal startup process and cause issues.
178+
Please make sure that `startApps` is not set to `true`. To clarify, `startApps` is a configuration option in the ElixirLS debug adapter. It controls whether or not to start the applications in the Mix project before running the task. In the case of Phoenix applications, setting `startApps` to `true` can interfere with the application's normal startup process and cause issues.
179179

180180
If you are running tests in the Phoenix application, you may need to set `startApps` to true. This will ensure that the necessary applications are started before the tests run.
181181

@@ -242,9 +242,9 @@ If a breakpoint is set on the line with `some_function()`, the last bound value
242242

243243
Additionally, although all bound variables are accessible in the expression evaluator, the evaluator doesn't support accessing module attributes (because these are determined at compile time).
244244

245-
### Connecting to debugger
245+
### Connecting to debug adapter
246246

247-
It may be useful to connect to a running debugger node via OTP distribution. This enables inspecting the running application and remotely triggering debugged functions. In order to do so, set `ELS_ELIXIR_OPTS` in the launch configuration and pass in the appropriate node `name/sname` and `cookie`.
247+
It may be useful to connect to a running debug adapter node via OTP distribution. This enables inspecting the running application and remotely triggering debugged functions. In order to do so, set `ELS_ELIXIR_OPTS` in the launch configuration and pass in the appropriate node `name/sname` and `cookie`.
248248

249249
```json
250250
{
@@ -326,9 +326,9 @@ Below is a list of configuration options supported by the ElixirLS language serv
326326
<dt>elixirLS.languageServerOverridePath</dt><dd>Absolute path to an alternative ElixirLS release that will override the packaged release</dd>
327327
</dl>
328328

329-
## Debugger configuration options
329+
## Debug Adapter configuration options
330330

331-
Below is a list of configuration options supported by the ElixirLS Debugger. Configuration options can be supplied via the debugger launch configuration. Please refer to your editor's documentation on how to configure debugger adapters.
331+
Below is a list of configuration options supported by the ElixirLS Debug Adapter. Configuration options can be supplied via launch configuration. Please refer to your editor's documentation on how to configure debug adapters.
332332

333333
<dl>
334334
<dt>startApps</dt><dd>Run `mix app.start` before launching the debugger. Some tasks (such as Phoenix tests) expect apps to already be running before the test files are required. Defaults to `false`.</dd>
@@ -441,7 +441,7 @@ When launching ElixirLS from an IDE that is itself launched from a graphical she
441441

442442
To ensure that the correct environment is set up, you can create a setup script at `$XDG_CONFIG_HOME/elixir_ls/setup.sh` (for Unix-based systems) or `%APPDATA%\elixir_ls\setup.bat` (for Windows).
443443

444-
In the setup script, the environment variable `ELS_MODE` is available and set to either `debugger` or `language_server` to help you decide what to do.
444+
In the setup script, the environment variable `ELS_MODE` is available and set to either `debug_adapter` or `language_server` to help you decide what to do.
445445

446446
Note: The setup script must not read from `stdin` or write to `stdout`. On Unix, Linux, and macOS
447447
this might be accomplished by adding `>/dev/null` at the end of any line that produces
File renamed without changes.

apps/elixir_ls_debugger/lib/debugger/cli.ex renamed to apps/debug_adapter/lib/debug_adapter.ex

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
defmodule ElixirLS.Debugger.CLI do
1+
defmodule ElixirLS.DebugAdapter do
22
alias ElixirLS.Utils
33
alias ElixirLS.Utils.{WireProtocol, Launch}
4-
alias ElixirLS.Debugger.{Output, Server}
4+
alias ElixirLS.DebugAdapter.{Output, Server}
55

66
def main do
77
Application.load(:erts)
@@ -10,18 +10,18 @@ defmodule ElixirLS.Debugger.CLI do
1010
Launch.start_mix()
1111

1212
if Version.match?(System.version(), ">= 1.15.0-dev") do
13-
# make sue that debugger modules are in code path
13+
# make sue that OTP debugger modules are in code path
1414
# without starting the app
1515
Mix.ensure_application!(:debugger)
1616
end
1717

18-
{:ok, _} = Application.ensure_all_started(:elixir_ls_debugger, :permanent)
18+
{:ok, _} = Application.ensure_all_started(:debug_adapter, :permanent)
1919

20-
Output.debugger_console("Started ElixirLS Debugger v#{Launch.debugger_version()}")
20+
Output.debugger_console("Started ElixirLS Debug Adapter v#{Launch.debug_adapter_version()}")
2121
versions = Launch.get_versions()
2222

2323
Output.debugger_console(
24-
"ElixirLS Debugger built with elixir #{versions.compile_elixir_version} on OTP #{versions.compile_otp_version}"
24+
"ElixirLS Debug Adapter built with elixir #{versions.compile_elixir_version} on OTP #{versions.compile_otp_version}"
2525
)
2626

2727
Output.debugger_console(

apps/elixir_ls_debugger/lib/debugger.ex renamed to apps/debug_adapter/lib/debug_adapter/application.ex

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
defmodule ElixirLS.Debugger do
1+
defmodule ElixirLS.DebugAdapter.Application do
22
@moduledoc """
3-
Debugger adapter for Elixir Mix tasks using VS Code Debug Protocol
3+
Debug adapter for Elixir Mix tasks using Debug Adapter Protocol
44
"""
55

66
use Application
7-
alias ElixirLS.Debugger.Output
8-
alias ElixirLS.Debugger.{Server, BreakpointCondition, ModuleInfoCache}
7+
alias ElixirLS.DebugAdapter.Output
8+
alias ElixirLS.DebugAdapter.{Server, BreakpointCondition, ModuleInfoCache}
99

1010
@impl Application
1111
def start(_type, _args) do
12-
# We don't start this as a worker because if the debugger crashes, we want
12+
# We don't start this as a worker because if the debug adapter crashes, we want
1313
# this process to remain alive to print errors
1414
{:ok, _pid} = Output.start(Output)
1515

@@ -28,7 +28,7 @@ defmodule ElixirLS.Debugger do
2828
[]
2929
end
3030

31-
opts = [strategy: :one_for_one, name: ElixirLS.Debugger.Supervisor, max_restarts: 0]
31+
opts = [strategy: :one_for_one, name: ElixirLS.DebugAdapter.Supervisor, max_restarts: 0]
3232
Supervisor.start_link(children, opts)
3333
end
3434

apps/elixir_ls_debugger/lib/debugger/binding.ex renamed to apps/debug_adapter/lib/debug_adapter/binding.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
defmodule ElixirLS.Debugger.Binding do
1+
defmodule ElixirLS.DebugAdapter.Binding do
22
def to_elixir_variable_names(bindings) do
33
bindings
44
|> Enum.group_by(fn {key, _} -> get_elixir_variable(key) end)

apps/elixir_ls_debugger/lib/debugger/breakpoint_condition.ex renamed to apps/debug_adapter/lib/debug_adapter/breakpoint_condition.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
defmodule ElixirLS.Debugger.BreakpointCondition do
1+
defmodule ElixirLS.DebugAdapter.BreakpointCondition do
22
@moduledoc """
33
Server that tracks breakpoint conditions
44
"""
55

66
use GenServer
7-
alias ElixirLS.Debugger.Output
7+
alias ElixirLS.DebugAdapter.Output
88
@range 0..99
99

1010
def start_link(args) do
@@ -178,7 +178,7 @@ defmodule ElixirLS.Debugger.BreakpointCondition do
178178
@spec unquote(:"check_#{i}")(term) :: boolean
179179
def unquote(:"check_#{i}")(binding) do
180180
{condition, log_message, hit_count, hits} = get_condition(unquote(i))
181-
elixir_binding = binding |> ElixirLS.Debugger.Binding.to_elixir_variable_names()
181+
elixir_binding = binding |> ElixirLS.DebugAdapter.Binding.to_elixir_variable_names()
182182
result = eval_condition(condition, elixir_binding)
183183

184184
result =

apps/elixir_ls_debugger/lib/debugger/completions.ex renamed to apps/debug_adapter/lib/debug_adapter/completions.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
defmodule ElixirLS.Debugger.Completions do
1+
defmodule ElixirLS.DebugAdapter.Completions do
22
# type CompletionItemType = 'method' | 'function' | 'constructor' | 'field'
33
# | 'variable' | 'class' | 'interface' | 'module' | 'property' | 'unit'
44
# | 'value' | 'enum' | 'keyword' | 'snippet' | 'text' | 'color' | 'file'

0 commit comments

Comments
 (0)