Giter Club home page Giter Club logo

elixir-lsp / elixir-ls Goto Github PK

View Code? Open in Web Editor NEW
1.4K 35.0 184.0 6.89 MB

A frontend-independent IDE "smartness" server for Elixir. Implements the "Language Server Protocol" standard and provides debugger support via the "Debug Adapter Protocol"

Home Page: https://elixir-lsp.github.io/elixir-ls/

License: Apache License 2.0

Elixir 99.26% Batchfile 0.09% Shell 0.64% Dockerfile 0.01%
language-server-protocol elixir debug-adapter-protocol language-server lsp

elixir-ls's People

Contributors

akash-akya avatar asummers avatar axelson avatar blindingdark avatar bottlenecked avatar danirukun avatar dependabot[bot] avatar gofenix avatar gonzooo avatar hworld avatar jakebecker avatar jjcarstens avatar jtrees avatar lukaszsamson avatar maciej-szlosarczyk avatar mattbaker avatar msaraiva avatar oo6 avatar polvalente avatar princemaple avatar richmorin avatar rodrigues avatar scohen avatar scottming avatar sheldak avatar tcrossland avatar trevoke avatar victorolinasc avatar wingyplus avatar zetaron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

elixir-ls's Issues

MatchError when :dialyzer.format_warning/1 returns an error

message = String.trim(to_string(:dialyzer.format_warning(raw_warning)))

The log:

** (MatchError) no match of right hand side value: {:error, {1, :erl_parse, ['syntax error before: ', '\'?\'']}}
    dialyzer.erl:626: anonymous fn/1 in :dialyzer.sig/2
    dialyzer.erl:541: :dialyzer.call_or_apply_to_string/6
    dialyzer.erl:322: :dialyzer.message_to_string/2
    dialyzer.erl:297: :dialyzer.format_warning/2
    (language_server) lib/language_server/dialyzer.ex:461: ElixirLS.LanguageServer.Dialyzer.dialyzer_raw_warning_message/1
    (language_server) lib/language_server/dialyzer.ex:421: anonymous fn/4 in ElixirLS.LanguageServer.Dialyzer.to_diagnostics/3
    (elixir) lib/enum.ex:1940: Enum."-reduce/3-lists^foldl/2-0-"/3
    (stdlib) maps.erl:232: :maps.fold_1/3
