简体   繁体   English

在摩纳哥编辑器中禁用括号的自动关闭

[英]Disable auto-closing of brackets in Monaco editor

How can I disable auto closing of specific brackets? 如何禁用特定括号的自动关闭? I have a java mode active and Monaco is auto closing '<' to '<>' 我有一个活跃的Java模式,摩纳哥正在自动关闭'<'到'<>'

You can use the editor option autoClosingBrackets 您可以使用编辑器选项autoClosingBrackets

/**
 * Enable auto closing brackets.
 * Defaults to true.
 */
autoClosingBrackets?: boolean;

You can use this option in the creation options or later: 您可以在创建选项或更高版本中使用此选项:

// When creating the editor
var editor = monaco.editor.create(container, { autoClosingBrackets: false });

// -----------------------
// Changing the option at a later time
var editor = monaco.editor.create(container);
// ...
editor.updateOptions({ autoClosingBrackets: false });

The problem was in the language definition of JAVA, where < was set to autoclose. 问题出在JAVA的语言定义中,其中<设置为自动关闭。 I had to remove that definition and all was working ok. 我必须删除该定义,并且一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM