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

Implement server-side support for inlay hints using CollectVariableType #408

Merged
merged 9 commits into from
Jun 30, 2021

Conversation

fwcd
Copy link
Member

@fwcd fwcd commented Jun 15, 2021

This is an early draft of support for inlay hints that uses the new CollectVariableType SourceKit request.

Implementation Progress

  • Add UIDs and structures for CollectVariableType
  • Support ranged CollectVariableType requests
  • Reimplement inlay hints using CollectVariableType
  • Update existing tests
  • Add new test for inlay hints on closure parameters

Note that this also requires a very recent build of the Swift toolchain, otherwise the tests will fail

fwcd added 8 commits June 24, 2021 18:51
Query VariableTypeInfos from sourcekitd and return inlay hints for all
variable declarations without an explicit type annotation.
The annotations are now (correctly) displayed after the variable
identifiers rather than after the bound expressions.
@fwcd fwcd force-pushed the inlay-hints-collect-var-type branch from 7dcdd06 to 7eb2fae Compare June 24, 2021 16:52
@fwcd
Copy link
Member Author

fwcd commented Jun 24, 2021

I have tested this branch with the newest toolchain and it's looking pretty nice already:

image

There are still two minor issues that probably have to be addressed on the SourceKit-side:

Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

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

LGTM

@ahoppen
Copy link
Member

ahoppen commented Jun 29, 2021

@swift-ci Please test

@ahoppen ahoppen merged commit bc8d336 into swiftlang:main Jun 30, 2021
@fwcd fwcd deleted the inlay-hints-collect-var-type branch June 30, 2021 20:21
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