mirror of
https://github.com/RustyRaptor/brackets.git
synced 2026-12-04 00:15:22 -07:00
new guessing
This commit is contained in:
1 parent
3107c979c7
commit
c887e8760f
5 files changed
+90
-4
No files matched your search
@@ -203,6 +203,52 @@ define(function (require, exports, module) {
|
||||
return $deferredHints.promise();
|
||||
}
|
||||
|
||||
/**
|
||||
* Request properties from Tern.
|
||||
*
|
||||
* @param {Document} document - the document for which scope info is
|
||||
* desired
|
||||
* @return {jQuery.Promise} - The promise will not complete until the tern
|
||||
* hints have completed.
|
||||
*/
|
||||
function requestProperties(session, document) {
|
||||
var path = document.file.fullPath,
|
||||
split = HintUtils.splitPath(path),
|
||||
dir = split.dir,
|
||||
file = split.file;
|
||||
|
||||
var $deferredHints = $.Deferred(),
|
||||
propertiesPromise,
|
||||
fnTypePromise;
|
||||
|
||||
propertiesPromise = getTernProperties(dir, file, document.getText());
|
||||
$.when(hintPromise).done(
|
||||
function(properties){
|
||||
session.setTernProperties(properties);
|
||||
$deferredHints.resolveWith(null);
|
||||
});
|
||||
return {promise:$deferredHints.promise()};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a Promise for all of the known properties from TernJS, for the directory and file.
|
||||
* The properties will be used as guesses in tern.
|
||||
*
|
||||
* @return {jQuery.Promise} - a promise that will resolve to an array of properties when
|
||||
* it is done
|
||||
*/
|
||||
function getTernProperties(dir, file, text) {
|
||||
ternWorker.postMessage({
|
||||
type: HintUtils.TERN_GET_PROPERTIES_MSG,
|
||||
dir:dir,
|
||||
file:file
|
||||
});
|
||||
|
||||
var $deferredHints = $.Deferred();
|
||||
addPendingRequest(file, HintUtils.TERN_PROPERTIES_MSG, $deferredHints);
|
||||
return $deferredHints.promise();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a Promise for the function type from TernJS.
|
||||
* @return {jQuery.Promise} - a promise that will resolve to the function type of the function being called.
|
||||
@@ -428,6 +474,7 @@ define(function (require, exports, module) {
|
||||
exports.handleEditorChange = handleEditorChange;
|
||||
exports.handleFileChange = handleFileChange;
|
||||
exports.requestHints = requestHints;
|
||||
exports.requestProperties = requestProperties;
|
||||
exports.isScopeDirty = isScopeDirty;
|
||||
exports.getTernHints = getTernHints;
|
||||
});
|
||||
Reference in new issue
Block a user