mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-29 09:35:38 -05:00
Preserve previous code cell's language when creating a new code cell from an existing context. (#18646)
This commit is contained in:
@@ -75,7 +75,7 @@ export class SplitCellAction extends CellActionBase {
|
||||
doRun(context: CellContext): Promise<void> {
|
||||
let model = context.model;
|
||||
let index = model.cells.findIndex((cell) => cell.id === context.cell.id);
|
||||
context.model?.splitCell(context.cell.cellType, this.notebookService, index);
|
||||
context.model?.splitCell(context.cell.cellType, this.notebookService, index, context.cell.metadata?.language);
|
||||
return Promise.resolve();
|
||||
}
|
||||
public setListener(context: CellContext) {
|
||||
@@ -246,7 +246,7 @@ export class AddCellFromContextAction extends CellActionBase {
|
||||
if (index !== undefined && this.isAfter) {
|
||||
index += 1;
|
||||
}
|
||||
model.addCell(this.cellType, index);
|
||||
model.addCell(this.cellType, index, context.cell.metadata?.language);
|
||||
} catch (error) {
|
||||
let message = getErrorMessage(error);
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ export class AddCellAction extends Action {
|
||||
}
|
||||
}
|
||||
if (context?.model) {
|
||||
context.model.addCell(this.cellType, index);
|
||||
context.model.addCell(this.cellType, index, context.cell.metadata?.language);
|
||||
context.model.sendNotebookTelemetryActionEvent(TelemetryKeys.NbTelemetryAction.AddCell, { cell_type: this.cellType });
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user