Mark import completion items as complex#52332
Conversation
Currently, import completion items are not marked as complex. This changes that to be marked as complex. Fixes dotnet#52331, and additionally adds verification of the flag for existing scenarios.
|
@allisonchou @genlu for if this flag is correct to use in this case. @allisonchou you needed this for things like override completion. But did you not need it for import completion? If so, i'm curious why not. |
|
I wasn't aware of import completion having a significant perf impact. If it does, I think it makes sense to mark it as a complex text edit. The primary downside is that it will block the UI thread. |
Can you expand on that @allisonchou that's a fairly big deal for me :-) |
|
(please don't merge on this just yet. Thanks!) |
|
I didn't think the flag was checked in non-lsp scenarios (and lsp doesn't do import completion today)? |
|
Looking through our source, the only references to |
|
Ahh right, I forgot import completion is ignored. Then in that case I don't think this change affects the CompletionHandler at all, ignore my earlier comment. |
|
Let me rephrase. First, if we enabled import completion for LSP (why is it off btw?), would we want this flag set on this or not? Thanks! :) If we would want this flag, then i'm totally ok with this PR. |
|
What's the intention of Also note there are cases when import completion would insert fully qualified type name instead of add using (which is determined at commit time though). |
If import completion has significant perf concerns (it sounds like from Fred it does), then I think we'd want the flag on. It would make the overall completion experience faster, but would make resolving individual items slower since resolving the item would require the UI thread.
I believe it's off due to parity issues, e.g. there's no way to display namespaces today on the right-hand side of the list. More details are in https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1076759.
|
Why does it require the UI thread? |
That, and perf concerns with huge completion list size and serialization. However this may have been mitigated by Taylor's recent changes with optimized completion lists and less resolve data. So I think once the work item to show the detail text is resolved we should try turning on import completion for LSP and evaluate the perf. |
|
OK, if LSP needs to compute text change from ALL items up front when creating completion list, then we absolutely need to mark unimported items as |
Some certainly do (such as vscode). |
|
@CyrusNajmabadi any more concerns with this change? |
|
Nope! LGTM. Just a request for LSP folks to work on integrating this functionality. |
Currently, import completion items are not marked as complex. This changes that to be marked as complex. Fixes #52331, and additionally adds verification of the flag for existing scenarios.