gleam icon indicating copy to clipboard operation
gleam copied to clipboard

LSP: Display function signature when passing arguments

Open palexanderm opened this issue 1 year ago • 5 comments

In instances like such:

fn main() {
  do_something(
}

it would be nice to have the function signature for do_something displayed as you pass in the arguments so as to know the order and type information.

palexanderm avatar Jun 25 '23 23:06 palexanderm

This would be fab, let's get this. It will likely require some amount of fault tolerant parsing and compilation.

lpil avatar Jun 26 '23 09:06 lpil

https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/

/**
 * Additional details for a completion item label.
 *
 * @since 3.17.0
 */
export interface [CompletionItemLabelDetails](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#completionItemLabelDetails) {

	/**
	 * An optional string which is rendered less prominently directly after
	 * {@link CompletionItem.label label}, without any spacing. Should be
	 * used for **function signatures** or type annotations.
	 */
	detail?: string;

	/**
	 * An optional string which is rendered less prominently after
	 * {@link CompletionItemLabelDetails.detail}. Should be used for fully qualified
	 * names or file path.
	 */
	description?: string;
}

preveen-stack avatar Jul 01 '23 03:07 preveen-stack

It's not a completion in this case as there's nothing being suggested that the programmer could select. It may be an InlayHint, but don't know for sure.

lpil avatar Jul 03 '23 10:07 lpil

I think this would be a signature help - https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#signatureHelp

jamesbirtles avatar Nov 07 '23 21:11 jamesbirtles

Well researched! Thank you

lpil avatar Nov 08 '23 12:11 lpil