Ability to turn off certain warnings

2,466 views
Skip to first unread message

Marius Gedminas

unread,
Apr 4, 2014, 8:36:57 AM4/4/14
to ace-d...@googlegroups.com
Hi!

We're using Ace to let users edit HTML snippets.  These are not complete HTML documents, so the warning that says  "Start tag seen without seeing a doctype first. Expected e.g. <!DOCTYPE html>." is not applicable to our use case.

I know that I can disable all warnings by using session.setUseWorker(false), but then I'd lose interesting errors as well.  Is there a way to do more gradual filtering?

Regards,
-- 
Marius Gedminas

Harutyun Amirjanyan

unread,
Apr 4, 2014, 6:11:38 PM4/4/14
to ace-d...@googlegroups.com
Hi

this isn't implemented yet
we'll probably need to extend setOption at
https://github.com/ajaxorg/ace/blob/master/lib/ace/mode/html_worker.js#L56
and the filtering of errors at
https://github.com/ajaxorg/ace/blob/master/lib/ace/mode/html_worker.js#L79

do you need to only disable doctype or other warnings as well?
Regards,
Harutyun

Ian Springer

unread,
Apr 29, 2014, 9:57:27 PM4/29/14
to ace-d...@googlegroups.com
I'd also like to see the ability to disable the doctype warnings (not sure about other warnings).

yao

unread,
Apr 30, 2014, 5:36:56 AM4/30/14
to ace-d...@googlegroups.com
maybe it's here. 
https://github.com/ajaxorg/ace-builds/blob/master/src/worker-html.js#L4573
also can find it by "expected-doctype-but-got-start-tag" in the min file.

在 2014年4月4日星期五UTC+9下午9时36分57秒,Marius Gedminas写道:

David Bau

unread,
Sep 21, 2014, 4:14:43 PM9/21/14
to ace-d...@googlegroups.com
Running into this also - I'd want to be able to disable other types of warnings including in other modes also.



On Friday, April 4, 2014 6:11:38 PM UTC-4, Harutyun Amirjanyan wrote:

mvlanc...@gmail.com

unread,
Jan 23, 2015, 3:09:34 PM1/23/15
to ace-d...@googlegroups.com
I need to disable the "Missing semicolon." warning for javascript.  I don't use semicolons.  Ace only shows the first 50 warnings, so as a result, none of the warnings I need to see appear.

When will this be implemented?

Thanks very much,
Matt

Harutyun Amirjanyan

unread,
Jan 24, 2015, 10:00:12 AM1/24/15
to ace-d...@googlegroups.com
For javascript mode this was implemented long ago
you need to call

editor.session.$worker.call("changeOptions", [{asi: true}])


Tom Southall

unread,
Mar 6, 2015, 1:05:43 PM3/6/15
to ace-d...@googlegroups.com
I would also like to be able to disable the doctype warning. 

My use-case is editing HTML snippets rather than entire documents.

Brian Hunt

unread,
Jul 7, 2015, 11:17:00 PM7/7/15
to ace-d...@googlegroups.com
While this certainly seems to be on the right track, it yields an Uncaught Error: Unknown command:changeOptionswindow.onmessage @ worker-html.js:180

It is also not clear when the $worker is spun up, and editor.session.$worker will be null until then.

Two issues one would have to work around to get this going.

baloodevil

unread,
Mar 2, 2016, 5:08:54 PM3/2/16
to Ajax.org Cloud9 Editor (Ace)
Hello Harutyun,
Checking to see if there is an update to this item.  I too am editing HTML snippets, so want to disable the doctype error.  Thanks in advance!


On Friday, April 4, 2014 at 6:11:38 PM UTC-4, Harutyun Amirjanyan wrote:

Chris

unread,
Apr 17, 2016, 5:21:03 PM4/17/16
to Ajax.org Cloud9 Editor (Ace)
Try this..


var session = editor.getSession();
session
.on("changeAnnotation", function() {
 
var annotations = session.getAnnotations()||[], i = len = annotations.length;
 
while (i--) {
   
if(/doctype first\. Expected/.test(annotations[i].text)) {
      annotations
.splice(i, 1);
   
}
 
}
 
if(len>annotations.length) {
    session
.setAnnotations(annotations);
 
}
});




Reply all
Reply to author
Forward
0 new messages