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 completions for for build files #193

Merged
merged 1 commit into from
Feb 13, 2025

Conversation

milesziemer
Copy link
Contributor

The server now can provide completions for smithy-build.json and .smithy-project.json. The implementation works roughly the same as other node-like completions, using a new builtins model that specifies the structure of the build files. I also had to override the completion item mapper to make sure it wrapped object keys in strings, which is necessary in json.

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

The server now can provide completions for smithy-build.json and
.smithy-project.json. The implementation works roughly the same as other
node-like completions, using a new builtins model that specifies the
structure of the build files. I also had to override the completion item
mapper to make sure it wrapped object keys in strings, which is
necessary in json.
@milesziemer milesziemer requested a review from a team as a code owner February 12, 2025 20:04
@milesziemer milesziemer requested review from kstich, yefrig and joewyz and removed request for kstich February 12, 2025 20:04
Copy link
Contributor

@yefrig yefrig left a comment

Choose a reason for hiding this comment

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

LGTM.

Tested in neovim v0.11. All completions work fine.

It might be nice to include a text edit with a comma if completing inside a list where the completion is not the last member of the list. But might be out of scope.

}

structure MavenRepository {
@required
Copy link
Contributor

Choose a reason for hiding this comment

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

How are constraints used by the LS? Could we possibly add more constraints to save energy doing validations like urls etc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They really aren't right now. Originally I intended to use them for validation, but I scrapped that idea to use the validation errors from smithy-build. However, with trait values, required members get autopopulated in completions, so maybe a future update could do that for node values too.

@milesziemer
Copy link
Contributor Author

LGTM.

Tested in neovim v0.11. All completions work fine.

It might be nice to include a text edit with a comma if completing inside a list where the completion is not the last member of the list. But might be out of scope.

Nice. Yea that would be cool, maybe a future improvement

@milesziemer milesziemer merged commit 6c4eef4 into smithy-lang:main Feb 13, 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.

3 participants