Add yaml indent action

If a line ends with `:` and a user presses Enter, they are probably
defining an object, which requires indentation.

This rule is taken from `monaco-yaml`, but I intend to remove basic
language support there, since that’s already part of `monaco-editor`.
pull/3058/head
Remco Haszing 2022-04-05 11:02:00 +02:00
parent 55edb3fc58
commit 8e34418a64
No known key found for this signature in database
GPG Key ID: 40D9F5FE9155FD3C
1 changed files with 10 additions and 2 deletions

View File

@ -1,4 +1,4 @@
import type { languages } from '../../fillers/monaco-editor-core';
import { languages } from '../../fillers/monaco-editor-core';
export const conf: languages.LanguageConfiguration = {
comments: {
@ -25,7 +25,15 @@ export const conf: languages.LanguageConfiguration = {
],
folding: {
offSide: true
}
},
onEnterRules: [
{
beforeText: /:\s*$/,
action: {
indentAction: languages.IndentAction.Indent
}
}
]
};
export const language = <languages.IMonarchLanguage>{