Skip to content

Add hover for smithy-build.json#202

Merged
milesziemer merged 1 commit intosmithy-lang:mainfrom
milesziemer:build-file-hover
Feb 25, 2025
Merged

Add hover for smithy-build.json#202
milesziemer merged 1 commit intosmithy-lang:mainfrom
milesziemer:build-file-hover

Conversation

@milesziemer
Copy link
Copy Markdown
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 joewyz, yasmewad and yefrig and removed request for yasmewad February 24, 2025 18:18
@milesziemer milesziemer merged commit 958f8ab into smithy-lang:main Feb 25, 2025
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