Skip to content

Use NotebookOptions for statusbar instead of viewmodel options #205791

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

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,11 @@ export class NotebookIndentationStatus extends Disposable implements IWorkbenchC
this._accessor.clear();
return;
}
const indentSize = cellOptions?.indentSize;
const tabSize = cellOptions?.tabSize;
const insertSpaces = cellOptions?.insertSpaces;

const cellEditorOverridesRaw = editor.notebookOptions.getDisplayOptions().editorOptionsCustomizations;
const indentSize = cellEditorOverridesRaw['editor.indentSize'] ?? cellOptions?.indentSize;
const insertSpaces = cellEditorOverridesRaw['editor.insertSpaces'] ?? cellOptions?.tabSize;
const tabSize = cellEditorOverridesRaw['editor.tabSize'] ?? cellOptions?.insertSpaces;

const width = typeof indentSize === 'number' ? indentSize : tabSize;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class NotebookIndentUsingTabs extends Action2 {

constructor() {
super({
id: NotebookIndentUsingSpaces.ID,
id: NotebookIndentUsingTabs.ID,
title: nls.localize('indentUsingTabs', "Indent Using Tabs"),
precondition: undefined,
});
Expand Down Expand Up @@ -56,7 +56,7 @@ export class NotebookChangeTabDisplaySize extends Action2 {

constructor() {
super({
id: NotebookIndentUsingSpaces.ID,
id: NotebookChangeTabDisplaySize.ID,
title: nls.localize('changeTabDisplaySize', "Change Tab Display Size"),
precondition: undefined,
});
Expand All @@ -72,15 +72,14 @@ export class NotebookIndentationToSpacesAction extends Action2 {

constructor() {
super({
id: NotebookIndentUsingSpaces.ID,
id: NotebookIndentationToSpacesAction.ID,
title: nls.localize('convertIndentationToSpaces', "Convert Indentation to Spaces"),
precondition: undefined,
});
}

override run(accessor: ServicesAccessor, ...args: any[]): void {
convertNotebookIndentation(accessor, true);

}
}

Expand All @@ -89,7 +88,7 @@ export class NotebookIndentationToTabsAction extends Action2 {

constructor() {
super({
id: NotebookIndentUsingSpaces.ID,
id: NotebookIndentationToTabsAction.ID,
title: nls.localize('convertIndentationToTabs', "Convert Indentation to Tabs"),
precondition: undefined,
});
Expand Down Expand Up @@ -194,8 +193,7 @@ function convertNotebookIndentation(accessor: ServicesAccessor, tabsToSpaces: bo

bulkEditService.apply(edits, { label: nls.localize('convertIndentation', "Convert Indentation"), code: 'undoredo.convertIndentation', });

})).then((notebookEdits) => {

})).then(() => {
// store the initial values of the configuration
const initialConfig = configurationService.getValue(NotebookSetting.cellEditorOptionsCustomizations) as any;
const initialIndentSize = initialConfig['editor.indentSize'];
Expand Down Expand Up @@ -255,3 +253,7 @@ function getIndentationEditOperations(model: ITextModel, tabSize: number, tabsTo
}

registerAction2(NotebookIndentUsingSpaces);
registerAction2(NotebookIndentUsingTabs);
registerAction2(NotebookChangeTabDisplaySize);
registerAction2(NotebookIndentationToSpacesAction);
registerAction2(NotebookIndentationToTabsAction);