GithubHelp home page GithubHelp logo

@do fails to complete about elixir_sense HOT 3 CLOSED

elixir-lsp avatar elixir-lsp commented on July 30, 2024
@do fails to complete

from elixir_sense.

Comments (3)

lukaszsamson avatar lukaszsamson commented on July 30, 2024

Are there currently any tests of completion that involve a file that fails to compile?

There are some in test/elixir_sense/suggestion_test.exs

from elixir_sense.

lukaszsamson avatar lukaszsamson commented on July 30, 2024

I hit some other similar errors lately, e.g.

add_call_to_line({Module.concat(module), call, length(params)}, {line, column + 1})
** (FunctionClauseError) no function clause matching in :elixir_aliases.do_concat/2
    (elixir 1.10.3) src/elixir_aliases.erl:120: :elixir_aliases.do_concat([{:state, [line: 50, column: 5], nil}, :Process], "Elixir")
    (elixir 1.10.3) src/elixir_aliases.erl:108: :elixir_aliases.concat/1
    (elixir_sense 1.0.1) lib/elixir_sense/core/metadata_builder.ex:990: ElixirSense.Core.MetadataBuilder.pre/2
    (elixir 1.10.3) lib/macro.ex:430: anonymous fn/4 in Macro.do_traverse_args/4
    (elixir 1.10.3) lib/enum.ex:1520: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (elixir 1.10.3) lib/enum.ex:1520: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (elixir 1.10.3) lib/macro.ex:396: Macro.do_traverse/4
    (elixir 1.10.3) lib/macro.ex:411: Macro.do_traverse/4


** (FunctionClauseError) no function clause matching in :elixir_aliases.do_concat/2
    (elixir 1.10.3) src/elixir_aliases.erl:120: :elixir_aliases.do_concat([{:|>, [line: 517, column: 5], [{:++, [line: 516, column: 28], [{:news, [line: 516, column: 23], nil}, {:modifys, [line: 516, column: 31], nil}]}, {{:., [line: 517, column: 12], [{:__aliases__, [line: 517, column: 8], [:Enum]}, :group_by]}, [line: 517, column: 12], [{:fn, [line: 517, column: 22], [{:->, [line: 517, column: 48], [[{:{}, [line: 517, column: 25], [{:side, [line: 517, column: 26], nil}, {:_price, [line: 517, column: 32], nil}, {:_order, [line: 517, column: 40], nil}]}], {:side, [line: 517, column: 51], nil}]}]}]}]}, :I], "Elixir")
    (elixir 1.10.3) src/elixir_aliases.erl:108: :elixir_aliases.concat/1
    (elixir_sense 1.0.1) lib/elixir_sense/core/state.ex:974: ElixirSense.Core.State.expand_alias/2
    (elixir_sense 1.0.1) lib/elixir_sense/core/metadata_builder.ex:1226: ElixirSense.Core.MetadataBuilder.get_binding_type/2
    (elixir_sense 1.0.1) lib/elixir_sense/core/metadata_builder.ex:753: ElixirSense.Core.MetadataBuilder.pre/2
    (elixir 1.10.3) lib/macro.ex:430: anonymous fn/4 in Macro.do_traverse_args/4
    (elixir 1.10.3) lib/enum.ex:1520: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (elixir 1.10.3) lib/enum.ex:1520: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (elixir 1.10.3) lib/macro.ex:396: Macro.do_traverse/4
    (elixir 1.10.3) lib/macro.ex:411: Macro.do_traverse/4
    (elixir 1.10.3) lib/enum.ex:1520: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (elixir 1.10.3) lib/macro.ex:416: Macro.do_traverse/4
    (elixir 1.10.3) lib/enum.ex:1520: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (elixir 1.10.3) lib/enum.ex:1520: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (elixir 1.10.3) lib/macro.ex:396: Macro.do_traverse/4
    (elixir 1.10.3) lib/enum.ex:1520: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (elixir 1.10.3) lib/enum.ex:1520: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (elixir 1.10.3) lib/macro.ex:396: Macro.do_traverse/4
    (elixir 1.10.3) lib/macro.ex:411: Macro.do_traverse/4
    (elixir 1.10.3) lib/enum.ex:1520: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3

Unfortunately it is not worth fixing every one. Metadata builder makes assumptions that AST is relatively sane. In the case with @do ... the parser assumes that function block is the attribute value which is obviously illegal. The best we can do is catch the error and replace the faulty AST node with nil.

from elixir_sense.

axelson avatar axelson commented on July 30, 2024

Thanks, that seems like a sane fix

from elixir_sense.

Related Issues (20)

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.