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 support for function signature help #1077

Merged
merged 7 commits into from
Mar 17, 2023
Merged

Add support for function signature help #1077

merged 7 commits into from
Mar 17, 2023

Conversation

dbanck
Copy link
Member

@dbanck dbanck commented Sep 23, 2022

This PR enables signature help for function signatures.

To make this work, we first add the function signatures from terraform-schema (introduced in hashicorp/terraform-schema#145) to the PathContext. This work is also required to enable completion, hover, etc. for functions later on.

We then add a new handler for the textDocument/signatureHelp LSP method.

UX

Nested function calls with variadic parameters
2023-03-14 14 06 18

Functions without any arguments
2023-03-14 14 07 34

No signature help, if passing too many arguments
2023-03-14 14 08 07

Multiline function calls
2023-03-14 14 17 06


@dbanck dbanck changed the title Add support for built-in functions Add support for function signature help Mar 15, 2023
@dbanck dbanck marked this pull request as ready for review March 15, 2023 18:17
@dbanck dbanck requested a review from a team as a code owner March 15, 2023 18:17
Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

LGTM overall, works great 🥇 👍🏻

I left only very minor questions and comments in-line but they're not really blocking.

internal/langserver/handlers/service.go Outdated Show resolved Hide resolved
internal/lsp/signature.go Outdated Show resolved Hide resolved
internal/lsp/signature.go Show resolved Hide resolved
internal/lsp/signature.go Outdated Show resolved Hide resolved
internal/lsp/signature.go Show resolved Hide resolved
@dbanck dbanck merged commit 68b265f into main Mar 17, 2023
@dbanck dbanck deleted the f-function-support branch March 17, 2023 09:12
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide function signature help
2 participants