Currently LSP clients cannot directly change EnableFunctionArgSnippets parameter.
This patch is to provide them with a way to enable/disable that functionality.
Details
Diff Detail
- Repository
- rCTE Clang Tools Extra
Event Timeline
clangd/tool/ClangdMain.cpp | ||
---|---|---|
172 | I wonder if we should make the IncludeFixIts option hidden? | |
173 | This is a bit too generic name for the binary. Maybe -completion-fixits? | |
177 | Maybe specify the value here explicitly? | |
180 | I wonder if we can infer this setting from the -completion-style' (=bundled` implies enable-function-arg-snippets == false) |
The description says "LSP clients", i.e. editors.
For editors (e.g. whether editor can handle snippets), LSP capability negotiation rather than flags is the right thing. I suspect this is true for including completion fixes.
For users (e.g. I like behavior X), flags are the right mechanism. But we don't need to expose every option, just the important ones.
clangd/tool/ClangdMain.cpp | ||
---|---|---|
172 | why would a user want to turn this on or off? | |
173 | clang calls changes attached to diagnostics "fix-it hints", clangd calls them "fixes". This isn't either of those, maybe it should have a different name? | |
177 | Not sure I agree here, this is consistent with the other options above. It's the other ClangdServer clients that are the weirdos, they should have to be explicit :-) The defaults are clear when running with -help, which is how users will see them. | |
180 | They're not inextricably linked, the main connection is "these options both need good signaturehelp support to be really useful". I don't have a strong opinion, I don't use -completion-style=bundled. Can we find a few people who do and ask if they like this setting? |
clangd/tool/ClangdMain.cpp | ||
---|---|---|
172 | Ideally, we want to have it always on. |
clangd/tool/ClangdMain.cpp | ||
---|---|---|
177 |
Sure, but I would still argue reading the code is simpler without extra indirection and defaults of the binary are not necessarily the defaults we use in the APIs. But also feel free to keep the code as is, don't think it's terribly important. | |
180 |
LG from my side, @sammccall is not a big fan of options so please wait for his approval too
clangd/tool/ClangdMain.cpp | ||
---|---|---|
175 | s/needs/need | |
181 | Maybe mention code completion in the comment?
| |
182 | s/parantheses/parentheses |
clangd/tool/ClangdMain.cpp | ||
---|---|---|
172 | Do we have any more details here? I'm still skeptical that exposing this to end users will help at all, this seems likely that it should be a capability if we do need it. | |
180 | This seems reasonable to have as a preference, I'm also fine combining it with bundled. If you keep it, naming nits:
|
clangd/tool/ClangdMain.cpp | ||
---|---|---|
172 | No updates on the issue. Here it is: Not sure capability is the right thing there, the problem is that additionalTextEdits are underspecified and implemented differently in every client. What we need is a fix in the protocol and fixes in all the clients. Sadly, this only works in YCM-based completer for now (of all we tested) |
I think I'm still where I was a few weeks ago - option to drop args makes sense, completions with fixes isn't something users should care about.
clangd/tool/ClangdMain.cpp | ||
---|---|---|
172 | Sure, sounds like protocol fix is the long-term answer. I don't think adding user-facing options are better than nothing. If YCM does the right thing and we want to disable it for everyone not on YCM, we can add a textEditsAreAppliedInOrder capability to the YCM completer and treat that as an opt-in. It's not clear what the advantage of a user-facing flag over an editor-facing capability is for this purpose. Mostly given LSP is unclear here it seems this feature isn't ready for prime-time. |
+1 to adding an option to drop arguments from snippets and removing the option for the fixes.
clangd/tool/ClangdMain.cpp | ||
---|---|---|
172 | I agree, the feature is not very useful if it breaks everywhere. Removing the option and exploring other ways to do it LG.
We tried to combine additionalTextEdits into the main textEdit, that's what works in YCM. |
clangd/tool/ClangdMain.cpp | ||
---|---|---|
172 | +1 to @ilya-biryukov . We might need to wait for a while until all editors supports additionalTextEdits in a sane way. | |
177 | Keeping it as it is. | |
180 | ping on this discussion to @ioeric , but I think linking seems like a good idea. Because it wouldn't be very useful if one already selects a specific overload from completion list. |
clangd/tool/ClangdMain.cpp | ||
---|---|---|
180 | I don't think YCM completes the snippets currently, so Eric won't notice the change for bundled vs normal completions. Anyhow, keeping it as a separate option is a safe bet. And some personal experience: have been using bundled completions for a few weeks now and will probably switch this one on immediately when it lands. |
Maybe commit only an option to enable function arg snippets for now (found myself wanting this option today :-))? The fixes would also be nice, but since they never work...
clangd/tool/ClangdMain.cpp | ||
---|---|---|
172 | Deleting this option and waiting until editors out there start to handle additionalTextEdits in a similar way. |
I wonder if we should make the IncludeFixIts option hidden?
It currently only works for our YCM integration, VSCode and other clients break.