mirror of
https://github.com/RustyRaptor/brackets.git
synced 2026-12-04 00:15:22 -07:00
Fix JSHint warnings and exclude tern and acorn related files from grunt.
This commit is contained in:
1 parent
c05e551302
commit
d371c0f916
5 files changed
+50
-47
No files matched your search
@@ -61,11 +61,11 @@ define(function (require, exports, module) {
|
||||
*/
|
||||
function initTernServer(dir, files) {
|
||||
ternWorker.postMessage({
|
||||
type : HintUtils.TERN_INIT_MSG,
|
||||
dir : dir,
|
||||
files : files,
|
||||
env : ternEnvironment
|
||||
});
|
||||
type : HintUtils.TERN_INIT_MSG,
|
||||
dir : dir,
|
||||
files : files,
|
||||
env : ternEnvironment
|
||||
});
|
||||
rootTernDir = dir;
|
||||
}
|
||||
|
||||
@@ -291,8 +291,7 @@ define(function (require, exports, module) {
|
||||
file:name,
|
||||
text:document.getText()
|
||||
});
|
||||
})
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -247,7 +247,7 @@ define(function (require, exports, module) {
|
||||
showFunctionType = true;
|
||||
var col = token.state.lexical.column;
|
||||
for (var line = this.getCursor().line, e = Math.max(0, line - 9), found = false; line >= e; --line) {
|
||||
if (this.getLine(line).charAt(col) == "(") {
|
||||
if (this.getLine(line).charAt(col) === "(") {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
@@ -396,9 +396,9 @@ define(function (require, exports, module) {
|
||||
|
||||
Session.prototype.setTernHints = function(newHints) {
|
||||
this.ternHints = newHints;
|
||||
}
|
||||
};
|
||||
Session.prototype.setFnType = function(newFnType) {
|
||||
this.fnType = newFnType;
|
||||
}
|
||||
};
|
||||
module.exports = Session;
|
||||
});
|
||||
@@ -187,23 +187,24 @@ define(function (require, exports, module) {
|
||||
// level indicates either variable scope or property confidence
|
||||
if (!type.property && token.depth !== undefined) {
|
||||
switch (token.depth) {
|
||||
case 0:
|
||||
$hintObj.addClass("priority-high");
|
||||
break;
|
||||
case 1:
|
||||
$hintObj.addClass("priority-medium");
|
||||
break;
|
||||
case 2:
|
||||
$hintObj.addClass("priority-low");
|
||||
break;
|
||||
default:
|
||||
$hintObj.addClass("priority-lowest");
|
||||
break;
|
||||
case 0:
|
||||
$hintObj.addClass("priority-high");
|
||||
break;
|
||||
case 1:
|
||||
$hintObj.addClass("priority-medium");
|
||||
break;
|
||||
case 2:
|
||||
$hintObj.addClass("priority-low");
|
||||
break;
|
||||
default:
|
||||
$hintObj.addClass("priority-lowest");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (token.guess)
|
||||
if (token.guess) {
|
||||
$hintObj.addClass("guess-hint");
|
||||
}
|
||||
|
||||
// is the token a global variable?
|
||||
if (token.global) {
|
||||
@@ -335,8 +336,8 @@ define(function (require, exports, module) {
|
||||
type.property !== cachedType.property ||
|
||||
type.context !== cachedType.context ||
|
||||
type.showFunctionType !== cachedType.showFunctionType ||
|
||||
query.length == 0 ||
|
||||
(cachedHints.length == 0 && query.length == 2)) { // FIXME: length of 2 is special because that is when tern starts guessing
|
||||
query.length === 0 ||
|
||||
(cachedHints.length === 0 && query.length === 2)) { // FIXME: length of 2 is special because that is when tern starts guessing
|
||||
var offset = session.getOffset(),
|
||||
scopeResponse = ScopeManager.requestHints(session, session.editor.document, offset),
|
||||
self = this;
|
||||
@@ -371,8 +372,8 @@ define(function (require, exports, module) {
|
||||
}
|
||||
|
||||
if (cachedHints) {
|
||||
var type = session.getType(),
|
||||
query = session.getQuery();
|
||||
type = session.getType(),
|
||||
query = session.getQuery();
|
||||
|
||||
// Compute fresh hints if none exist, or if the session
|
||||
// type has changed since the last hint computation
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*jslint vars: true, pluspluss: true, devel: true, nomen: true, indent: 4, maxerr: 50, regexp: true */
|
||||
/*global self, importScripts */
|
||||
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50, regexp: true */
|
||||
/*global self, importScripts, require */
|
||||
|
||||
importScripts("thirdparty/requirejs/require.js");
|
||||
|
||||
@@ -76,7 +76,7 @@ importScripts("thirdparty/requirejs/require.js");
|
||||
defs:env,
|
||||
async:true,
|
||||
getFile: getFile
|
||||
};
|
||||
};
|
||||
ternServer = new Tern.Server(ternOptions);
|
||||
|
||||
files.forEach(function (file){
|
||||
@@ -119,9 +119,9 @@ importScripts("thirdparty/requirejs/require.js");
|
||||
var completions = [];
|
||||
var ternHints = [];
|
||||
for (var i = 0; i < data.completions.length; ++i) {
|
||||
var completion = data.completions[i];//, className = typeToIcon(completion.type);
|
||||
//if (data.guess) className += " Tern-completion-guess";
|
||||
completions.push({value: completion.name, type: completion.type, depth: completion.depth, guess: completion.guess /*, className: className*/});
|
||||
var completion = data.completions[i];//, className = typeToIcon(completion.type);
|
||||
//if (data.guess) className += " Tern-completion-guess";
|
||||
completions.push({value: completion.name, type: completion.type, depth: completion.depth, guess: completion.guess /*, className: className*/});
|
||||
}
|
||||
|
||||
// Post a message back to the main thread with the completions
|
||||
@@ -170,32 +170,32 @@ importScripts("thirdparty/requirejs/require.js");
|
||||
}
|
||||
|
||||
self.addEventListener("message", function (e) {
|
||||
var request = e.data,
|
||||
var dir, file, text,
|
||||
request = e.data,
|
||||
type = request.type;
|
||||
|
||||
if (type === HintUtils.TERN_INIT_MSG) {
|
||||
|
||||
var dir = request.dir,
|
||||
env = request.env,
|
||||
dir = request.dir;
|
||||
var env = request.env,
|
||||
files = request.files;
|
||||
initTernServer(env, dir, files);
|
||||
|
||||
} else if( type === HintUtils.TERN_COMPLETIONS_MSG) {
|
||||
|
||||
var file = request.file,
|
||||
dir = request.dir,
|
||||
offset = request.offset,
|
||||
text = request.text;
|
||||
dir = request.dir;
|
||||
file = request.file;
|
||||
text = request.text;
|
||||
var offset = request.offset;
|
||||
getTernHints(dir, file, offset, text);
|
||||
} else if ( type === HintUtils.TERN_GET_FILE_MSG ) {
|
||||
var file = request.file,
|
||||
text = request.text;
|
||||
file = request.file,
|
||||
text = request.text;
|
||||
handleGetFile(file, text);
|
||||
} else if ( type === HintUtils.TERN_CALLED_FUNC_TYPE_MSG ) {
|
||||
var file = request.file,
|
||||
text = request.text,
|
||||
dir = request.dir,
|
||||
pos = request.pos;
|
||||
dir = request.dir;
|
||||
file = request.file;
|
||||
text = request.text;
|
||||
var pos = request.pos;
|
||||
handleFunctionType(dir, file, pos, text);
|
||||
} else {
|
||||
_log("Unknown message: " + JSON.stringify(request));
|
||||
|
||||
Reference in new issue
Block a user