Skip to content

Commit

Permalink
Improved hover support: Structs, qualified calls/types, behaviours (#356
Browse files Browse the repository at this point in the history
)

FEATURES:

* Include the range of resolved entities when responding to hover requests

This allows editors to highlight the token that the hover content applies to. For instance, if you hovered `Baz` in the module `Foo.Bar.Baz`, the entire module will be highlighted, not just the hovered segment in the module.

* Improve formatting and docs when hovering modules

Behaviours (modules that have `@callback` attributes) will now show callback specs and below any module docs.

* Don't show return content when hovering modules without docs

This applies to modules that use `@moduledoc false` or modules that are missing a `@moduledoc` attribute and don't have other additional docs to show (e.g. behaviour callbacks).

* Add support for hovering structs

When hovering a module being used as a struct, e.g. `%MyStruct{}`,  `MyStruct.t` types will now be shown before any additional module docs.

* Add support for hovering qualified functions, macros, and types

Qualified calls are those that begin with a module, e.g. `MyModule.my_fun()`. When hovering qualified functions or macros, the signatures of those calls will be shown followed by any specs and docs. When hovering qualified types, the type definition will be shown followed by any docs.

For functions with multiple arities, the arity currently being used will try to be inferred and those definitions/docs shown first, followed by those for any higher arities. 

INTERNAL:

* Add additional utilities to `Lexical.Ast`, including `path_at/2` and `contains_position?/2`

* Add `Lexical.Test.CursorSupport.pop_range/2`

* Add `Lexical.Test.RangeSupport.pop_range/1`

* Update Sourceror to 0.14

This version bump includes more complete and resilient APIs for getting ranges, as well as a new `%Zipper{}` struct that replaces the old `{tree, meta}` tuple that previously was used to represent zippers.
  • Loading branch information
zachallaun committed Sep 22, 2023
1 parent fc90933 commit 9bff1bb
Show file tree
Hide file tree
Showing 25 changed files with 2,363 additions and 383 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
id: set_mix_lock_hash
run: |
mix_lock_hash="${{ hashFiles(env.project_mix_lock) }}"
projects_hash="${{ hashFiles(env.project_ex_blob, env.projects_locks_blob) }}"
projects_hash="${{ hashFiles(env.projects_ex_blob, env.projects_locks_blob) }}"
echo "mix_lock_hash=$mix_lock_hash::$projects_hash" >> "$GITHUB_OUTPUT"
# Step: Define how to cache deps. Restores existing cache if present.
Expand Down
Loading

0 comments on commit 9bff1bb

Please sign in to comment.