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

前端 未结 3 1700
生来不讨喜
生来不讨喜 2021-01-07 22:53

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         


        
相关标签:
3条回答
  • 2021-01-07 23:25

    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

    0 讨论(0)
  • 2021-01-07 23:36

    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
      });
    
    0 讨论(0)
  • 2021-01-07 23:46

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

    editor.renderer.setOption('showLineNumbers', false);
    
    0 讨论(0)
提交回复
热议问题