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 client-side support for inlay hints in VSCode #407

Merged
merged 4 commits into from
Jun 22, 2021

Conversation

fwcd
Copy link
Member

@fwcd fwcd commented Jun 8, 2021

For easier reviewability, the client-side implementation of inlay hints for VSCode (originally part of #406) is now in this PR. It implements the new (non-standard) sourcekit-lsp/inlayHints request and generates corresponding text decorations for inlay hints:

image

Inlay hints as text decorations on the client side are also a proposed part of the VSCode API, although this implementation does not use it yet, as it is only available in VSCode Insiders builds. More details can be found here:

Once inlay hints become part of LSP, this client-side implementation can be removed completely as VSCode's internal language client will then send inlay hint requests as appropriate.

Copy link
Contributor

@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.

I’ve got two minor inline hints inline.

Editors/vscode/src/inlayHints.ts Show resolved Hide resolved
Editors/vscode/src/inlayHints.ts Outdated Show resolved Hide resolved
fwcd added 2 commits June 15, 2021 14:23
Implement the `sourcekit-lsp/inlayHints` request on the client side for
VSCode.

- Add scaffolding for inlay hints in the VSCode extension
- Add InlayHintsStyle
- Add some notes on the inlay hints client
- Implement generation of inlay hint decorations for VSCode
- Implement syncCacheAndRenderHints on the VSCode side
- Consistently use 4-space-indent in TypeScript sources
- Remove unused (and unneeded) hints check
- Address suggestions regarding inlay hints in VSCode
Copy link
Contributor

@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.

I have just managed to try this out and it feels good, especially if I imagine the type hints on the variable and not expression side.

Disabling the Render inlay type annotations in the editor doesn’t seem to do anything for me though and type hints are still being displayed if the setting is disabled.

Also, after trying it out, I think we should default Render inlay type annotations in the editor to false while the feature is under development and maybe also mark it as (experimental) or something like that.

@fwcd
Copy link
Member Author

fwcd commented Jun 20, 2021

Thanks for the feedback, both of these issues should be fixed now.

Copy link
Contributor

@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.

Thanks. Looking good now!

@ahoppen
Copy link
Contributor

ahoppen commented Jun 22, 2021

@swift-ci Please test

@ahoppen ahoppen merged commit 59b5e68 into swiftlang:main Jun 22, 2021
@fwcd fwcd deleted the inlay-hints-vscode branch June 22, 2021 15:05
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