最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - CodeMirror Dynamic Syntax Validation - Stack Overflow

programmeradmin1浏览0评论

Been trying to decide between using CodeMirror or Ace editor. I've been leaning towards CodeMirror, however there's one feature of Ace that I really like and that is how it does syntax validation. So as I'm typing there can appear a warning or error icon in the left gutter area beside the line number, and when I hover over it it gives me a little description.

Is there any way to get this functionality in CodeMirror? Specifically, I'm using the css mode for CodeMirror.

It'd also be nice to be able to add in my own custom validation.

Thanks.

Been trying to decide between using CodeMirror or Ace editor. I've been leaning towards CodeMirror, however there's one feature of Ace that I really like and that is how it does syntax validation. So as I'm typing there can appear a warning or error icon in the left gutter area beside the line number, and when I hover over it it gives me a little description.

Is there any way to get this functionality in CodeMirror? Specifically, I'm using the css mode for CodeMirror.

It'd also be nice to be able to add in my own custom validation.

Thanks.

Share Improve this question asked Sep 7, 2012 at 22:24 rawrrawr 1231 gold badge1 silver badge4 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 13

see http://codemirror.net/3/demo/widget.html for a nice demo.

but ace have other nice features too. For me deciding factors were multiple cursors and indentGuides

For Ace adding your own validation function is quite simple.Here is how we added validation for CSS using CSSLint:

https://github.com/ajaxorg/ace/blob/master/lib/ace/mode/css_worker.js https://github.com/ajaxorg/ace/blob/master/lib/ace/mode/css.js#L78

发布评论

评论列表(0)

  1. 暂无评论