Skip to content
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

Compiler never returns columns in warning/error positions #11965

Closed
lukaszsamson opened this issue Jul 5, 2022 · 1 comment
Closed

Compiler never returns columns in warning/error positions #11965

lukaszsamson opened this issue Jul 5, 2022 · 1 comment

Comments

@lukaszsamson
Copy link
Contributor

lukaszsamson commented Jul 5, 2022

Elixir and Erlang/OTP versions

1.11+

Operating system

macOS

Current behavior

Both Mix.Task.Compiler.Diagnostic and Kernel.ParalelCompiler APIs allow lines and lines with columns (or even ranges) in their typespecs. Column information is often available and is printed in error messages but is never returned in API calls.

%Mix.Task.Compiler.Diagnostic{
    file: "/Users/lukaszsamson/bug_repro/phx_error_path_umbr_umbrella/apps/phx_error_path_umbr_web/lib/phx_error_path_umbr_web/views/page_view.ex",
    severity: :error,
    message: "** (SyntaxError) lib/phx_error_path_umbr_web/views/page_view.ex:3:26: unexpected token: ). The \"do\" at line 1 is missing terminator \"end\"\n    (elixir 1.14.0-dev) lib/kernel/parallel_compiler.ex:346: anonymous fn/5 in Kernel.ParallelCompiler.spawn_workers/7\n",
    position: 3,
    compiler_name: "Elixir",
    details: nil
  }
Kernel.ParallelCompiler.compile(["test/fixtures/token_missing_error/lib/has_error.ex"])

== Compilation error in file test/fixtures/token_missing_error/lib/has_error.ex ==
** (TokenMissingError) test/fixtures/token_missing_error/lib/has_error.ex:16:1: missing terminator: end (for "do" starting at line 1)

    HINT: it looks like the "do" on line 6 does not have a matching "end"

    (elixir 1.13.4) lib/kernel/parallel_compiler.ex:347: anonymous fn/5 in Kernel.ParallelCompiler.spawn_workers/7
{:error,
 [
   {"/Users/lukaszsamson/vscode-elixir-ls/elixir-ls/apps/language_server/test/fixtures/token_missing_error/lib/has_error.ex",
    16,
    "** (TokenMissingError) test/fixtures/token_missing_error/lib/has_error.ex:16:1: missing terminator: end (for \"do\" starting at line 1)\n\n    HINT: it looks like the \"do\" on line 6 does not have a matching \"end\"\n\n    (elixir 1.13.4) lib/kernel/parallel_compiler.ex:347: anonymous fn/5 in Kernel.ParallelCompiler.spawn_workers/7\n"}
 ], []}

Expected behavior

Return column if available

position: {3, 26}

or

{:error,
 [
   {...,
    {16, 1},
    "** (TokenMissingError) ..}
 ], []}
@josevalim
Copy link
Member

Closed by cadd15c but linked the wrong PR in the commit message. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants