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

Add on-hover details for types #1974

Merged

Conversation

awerment
Copy link
Contributor

@awerment awerment commented Jun 10, 2023

Hello! 👋

Been bugged by the fact that type specs are not displayed in the on-hover windows and decided to try and change that.

This PR adds more details:

  • includes type spec
  • includes full type signature, e.g. GenServer.on_start() instead of just on_start
  • includes link to erlang/hexdocs documentation

Examples

Elixir before

from_elixir

Elixir after

to_elixir to_elixir_opaque

Erlang before

from_erlang

Erlang after

to_erlang

@CLAassistant
Copy link

CLAassistant commented Jun 10, 2023

CLA assistant check
All committers have signed the CLA.

- show type definition
- show full type signature in first line, including module
- include docs link
@awerment awerment force-pushed the feature/hover-details-type-specs branch from 9eaf315 to 5c1c328 Compare June 10, 2023 21:36
Shown without the internal definition
@awerment awerment force-pushed the feature/hover-details-type-specs branch from c3a7afd to 3df610c Compare June 10, 2023 22:21
Copy link
Member

@jonatanklosko jonatanklosko left a comment

Choose a reason for hiding this comment

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

Awesome, thanks! Just a couple nitpicks :)

lib/livebook/intellisense.ex Outdated Show resolved Hide resolved
lib/livebook/intellisense.ex Outdated Show resolved Hide resolved
lib/livebook/intellisense.ex Outdated Show resolved Hide resolved
lib/livebook/intellisense/docs.ex Show resolved Hide resolved
@github-actions
Copy link

github-actions bot commented Jun 12, 2023

Uffizzi Preview deployment-28237 was deleted.

Copy link
Member

@jonatanklosko jonatanklosko left a comment

Choose a reason for hiding this comment

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

🐈

@jonatanklosko jonatanklosko merged commit 7691324 into livebook-dev:main Jun 12, 2023
@awerment
Copy link
Contributor Author

@jonatanklosko Just now noticed that the additions do not apply for the details of autocomplete suggestions. Should I take another look at that?

@jonatanklosko
Copy link
Member

@awerment yes, please! It should be a matter of adjusting this:

defp format_completion_item(%{
kind: :type,
name: name,
arity: arity,
documentation: documentation
}),
do: %{
label: "#{name}/#{arity}",
kind: :type,
detail: "typespec",
documentation: format_documentation(documentation, :short),
insert_text: Atom.to_string(name)
}

@awerment awerment deleted the feature/hover-details-type-specs branch June 12, 2023 15:14
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.

3 participants