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 3 years ago
parent 55edb3fc58
commit 8e34418a64
No known key found for this signature in database
GPG Key ID: 40D9F5FE9155FD3C

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

Loading…
Cancel
Save