-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
[clangd] option to disable adding parenthesis for function with auto-completion #63565
Comments
@llvm/issue-subscribers-clangd |
clangd/clangd#1252 is another request for a configuration option related to what text is inserted when when selecting a completion proposal. Perhaps it would be appropriate to add both options in the Completion section of the config file? Should |
Is there any progress on this issue? This has always been disrupting and annoying for me, as it always duplicates opening parentheses unlike any other editor. |
Here's a concrete proposal for a config file syntax that would address this request, clangd/clangd#1252, and supersede
For backwards compatibility:
If both Thoughts? |
This would fix all my annoyances I have with clangd in VScode. really hope this gets approved and implemented (soon).! I really love clangd, it really improves my work but I need the |
The idea sounds great to me, too. |
It sounds good to me. |
* With a friendly smile on his face, and sympathetic tone in his voice, MK-Alias is asking * This issue/thing/ticket is over a year old, and my own ticket #390 on this, is about two years old. I'm kind of wondering how this is going..!? |
I haven't had time to work on this, sorry. I know I comment on clangd issues frequently, but just in case anyone has misconceptions about my relationship to the project: no one is employing me to contribute to clangd. I do it in my spare time, and the amount of spare time I have is limited and variable over time. Recently, I've been using that limited time to focus on what I see as the highest-impact contributions I can make:
Improvements in other areas will need to come from other members of the community stepping up to contribute to things they care about. |
Thanks for your reply, and elaboration! I did kind of thought that most where volunteering. Maybe I'll write my own patch, the work doesn't seem that difficult, I'm just not familiar with the codebase, and also don't have much time for it. |
I'm happy to provide pointers to the relevant code and other guidance as needed :) |
I've been at it for some part of the day, and got a patch which already implements everything except for the The problem is, that I don't know how to implement here is the patch: placeholders-patch-alpha.patch You can apply it to the LLVM source with: In its current state, this patch is already very usable for myself, because I only need the Edit: here's a screenshot of the help text regarding the new features: |
Good question. I would say, rather than trying to remove the type name for a parameter placeholder string that already contains it, to implement Tracing through the code a bit, the snippet string comes from here, which is set here (for code completion results coming from the AST); inside that function, the contents of a placeholder for a single argument comes from here, where the source string ( So, to get rid of the type name, we need to look earlier, where the So, to implement (An interesting question is what to do about code completion results coming from the index. For those, the snippet is computed at the time the index is built, and stored in the index. Therefore, the above code change will take effect for those too, but it will be based on the value of the setting at the time the index was built. If you change the setting, the format of the snippets for results coming from the index will not be updated until the index is rebuilt. Not sure what to do about that... it may be a wart we just need to live with.) If all that sounds involved, I'd say it's fine to just implement the other three options first, and leave |
So simply put, the framework in it's current state doesn't support the removal of the storage/type. So to implement
Reformatting seems as too much of a workaround, and if the framework [ever] gets updated, the reformatted functionality might break, which is then an unsuspected side-effect. So updating the framework seems like the better choice. However, putting a boolean on the functionality just to accommodate our placeholder issue, seems a bit specific.
other than that, time is also an issue. It will probably takes some time to figure everything out, which I rater not spend right now. Mostly for that reason I'm leaning towards dropping I can however, implement a Is that a good idea?? And is the help text (see earlier screenshot) to everyone's liking? |
+1
Unless this is something you plan to use yourself, I would wait until someone asks for this.
Looks generally good to me. I may have suggestions for small tweaks but those are easier to make in the form of comments on a PR. |
Okay, I've created a new "beta" patch: placeholders-patch-beta.patch After playing around with it I really think that an This patch has 2 minor issues with vscode/vscode-clangd:
This patch should be fully applicable, other than perhaps taking a last critical look at the help description texts.., and of course, feel free to change/reconfigure things where deemed necessary. hope to see it implemented soon! Until then I'll use my local dev copy. |
Could you submit it as a pull request please?
Ok, sounds reasonable to me. Name suggestion: |
For tree hours I've tried to
^^^ these things all don't like each other, and its up to me to make them work together ^^^ So to answer your question:
Despite my trying, unfortunately, no! Here is the last updated version of the patch. I basically just renamed It would be my honer if it still gets integrated into clangd - and by all means feel free to modify/reconfigure it as you see fit. However, I'm done with the whole "Github: pull request" fetch quest for now.... for which I'm sorry! |
The simplest way to set up Git credential is to use Git bash. You generate a key pair with Once you have your SSH key set up, you can clone all GitHub repos using SSH protocol. DO NOT USE HTTPS, as HTTPS is read-only:
If the server is asking you for a password for the This will allow you to push commits to your own repo. Once you have pushed your commits, you can file a Pull Request at https://github.com/llvm/llvm-project/compare . You need to click compare across forks to select your own repo as the source. |
Thanks for the guide, and with doing so I was able to submit the pull request! During my previous 3 hour adventure, there was a little voice in me that suggested to try Thanks, buddy! |
The new config option is a more flexible version of --function-arg-placeholders, allowing users more detailed control of what is inserted in argument list position when clangd completes the name of a function in a function call context. Fixes llvm#63565
The new config option is a more flexible version of --function-arg-placeholders, allowing users more detailed control of what is inserted in argument list position when clangd completes the name of a function in a function call context. Fixes #63565 Co-authored-by: MK-Alias <[email protected]>
I personally am not a huge fan of having this happening. I would really love to see this option available!
What I mean is kind of like this option:
--function-arg-placeholders=0
. This disabling the automatic filling of argument slots. In the same way I'd love to see clangd not adding the parenthesis when auto-completion is used.The text was updated successfully, but these errors were encountered: