Skip to content

Improvements to document outline #76

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

Merged
merged 23 commits into from
Nov 27, 2019
Merged

Conversation

lukaszsamson
Copy link
Collaborator

This PR introduces many improvements and fixes to document outline provider.

@lukaszsamson
Copy link
Collaborator Author

It looks like code in this PR triggered an inconsistency in elixir formatter as it reports not formatted on < 1.9

@axelson
Copy link
Member

axelson commented Nov 27, 2019

Hmmm, the diff is annoying:

-        [{:"::", _, [{_, _, _} = type_head | _]}] ->
+        [{:::, _, [{_, _, _} = type_head | _]}] ->
           Macro.to_string(type_head)

-        [{:when, _, [{:"::", _, [{_, _, _} = type_head, _]}, _]}] ->
+        [{:when, _, [{:::, _, [{_, _, _} = type_head, _]}, _]}] ->

One workaround is to use a binding. So something like:

type_separator = String.to_atom("::")
case type_expression do
  [{^type_separator, _, [{_, _, _} = type_head | _]}] ->
  ...

That's perhaps a little uglier, but at least it is straightforward and semantically the same. Alternatively we could try to run the formatter check only 1.9.x, but I'm not sure how to do that with travis.

@NobbZ
Copy link
Member

NobbZ commented Nov 27, 2019

Alternatively we could try to run the formatter check only 1.9.x, but I'm not sure how to do that with travis.

As far as I know, there is ELIXIR_VERSION environment variable set up by travis.

Therefore doing something like this should work:

script:
  - MIX_ENV=test mix compile --force --warnings-as-errors
  - [[ ${ELIXIR_VERSION} == 1.9* ]] && mix format --check-formatted
  - mix test

@lukaszsamson
Copy link
Collaborator Author

@axelson I managed to enable conditional check.
@NobbZ your suggestion would not work properly as it would return non 0 exit code if ${ELIXIR_VERSION} == 1.9* condition were not satisfied causing the build to fail. Besides, the env in question is TRAVIS_ELIXIR_VERSION

Copy link
Member

@axelson axelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@axelson axelson merged commit dfa8116 into elixir-lsp:master Nov 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorporate nested outline view Using regular atoms as module names kills outline query
5 participants