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

Signature help #30

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Signature help #30

wants to merge 1 commit into from

Conversation

bentsherman
Copy link
Member

Adds a basic implementation of signature help for functions, processes, and workflows.

When you type a method name and then (, vscode will show the method signature and docs (similar to hover hint). As you type each argument followed by a comma, the current parameter is highlighted, and can also show docs for each parameter. We could pull param docs from inline comments or @param directives in the method's groovydoc comment.

My main concern with the current impl is that process inputs don't quite fit the expectations of signature help, which expects a conventional signature of func(param1, param2, param3, ...), whereas process inputs are a bit more complex.

I tried to do a multi-line signature for processes to space out the inputs, but vscode still squashes it onto a single line.

Another thing I could try is to do something like PROC( <1>, <2>, <3>, <4> ) for the signature and then show the full spec below that for the current input, which should be possible with the label / documentation of ParameterInfo. But for some reason, the param documentation is only showing for the first param and then goes away. If I can fix this issue, that might be good enough.

Long term, I think the problem will go away with typed process inputs, which should look more like function / workflow inputs:

def func(a: int, b: String, c: boolean) {
  // ...
}

process PROC {
  input:
  meta: String
  reads: Path

  // ...
}

workflow FLOW {
  take:
  samplesheet: Path
  outdir: Path

  // ...
}

Signed-off-by: Ben Sherman <[email protected]>
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.

1 participant