API allowing CodeActionProviders to reliably get the current editor selection#49081
API allowing CodeActionProviders to reliably get the current editor selection#49081mjbvz merged 5 commits intomicrosoft:masterfrom
Conversation
src/vs/vscode.d.ts
Outdated
There was a problem hiding this comment.
We should explain when there is no selection, e.g. there is always a selection with an editor but we should point out that providers aren't always called without the document being shown inside an editor
There was a problem hiding this comment.
You really wanna use strictNull-check, right?
|
Overall, still not sure if we should pass the selection instead of the range, e.g. |
c46c005 to
2d30e84
Compare
Fixes microsoft#49024 Fixes microsoft#49060 See microsoft#49024 for details on the problem. Adds an optional `selection` property to `CodeActionContext`. This property has the original editor selection
2d30e84 to
11c9ae2
Compare
11c9ae2 to
dcbad16
Compare
|
@jrieken Pushed an update that goes to the |
| return undefined; | ||
| } | ||
|
|
||
| private _getRangeOfSelectionUnlessWhitespaceEnclosed(): Selection { |
There was a problem hiding this comment.
Unclear to me if we still want this check or not. The current logic always forwards the exact selection to the providers
There was a problem hiding this comment.
Yeah, I remember we had that for a very specific reason... Needs some deeper thinking but I believe it was to prevent the lightbulb from showing 'randomly' while clicking into the void/whitespace....
Fixes #49024
Fixes #49060
See #49024 for details on the problem.