-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
x/tools/internal/lsp: snippet placeholders should include type as well #31547
Comments
I'd be curious to get more feedback on people's preferences before making a decision here. Personally, I think that, when combined with signature help, it's not really necessary, but if it's useful then I'd be happy to add it. I also had the idea that perhaps we could replace the placeholder with the nearest identifier in scope with the matching type, which could save people some extra typing, but that's probably a separate issue. /cc @ianthehat |
In emacs, the signature help doesn't show in this case because (in my example) "format" is not a valid identifier, so that LSP error hides the signature help. I have signature/hover popups disabled (they show up in the minibuffer only, which is shared with LSP error/warning output). Even if the signature help showed up properly in the minibuffer, it is still useful for me to have the placeholders show up properly under point, so I don't have to look around.
I was thinking about that myself. I was also thinking that you often "pass along" variables/fields that have the same/similar name as the function argument. That could good be a good heuristic for picking between multiple in-scope identifiers with the same type. |
@muirrn, are you saying that the diagnostic errors cover up the signature help? This seems like it might be a bug in I filed #31548 to track improving the contents of the placeholders. |
Yes, but it is related to my config since I have all inline popups disabled. The diagnostic comes back after the signature help, so it overwrites it in the minibuffer. (The minibuffer is actually being updated by two separate modes: lsp-mode displays the signature help, but delegates to flycheck to handle the diagnostic errors.) If I configure the diagnostics to show up inline then I can see the signature help in the minibuffer. However, even with signature help visible, it would still be useful to have the name/type show up in the placeholder because it is under my cursor (and the signature help in the minibuffer is far away). |
Change https://golang.org/cl/172666 mentions this issue: |
Currently the function call completion placeholder snippets only contain the function parameter names like "fmt.Errorf(format, a)". It would be useful if they also had the parameter type like "fmt.Errorf(format string, a ...interface{})"
The text was updated successfully, but these errors were encountered: