Ace editor: customizing syntax error gutter

和自甴很熟 提交于 2019-12-06 12:28:24

You can add underline similar to the way cloud9 and zed do (see https://github.com/zedapp/zed/commit/59ae66c545db2ad92dc5efc1a069edd16960ebdd) or modify highlighter tokens see https://groups.google.com/d/msg/ace-discuss/_PRUJ_HemNo/wvDf9FqwzhMJ

I discovered that the line that has an error does not have spans, so I did the following:

if( editor.getValue() != "" && $('.ace_text-layer.ace_line:not(:has(span))')){
  $('.ace_line:not(:has(span))').css("background","#FCBEA5")
}else {
  $('.ace_line:not(:has(span))').css("background","#000000")
}

There are a few issues with this, such as it highlighting the current line.

To customize the gutter you can play around its .ace_gutter properties. Now suppose if you want to change the width of the gutter,

.ace_gutter > .ace_layer {
    width: 20px !important;
}

This will help you in changing the width of the gutter by overriding the present gutter width. Similarly, you can edit other properties too.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!