-
Notifications
You must be signed in to change notification settings - Fork 303
-
Notifications
You must be signed in to change notification settings - Fork 303
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
Code Actions with snippets that contain "choices" are not handled correctly #3996
Comments
It turns out there are two issues here:
There are two possible fixes for the second one:
Neither of these are perfect, so the question is whether it's better to keep the full list of suggestions (and have the odd final tabstop) or provide only the first suggestion without the drop-down list that would usually appear. Here's how (1) would look (note the grey bar after And (2) would look like this (no choices): @bwilkerson do you think one of these is particularly better than the other? |
I don't have a strong opinion, but I can give you one factor I can think of that might influence the choice. Server computes the list based on both the name of the outermost function being executed and on some common names given the type. In the case above, that work well and the first name in the list is probably the best. But in other cases that doesn't work as well. For example:
The first suggested name is As a result, I'm kind of favoring keeping the list around. On the other hand, maybe we should put shorter items (based on the name) first and then always take the first one. It would be nice to have some information about what names users actually pick in these cases, but we don't, so the choice here is more subjective than I'd like. |
If we took the first one, I think the original example above would end up with Although I don't really like the additional final tabstop, I also think keeping the list might be overall better. It's also what my local workaround will be (to ship a fix for this before the next SDK release) since it's a simple string replacement. Unfortunately I had a dig through the LSP client code, and there's no current way for us to read the |
@bwilkerson I've pushed a new pre-release version of the extension if you'd like the fix for this before the stable release. You can opt-in to pre-release versions in VS Code here (the pre-releases should be generally quite stable.. they're published in the final week before a stable release to get some advanced testing from a larger portion of users than just me): Pre-release versions have version numbers like |
Thanks! I can confirm that that solved the problem for me too. |
See Dart-Code/Dart-Code#3996. Change-Id: If718b23ca4e5216dc7f635a679a38bef91d1056e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246448 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Found by @bwilkerson:
This is likely because of this hack:
Dart-Code/src/extension/analysis/analyzer_lsp_snippet_text_edits.ts
Lines 46 to 50 in bb045c4
We should find a way to access
insertTextFormat
to make this reliable (but if it's not quick, we need to improve this regex to handle choices in the short-term).The text was updated successfully, but these errors were encountered: