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 hover for smithy-build.json #202

Merged
merged 1 commit into from
Feb 25, 2025

Conversation

milesziemer
Copy link
Contributor

The language server now provides hover content for smithy-build.json. Specifically, when hovering on json keys (and only the keys), hover content will include the documentation for that property from https://smithy.io/2.0/guides/smithy-build-json.html, in addition to a link to the corresponding section in the docs page where applicable.

This uses the build.smithy builtin model. I've added documentation traits to all relevant members, including externalDocumentation for the links. I didn't do the same for .smithy-project.json, as I'll need to think through properly documenting that and plan on doing so later.

This commit will have a few followups based on things I've learned from this commit:

  1. I should add support for externalDocumentation to IDL hover. Can probably share a lot of the code.
  2. I can probably remove the serialization of validation events into IDL hover content. I'm not sure why exactly I put them there, maybe it was an artifact from the history of the language server, but I think that diagnostics are already displayed with hover content, so doing the extra work is unnecessary.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

The language server now provides hover content for smithy-build.json.
Specifically, when hovering on json keys (and only the keys), hover
content will include the documentation for that property from
https://smithy.io/2.0/guides/smithy-build-json.html, in addition to a
link to the corresponding section in the docs page where applicable.

This uses the `build.smithy` builtin model. I've added documentation
traits to all relevant members, including externalDocumentation for the
links. I didn't do the same for .smithy-project.json, as I'll need to
think through properly documenting that and plan on doing so later.

This commit will have a few followups based on things I've learned from
this commit:
1. I should add support for externalDocumentation to IDL hover. Can
   probably share a lot of the code.
2. I can probably remove the serialization of validation events into IDL
   hover content. I'm not sure why exactly I put them there, maybe it
   was an artifact from the history of the language server, but I think
   that diagnostics are already displayed with hover content, so doing
   the extra work is unnecessary.
@milesziemer milesziemer requested a review from a team as a code owner February 24, 2025 18:18
@milesziemer milesziemer requested review from yasmewad, joewyz and yefrig and removed request for yasmewad February 24, 2025 18:18
@milesziemer milesziemer merged commit 958f8ab into smithy-lang:main Feb 25, 2025
3 checks passed
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.

2 participants