Skip to content

Commit

Permalink
Indent playground code using spaces (#12231)
Browse files Browse the repository at this point in the history
  • Loading branch information
potomak authored Sep 2, 2022
1 parent 3694469 commit b32e251
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/compiler/crystal/tools/playground/public/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,22 @@ Playground.Session = function(options) {
tabSize: 2,
viewportMargin: Infinity,
dragDrop: false, // dragDrop functionality is implemented to capture drop anywhere and replace source
value: options.source
value: options.source,
// indent using spaces, see https://github.com/codemirror/codemirror5/issues/988
extraKeys: {
Tab: (cm) => {
if (cm.getMode().name === 'null') {
cm.execCommand('insertTab');
} else {
if (cm.somethingSelected()) {
cm.execCommand('indentMore');
} else {
cm.execCommand('insertSoftTab');
}
}
},
'Shift-Tab': (cm) => cm.execCommand('indentLess')
}
});
this.editor._playgroundSession = this;

Expand Down

0 comments on commit b32e251

Please sign in to comment.