Is there a way to hide the line numbers in Ace Editor?

孤人 提交于 2020-01-21 06:25:10

问题


Is there any way to remove the line numbers when using the ace editor?

Similar to removing the print margin as shown below?

editor.setShowPrintMargin(false);

回答1:


Use

editor.renderer.setShowGutter(true/false);

http://ace.c9.io/#VirtualRenderer.setShowGutter=&nav=api&api=virtual_renderer

Editor Options https://github.com/ajaxorg/ace/wiki/Configuring-Ace




回答2:


If you want to hide the line numbers but keep the gutter for the folding widgets:

editor.renderer.setOption('showLineNumbers', false);



回答3:


Updating the answer for version 1.4.7. You can set multiple options for ace editor like this, including showGutter

this.editor.getEditor().setOptions({
    enableBasicAutocompletion: true,
    enableSnippets: true,
    enableLiveAutocompletion: true,
    showGutter: false,
    maxLines: 20
  });


来源:https://stackoverflow.com/questions/28283344/is-there-a-way-to-hide-the-line-numbers-in-ace-editor

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