Last message (from #PID<0.2866.0>): {:analysis_finished, :ok, {:plt, #Reference<0.428144727.440533000.7688>, #Reference<0.428144727.440533000.7690>, #Reference<0.428144727.440533000.7689>, #Reference<0.428144727.440533000.7691>, #Reference<0.428144727.440533000.7692>},

Unable to launch test task from VS Code

Environment

  • Elixir & Erlang versions (elixir --version): Erlang/OTP 22 [erts-10.6.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe] [dtrace]
    Elixir 1.10.0 (compiled with Erlang/OTP 22)
  • Operating system: macOS Mojave 10.14.6
  • Editor or IDE name: VSCode (latest)
  • LSP Client name:
  • If using VSCode, are you using "ElixirLS Fork: Elixir support and debugger" (note that it has "Fork" in the name)? yes, the latest available on VSCode marketplace

Crash report template

I'm starting from a brand new Mix project (generated with mix new_project)
I let VSCode create a launch.json file in order to run the tests.
With the generated Configuration I'm able to run the main task, the issue only applies to the mix test task.

The test mix task descriptor looks fine:
{
"type": "mix_task",
"name": "mix test",
"request": "launch",
"task": "test",
"taskArgs": [
"--trace"
],
"startApps": true,
"projectDir": "${workspaceRoot}",
"requireFiles": [
"test//test_helper.exs",
"test/
/*_test.exs"
]
}

By then I try to launch the tests, by choosing "mix test" in the debugger and pressing the run button I get the following error:

Started ElixirLS debugger
Elixir version: "1.10.0 (compiled with Erlang/OTP 22)"
Erlang version: "22"
(Debugger) Initialization failed because an exception was raised:
** (Mix.NoProjectError) Could not find a Mix.Project, please ensure you are running Mix in a directory with a mix.exs file
(mix 1.10.0) lib/mix/project.ex:176: Mix.Project.get!/0
(mix 1.10.0) lib/mix/tasks/compile.ex:89: Mix.Tasks.Compile.run/1
(mix 1.10.0) lib/mix/task.ex:330: Mix.Task.run_task/3
(debugger 0.3.0) lib/debugger/server.ex:456: ElixirLS.Debugger.Server.initialize/1

of course the mix.exs is in the right place ...

Please tag your releases!

Hello, I run into this when trying to set up Emacs integration with Elixir LS. At first, I went to the releases page to fetch the latest release, where I noticed that the latest version (v0.2.18) was released almost half a year ago. Then I opened Changelog, and it turned out that there were actually eight more releases with the latest one (v0.2.26) released 12 days ago. It's a little confusing for newcomers, so please, create Git tags for new releases!

Fix the tests

The tests are currently broken and we should try to fix them.

Mix process crashing in tests

Environment

  • Elixir & Erlang versions (elixir --version): 1.9.x, 1.10-rc.0
  • Operating system: macos, linux

Crash report template

Running tests result in one of mix application processes crashing. It looks like the tests put mix in some illegal state.

elixir 1.10-rc.0

12:36:34.397 [error] GenServer Mix.ProjectStack terminating
** (FunctionClauseError) no function clause matching in anonymous fn/1 in Mix.ProjectStack.recur/1
    (mix 1.10.0-rc.0) lib/mix/project_stack.ex:183: anonymous fn([]) in Mix.ProjectStack.recur/1
    (mix 1.10.0-rc.0) lib/mix/project_stack.ex:268: Mix.ProjectStack.handle_call/3
    (stdlib 3.11) gen_server.erl:661: :gen_server.try_handle_call/4
    (stdlib 3.11) gen_server.erl:690: :gen_server.handle_msg/6
    (stdlib 3.11) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message (from #PID<0.92.0>): {:update_stack, #Function<21.19485960/1 in Mix.ProjectStack.recur/1>}
State: {[], []}
Client #PID<0.92.0> is alive

    (stdlib 3.11) gen.erl:167: :gen.do_call/4
    (elixir 1.10.0-rc.0) lib/gen_server.ex:1020: GenServer.call/3
    (mix 1.10.0-rc.0) lib/mix/project_stack.ex:180: Mix.ProjectStack.recur/1
    (mix 1.10.0-rc.0) lib/mix/cli.ex:82: Mix.CLI.run_task/2
    (elixir 1.10.0-rc.0) src/elixir_compiler.erl:75: :elixir_compiler.dispatch/4
    (elixir 1.10.0-rc.0) src/elixir_compiler.erl:60: :elixir_compiler.compile/3
    (elixir 1.10.0-rc.0) src/elixir_lexical.erl:14: :elixir_lexical.run/3
    (elixir 1.10.0-rc.0) src/elixir_compiler.erl:18: :elixir_compiler.quoted/3
    (elixir 1.10.0-rc.0) lib/code.ex:917: Code.require_file/2
    (elixir 1.10.0-rc.0) lib/kernel/cli.ex:549: Kernel.CLI.wrapper/1
    (elixir 1.10.0-rc.0) lib/enum.ex:1396: Enum."-map/2-lists^map/1-0-"/2
    (elixir 1.10.0-rc.0) lib/kernel/cli.ex:76: Kernel.CLI.process_commands/1
    (elixir 1.10.0-rc.0) lib/kernel/cli.ex:30: anonymous fn/2 in Kernel.CLI.main/1
    (elixir 1.10.0-rc.0) lib/kernel/cli.ex:124: anonymous fn/3 in Kernel.CLI.exec_fun/2

elixir 1.9.1

00:20:15.427 [error] GenServer Mix.ProjectStack terminating
** (FunctionClauseError) no function clause matching in anonymous fn/1 in Mix.ProjectStack.recur/1
    (mix) lib/mix/project_stack.ex:210: anonymous fn(%{cache: %{}, post_config: [], stack: []}) in Mix.ProjectStack.recur/1
    (elixir) lib/agent/server.ex:27: Agent.Server.handle_cast/2
    (stdlib) gen_server.erl:637: :gen_server.try_dispatch/4
    (stdlib) gen_server.erl:711: :gen_server.handle_msg/6
    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: {:"$gen_cast", {:cast, #Function<23.36738168/1 in Mix.ProjectStack.recur/1>}}
State: %{cache: %{}, post_config: [], stack: []}

Compilation error in file lib/language_server/dialyzer/analyzer.ex

Environment

  • Elixir & Erlang versions (elixir --version): Elixir 1.8.2 @ Erlang/OTP 20
  • Operating system: Ubuntu 18.04.2

Problem Description

elixir-ls compilation (mix compile) on master and latest release fails with:

== Compilation error in file lib/language_server/dialyzer/analyzer.ex ==
** (RuntimeError) error parsing file /usr/lib/erlang/lib/dialyzer-3.2.3/src/dialyzer.hrl, got: {:error, :enoent}
    (elixir) lib/record/extractor.ex:84: Record.Extractor.read_file/2
    (elixir) lib/record/extractor.ex:50: Record.Extractor.extract_record/2
    lib/language_server/dialyzer/analyzer.ex:42: (module)
    (stdlib) erl_eval.erl:670: :erl_eval.do_apply/6

Exception from Logger when running on a 1.10 project

07:00:03.587 [error] GenServer ElixirLS.LanguageServer.Server terminating
** (UndefinedFunctionError) function Logger.__should_log__/1 is undefined or private
    (logger 1.10.0) Logger.__should_log__(:warn)
    (language_server 0.2.28) lib/language_server/server.ex:164: ElixirLS.LanguageServer.Server.handle_info/2
    (stdlib 3.10) gen_server.erl:637: :gen_server.try_dispatch/4
    (stdlib 3.10) gen_server.erl:711: :gen_server.handle_msg/6
    (stdlib 3.10) proc_lib.erl:249: :proc_lib.init_p_do_apply/3

Note: this doesn't affect the vscode extension because the vscode extension doesn't hit this code path because it usually supplies a workspace/didChangeConfiguration message.

Compiler diagnostics for .exs files

Environment

  • Elixir & Erlang versions (elixir --version): 1.9.4, 22
  • Operating system: macOS 10.14.6
  • Client (editor or IDE): VS Code

Not sure if this is by design, but I'm not getting any hints when things are broken in .exs files. e.g.: If I have a typo calling a function in a test, this doesn't get reported in VS Code, I'll only notice when running the tests.

Credo integration

Environment

  • Elixir & Erlang versions (elixir --version): 1.8.1
  • Operating system: MacOS
  • Client (editor or IDE): Emacs

The codebase that I'm working on enforces strict credo check on the source code, so it would be nice to have credo working with flycheck, just as is the case by default under alchemist.

Somebody mentioned in ElixirForum that they also tried to do it with the following config:

  (add-hook 'elixir-mode-hook
    (lambda ()
      (flycheck-credo-setup)))

  (add-hook 'lsp-after-initialize-hook
            (lambda ()
              (flycheck-add-next-checker 'lsp-ui
                                         'elixir-credo)))

But it doesn't really work, as credo messages will only be updated in the flycheck buffer, whenever lsp-ui error messages are also updated.

Is there a way to make credo work with lsp? Or is it currently not possible due to some limitations?

"completion--some: Wrong type argument: stringp, nil" when trying to select autocompletion at point

Environment

  • Elixir & Erlang versions (elixir --version):
Erlang/OTP 22 [erts-10.5.5] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe]
Elixir 1.9.4 (compiled with Erlang/OTP 21)
  • Operating system:
Ubuntu 18.04.3 LTS
  • Client (editor or IDE):

spacemacs on GNU Emacs 26.3

How to reproduce

  1. have auto-completion and elixir-ls in latest version
  2. try typing:

Enum.t (press tab)

  1. the completion-at-point appears, select whatever suggested entry and press enter
  2. nothing happens, the messages buffer contains completion--some: Wrong type argument: stringp, nil log entry after enter was pressed

Desired outcome: Enum.t is replaced by the suggested completion line item.

This issue might be specific to my configuration and setup or might event be not specific to elixir-ls but I would appreciate any help on this issue.

Dialyzer write manifest crashes on CI on elixir 1.7

Environment

  • Elixir & Erlang versions (elixir --version): 1.7, otp 20.3
  • Operating system: linux

Crash report template

00:20:55.080 [error] Task #PID<0.1544.0> started from #PID<0.1232.0> terminating
** (ArgumentError) argument error
    (stdlib) :ets.select_trap({#Reference<0.1221418905.1456340993.57541>, 2003, 0, #Reference<0.1221418905.1456340994.55827>, [{{Logger, :enable, 1}, {{:c, :atom, [:ok], :unknown}, [:any]}}, {{:erl_types, :t_map_def_key, 2}, {:any, [{:c, :opaque, [{:opaque, :erl_types, :erl_type, [], {:c, :union, [{:c, :atom, [:any, :none, :unit], :unknown}, :none, :none, :none, :none, :none, {:c, :tuple, [{:c, :atom, [:c], :unknown}, {:c, :atom, :any, :unknown}, :any, {:c, :union, [{:c, :atom, [:float, :integer, :nonempty, :pid, :port, ...], :unknown}, :none, :none, :none, :none, :none, {:c, :tuple, ...}, :none, :none, ...], :unknown}], {4, {:c, :atom, [:c], :unknown}}}, :none, :none, :none], :unknown}}], :unknown}, {:c, :union, [{:c, :atom, [:universe], :unknown}, :none, :none, :none, {:c, :list, [{:c, :opaque, [{:opaque, :erl_types, :erl_type, [], {:c, :union, [{:c, :atom, [:any, :none, :unit], :unknown}, :none, :none, :none, :none, :none, {:c, :tuple, [{:c, :atom, ...}, {:c, ...}, :any, ...], {4, {...}}}, :none, :none, :none], :unknown}}], :unknown}, {:c, nil, [], :unknown}], :unknown}, :none, :none, :none, :none, :none], :unknown}]}}, {{:file, :path_eval, 3}, {{:c, :tuple_set, [{2, [{:c, :tuple, [{:c, :atom, [:error], :unknown}, {:c, :union, [{:c, :atom, :any, :unknown}, :none, :none, :none, :none, :none, {:c, :tuple, [{:c, :union, [:none, :none, :none, :none, :none, {:c, :number, {:int_rng, ...}, :integer}, {:c, :tuple, [...], ...}, :none, :none, :none], :unknown}, {:c, :atom, :any, :unknown}, :any], {3, :any}}, :none, :none, :none], :unknown}], {2, {:c, :atom, [:error], :unknown}}}, {:c, :tuple, [{:c, :atom, [:ok], :unknown}, :any], {2, {:c, :atom, [:ok], :unknown}}}]}], :unknown}, [{:c, :list, [{:c, :union, [{:c, :atom, :any, :unknown}, {:c, :binary, [8, 0], :unknown}, :none, :none, {:c, :list, [{:c, :union, [{:c, :atom, :any, :unknown}, :none, :none, :none, {:c, :list, [:any, {:c, nil, [], :unknown}], :unknown}, {:c, :number, {:int_rng, 0, 1114111}, :integer}, :none, :none, :none, :none], :unknown}, {:c, nil, [], :unknown}], :unknown}, :none, :none, :none, :none, :none], :unknown}, {:c, nil, [], :unknown}], :unknown}, {:c, :union, [{:c, :atom, :any, :unknown}, {:c, :binary, [8, 0], :unknown}, :none, :none, {:c, :list, [{:c, :union, [{:c, :atom, :any, :unknown}, :none, :none, :none, {:c, :list, [:any, {:c, nil, [], :unknown}], :unknown}, {:c, :number, {:int_rng, 0, 1114111}, :integer}, :none, :none, :none, :none], :unknown}, {:c, nil, [], :unknown}], :unknown}, :none, :none, :none, :none, :none], :unknown}, :any]}}, {{:digraph, :add_vertex, 1}, {:any, [{:c, :opaque, [{:opaque, :digraph, :graph, [], {:c, :tuple, [{:c, :atom, [:digraph], :unknown}, {:c, :union, [{:c, :atom, :any, :unknown}, :none, :none, :none, :none, :none, :none, :none, {:c, :opaque, [{:opaque, :ets, :tid, [], {:c, ...}}], :unknown}, :none], :unknown}, {:c, :union, [{:c, :atom, :any, :unknown}, :none, :none, :none, :none, :none, :none, :none, {:c, :opaque, [{:opaque, :ets, :tid, [], {...}}], :unknown}, :none], :unknown}, {:c, :union, [{:c, :atom, :any, :unknown}, :none, :none, :none, :none, :none, :none, :none, {:c, :opaque, [{:opaque, :ets, :tid, [], ...}], :unknown}, :none], :unknown}, {:c, :atom, [false, true], :unknown}], {5, {:c, :atom, [:digraph], :unknown}}}}], :unknown}]}}, {{Registry, :start_link, 3}, {{:c, :tuple_set, [{2, [{:c, :tuple, [{:c, :atom, [:error], :unknown}, :any], {2, {:c, :atom, [:error], :unknown}}}, {:c, :tuple, [{:c, :atom, [:ok], :unknown}, {:c, :identifier, [:pid], :unknown}], {2, {:c, :atom, [:ok], :unknown}}}]}], :unknown}, [{:c, :atom, [:duplicate, :unique], :unknown}, {:c, :atom, :any, :unknown}, {:c, :list, [{:c, :tuple_set, [{2, [{:c, :tuple, [{:c, :atom, [:keys], :unknown}, {:c, :atom, [:duplicate, :unique], :unknown}], {2, {:c, :atom, [:keys], :unknown}}}, {:c, :tuple, [{:c, :atom, [:listeners], :unknown}, {:c, :list, [{:c, :atom, :any, :unknown}, {:c, nil, [], :unknown}], :unknown}], {2, {:c, :atom, [:listeners], :unknown}}}, {:c, :tuple, [{:c, :atom, [:meta], :unknown}, {:c, :list, [{:c, :tuple, [:any, :any], {2, :any}}, {:c, nil, [], :unknown}], :unknown}], {2, {:c, :atom, [:meta], :unknown}}}, {:c, :tuple, [{:c, :atom, [:name], :unknown}, {:c, :atom, :any, :unknown}], {2, {:c, :atom, [:name], :unknown}}}, {:c, :tuple, [{:c, :atom, [:partitions], :unknown}, {:c, :number, {:int_rng, 1, :pos_inf}, :integer}], {2, {:c, :atom, [:partitions], :unknown}}}]}], :unknown}, {:c, nil, [], :unknown}], :unknown}]}}, {{:hipe_arm_cfg, :init, 1}, {{:c, :tuple, [{:c, :atom, [:cfg], :unknown}, {:c, :opaque, [{:opaque, :gb_trees, :tree, [:any, :any], {:c, :tuple, [{:c, :number, {:int_rng, 0, :pos_inf}, :integer}, {:c, :union, [{:c, :atom, [nil], :unknown}, :none, :none, :none, :none, :none, {:c, :tuple, [:any, :any, :any, :any], {4, :any}}, :none, :none, :none], :unknown}], {2, :any}}}], :unknown}, {:c, :tuple, [{:c, :atom, [:cfg_info], :unknown}, {:c, :tuple, [:any, :any, :any], {3, :any}}, {:c, :number, {:int_rng, 0, :pos_inf}, :integer}, {:c, :atom, [false, true], :unknown}, {:c, :union, [{:c, :atom, [:none], :unknown}, :none, :none, :none, :none, {:c, :number, {:int_rng, 0, 255}, :integer}, :none, :none, :none, :none], :unknown}, {:c, :atom, [false, true], :unknown}, {:c, :list, [:any, {:c, nil, [], :unknown}], :unknown}, {:c, :list, [:any, {:c, nil, [], :unknown}], :unknown}], {8, {:c, :atom, [:cfg_info], :unknown}}}, {:c, :tuple, [{:c, :opaque, [{:opaque, :dict, :dict, [:any, :any], {:c, :tuple, [:any, :any, :any, :any, :any, :any, :any, :any, :any], {9, :any}}}], :unknown}, {:c, :list, [:any, {:c, nil, [], :unknown}], :unknown}, {:c, :number, {:int_rng, 0, :pos_inf}, :integer}], {3, :any}}], {4, {:c, :atom, [:cfg], :unknown}}}, [{:c, :tuple, [{:c, :atom, [:defun], :unknown}, {:c, :tuple, [{:c, :atom, :any, :unknown}, {:c, :atom, :any, :unknown}, {:c, :number, {:int_rng, 0, 255}, :integer}], {3, :any}}, :any, :any, {:c, :tuple, [{:c, :opaque, [{:opaque, :dict, :dict, [:any, :any], {:c, :tuple, [{:c, :atom, [:dict], :unknown}, {:c, :number, {:int_rng, 0, :pos_inf}, :integer}, {:c, :number, {:int_rng, 0, :pos_inf}, :integer}, {:c, :number, {:int_rng, 0, :pos_inf}, :integer}, {:c, :number, {:int_rng, 0, ...}, :integer}, {:c, :number, {:int_rng, ...}, :integer}, {:c, :number, {...}, ...}, {:c, :tuple, ...}, {:c, ...}], {9, {:c, :atom, [:dict], :unknown}}}}], :unknown}, {:c, :list, [{:c, :number, {:int_rng, 0, :pos_inf}, :integer}, {:c, nil, [], :unknown}], :unknown}, {:c, :number, {:int_rng, 0, :pos_inf}, :integer}], {3, :any}}, {:c, :atom, [false, true], :unknown}, {:c, :atom, [false, true], :unknown}, :any, :any], {9, {:c, :atom, [:defun], :unknown}}}]}}, {{IO, :module_info, 1}, {:any, [:any]}}, {{:hipe_ppc_specific_fp, :def_use, 2}, {{:c, :tuple, [{:c, :list, [:any, {:c, nil, [], :unknown}], :unknown}, {:c, :list, [:any, {:c, nil, [], :unknown}], :unknown}], {2, :any}}, [:any, :any]}}, {{:erl_posix_msg, :message, 1}, {:any, [:any]}}, {{Kernel.LexicalTracker, :remote_dispatch, 5}, {{:c, :atom, [:ok], :unknown}, [{:c, :union, [{:c, :atom, :any, :unknown}, :none, :none, {:c, :identifier, [:pid], :unknown}, :none, :none, {:c, :tuple_set, [{2, [{:c, :tuple, [{:c, :atom, :any, :unknown}, :any], {2, :any}}]}, {3, [{:c, :tuple, [{:c, :atom, [:via], :unknown}, :any, :any], {3, {:c, :atom, [:via], :unknown}}}]}], :unknown}, :none, :none, :none], :unknown}, {:c, :atom, :any, :unknown}, :any, :any, :any]}}, {{:group, :interfaces, 1}, {{:c, :list, [{:c, :tuple_set, [{2, [{:c, :tuple, [{:c, :atom, [:shell], :unknown}, :any], {2, {:c, :atom, [:shell], :unknown}}}, {:c, :tuple, [{:c, :atom, [:user_drv], :unknown}, :any], {2, {:c, :atom, [:user_drv], :unknown}}}]}], :unknown}, {:c, nil, [], :unknown}], :unknown}, [:any]}}, {{Registry, :unregister_match, 4}, {{:c, :atom, [:ok], :unknown}, [{:c, :union, [{:c, :atom, :any, :unknown}, :none, :none, :none, :none, :none, :none, :none, {:c, :opaque, [{:opaque, :ets, :tid, [], {:c, :identifier, [:reference], :unknown}}], :unknown}, :none], :unknown}, :any, :any, {:c, :list, [:any, {:c, nil, [], :unknown}], :unknown}]}}, {{:cerl, :call_module, 1}, {:any, [{:c, :tuple, [{:c, :atom, [:c_call], :unknown}, :any, :any, :any, :any], {5, {:c, :atom, [:c_call], :unknown}}}]}}, {{:elixir_lexical, :module_info, 1}, {:any, [:any]}}, {{:hipe_x86_specific_x87, :breadthorder, 2}, {{:c, :list, [:any, {:c, nil, [], :unknown}], :unknown}, [{:c, :tuple, [{:c, :atom, [:cfg], :unknown}, {:c, :opaque, [{:opaque, :gb_trees, :tree, [:any, :any], {:c, :tuple, [{:c, :number, {:int_rng, 0, :pos_inf}, :integer}, {:c, :union, [{:c, :atom, ...}, :none, :none, ...], :unknown}], {2, :any}}}], :unknown}, {:c, :tuple, [{:c, :atom, [:cfg_info], :unknown}, {:c, :tuple, [{:c, :atom, :any, :unknown}, {:c, :atom, :any, :unknown}, {:c, :number, {:int_rng, 0, 255}, :integer}], {3, :any}}, {:c, :number, {:int_rng, 0, :pos_inf}, :integer}, {:c, :atom, [false, true], :unknown}, {:c, :union, [{:c, :atom, [:none], :unknown}, :none, :none, :none, :none, {:c, :number, ...}, :none, :none, ...], :unknown}, {:c, :atom, [false, true], :unknown}, {:c, :list, [:any, {:c, nil, [], :unknown}], :unknown}, {:c, :list, [:any, {:c, nil, [], ...}], :unknown}], {8, {:c, :atom, [:cfg_info], :unknown}}}, {:c, :tuple, [{:c, :opaque, [{:opaque, :dict, :dict, [:any, :any], {:c, :tuple, [{:c, ...}, {...}, ...], {9, ...}}}], :unknown}, {:c, :list, [{:c, :number, {:int_rng, 0, :pos_inf}, :integer}, {:c, nil, [], :unknown}], :unknown}, {:c, :number, {:int_rng, 0, :pos_inf}, :integer}], {3, :any}}], {4, {:c, :atom, [:cfg], :unknown}}}, :any]}}, {{RuntimeError, :__struct__, 1}, {:any, [:any]}}, {{:hipe_ppc, :pseudo_fmove_src, 1}, {:any, [{:c, :tuple, [{:c, :atom, [:pseudo_fmove], :unknown}, :any, :any], {3, {:c, :atom, [:pseudo_fmove], :unknown}}}]}}, {{:proplists, :lookup, 2}, {{:c, :union, [{:c, :atom, [:none], :unknown}, :none, :none, :none, :none, :none, {:c, :tuple, :any, {:any, :any}}, :none, :none, :none], :unknown}, [:any, {:c, :list, [:any, :any], :unknown}]}}, {{Supervisor, :delete_child, 2}, {:any, [{:c, :union, [{:c, :atom, :any, :unknown}, :none, :none, {:c, :identifier, [:pid], :unknown}, :none, :none, {:c, :tuple_set, [{2, [{:c, :tuple, [{...}, ...], {...}}]}, {3, [{:c, :tuple, [...], ...}]}], :unknown}, :none, :none, :none], :unknown}, :any]}}, {{:dets_utils, :find_allocated, 4}, {:any, [{:c, :tuple, :any, {:any, :any}}, {:c, :number, :any, :unknown}, {:c, :number, :any, :unknown}, :any]}}, {{:binary, :matches, 2}, {:any, [:any, :any]}}, {{BadBooleanError, :__info__, 1}, {:any, [{:c, :atom, [:attributes, :compile, :deprecated, :functions, :macros, :md5, :module], :unknown}]}}, {{:cerl, :string_val, 1}, {:any, [{:c, :tuple, [{:c, :atom, [:c_literal], :unknown}, :any, :any], {3, {:c, :atom, [:c_literal], :unknown}}}]}}, {{System, :endianness, 0}, {{:c, :atom, [:big, :little], :unknown}, []}}, {{Kernel, :"MACRO-defmacro", 3}, {{:c, :tuple, [{:c, :tuple, [{:c, :atom, [:.], :unknown}, {:c, nil, [], :unknown}, {:c, :list, [{:c, :atom, [...], ...}, {:c, nil, ...}], :nonempty}], {3, {:c, :atom, [:.], :unknown}}}, {:c, nil, [], :unknown}, {:c, :list, [:any, {:c, nil, [], :unknown}], :nonempty}], {3, :any}}, [{:c, :union, [:none, :none, :none, :none, :none, :none, {:c, :tuple, [:any, {...}], {2, ...}}, :none, :none, {:c, :map, ...}], :unknown}, :any, :any]}}, {{:hipe_amd64_specific, :is_spill_move, 2}, {{:c, :atom, [false, true], :unknown}, [:any, :any]}}, {{:hipe_llvm, :adj_stack_register, 1}, {:any, [{:c, :tuple, [{:c, :atom, [:llvm_adj_stack], :unknown}, :any, :any, :any], {4, {:c, :atom, [:llvm_adj_stack], :unknown}}}]}}, {{:hipe_sparc_ra_ls, :module_info, 0}, {:any, []}}, {{:proc_lib, :hibernate, 3}, {:any, [{:c, :atom, :any, :unknown}, {:c, :atom, :any, :unknown}, {:c, :list, [:any, :any], :unknown}]}}, {{:gen, :reply, 2}, {{:c, :tuple, [:any, :any], {2, :any}}, [{:c, :tuple, [:any, :any], {2, :any}}, :any]}}, {{Task, :start, 3}, {{:c, :tuple, [{:c, :atom, [:ok], :unknown}, {:c, :identifier, [:pid], :unknown}], {2, {:c, :atom, [:ok], :unknown}}}, [:any, :any, :any]}}, {{:hipe_ppc_cfg, :branch_preds, 1}, {{:c, :list, [{:c, :tuple, [:any, {:c, ...}], {2, :any}}, {:c, nil, [], :unknown}], :unknown}, [{:c, :tuple_set, [{1, [{:c, ...}]}, {2, [{...}, ...]}, {3, [...]}, {5, ...}], :unknown}]}}, {{Access, :__info__, 1}, {:any, [{:c, :atom, [:attributes, :compile, :deprecated, :functions, ...], :unknown}]}}, {{Stream, :dedup_by, 2}, {{:c, :map, {[{{:c, :atom, ...}, :mandatory, {...}}, {{:c, ...}, :mandatory, ...}, {{...}, ...}, {...}], :any, :any}, :unknown}, [:any, :any]}}, {{:hipe_llvm, :mk_indirectbr, 3}, {{:c, :tuple, [{:c, :atom, [...], ...}, :any, :any, :any], {4, {:c, ...}}}, [:any, :any, :any]}}, {{:cerl, :atom_lit, 1}, {{:c, :list, [{:c, :union, ...}, {:c, ...}], :nonempty}, [{:c, :tuple, [{...}, ...], {...}}]}}, {{:disk_log_1, :chunk, 5}, {{:c, :tuple, [:any, :any], {2, ...}}, [:any, :any, :any, :any, ...]}}, {{:erts_debug, :map_info, 1}, {:any, [:any]}}, {{Version.InvalidVersionError, :__struct__, 0}, {{:c, :map, {...}, ...}, []}}, {{:application, :get_application, 0}, {{:c, :union, ...}, []}}, {{String.Chars.Version, :__impl__, 1}, {{:c, ...}, [...]}}, {{Inspect.Port, :module_info, ...}, {:any, ...}}, {{:hipe_icode, ...}, {...}}, {{...}, ...}, {...}, ...], 2760})
    (stdlib) ets.erl:736: :ets.tab2list/1
    (language_server) lib/language_server/dialyzer/manifest.ex:43: anonymous fn/6 in ElixirLS.LanguageServer.Dialyzer.Manifest.write/6
    (elixir) lib/task/supervised.ex:89: Task.Supervised.do_apply/2
    (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Function: #Function<7.78335674/0 in ElixirLS.LanguageServer.Dialyzer.Manifest.write/6>
    Args: []

Works fine on newer elixir and otp combinations

Provide easy configuration for limiting resource (mainly CPU) usage?

Environment

  • Elixir & Erlang versions (elixir --version): 1.9.2
  • Operating system: Linux Mint 19
  • Client (editor or IDE): Vim

I installed Elixir-LS a little bit ago, and I've noticed that it is a very resource intensive program. Since I usually leave vim open while doing other things, it will chew up a lot of CPU, making my computer relatively slow.

I was able to remedy this by editing the startup script to restrict the number of schedulers so that it was never taking up too much of my machine (now 2 cores out of the 8 available with elixir --erl "+S 2:2" -e "ElixirLS.LanguageServer.CLI.main()"), but I'm betting most Elixir users won't know how to do this, and it might affect their experience.

Maybe it would be nice if there was a way to let users easily configure how much of their machine's CPU they want Elixir-LS to have access to?

Emacs lsp-mode not registering file watchers

Environment

  • Elixir & Erlang versions (elixir --version): 1.81 (OTP 20)
  • Client (editor or IDE): Emacs 25 (lsp-mode)

Problem Description

I use emacs with lsp-mode for a number of different programming languages. I found a problem when using elixir-ls in that compilation errors were not appearing in the emacs buffer.
Upon further inspection, I found that the lsp-mode client sent a textDocument/didChange notification instead of a workspace/didChangeWatchedFiles notification, which would trigger a build.

This behaviour is not replicated on VS Code. VS Code seems to eagerly create file watchers without being specifically prompted by the server. From the LSP specification:

It is recommended that servers register for these file events using the registration mechanism. In former implementations clients pushed file events without the server actively asking for it.

This is fine for the plugin, since it is known that the server does support file watchers. However, it seems that Emacs lsp-mode acts more conservatively in this respect, and does not create file watches unless specifically asked to.

Proposed Solution

Digging into the source code, I've found the infrastructure to send requests is present. By sending an additional message to the client, Emacs lsp-mode takes care of everything else and syntax highlighting and re-building work as intended.

The VSCode extension crashes

I uninstalled the "official" ElixirLS and installed this fork from the marketplace. After restarting the code, I got a crash, and the extension is not working. The old ElixirLS worked just fine.

Environment

  • Elixir & Erlang versions (elixir --version): 1.9.1 && OTP 21
  • Operating system: Ubuntu 19.04
  • Client (editor or IDE): VSCode

Crash report template

  1. Create a new Mix project with mix new empty, then open that project with VS Code and open an Elixir file. Is your issue reproducible on the empty project? If not, please publish a repo on Github that does reproduce it.

The issue is not reproducible on an empty project. Unfortunately, I can't publish the repo in question.

  1. Check the output log by opening View > Output and selecting "ElixirLS" in the dropdown. Please include any output that looks relevant. (If ElixirLS isn't in the dropdown, the server failed to launch.)
** (UndefinedFunctionError) function ElixirLS.Utils.WireProtocol.intercept_output/2 is undefined (module ElixirLS.Utils.WireProtocol is not available)
    ElixirLS.Utils.WireProtocol.intercept_output(&ElixirLS.LanguageServer.JsonRpc.print/1, &ElixirLS.LanguageServer.JsonRpc.print_err/1)
    lib/language_server/cli.ex:6: ElixirLS.LanguageServer.CLI.main/0
    (stdlib) erl_eval.erl:680: :erl_eval.do_apply/6
    (elixir) lib/code.ex:240: Code.eval_string/3
[Error - 8:03:46 PM] Connection to server got closed. Server will not be restarted.

Callback info about the 'Elixir.Mix.Task' behaviour is not available

Environment

  • Elixir & Erlang versions (elixir --version): latest
  • Operating system: macos
  • Client (editor or IDE): vscode

Sanity Check List

  1. Create a new Mix project with mix new empty, then open that project with VS Code and open an Elixir file. Is your issue reproducible on the empty project? YES
  2. Check the output log by opening View > Output and selecting "ElixirLS" in the dropdown. Please include any output that looks relevant. (If ElixirLS isn't in the dropdown, the server failed to launch.)
13:14:18.445 [error] Process #PID<0.15210.0> raised an exception
** (SyntaxError) nofile:11: syntax error before: 'Callback'
    (language_server) lib/language_server/providers/document_symbols.ex:41: ElixirLS.LanguageServer.Providers.DocumentSymbols.list_symbols/1
    (language_server) lib/language_server/providers/document_symbols.ex:35: ElixirLS.LanguageServer.Providers.DocumentSymbols.symbols/2
    (language_server) lib/language_server/server.ex:442: anonymous fn/3 in ElixirLS.LanguageServer.Server.handle_request_async/2
  1. Check the developer console by opening Help > Toggle Developer Tools and include any errors that look relevant.
    Nothing relevant.

Comments

Based on the documentation for dialyzer, I believe that starting dialyzer with the option: --apps mix would resolve this matter. When I go to settings however, I am only able to provide warn options.

If my assessment is correct, could someone kindly share with me how I could customize the starting options for dialyzer manually for the time being?

Compilation errors are not showing up

It looks like on the current master branch, compilation errors are not being appropriately reported. This blocks the next release of the extension.

Crashes when using magit's `time-machine-transient-state`

Environment

  • Elixir & Erlang versions (elixir --version): 1.8.1
  • Operating system: MacOS
  • Client (editor or IDE): Emacs 26.3

Crash report template

Delete this section if not reporting a crash

  1. If using a client other than VS Code, please try VS Code's ElixirLS extension. Does it reproduce your failure?
    It doesn't have magit
  2. Create a new Mix project with mix new empty, then open that project with VS Code and open an Elixir file. Is your issue reproducible on the empty project? If not, please publish a repo on Github that does reproduce it.
    Yes
  3. Check the output log by opening View > Output and selecting "ElixirLS" in the dropdown. Please include any output that looks relevant. (If ElixirLS isn't in the dropdown, the server failed to launch.)
    Not in VSCode
  4. Check the developer console by opening Help > Toggle Developer Tools and include any errors that look relevant.
    Not in VSCode

Steps to reproduce

  1. Create a new project
  2. Create at least two git commits
  3. Use time-machine-transient-state to display the state of the file under a previous commit

Guidance on what version the language server should run

Environment

  • Elixir & Erlang versions (elixir --version): Lots :)
  • Operating system: Linux
  • Client (editor or IDE): Emacs 26.2 / Spacemacs development branch.

Description

I run a single Emacs server, and graphical or terminal clients; at any given time, I may have one or more Elixir projects open (using projectile) and I'm switching through a wide variety of Elixir/OTP version requirements, all neatly handled by asdf-vm.

As far as I can tell, only one language server is started by Emacs and shared by all the projects. I'm not sure whether that's intended or not but it does beg the question what version the language server should run under. Currently, Emacs starts language_server.sh from whatever project directory is current, and this version may be too old (or too new?) for other projects.

My hunch is that elixir-ls should be compiled with the lowest supported version and run with the highest supported version so that it understands everything that various projects throw at it, but I'm not sure. In any case, it smells to me that "what version to run this with" is a tad under-documented.

Non standard expandMacro request

Comparing this fork with Jake's master, I've found this: JakeBecker/elixir-ls@643bb31

Is this still conformant to the language server protocol?

In the specification, if you search for interface ServerCapabilities, the allowed keys seems to be a very strict set, I'm not sure if adding macro expansion is valid.

Maybe that's the case for a code action instead?

Thanks!

Feature: add support to peek definition of defdelegated code

Environment

Erlang/OTP 21 [erts-10.3] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
Elixir 1.10.1 (compiled with Erlang/OTP 21)
Visual Studio Code 1.42.1
Windows 10
ElixirLS Fork: Elixir support and debugger 0.3.0

Current behavior

Currently peek definition (Alt+F12) will peek into defdelegate not to code it points to. It's very annoying that if you want use defdelegate you'll lose ability to peek actual code.

Feature behavior

Peek definition (Alt+F12) would show code defdelegate points to instead.
This could be under settings to be enabled if not wanted to made enabled by default.

vim-lsc crashes ElixirLS on method `shutdown`

Description

When exiting Neovim using vim-lsc, message "[lsc:Error] ElixirLS has crashed. See Output panel." is shown. Upon investigation, ElixirLS is throwing an exception (below).

Related from root:
JakeBecker/elixir-ls#207

Steps to Reproduce

  1. Open an Elixir file in a (Neo)vim instance using vim-lsc.
  2. Ensure the ElixirLS is running.
  3. Close the file.

Expected Behavior

The language server should exit cleanly.

Actual Behavior

ElixirLS crashes with the following:

21:16:59.997 [error] GenServer ElixirLS.LanguageServer.Server terminating
** (FunctionClauseError) no function clause matching in ElixirLS.LanguageServer.Server.handle_notification/2
    (language_server) lib/language_server/server.ex:216: ElixirLS.LanguageServer.Server.handle_notification(%{"id" => 2, "jsonrpc" => "2.0", "method" => "shutdown"}, %ElixirLS.LanguageServer.Server{analysis_ready?: false, awaiting_contracts: [], build_diagnostics: [], build_ref: nil, build_running?: false, client_capabilities: %{"textDocument" => %{"codeAction" => %{"codeActionLiteralSupport" => %{"codeActionKind" => %{"valueSet" => ["quickfix", "refactor", "source"]}}}, "completion" => %{"completionItem" => %{"snippetSupport" => false}}, "definition" => %{"dynamicRegistration" => false}, "signatureHelp" => %{"dynamicRegistration" => false}, "synchronization" => %{"didSave" => false, "willSave" => false, "willSaveWaitUntil" => false}}, "workspace" => %{"applyEdit" => true}}, dialyzer_diagnostics: [], dialyzer_sup: nil, needs_build?: false, project_dir: nil, received_shutdown?: false, requests: %{}, root_uri: "file:///Users/[redacted]/[project]" settings: nil, source_files: %{}})
    (language_server) lib/language_server/server.ex:144: ElixirLS.LanguageServer.Server.handle_cast/2
    (stdlib) gen_server.erl:637: :gen_server.try_dispatch/4
    (stdlib) gen_server.erl:711: :gen_server.handle_msg/6
    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: {:"$gen_cast", {:receive_packet, %{"id" => 2, "jsonrpc" => "2.0", "method" => "shutdown"}}}
State: %ElixirLS.LanguageServer.Server{analysis_ready?: false, awaiting_contracts: [], build_diagnostics: [], build_ref: nil, build_running?: false, client_capabilities: %{"textDocument" => %{"codeAction" => %{"codeActionLiteralSupport" => %{"codeActionKind" => %{"valueSet" => ["quickfix", "refactor", "source"]}}}, "completion" => %{"completionItem" => %{"snippetSupport" => false}}, "definition" => %{"dynamicRegistration" => false}, "signatureHelp" => %{"dynamicRegistration" => false}, "synchronization" => %{"didSave" => false, "willSave" => false, "willSaveWaitUntil" => false}}, "workspace" => %{"applyEdit" => true}}, dialyzer_diagnostics: [], dialyzer_sup: nil, needs_build?: false, project_dir: nil, received_shutdown?: false, requests: %{}, root_uri: "file:///Users/[redacted]/[project]", settings: nil, source_files: %{}}

Environment

Elixir & Erlang versions (elixir --version):

Erlang/OTP 22 [erts-10.5.6] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] [dtrace]

Elixir 1.9.4 (compiled with Erlang/OTP 22)

Operating system:

MacOS Catalina - 10.15.3 (19D76)

Client (editor or IDE):

vim-lsc 0.4.0
NVIM v0.4.3
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/tmp/neovim-20191107-85913-1wbgqz6/neovim-0.4.3/build/config -I/tmp/neovim-20191107-85913-1wbgqz6/neovim-0.4.3/src -I/usr/local/include -I/tmp/neovim-20191107-85913-1wbgqz6/neovim-0.4.3/deps-build/include -I/usr/local/opt/gettext/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include -I/tmp/neovim-20191107-85913-1wbgqz6/neovim-0.4.3/build/src/nvim/auto -I/tmp/neovim-20191107-85913-1wbgqz6/neovim-0.4.3/build/include
Compiled by [email protected]

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/0.4.3/share/nvim"

Run :checkhealth for more info

Bug: function nil.text/0 is undefined exception

Got this exception today, not sure how to reproduce yet. Also not sure about the input that caused this.

09:45:52.252 [error] Process #PID<0.5762.0> raised an exception
** (UndefinedFunctionError) function nil.text/0 is undefined
    nil.text()
    (language_server) lib/language_server/server.ex:345: anonymous fn/4 in ElixirLS.LanguageServer.Server.handle_request/2
    (language_server) lib/language_server/server.ex:419: anonymous fn/3 in ElixirLS.LanguageServer.Server.handle_request_async/2

Error with import MyApp.{ModA, ModB}

Environment

  • Elixir & Erlang versions (elixir --version): Elixir 1.8.0 (compiled with Erlang/OTP 20)
  • Operating system: Linux
  • Client (editor or IDE): Emacs

When visiting a file that is using a module that has a line like import MyApp.{ModA, ModB} in it's __using__ macro, the following error is raised:

LSP :: an exception was raised:
    ** (FunctionClauseError) no function clause matching in Code.ensure_loaded/1
        (elixir) lib/code.ex:985: Code.ensure_loaded({{:., [], [ElixirLsTest, :{}]}, [], [ModA, ModB]})
        (elixir_sense) lib/alchemist/helpers/module_info.ex:64: Alchemist.Helpers.ModuleInfo.get_module_funs/1
        (elixir_sense) lib/alchemist/helpers/module_info.ex:52: Alchemist.Helpers.ModuleInfo.has_function?/2
        (elixir) lib/enum.ex:2948: Enum.find_list/3
        (elixir_sense) lib/elixir_sense/core/introspection.ex:628: ElixirSense.Core.Introspection.find_imported_function/2
        (elixir_sense) lib/elixir_sense/core/introspection.ex:602: ElixirSense.Core.Introspection.actual_mod_fun/4
        (elixir_sense) lib/elixir_sense/providers/docs.ex:12: ElixirSense.Providers.Docs.all/4
        (elixir_sense) lib/elixir_sense.ex:50: ElixirSense.docs/3

I've set up a test repo at https://github.com/manukall/elixir_ls_test. When opening the file lib/elixir_ls_test/using.ex I get the above error.

Clarificaiton regarding completion response spec

Currently, completion for module attributes returns insertText with @ prefix removed.

ie. if the module have @default_value attribute. @defa<cursor> returns defult_value as insertText.

From the spec CompletionItem.insertText should be complete text including @?

Show Dialyzer Report?

Environment

  • Elixir & Erlang versions (elixir --version): Elixir 1.9.4 (compiled with Erlang/OTP 22)
  • Operating system: MacOs
  • Client (editor or IDE): Emacs (spacemacs)

hey folks,
probably I am the idiot here, but is there any way to pretty-print the findings of the dialyzer analysis in emacs or just via console?

I thought that the dialyzer manifest could be used for that, but currently I only see a blob there.

Flycheck (an emacs tool) only displays errors within file in the current buffer, but I would like to see the results for my whole project.
I am not afraid to do some scripting on my own, but currently I am rather benighted how to even read that file.
I would really appreciate if you gave me some pointers here. :)

With kind regards
Peter

Auto completion for struct fields

Environment

  • Elixir & Erlang versions (elixir --version): Elixir 1.9.4
  • Operating system: Mac os catalina
  • Client (editor or IDE): Visual Studio Code

This is not a bug report, I merely have a question regarding the autocomplete for structs.

According to this elixir-ls is supposed to be able to do autocompletion for the names of struct fields. But at least for me, this literally never happens.

I am curious to know if there is something that may need to be done on my end to get this to work and also if this feature only works under certain contexts or not.

Thanks.

asdf does not support sh

David Sweeney in this Elixir Forum post recently discovered the issue that our language_server.sh is no longer sh compatible because asdf (added in #78) is not currently sh compatible.

The error manifests itself with an error like:
/home/my_home/.asdf/asdf.sh: 8: /home/my_home/.asdf/asdf.sh: Bad substitution

I have raised an issue on asdf to determine if asdf is meant to support sh/dash, or only bash and other shells.

I see a few possible ways forward but would like to collect other's thoughts about them:

  1. Change language_server.sh to run bash instead of sh (via #!/usr/bin/env bash)
  2. Revert #78
  3. Wait for asdf to support sh

I'm currently leaning towards option 1 because bash is very widespread at this point and I'd imagine most systems will have it and for any that don't, the user will most likely understand how to fix the error.

Discussion: Change packaging approach

Currently ElixirLS is packaged with https://github.com/JakeBecker/mix_task_archive_deps as .ez archives. This approach means that the language server is run by a different version of elixir than it was compiled with which can cause issues such as #107

ElixirLS used to run as an escript but that was changed in v0.2.4: 25 Oct 2017:

Package ElixirLS as .ez archives instead of escripts. This should make asdf installs work.

Goals/Requirements:

  1. End-user's code should be compiled with the version of elixir and erlang that they have in their .tool-versions or installed globally
    a. This means that reported warnings/errors match the version of Elixir that they're using, not earlier or later versions
  2. The majority of the ElixirLS/ElixirSense code should run on the same version of elixir that it was compiled on
  3. For users of the vscode-elixir-ls package it should continue to be a one-click install

Possible approaches:

  1. Continue to use mix_task_archive_deps
  2. Use escripts
  3. Use a release
  4. Other?
  5. Separate BEAM instance with source code (being fleshed out in #136)

Potential issues to be aware of:

  1. With mix_task_archive_deps there can only be one version of a dependency running which is mainly an issue for Jason and Dialyxir (but if we added more dependencies it could become a larger issue)
  2. Compiled Elixir code relies on Elixir internals that could change (see #107 for an example)
    a. This is the issue that is currently causing the most trouble
  3. Elixir releases are generally recommended to be built on the same version of OS that they will run on
  4. Escripts require Erlang to be installed on the target system

I will come back and flesh out the issues and possible approaches later, along with more clear guidelines on what the requirements are.
Edit: added above

Does not work on elixir 1.10

What's this project's goal?

Hi, I just stumbled upon this repo and wonder two things:

  • What's this project its goal, or how is it different from Jake Becker's version?
  • Why or when should I use this project instead of Jake Becker's version

KR,
Edward

[Feature request] VSCode: Display errors above documentation

Environment
  • Elixir & Erlang versions (elixir --version):

    Erlang/OTP 22 [erts-10.6.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1]
    
    Elixir 1.10.1 (compiled with Erlang/OTP 21)
    
  • Operating system: Ubuntu 18.04

  • Editor or IDE name (e.g. Emacs/VSCode): VSCode

  • LSP Client name: I'm not sure, is VSCode an "LSP" client?

  • If using VSCode, are you using "ElixirLS Fork: Elixir support and debugger" (note that it has "Fork" in the name)? Yup

Feature request

When VSCode underlines a problem in my code (error or warning), I can hover it to see the error message. If the hovered module is documented, its documentation is shown first and I have to scroll all the way down to see the message (notice the scroll bar):

Screenshot from 2020-02-18 21-44-04

It would be nice to show the errors first.

Edit: I almost forgot: thanks for maintaining this fork. ❤️

Issue on hover while writing an ExUnit test

Got an exception while writing an exunit test:

10:25:32.006 [error] Process #PID<0.13311.4> raised an exception
** (MatchError) no match of right hand side value: nil
    (elixir_sense) lib/elixir_sense/core/parser.ex:67: ElixirSense.Core.Parser.fix_parse_error/3
    (elixir_sense) lib/elixir_sense/core/parser.ex:53: ElixirSense.Core.Parser.string_to_ast/3
    (elixir_sense) lib/elixir_sense/core/parser.ex:18: ElixirSense.Core.Parser.parse_string/4
    (elixir_sense) lib/elixir_sense.ex:43: ElixirSense.docs/3
    (language_server) lib/language_server/providers/hover.ex:7: ElixirLS.LanguageServer.Providers.Hover.hover/3
    (language_server) lib/language_server/server.ex:419: anonymous fn/3 in ElixirLS.LanguageServer.Server.handle_request_async/2
test "get_community_groups/1 returns only the groups viewable to the user", do
  #                                                                       ^ cursor

This partially makes sense because the code is in an uncompilable state. The exception actually appears to be within elixir_sense.

ElixirLS Dialyzer Warnings Support for Umbrellas?

Environment

  • Elixir & Erlang versions (elixir --version): Elixir 1.9.1 (compiled with Erlang/OTP 22)
  • Operating system: MacOS 10.14.6
  • Client (editor or IDE): VSCode 1.38.1 and ST3 v3208 (LSP plugin) as it's an LS issue not a plugin issue

Issue

I can't get Dialyzer warnings to emit in a fresh Phoenix 1.4.9 umbrella project. Here are the steps I took (after setting "tracing" to verbose):

  1. mix phx.new blah
  2. code -n blah

I made this trivial edit to lib/blah_web/controllers/page_controller.ex:

  def index(conn, _params) do
    _a = blah(42)
    render(conn, "index.html")
  end

  def blah(nil), do: false

After a few seconds it works great telling me:

The function call will not succeed.

BlahWeb.PageController.blah(42)

will never return since it differs in arguments with
positions 1st from the success typing arguments:

(nil)
ElixirLS Dialyzer

I can see that warning in the tracing log showing the LS emitted that warning which was rendered properly by VSCode.

Now if I create an umbrella project with mix phx.new blah --umbrella and make the same exact change to page_controller.ex this warning does not show up. Tracing log shows the LS does not send the warning to the frontend even though Dialyzer is started and the dialyzer_manifest_22.0.7_elixir-1.9.1_test file is created properly in /.elixir-ls. There are no error messages or other anomalies in the tracing log.

Compiler warnings always work it's the Dialyzer warnings that are not emitting on umbrella projects. I tested with Jake's LS also and the same thing is happening. Thanks for any help!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.