mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 16:15:41 +01:00
Add auto-indentation for python
This commit is contained in:
parent
781bcdd267
commit
5c8480449b
1 changed files with 9 additions and 0 deletions
|
|
@ -8,6 +8,9 @@
|
|||
import IRichLanguageConfiguration = monaco.languages.LanguageConfiguration;
|
||||
import ILanguage = monaco.languages.IMonarchLanguage;
|
||||
|
||||
// Allow for running under nodejs/requirejs in tests
|
||||
const _monaco: typeof monaco = (typeof monaco === 'undefined' ? (<any>self).monaco : monaco);
|
||||
|
||||
export const conf: IRichLanguageConfiguration = {
|
||||
comments: {
|
||||
lineComment: '#',
|
||||
|
|
@ -32,6 +35,12 @@ export const conf: IRichLanguageConfiguration = {
|
|||
{ open: '"', close: '"' },
|
||||
{ open: '\'', close: '\'' },
|
||||
],
|
||||
onEnterRules: [
|
||||
{
|
||||
beforeText: new RegExp("^\\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\\s*$"),
|
||||
action: { indentAction: _monaco.languages.IndentAction.Indent }
|
||||
}
|
||||
],
|
||||
folding: {
|
||||
offSide: true,
|
||||
markers: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue