I am using ACE editor on HTML where I've designed a custom mode for highlighting syntax on my site, thought everything seems fine with the syntax recognizing and highlighting, I am not able to find a way to show white-spaces and tab spaces just like in sublime text.
我在HTML中使用ACE编辑器,我在我的网站上设计了一种用于突出语法的自定义模式,我认为在语法识别和高亮显示的情况下,一切似乎都很好,我无法找到一种方法来显示空白和标签空间,就像在文本中一样。
On searching I fount that we could use
在寻找时,我发现我们可以使用。
getNextLineIndent(state, line, tab) { }
getNextLineIndent(state, line, tab) {}
as a counter to check for the event in every new line.
作为一个计数器检查事件在每个新行。
Apart from this solution is there any default or easy option?
除了这个解决方案之外,还有什么默认或简单的选项吗?
3 个解决方案
#1
12
use editor.setOption("showInvisibles", true)
使用编辑器。setOption(“showInvisibles”,真的)
#2
5
editor.setShowInvisibles(true);
editor.setShowInvisibles(真正的);
#3
-4
Figured it out finally!
终于搞懂了!
White Spaces could be displayed (Just as in sublime text) by the following steps:
白色空间可以通过以下步骤显示(就像在崇高的文本中一样):
- Open ace.js
- 打开ace.js
- Search for the word Invisibles
- 搜索“无形”这个词
-
on line 14499, replace with the following code
在14499行,用下面的代码替换。
this.showInvisibles = true; this.setShowInvisibles = function(showInvisibles) { if (this.showInvisibles == showInvisibles) return true; this.showInvisibles = showInvisibles; this.$computeTabString(); return true; };
- Save and refresh your browser, all white spaces would be displayed.
- 保存并刷新浏览器,将显示所有空白区域。
- You can similarly toggle other available options too.
- 同样,您也可以切换其他可用选项。
#1
12
use editor.setOption("showInvisibles", true)
使用编辑器。setOption(“showInvisibles”,真的)
#2
5
editor.setShowInvisibles(true);
editor.setShowInvisibles(真正的);
#3
-4
Figured it out finally!
终于搞懂了!
White Spaces could be displayed (Just as in sublime text) by the following steps:
白色空间可以通过以下步骤显示(就像在崇高的文本中一样):
- Open ace.js
- 打开ace.js
- Search for the word Invisibles
- 搜索“无形”这个词
-
on line 14499, replace with the following code
在14499行,用下面的代码替换。
this.showInvisibles = true; this.setShowInvisibles = function(showInvisibles) { if (this.showInvisibles == showInvisibles) return true; this.showInvisibles = showInvisibles; this.$computeTabString(); return true; };
- Save and refresh your browser, all white spaces would be displayed.
- 保存并刷新浏览器,将显示所有空白区域。
- You can similarly toggle other available options too.
- 同样,您也可以切换其他可用选项。