Linter Demo
1
var widgets = []2
function updateHints() {3
editor.operation(function(){4
for (var i = 0; i < widgets.length; ++i)5
editor.removeLineWidget(widgets[i]);6
widgets.length = 0;7
8
JSHINT(editor.getValue());9
for (var i = 0; i < JSHINT.errors.length; ++i) {10
var err = JSHINT.errors[i];11
if (!err) continue;12
var msg = document.createElement("div");13
var icon = msg.appendChild(document.createElement("span"));14
icon.innerHTML = "!!";15
icon.className = "lint-error-icon";16
msg.appendChild(document.createTextNode(err.reason));17
msg.className = "lint-error";18
widgets.push(editor.addLineWidget(err.line - 1, msg, {coverGutter: false, noHScroll: true}));19
}20
});21
var info = editor.getScrollInfo();22
var after = editor.charCoords({line: editor.getCursor().line + 1, ch: 0}, "local").top;23
if (info.top + info.clientHeight < after)24
editor.scrollTo(null, after - info.clientHeight + 3);25
}26
21
1
[2
{3
_id: "post 1",4
"author": "Bob",5
"content": "...",6
"page_views": 57
},8
{9
"_id": "post 2",10
"author": "Bob",11
"content": "...",12
"page_views": 913
},14
{15
"_id": "post 3",16
"author": "Bob",17
"content": "...",18
"page_views": 819
}20
]21
60
width: 100%; /*Warning: 100% can be problematic*/1
@charset "UTF-8";2
3
@import url("booya.css") print, screen;4
@import "whatup.css" screen;5
@import "wicked.css";6
7
/*Error*/8
@charset "UTF-8";9
10
11
@namespace "http://www.w3.org/1999/xhtml";12
@namespace svg "http://www.w3.org/2000/svg";13
14
/*Warning: empty ruleset */15
.foo {16
}17
18
h1 {19
font-weight: bold;20
}21
22
/*Warning: qualified heading */23
.foo h1 {24
font-weight: bold;25
}26
27
/*Warning: adjoining classes */28
.foo.bar {29
zoom: 1;30
}31
32
li.inline {