Skip to content

Commit 71e2b34

Browse files
author
Ives van Hoorne
committed
Add TabSize preference
1 parent 8f0af71 commit 71e2b34

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

packages/app/src/app/components/sandbox/CodeEditor/Monaco.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ export default class CodeEditor extends React.Component<Props, State> {
792792
new this.monaco.Uri().with({ path, scheme: 'file' })
793793
);
794794

795-
model.updateOptions({ tabSize: 2 });
795+
model.updateOptions({ tabSize: this.props.preferences.tabSize });
796796

797797
modelCache[module.id] = modelCache[module.id] || {
798798
model: null,

packages/app/src/app/containers/Preferences/EditorPageSettings/EditorSettings/Preferences.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ const Preferences = ({ preferences, preferencesActions }: Props) => {
8080
{...bindValue('fontSize')}
8181
/>
8282
<Rule />
83+
<PaddedPreference
84+
title="Tab size"
85+
type="number"
86+
{...bindValue('tabSize')}
87+
/>
88+
<Rule />
8389
<PaddedPreference
8490
title="Font family"
8591
type="string"

packages/app/src/app/store/preferences/keys.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ export const codeMirror = 'settings.codemirror';
1313
export const autoDownloadTypes = 'settings.autoDownloadTypes';
1414
export const newPackagerExperiment = 'settings.newPackagerExperiment';
1515
export const zenMode = 'settings.zenMode';
16+
export const tabSize = 'settings.tabSize';
1617
export const keybindings = 'settings.keybindings';

packages/app/src/app/store/preferences/reducer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const initialState: Preferences = Object.keys(keys).reduce(
2929
lintEnabled: true,
3030
instantPreviewEnabled: false,
3131
fontSize: 14,
32+
tabSize: 2,
3233
fontFamily: '',
3334
lineHeight: 1.15,
3435
clearConsoleEnabled: true,

0 commit comments

Comments
 (0)