물론 있습니다. remoting-lint.js의 마지막 버전 (https://github.com/marijnh/CodeMirror/commit/27f097ed75561e846bdb955f13f8dd2bcf0b589e)의 내용을 간략하게 살펴보면 jQuery AJAX 요청보다 약간 더 많음을 알 수 있습니다.이 요청은 함수에 매개 변수로 제공되는 콜백을 호출합니다. 이 콜백은 "async"옵션이 lint plugin에 주어진 경우에만 전달됩니다. CodeMirror에 전달되는 몇 가지 옵션이 있습니다. 이는 관련이 없을 수 있습니다. 보풀 관련 옵션은 "거터"및 "lintWith"입니다.
파이썬은 한 번에 하나의 오류 만 표시하지만 lint addon은 오류 목록을 허용한다는 점에 유의하십시오. 전자의 경우, 후자는 하나의 항목 만 가질 수 있습니다. 나는이 좀 더 간단하게 만들 수있는 매우 간단한 프로젝트 게시 한
function python_validator(cm, updateLinting, options) {
var text = cm.getValue() + "\n";
if(text.trim() == "")
{
updateLinting(cm, []);
return;
}
function result_cb(error)
{
var found = [];
if(error != null) {
var start_line = error.line_no;
var start_char = error.column_no;
var end_line = error.line_no;
var end_char = error.column_no;
var message = error.message;
found.push({
from: CodeMirror.Pos(start_line - 1, start_char),
to: CodeMirror.Pos(end_line - 1, end_char),
message: message
});
}
updateLinting(cm, found);
}
check_python_syntax(text, result_cb)
};
var text_obj = $discriminator_text.get()[0];
var editor = CodeMirror.fromTextArea(text_obj, {
mode: { name: "python",
version: 2,
singleLineStringErrors: false },
lineNumbers: true,
indentUnit: 4,
tabMode: "shift",
matchBrackets: true,
styleActiveLine: true,
lineWrapping: false,
gutters: ["CodeMirror-lint-markers"],
lintWith: {
"getAnnotations": python_validator,
"async" : true,
},
});
: 잘 넣어 https://github.com/dsoprea/CodeMirrorRemoteValidator
, +1을 지식을 공유 할 수있는 의지에 대한과의 여분의 노력 (자신의 게시물을 대답) github 프로젝트 게시. –
그게 전부입니다. –