Add tests for jscodehints in an html file.

Also fix some bugs with jump-to-def and function type hints uncovered by the tests.
This commit is contained in:
Erik Tierney committed 2013-05-02 16:28:40 -04:00
1 parent 0755c30d58
commit 9416e75828
3 files changed
+69 -10

No files matched your search

@@ -254,14 +254,14 @@ define(function (require, exports, module) {
* function being called
*/
Session.prototype.getType = function () {
function getLexicalInfo(token) {
function getLexicalState(token) {
if (token.state.lexical) {
// in a javascript file this is just in the state field
return token.state.lexical.info;
return token.state.lexical;
} else if (token.state.localState && token.state.localState.lexical) {
// inline javascript in an html file will have this in
// the localState field
return token.state.localState.lexical.info;
return token.state.localState.lexical;
}
}
var propertyLookup = false,
@@ -270,12 +270,14 @@ define(function (require, exports, module) {
context = null,
cursor = this.getCursor(),
functionCallPos,
token = this.getToken(cursor);
token = this.getToken(cursor),
lexical;
if (token) {
// if this token is part of a function call, then the tokens lexical info
// will be annotated with "call"
if (getLexicalInfo(token) === "call") {
lexical = getLexicalState(token);
if (lexical.info === "call") {
inFunctionCall = true;
if (this.getQuery().length > 0) {
inFunctionCall = false;
@@ -292,7 +294,7 @@ define(function (require, exports, module) {
// and it will prevent us from walking back thousands of lines if something went wrong.
// there is nothing magical about 9 lines, and it can be adjusted if it doesn't seem to be
// working well
var col = token.state.lexical.column,
var col = lexical.column,
line,
e,
found;