Files
brackets/src/extensions/default/JavaScriptCodeHints/test/file1.js
T
Erik Tierney a4c87a6bba Fix Issue #3511
when inserting a hint which is not a valid property name, such as 'my-key', insert the hint as ["my-key"] instead of .my-key.

insertHint now runs the hint through the acorn tokenizer to see if it looks like a valid property name.  If it's invalid, it replaces the '.' with brackets.
Refactored some code in Session.getType() - pulled out a method to find the leading '.' in a property lookup, and use that method from the insertHint logic as well.
Added 3 new unittests to test this new behavior.
2013-04-24 15:40:05 -04:00

50 lines
867 B
JavaScript

/*jslint vars: true, plusplus: true, devel: true, browser: true, nomen: true, indent: 4, maxerr: 50 */
/*global brackets, require */
var A1 = { propA : 1 },
A2 = { propA : 2 },
A3 = A2;
function funB(paramB1, paramB2) {
'use strict';
var B1 = { propB : 1 },
B2 = { propB : 2 };
function funC(paramC1, paramC2) {
var C1 = { propC : 1 },
C2 = { propC : 2 };
B1.propB = 0;
C1.propC = 0;
B1.foo = 0;
console.log("hello\\\" world!");
}
var s = "a string";
var r = s;
var t = r;
}
/**
* @param {string} a
* @param {number} b
*/
function funD(a, b) {
"use strict";
return {x: a, y: b};
}
require(["MyModule"], function (myModule) {
'use strict';
var x = myModule.a;
});
funB();
var x = A1;
var arr = [];
arr["my-key"] = 1;
arr["for"] = 10;