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

Ignore applys #70

Merged
merged 6 commits into from Sep 20, 2022
Merged

Ignore applys #70

merged 6 commits into from Sep 20, 2022

Conversation

milesziemer
Copy link
Contributor

Issue #, if available:
#68
Description of changes:
apply statements are now ignored by the language server when collecting definition locations

As mentioned in the issue, the language server was breaking when an apply statement targeted a member mixed in from another namespace. This brought up various issues about how apply statements were being handled, and more generally about how we were collecting shape definition locations. Apply statements could trick the old collectLocations method into thinking shapes began or ended in arbitrary file locations, or flat out make it crash. At this time, apply statement definition locations don't serve a purpose to the language server, and should be safely ignorable without compromising functionality.

Additional changes:

  • Shape definition location collection was moved into its own class behind an interface that we can use to make it easier to add new ways of collecting locations, or new kinds of locations (other than definitions)
  • A new test case was added specifically for apply statement behavior, ensuring they are fully ignored
  • Various methods were cleaned up, simplified or broken down into smaller methods

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

A new interface was created for getting shape locations, so we can
add new methods for getting locations later more easily. Shape
location collection was separated into its own class to separate and
protect it from `SmithyProject`. The shape location collection was
also refactored to get container locations in all files first, then
easier to collect member locations. This makes handling multi-file
models simpler. There was also a few minor clean ups in `SmithyProject`.
@milesziemer milesziemer requested a review from a team as a code owner September 19, 2022 22:08
milesziemer and others added 2 commits September 20, 2022 12:23
…tor.java

Co-authored-by: Chase Coalwell <782571+srchase@users.noreply.github.com>
…ector.java

Co-authored-by: Chase Coalwell <782571+srchase@users.noreply.github.com>
@milesziemer milesziemer merged commit 1b0688f into smithy-lang:main Sep 20, 2022
@milesziemer milesziemer deleted the ignore-applys branch September 20, 2022 16:30
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.

None yet

2 participants