Add feature to hint on '(' key and fix typos

This commit is contained in:
dloverin committed 2013-08-12 10:55:24 -04:00
1 parent 388ddcfa41
commit dd6b19d984
5 files changed
+15 -14

No files matched your search

@@ -55,7 +55,7 @@ define(function (require, exports, module) {
hintState = {},
hintStack = [], // stack for previous function hint to restore
preserveHintStack, // close a function hint without clearing stack
session; // current editor session, updated by main
session; // current editor session, updated by main
// Constants
var POINTER_TOP_OFFSET = 4, // Size of margin + border of hint.
@@ -324,7 +324,7 @@ define(function (require, exports, module) {
/**
*
* @param {Object} cursor - a CodeMirror token
* @param {Object} token - a CodeMirror token
* @return {*} - the lexical state of the token
*/
function getLexicalState(token) {
@@ -372,7 +372,7 @@ define(function (require, exports, module) {
if (type === "variable-2" || type === "variable" || type === "property") {
nextToken = self.getNextToken(localCursor, true);
if (nextToken.string === "(") {
if (nextToken && nextToken.string === "(") {
//nextToken = self.getNextToken(localCursor, true);
localLexical = getLexicalState(nextToken);
return localLexical;
@@ -1,11 +1,11 @@
{
"showParameterHint": [
{
"key": "Ctrl-Shift-Space"
"key": "Ctrl-Shift-Space"
},
{
"key": "Ctrl-Shift-Space",
"platform": "mac"
"key": "Ctrl-Shift-Space",
"platform": "mac"
}
]
}
@@ -576,6 +576,7 @@ define(function (require, exports, module) {
.on(HintUtils.eventName("change"), function (event, editor, changeList) {
if (!ignoreChange) {
ScopeManager.handleFileChange(changeList);
ParameterHintManager.popUpHint();
}
ignoreChange = false;
});
@@ -299,7 +299,7 @@ importScripts("thirdparty/requirejs/require.js");
* Given a Tern formatted function type string, convert it to an array of Objects, where each object describes
* a parameter.
*
* @param {String} newFnType - Tern formatted function type string.
* @param {string} newFnType - Tern formatted function type string.
* @return {Array<{name: string, type: string, isOptional: boolean}>} where each entry in the array is a parameter.
*/
function getParameters(newFnType) {
@@ -316,7 +316,7 @@ importScripts("thirdparty/requirejs/require.js");
*
* @param {Infer.Arr} inferArrType
*
* @return {String} - array formatted in google closure style.
* @return {string} - array formatted in google closure style.
*
*/
function inferArrTypeToString(inferArrType) {
@@ -341,16 +341,16 @@ importScripts("thirdparty/requirejs/require.js");
/**
* Convert an infer type to a string.
*
* @param {*} inferType - one of the Infer's types; infer.Prim, infer.Arr, infer.ANull. infer.Fn functions are
* @param {*} inferType - one of the Infer's types; Infer.Prim, Infer.Arr, Infer.ANull. Infer.Fn functions are
* not handled here.
*
* @return {String}
* @return {string}
*
*/
inferTypeToString = function (inferType) {
var result;
if (inferType instanceof infer.Prim) {
if (inferType instanceof Infer.Prim) {
result = inferType.toString();
if (result === "string") {
result = "String";
@@ -359,11 +359,11 @@ importScripts("thirdparty/requirejs/require.js");
} else if (result === "boolean") {
result = "Boolean";
}
} else if (inferType instanceof infer.Arr) {
} else if (inferType instanceof Infer.Arr) {
result = inferArrTypeToString(inferType);
} else if (inferType instanceof Infer.Fn) {
result = inferFnTypeToString(inferType);
} else if (inferType instanceof infer.Obj) {
} else if (inferType instanceof Infer.Obj) {
result = inferType.name;
} else {
result = "Object";
@@ -394,7 +394,7 @@ importScripts("thirdparty/requirejs/require.js");
/**
* Convert an infer function type to string.
*
* @param {*} inferType - one of the Infer's types; infer.Fn, infer.Prim, infer.Arr, infer.ANull
* @param {*} inferType - one of the Infer's types; Infer.Fn, Infer.Prim, Infer.Arr, Infer.ANull
* @return {Array<{name: string, type: string, isOptional: boolean}>} where each entry in the array is a parameter.
*/
processInferFnTypeParameters = function (inferType) {