vscode-elixir-ls icon indicating copy to clipboard operation
vscode-elixir-ls copied to clipboard

Confusing / harmful directions about debug_info in the README

Open al2o3cr opened this issue 1 year ago • 1 comments

The elixirc_options setting suggested in https://github.com/elixir-lsp/vscode-elixir-ls/pull/188 has several issues:

  • it's unnecessary, as debug_info defaults to true. This was incorrectly documented as defaulting to false until the documentation was updated for 1.15 as part of https://github.com/elixir-lang/elixir/pull/9348

  • it's not recommended, per the documentation for Code.put_compiler_option

    Therefore, disabling :debug_info is not recommended as it removes the ability of the Elixir compiler and other tools to provide feedback. If you want to remove the :debug_info while deploying, tools like mix release already do such by default. Additionally, mix test disables it via the :test_elixirc_options project configuration option. This option can also be overridden per module using the @compile directive.

  • it breaks Dialyzer when used in a project that is subsequently used as a Hex dependency. Examples:

    • https://elixirforum.com/t/dialyzer-could-not-get-core-erlang-code-for/56730
    • https://elixirforum.com/t/dialyzer-issues-in-elixir-libraries/60608

I don't know what the root cause of the "Invalid beam file or no abstract code" error that motivated #188 was, but the only result of the change it suggests is setting debug_info to false when compiling in Mix.env == :prod since the default was already true...

al2o3cr avatar Dec 28 '23 19:12 al2o3cr

Probably that README section is not relevant anymore. Since v0.15 which added official support for elixir 1.15 (https://github.com/elixir-lsp/elixir-ls/pull/898), ElixirLS overwrites project settings anyway and sets debug_info, both global and test_elixirc_options, to true. IIRC it was necessary to make debugger work and tests pass.

Would you create a PR removing or updating that section?

it's unnecessary, as debug_info defaults to true

I think that's not true in tests, see https://github.com/elixir-lang/elixir/blob/38ddc98fef7faf6f4666703dcd9c99105e6388d2/lib/mix/lib/mix/compilers/test.ex#L25-L26.

lukaszsamson avatar Dec 28 '23 20:12 lukaszsamson