-
Notifications
You must be signed in to change notification settings - Fork 29k
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
Share "Reopen with" command and Editor Associations with notebooks, settings and keybindings UIs #94408
Comments
Internally we are all using |
I'm thinking about prototyping a "PowerShell Notebooks" experience where the backing file is a regular I want to be able to toggle between rendering the Having a mechanism to do this would be fantastic. |
Above is the prototype for shared "Reopen with..." command. Previously every "custom" editor registers a simple editor override handler export interface IOpenEditorOverrideHandler {
(editor: IEditorInput, options: IEditorOptions | ITextEditorOptions | undefined, group: IEditorGroup): IOpenEditorOverride | undefined;
}
interface IEditorService
overrideOpenEditor(handler: IOpenEditorOverrideHandler): IDisposable;
} Now the export interface IOpenEditorOverrideHandler {
open: (editor: IEditorInput, options: IEditorOptions | ITextEditorOptions | undefined, group: IEditorGroup) => IOpenEditorOverride | undefined;
canOpen: (editor: IEditorInput, options: IEditorOptions | undefined, group: IEditorGroup | undefined) => { id?: string; label: string; description?: string; detail?: string; }[];
} The shared "File: Reopen with..." action will show all custom editors (which can be multiple CustomEditors, multiple Notebook Editors, two types of Settings Editors and one Search Editor) which can handle the resource for users to choose from. We also need to think about how to configure the default editor for a resource. @mjbvz added settings for CustomEditor but considering that the same file extension can be supported by different contributors. @mjbvz @sandy081 @roblourens @JacksonKearl thoughts? |
As the first step, I can add this action and adopt it in Notebook and then later on you can adopt it gradually in your "custom" editor. |
The QuickPick now aligns with Custom Editor per feedback from today's sit-down Pushed my first attempt to master dc1746e . To adopt the change in your 1. Implement this.editorService.overrideOpenEditor({
getEditorOverrides: (editor: IEditorInput, options: IEditorOptions | undefined, group: IEditorGroup | undefined) => {
...
return [
{
label,
id,
active,
detail
}
];
}
} Note that the The return type is Handle Reopening The editor input reopen override handler now has one more optional parameter |
Thanks @rebornix. The approach looks good like a good start. I'll look into adopting it for custom editors. I think it's also worth considering adopting more concepts from custom editors for notebooks and settings. For example, the |
@mjbvz Settings and Keybinding can also register themselves with |
@rebornix I hooked custom editors up to use the shared api. The only missing feature from the shared command compared the custom editor one is that custom editors show a gear icon: Clicking this gear sets I see two options:
@rebornix Would notebooks also benefit from making |
@mjbvz yes, notebook will have similar problems and having the gear as a shared feature makes best sense. Will you do the migration? I can do that as well. |
@mjbvz adopted the gear icon in the quick pick, which will set editor association. It's safe to deprecate the "View: Reopen with..." command from Custom Editor now. |
@rebornix Thanks! I'll move over any other custom editor functionality that makes sense to share |
@rebornix is this an editor command I can take advantage of in an extension? |
This one is an internal one for now but I've heard that @mjbvz is making a generic public command to open a resource with a specific "custom editor" |
For #94408 Moves this out of custom editors
70a890e make the |
Can somebody please explain to me what needs to be done here for Keyboard Shortcuts editor and any code references? |
@sandy081 Keybindings contribution needs to register itself as an
|
We closed this issue because we don't plan to address it in the foreseeable future. If you disagree and feel that this issue is crucial: we are happy to listen and to reconsider. If you wonder what we are up to, please see our roadmap and issue reporting guidelines. Thanks for your understanding, and happy coding! |
Notebooks, settings UI and the keybindings UI are very similar to custom editors. We should make the command more generic so the method to view the backing file in the text editor is shared and behaves the same across each of these editors.
The text was updated successfully, but these errors were encountered: