Skip to content

Commit

Permalink
re #109549. hook notebook cell language picker into Change Language M…
Browse files Browse the repository at this point in the history
…ode.
  • Loading branch information
rebornix authored and meganrogge committed Nov 18, 2020
1 parent 1292340 commit ff89271
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/vs/workbench/browser/parts/editor/editorStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1046,12 +1046,19 @@ export class ChangeModeAction extends Action {
@IQuickInputService private readonly quickInputService: IQuickInputService,
@IPreferencesService private readonly preferencesService: IPreferencesService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@ITextFileService private readonly textFileService: ITextFileService
@ITextFileService private readonly textFileService: ITextFileService,
@ICommandService private readonly commandService: ICommandService
) {
super(actionId, actionLabel);
}

async run(): Promise<void> {
const activeEditorPane = this.editorService.activeEditorPane as unknown as { isNotebookEditor?: boolean } | undefined;
if (activeEditorPane?.isNotebookEditor) {
// it's inside notebook editor
return this.commandService.executeCommand('notebook.cell.changeLanguage');
}

const activeTextEditorControl = getCodeEditor(this.editorService.activeTextEditorControl);
if (!activeTextEditorControl) {
await this.quickInputService.pick([{ label: nls.localize('noEditor', "No text editor active at this time") }]);
Expand Down

0 comments on commit ff89271

Please sign in to comment.