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
Easy pick codelenses with keyboard shortcut #91232
Conversation
Signed-off-by: Gustavo Sampaio <gbritosampaio@gmail.com>
55cf235
to
e9ddb0f
Compare
Figured out what was going on. Tests for monaco are ok. Thanks anyway |
Signed-off-by: Gustavo Sampaio <gbritosampaio@gmail.com>
} | ||
} | ||
|
||
export class ShowLensesInCurrentLineCommand extends Command { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use EditorCommand
instead of the generic command. It will already have the correct editor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Changed to use it. Thanks @jrieken
|
||
public getLenses(): CodeLensWidget[] { | ||
return this._lenses; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why expose the widgets and not the model itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need the line number of the widget on line 421:
const activeLensesWidgets = codelensController.getLenses().filter(lens => lens.getLineNumber() === lineNumber);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, the live/updated line numbers... That makes good sense. Thanks for clarifying
|
||
const commandArguments: Map<string, any[] | undefined> = new Map(); | ||
|
||
const picker = quickInputService.createQuickPick(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use IQuickInputService#pick
instead of createQuickPick
. For simple cases like this you don't to write that much code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Just updated it! Thanks @jrieken
Thanks |
Signed-off-by: Gustavo Sampaio gbritosampaio@gmail.com
This PR closes #41579
This adds a new command that when invoked, shows in a quickpick all the codelenses available in the current line. This makes it easier to "activate"/run a codelens with keyboard. One can set a keybinding for that command and easily switch between the available codelenses with the keyboard.
This is my first pr! I appreciate any suggestions or comments on where to improve this.