mirror of
https://github.com/RustyRaptor/brackets.git
synced 2026-12-04 00:15:22 -07:00
Merge with master
This commit is contained in:
commit
ada68e2b1f
184 files changed
+19232
-3339
No files matched your search
@@ -63,7 +63,7 @@ define(function (require, exports, module) {
|
||||
/**
|
||||
* An array of library names that contain JavaScript builtins definitions.
|
||||
*
|
||||
* @returns {Array.<string>} - array of library names.
|
||||
* @return {Array.<string>} - array of library names.
|
||||
*/
|
||||
function getBuiltins() {
|
||||
return builtinLibraryNames;
|
||||
@@ -214,7 +214,7 @@ define(function (require, exports, module) {
|
||||
* Test if the directory should be excluded from analysis.
|
||||
*
|
||||
* @param {!string} path - full directory path.
|
||||
* @returns {boolean} true if excluded, false otherwise.
|
||||
* @return {boolean} true if excluded, false otherwise.
|
||||
*/
|
||||
function isDirectoryExcluded(path) {
|
||||
var excludes = preferences.getExcludedDirectories();
|
||||
@@ -233,7 +233,7 @@ define(function (require, exports, module) {
|
||||
* Test if the file should be excluded from analysis.
|
||||
*
|
||||
* @param {!string} path - full directory path.
|
||||
* @returns {boolean} true if excluded, false otherwise.
|
||||
* @return {boolean} true if excluded, false otherwise.
|
||||
*/
|
||||
function isFileExcluded(path) {
|
||||
var excludes = preferences.getExcludedFiles();
|
||||
@@ -483,7 +483,7 @@ define(function (require, exports, module) {
|
||||
*
|
||||
* @param {!Session} session - the current session
|
||||
* @param {{line: number, ch: number}} start - the starting position of the changes
|
||||
* @returns {{type: string, name: string, offsetLines: number, text: string}}
|
||||
* @return {{type: string, name: string, offsetLines: number, text: string}}
|
||||
*/
|
||||
function getFragmentAround(session, start) {
|
||||
var minIndent = null,
|
||||
@@ -552,9 +552,11 @@ define(function (require, exports, module) {
|
||||
* changes are reset.
|
||||
*
|
||||
* @param {!Session} session - the current session
|
||||
* @returns {{type: string, name: {string}, offsetLines: {number}, text: {string}}
|
||||
* @param {boolean=} preventPartialUpdates - if true, disallow partial updates.
|
||||
* Optional, defaults to false.
|
||||
* @return {{type: string, name: string, offsetLines: number, text: string}}
|
||||
*/
|
||||
function getFileInfo(session) {
|
||||
function getFileInfo(session, preventPartialUpdates) {
|
||||
var start = session.getCursor(),
|
||||
end = start,
|
||||
document = session.editor.document,
|
||||
@@ -570,7 +572,7 @@ define(function (require, exports, module) {
|
||||
result = {type: MessageIds.TERN_FILE_INFO_TYPE_EMPTY,
|
||||
name: path,
|
||||
text: ""};
|
||||
} else if (session.editor.lineCount() > LARGE_LINE_COUNT &&
|
||||
} else if (!preventPartialUpdates && session.editor.lineCount() > LARGE_LINE_COUNT &&
|
||||
(documentChanges.to - documentChanges.from < LARGE_LINE_CHANGE) &&
|
||||
documentChanges.from <= start.line &&
|
||||
documentChanges.to > end.line) {
|
||||
@@ -596,10 +598,16 @@ define(function (require, exports, module) {
|
||||
* and the text is empty.
|
||||
* @param {{line: number, ch: number}=} offset - the default offset (optional). Will
|
||||
* use the cursor if not provided.
|
||||
* @returns {{line: number, ch: number}}
|
||||
* @return {{line: number, ch: number}}
|
||||
*/
|
||||
function getOffset(session, fileInfo, offset) {
|
||||
var newOffset = offset || session.getCursor();
|
||||
var newOffset;
|
||||
|
||||
if (offset) {
|
||||
newOffset = {line: offset.line, ch: offset.ch};
|
||||
} else {
|
||||
newOffset = session.getCursor();
|
||||
}
|
||||
|
||||
if (fileInfo.type === MessageIds.TERN_FILE_INFO_TYPE_PART) {
|
||||
newOffset.line = Math.max(0, newOffset.line - fileInfo.offsetLines);
|
||||
@@ -654,10 +662,13 @@ define(function (require, exports, module) {
|
||||
properties = response.properties,
|
||||
fnType = response.fnType,
|
||||
type = response.type,
|
||||
error = response.error,
|
||||
$deferredHints = getPendingRequest(file, offset, type);
|
||||
|
||||
if ($deferredHints) {
|
||||
if (completions) {
|
||||
if (error) {
|
||||
$deferredHints.reject();
|
||||
} else if (completions) {
|
||||
$deferredHints.resolveWith(null, [{completions: completions}]);
|
||||
} else if (properties) {
|
||||
$deferredHints.resolveWith(null, [{properties: properties}]);
|
||||
@@ -734,7 +745,7 @@ define(function (require, exports, module) {
|
||||
* Determine whether the current set of files are using modules to pull in
|
||||
* additional files.
|
||||
*
|
||||
* @returns {boolean} - true if more files than the current directory have
|
||||
* @return {boolean} - true if more files than the current directory have
|
||||
* been read in.
|
||||
*/
|
||||
function usingModules() {
|
||||
@@ -1073,7 +1084,7 @@ define(function (require, exports, module) {
|
||||
* already been added to tern.
|
||||
*
|
||||
* @param {string} newFile - full path of new file being opened in the editor.
|
||||
* @returns {boolean} - true if tern initialization should be skipped,
|
||||
* @return {boolean} - true if tern initialization should be skipped,
|
||||
* false otherwise.
|
||||
*/
|
||||
function canSkipTernInitialization(newFile) {
|
||||
@@ -1252,6 +1263,33 @@ define(function (require, exports, module) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Request a parameter hint from Tern.
|
||||
*
|
||||
* @param {Session} session - the active hinting session
|
||||
* @param {{line: number, ch: number}} functionOffset - the offset of the function call.
|
||||
* @return {jQuery.Promise} - The promise will not complete until the
|
||||
* hint has completed.
|
||||
*/
|
||||
function requestParameterHint(session, functionOffset) {
|
||||
var $deferredHints = $.Deferred(),
|
||||
fileInfo = getFileInfo(session, true),
|
||||
offset = getOffset(session, fileInfo, functionOffset),
|
||||
fnTypePromise = getTernFunctionType(fileInfo, offset);
|
||||
|
||||
$.when(fnTypePromise).done(
|
||||
function (fnType) {
|
||||
session.setFnType(fnType);
|
||||
session.setFunctionCallPos(functionOffset);
|
||||
$deferredHints.resolveWith(null, [fnType]);
|
||||
}
|
||||
).fail(function () {
|
||||
$deferredHints.reject();
|
||||
});
|
||||
|
||||
return $deferredHints.promise();
|
||||
}
|
||||
|
||||
/**
|
||||
* Request hints from Tern.
|
||||
*
|
||||
@@ -1269,26 +1307,15 @@ define(function (require, exports, module) {
|
||||
function requestHints(session, document) {
|
||||
var $deferredHints = $.Deferred(),
|
||||
hintPromise,
|
||||
fnTypePromise,
|
||||
sessionType = session.getType(),
|
||||
fileInfo = getFileInfo(session),
|
||||
offset = getOffset(session, fileInfo,
|
||||
sessionType.showFunctionType ? sessionType.functionCallPos : null);
|
||||
offset = getOffset(session, fileInfo, null);
|
||||
|
||||
maybeReset(session, document);
|
||||
|
||||
hintPromise = getTernHints(fileInfo, offset, sessionType.property);
|
||||
|
||||
if (sessionType.showFunctionType) {
|
||||
// Show function sig
|
||||
fnTypePromise = getTernFunctionType(fileInfo, offset);
|
||||
} else {
|
||||
var $fnTypeDeferred = $.Deferred();
|
||||
fnTypePromise = $fnTypeDeferred.promise();
|
||||
$fnTypeDeferred.resolveWith(null);
|
||||
}
|
||||
|
||||
$.when(hintPromise, fnTypePromise).done(
|
||||
$.when(hintPromise).done(
|
||||
function (completions, fnType) {
|
||||
if (completions.completions) {
|
||||
session.setTernHints(completions.completions);
|
||||
@@ -1298,7 +1325,6 @@ define(function (require, exports, module) {
|
||||
session.setGuesses(completions.properties);
|
||||
}
|
||||
|
||||
session.setFnType(fnType);
|
||||
$deferredHints.resolveWith(null);
|
||||
}
|
||||
).fail(function () {
|
||||
@@ -1393,6 +1419,7 @@ define(function (require, exports, module) {
|
||||
exports.handleFileChange = handleFileChange;
|
||||
exports.requestHints = requestHints;
|
||||
exports.requestJumptoDef = requestJumptoDef;
|
||||
exports.requestParameterHint = requestParameterHint;
|
||||
exports.handleProjectClose = handleProjectClose;
|
||||
exports.handleProjectOpen = handleProjectOpen;
|
||||
|
||||
|
||||
Reference in new issue
Block a user