diff options
author | Mike Rennie <Michael_Rennie@ca.ibm.com> | 2015-07-07 13:54:49 -0400 |
---|---|---|
committer | Mike Rennie <Michael_Rennie@ca.ibm.com> | 2015-07-07 13:54:54 -0400 |
commit | f75db55a7df558bb12faaed2f590845c54bf915a (patch) | |
tree | 8b3b0a2055cd9270844a127de176f035ea5f918f | |
parent | 5a3b8efa60aa190d2ba60eec3170f6cf7d770814 (diff) | |
download | org.eclipse.orion.client-origin/stable_20150707.zip org.eclipse.orion.client-origin/stable_20150707.tar.gz org.eclipse.orion.client-origin/stable_20150707.tar.bz2 |
Bug 471962 - [assist] JS doc proposals not working all the timeorigin/stable_20150707
4 files changed, 525 insertions, 515 deletions
diff --git a/bundles/org.eclipse.orion.client.javascript/web/javascript/contentAssist/ternAssist.js b/bundles/org.eclipse.orion.client.javascript/web/javascript/contentAssist/ternAssist.js index 9a702b9..571100c 100644 --- a/bundles/org.eclipse.orion.client.javascript/web/javascript/contentAssist/ternAssist.js +++ b/bundles/org.eclipse.orion.client.javascript/web/javascript/contentAssist/ternAssist.js @@ -314,9 +314,9 @@ define([ }
}
} else if(kind && kind.kind === 'doc') {
- var comment = kind.node.value.trim();
+ var comment = kind.node.value;
if(comment) {
- if(/^(?:\/\*)?\s*eslint(?:-enable|-disable)?\s+/gi.test(params.line)) {
+ if(/^\s*(?:\/\*)?\s*eslint(?:-enable|-disable)?\s+/gi.test(comment)) {
//eslint eslint-enable eslint-disable
var rules = Rules.getRules();
var rulekeys = Object.keys(rules).sort();
@@ -342,7 +342,7 @@ define([ proposals.push(_p);
}
}
- } else if(/^(?:\/\*)?\s*eslint-env\s+/gi.test(params.line)) {
+ } else if(/^\s*(?:\/\*)?\s*eslint-env\s+/gi.test(comment)) {
//eslint-env (comma-separated list)
var _all = Objects.mixin(ESLintEnv, pluginenvs);
var keys = Object.keys(_all).sort();
@@ -373,7 +373,7 @@ define([ var _d = evnt.data;
if(_d.request === 'completions') {
if(deferred.proposals) {
- deferred.resolve([].concat(sortProposals(_d.proposals, deferred.args), deferred.proposals));
+ deferred.resolve([].concat(sortProposals(_d.proposals ? _d.proposals : [], deferred.args), deferred.proposals));
} else {
deferred.resolve(sortProposals(_d.proposals, deferred.args));
}
@@ -467,7 +467,9 @@ define([ clearTimeout(this.timeout);
}
this.timeout = setTimeout(function() {
- deferred.resolve(Messages['noProposalsTimedOut']);
+ if(deferred) {
+ deferred.resolve(Messages['noProposalsTimedOut']);
+ }
this.timeout = null;
}, 5000);
return deferred;
diff --git a/bundles/org.eclipse.orion.client.javascript/web/javascript/finder.js b/bundles/org.eclipse.orion.client.javascript/web/javascript/finder.js index 0aa46ae..fbb161d 100644 --- a/bundles/org.eclipse.orion.client.javascript/web/javascript/finder.js +++ b/bundles/org.eclipse.orion.client.javascript/web/javascript/finder.js @@ -571,7 +571,7 @@ define([ }, /** override */ leave: function(node) { - if(parents && offset >= node.range[1]) { + if(parents && offset > node.range[1]) { parents.pop(); } } diff --git a/bundles/org.eclipse.orion.client.javascript/web/js-tests/javascript/contentAssistTests.js b/bundles/org.eclipse.orion.client.javascript/web/js-tests/javascript/contentAssistTests.js index b13fb51..a52ad0d 100644 --- a/bundles/org.eclipse.orion.client.javascript/web/js-tests/javascript/contentAssistTests.js +++ b/bundles/org.eclipse.orion.client.javascript/web/js-tests/javascript/contentAssistTests.js @@ -4617,194 +4617,7 @@ define([ ["ffff", "ffff : Number"] ]); }); - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=425675 - * @since 5.0 - */ - it("test completions for Function1", function() { - //computeContentAssist(buffer, prefix, offset, lintOptions, editorContextMixin, paramsMixin) { - var results = computeContentAssist("var foo; foo !== null ? fun : function(f2) {};", - "fun", - 27, - {}, - {}, - {keyword:true, template:true}); - return testProposals(results, [ - //proposal, description - ["Function()", "Function() : Function"], - ["", "Templates"], - ["/**\n * @name name\n * @param parameter\n */\nfunction name (parameter) {\n\t\n}", "function - function declaration"], - //["/**\n * @name name\n * @function\n * @param parameter\n */\nname: function(parameter) {\n\t\n}", "function - function expression"], - ["", "Keywords"], - ["ction", "function"] - ]); - }); - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=425675 - * @since 5.0 - */ - it("test completions for Function2", function() { - var results = computeContentAssist("var foo; foo !== null ? function(f2) {} : fun;", - "fun", - 45, - {}, - {}, - {keyword:true, template:true}); - return testProposals(results, [ - //proposal, description - ["Function()", "Function() : Function"], - ["", "Templates"], - ["/**\n * @name name\n * @param parameter\n */\nfunction name (parameter) {\n\t\n}", "function - function declaration"], - ["", "Keywords"], - ["ction", "function"] - ]); - }); - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=425675 - * @since 5.0 - */ - it("test completions for Function3", function() { - var results = computeContentAssist("var foo = {f: fun};", - 'fun', - 17, - {}, - {}, - {keyword:true, template:true}); - return testProposals(results, [ - //proposal, description - ['Function()', 'Function() : Function'], - ["", "Templates"], - ['ction(parameter) {\n\t\n}', 'function - member function expression'], - ["", "Keywords"], - ["ction", "function"] - ]); - }); - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=425675 - * @since 5.0 - */ - it("test completions for Function4", function() { - var results = computeContentAssist("var foo = {f: fun};", - 'fun', - 17, - {}, - {}, - {keyword:true, template:true}); - return testProposals(results, [ - //proposal, description - ['Function()', 'Function() : Function'], - ["", "Templates"], - ['ction(parameter) {\n\t\n}', 'function - member function expression'], - ["", "Keywords"], - ["ction", "function"], - ]); - }); - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=425675 - * @since 5.0 - */ - it("test completions for Function5", function() { - var results = computeContentAssist("fun", - 'fun', - 3, - {}, - {}, - {keyword:true, template:true}); - return testProposals(results, [ - //proposal, description - ["Function()", "Function() : Function"], - ["", "Templates"], - ["/**\n * @name name\n * @param parameter\n */\nfunction name (parameter) {\n\t\n}", "function - function declaration"], - ["", "Keywords"], - ["ction", "function"] - ]); - }); - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=426284 - * @since 6.0 - */ - it("test completions for Function6", function() { - var results = computeContentAssist("var foo = {f: t};", - 't', - 15, - {}, - {}, - {keyword:true, template:true}); - return testProposals(results, [ - //proposal, description - ['this', 'this : {f:Object}'], - ['', '---------------------------------'], - ["toLocaleString()", "toLocaleString() : String"], - ["toString()", "toString() : String"], - ["", "Keywords"], - ["his", "this"], - ["rue", "true"], - ["ypeof", "typeof"] - ]); - }); - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=426284 - * @since 6.0 - */ - it("test completions for Function7", function() { - var results = computeContentAssist("var foo = {f: h};", - 'h', - 15, - {}, - {}, - {keyword:true, template:true}); - return testProposals(results, [ - ['hasOwnProperty(property)', 'hasOwnProperty(property) : Boolean'] - ]); - }); - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=426284 - * @since 6.0 - */ - it("test completions for Function8", function() { - var results = computeContentAssist("var foo = {f: fal};", - 'fal', - 17, - {}, - {}, - {keyword:true, template:true}); - return testProposals(results, [ - //proposal, description - ["", "Keywords"], - ["se", "false"] - ]); - }); - - /** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=426284 - * @since 6.0 - */ - it("test completions for Function9", function() { - var results = computeContentAssist("var foo = {f: n};", - 'n', - 15, - {}, - {}, - {keyword:true, template:true}); - return testProposals(results, [ - //proposal, description - ['Number([val])', 'Number([val]) : Number'], - ['NaN', 'NaN : Number'], - ["", "Keywords"], - ["ew", "new"], - ['ull', 'null'] - ]); - }); - /** * Test that keyword suggestions are not made when looking for a member function or property. * @since 5.0 @@ -5019,120 +4832,7 @@ define([ ["zzz", "zzz : Number"] ]); }); - - //////////////////////////////////////// - // tests for contributed Tern index files - //////////////////////////////////////// - var testTernIndex = { - "!name": "mylib", - "!define": { - mylib: { - whatever: { - "!type": "Number" - } - } - } - }; - it("test proposals shown for contributed module when `node:true`", function() { - var results = computeContentAssist({ - buffer: "var lib = require(\"mylib\");\n" + - "lib.w", - prefix: "w", - lintOptions: { - options: { "node": true } - }, - editorContextMixin: { - getTypeDef: function() { - return new Deferred().resolve(testTernIndex); - } - }, - paramsMixin: { - typeDefs: { - mylib: { - type: "tern" - } - } - } - }); - return testProposals(results, [ - ["whatever", "whatever : Number"] - ]); - }); - it("test proposals shown for contributed module when no lint option", function() { - var results = computeContentAssist({ - buffer: "var lib = require(\"mylib\");\n" + - "lib.w", - prefix: "w", - lintOptions: {}, - editorContextMixin: { - getTypeDef: function() { - return new Deferred().resolve(testTernIndex); - } - }, - paramsMixin: { - typeDefs: { - mylib: { - type: "tern" - } - } - } - }); - return testProposals(results, [ - ["whatever", "whatever : Number"] - ]); - - }); - - /** - * Tests mysql index - * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=426486 - * @since 7.0 - */ - it("test mysql index 1", function() { - var results = computeContentAssist("require('mysql').createP", "createP", 24); - testProposals(results, [ - ['ool', 'createPool(config) : Pool'], - ['oolCluster', 'createPoolCluster(config) : PoolCluster'] - ]); - }); - - /** - * Tests mysql index - * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=426486 - * @since 7.0 - */ - it("test mysql index 2", function() { - var results = computeContentAssist("require('mysql').createC", "createC", 25); - testProposals(results, [ - ['onnection', 'createConnection(config) : Connection'] - ]); - }); - - /** - * Tests mysql index - * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=426486 - * @since 7.0 - */ - it("test mysql index 3", function() { - var results = computeContentAssist("require('mysql').createQ", "createQ", 25); - testProposals(results, [ - ['uery', 'createQuery(sql, values, cb) : Query'] - ]); - }); - - /** - * Tests mysql index for indirect proposals - * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=426486 - * @since 7.0 - */ - it("test mysql index 4", function() { - var results = computeContentAssist("require('mysql').createQuery(null,null,null).sta", "sta", 47); - testProposals(results, [ - ['rt', 'start()'] - ]); - }); - /** * Tests redis index indirect proposals * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=426486 @@ -5492,213 +5192,6 @@ define([ }); /** - * Tests the eslint* templates in source - * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 - */ - it("test eslint* template 1", function() { - var results = computeContentAssist("es", "es", 2); - testProposals(results, [ - ['lint', 'eslint', 'ESLint rule enable / disable directive'], - ['lint-disable', 'eslint-disable', 'ESLint rule disablement directive'], - ['lint-enable', 'eslint-enable', 'ESLint rule enablement directive'], - ['lint-env', 'eslint-env', 'ESLint environment directive'] - ] - ); - }); - - /** - * Tests the eslint* templates in comments - * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 - */ - it("test eslint* template 2", function() { - var results = computeContentAssist("/* es", "es", 5); - testProposals(results, [ - ['lint', 'eslint', 'ESLint rule enable / disable directive'], - ['lint-disable', 'eslint-disable', 'ESLint rule disablement directive'], - ['lint-enable', 'eslint-enable', 'ESLint rule enablement directive'], - ['lint-env', 'eslint-env', 'ESLint environment directive'] - ] - ); - }); - - /** - * Tests the eslint* templates in comments - * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 - */ - it("test eslint* template 3", function() { - var results = computeContentAssist("/* es */", "es", 5); - testProposals(results, [ - ['lint', 'eslint', 'ESLint rule enable / disable directive'], - ['lint-disable', 'eslint-disable', 'ESLint rule disablement directive'], - ['lint-enable', 'eslint-enable', 'ESLint rule enablement directive'], - ['lint-env', 'eslint-env', 'ESLint environment directive'] - ] - ); - }); - - /** - * Tests the eslint* templates in comments - * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 - */ - it("test eslint* template 4", function() { - var results = computeContentAssist("var f; /* es", "es", 12); - testProposals(results, [ - ['lint', 'eslint', 'ESLint rule enable / disable directive'], - ['lint-disable', 'eslint-disable', 'ESLint rule disablement directive'], - ['lint-enable', 'eslint-enable', 'ESLint rule enablement directive'], - ['lint-env', 'eslint-env', 'ESLint environment directive'] - ] - ); - }); - - /** - * Tests that no eslint* templates are in jsdoc comments - * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 - */ - it("test eslint* template 5", function() { - var results = computeContentAssist("/** es", "es", 6); - testProposals(results, []); - }); - - /** - * Tests that eslint* templates will be proposed further in comment with no content beforehand - * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 - * @since 7.0 - */ - it("test eslint* template 6", function() { - var results = computeContentAssist("/* \n\n es", "es", 10); - testProposals(results, [ - ['lint', 'eslint', 'ESLint rule enable / disable directive'], - ['lint-disable', 'eslint-disable', 'ESLint rule disablement directive'], - ['lint-enable', 'eslint-enable', 'ESLint rule enablement directive'], - ['lint-env', 'eslint-env', 'ESLint environment directive'] - ]); - }); - - /** - * Tests that no eslint* templates are in comments after other content - * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 - * @since 7.0 - */ - it("test eslint* template 7", function() { - var results = computeContentAssist("/* foo \n\n es", "es", 10); - testProposals(results, []); - }); - - /** - * Tests that no eslint* templates are proposed when there is already one - * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 - * @since 7.0 - */ - it("test eslint* template 8", function() { - var results = computeContentAssist("/* eslint ", "es", 10); - assertNoProposal('eslint', results); - assertNoProposal('eslint-env', results); - }); - - /** - * Tests that no eslint* templates are proposed when there is already one - * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 - * @since 7.0 - */ - it("test eslint* template 9", function() { - var results = computeContentAssist("/* eslint ", "eslint", 9); - testProposals(results, [ - ['lint', 'eslint', 'ESLint rule enable / disable directive'], - ['lint-disable', 'eslint-disable', 'ESLint rule disablement directive'], - ['lint-enable', 'eslint-enable', 'ESLint rule enablement directive'], - ['lint-env', 'eslint-env', 'ESLint environment directive'] - ]); - }); - - /** - * Tests that eslint-env environs are proposed - * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 - * @since 7.0 - */ - it("test eslint-env proposals 1", function() { - var results = computeContentAssist("/* eslint-env ", "", 14); - testProposals(results, [ - ['amd', 'amd', 'ESLint environment name'], - ['browser', 'browser', 'ESLint environment name'], - ['mocha', 'mocha', 'ESLint environment name'], - ['node', 'node', 'ESLint environment name'] - ]); - }); - - /** - * Tests that eslint-env environs are proposed - * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 - * @since 7.0 - */ - it("test eslint-env proposals 2", function() { - var results = computeContentAssist("/* eslint-env a", "a", 15); - testProposals(results, [ - ['md', 'amd', 'ESLint environment name'], - ]); - }); - - /** - * Tests that eslint rules are proposed - * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 - * @since 7.0 - */ - it("test eslint rule proposals 1", function() { - var results = computeContentAssist("/* eslint c", "c", 11); - testProposals(results, [ - ['urly', 'curly', 'ESLint rule name'] - ]); - }); - - /** - * Tests that eslint rules are proposed - * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 - * @since 7.0 - */ - it("test eslint rule proposals 2", function() { - var results = computeContentAssist("/* eslint no-js", "no-js", 15); - testProposals(results, [ - ['lint', 'no-jslint', 'ESLint rule name'], - ]); - }); - - /** - * Tests that eslint rules are proposed - * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 - * @since 7.0 - */ - it("test eslint rule proposals 3", function() { - var results = computeContentAssist("/* eslint-enable no-js", "no-js", 22); - testProposals(results, [ - ['lint', 'no-jslint', 'ESLint rule name'], - ]); - }); - - /** - * Tests that eslint rules are proposed - * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 - * @since 7.0 - */ - it("test eslint rule proposals 4", function() { - var results = computeContentAssist("/* eslint-disable no-js", "no-js", 23); - testProposals(results, [ - ['lint', 'no-jslint', 'ESLint rule name'], - ]); - }); - - /** - * Tests that eslint rules are proposed - * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 - * @since 7.0 - */ - it("test eslint rule proposals 5", function() { - var results = computeContentAssist("/* eslint-enable no-jslint, c", "c", 29); - testProposals(results, [ - ['urly', 'curly', 'ESLint rule name'] - ]); - }); - - /** * Tests line comments * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=443521 * @since 7.0 diff --git a/bundles/org.eclipse.orion.client.javascript/web/js-tests/javascript/ternAssistTests.js b/bundles/org.eclipse.orion.client.javascript/web/js-tests/javascript/ternAssistTests.js index 48fadd0..489f91f 100644 --- a/bundles/org.eclipse.orion.client.javascript/web/js-tests/javascript/ternAssistTests.js +++ b/bundles/org.eclipse.orion.client.javascript/web/js-tests/javascript/ternAssistTests.js @@ -195,7 +195,7 @@ define([ }; var _p = setup(options); state.warmup = true; - ternAssist.computeContentAssist(_p.editorContext, _p.params).then(function (actualProposals) { + ternAssist.computeContentAssist(_p.editorContext, _p.params).then(/* @callback */ function (actualProposals) { //do noting, warm up }); }); @@ -267,5 +267,520 @@ define([ ]); }); }); + describe('Function Templates and Keywords', function() { + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=425675 + * @since 5.0 + */ + it("test completions for Function1", function(done) { + var options = { + buffer: "var foo; foo !== null ? fun : function(f2) {};", + prefix: "fun", + offset: 27, + templates: true, + keywords: true, + callback: done}; + return testProposals(options, [ + //proposal, description + ["function", "function - Keyword"], + ["", "Templates"], + ["/**\n * @name name\n * @param parameter\n */\nfunction name (parameter) {\n\t\n}", "function - function declaration"] + ]); + }); + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=425675 + * @since 5.0 + */ + it("test completions for Function2", function(done) { + var options = { + buffer: "var foo; foo !== null ? function(f2) {} : fun;", + prefix: "fun", + offset: 45, + templates: true, + keywords: true, + callback: done + }; + return testProposals(options, [ + //proposal, description + ["function", "function - Keyword"], + ["", "Templates"], + ["/**\n * @name name\n * @param parameter\n */\nfunction name (parameter) {\n\t\n}", "function - function declaration"], + ]); + }); + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=425675 + * @since 5.0 + */ + it("test completions for Function3", function(done) { + var options = { + buffer: "var foo = {f: fun};", + prefix: 'fun', + offset: 17, + templates: true, + keywords: true, + callback: done + }; + return testProposals(options, [ + //proposal, description + ["function", "function - Keyword"], + ["", "Templates"], + ['ction(parameter) {\n\t\n}', 'function - member function expression'], + ]); + }); + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=425675 + * @since 5.0 + */ + it("test completions for Function4", function(done) { + var options = { + buffer: "var foo = {f: fun};", + prefix: 'fun', + offset: 17, + templates: true, + keywords: true, + callback: done + }; + return testProposals(options, [ + //proposal, description + ["function", "function - Keyword"], + ["", "Templates"], + ['ction(parameter) {\n\t\n}', 'function - member function expression'], + ]); + }); + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=425675 + * @since 5.0 + */ + it("test completions for Function5", function(done) { + var options = { + buffer: "fun", + prefix: 'fun', + offset: 3, + templates: true, + keywords: true, + callback: done + }; + return testProposals(options, [ + //proposal, description + ["function", "function - Keyword"], + ["", "Templates"], + ["/**\n * @name name\n * @param parameter\n */\nfunction name (parameter) {\n\t\n}", "function - function declaration"], + ]); + }); + /* + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=426284 + * @since 6.0 + */ + it("test completions for Function6", function(done) { + var options = { + buffer: "var foo = {f: t};", + prefix: 't', + offset: 15, + keywords:true, + templates:true, + callback: done + }; + return testProposals(options, [ + //proposal, description + ["this", "this - Keyword"], + ['throw', 'throw - Keyword'], + ['try', 'try - Keyword'], + ["typeof", "typeof - Keyword"], + ['', 'ecma5'], + ["toLocaleString()", "toLocaleString() : string"], + ["toString()", "toString() : string"], + + ]); + }); + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=426284 + * @since 6.0 + */ + it("test completions for Function7", function(done) { + var options = { + buffer: "var foo = {f: h};", + prefix: 'h', + offset: 15, + keywords: true, + templates: true, + callback: done + }; + return testProposals(options, [ + ['', 'ecma5'], + ['hasOwnProperty(prop)', 'hasOwnProperty(prop) : bool'] + ]); + }); + + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=426284 + * @since 6.0 + */ + it("test completions for Function8", function(done) { + var options = { + buffer: "var foo = {f: n};", + prefix: 'n', + offset: 15, + keywords: true, + templates: true, + callback: done + }; + return testProposals(options, [ + //proposal, description + ["new", "new - Keyword"] + ]); + }); + }); + describe('ESLint Directive Tests', function() { + /** + * Tests the eslint* templates in source + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 + */ + it("test eslint* template 1", function(done) { + var options = { + buffer: "es", + prefix: "es", + offset: 2, + callback: done, + templates: true + }; + testProposals(options, [ + ['', 'Templates'], + ['/* eslint rule-id:0/1*/', 'eslint - ESLint rule enable / disable directive'], + ['/* eslint-disable rule-id */', 'eslint-disable - ESLint rule disablement directive'], + ['/* eslint-enable rule-id */', 'eslint-enable - ESLint rule enablement directive'], + ['/* eslint-env library*/', 'eslint-env - ESLint environment directive']] + ); + }); + /** + * Tests the eslint* templates in comments + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 + */ + it("test eslint* template 2", function(done) { + var options = { + buffer: "/* es", + prefix: "es", + offset: 5, + callback: done, + templates: true + }; + testProposals(options, [ + ['', 'Templates'], + ['lint rule-id:0/1 ', 'eslint - ESLint rule enable or disable'], + ['lint-disable rule-id ', 'eslint-disable - ESLint rule disablement directive'], + ['lint-enable rule-id ', 'eslint-enable - ESLint rule enablement directive'], + ['lint-env library', 'eslint-env - ESLint environment directive']] + ); + }); + /** + * Tests the eslint* templates in comments + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 + */ + it("test eslint* template 3", function(done) { + var options = { + buffer: "/* es */", + prefix: "es", + offset: 5, + callback: done, + templates: true + }; + testProposals(options, [ + ['', 'Templates'], + ['lint rule-id:0/1 ', 'eslint - ESLint rule enable or disable'], + ['lint-disable rule-id ', 'eslint-disable - ESLint rule disablement directive'], + ['lint-enable rule-id ', 'eslint-enable - ESLint rule enablement directive'], + ['lint-env library', 'eslint-env - ESLint environment directive']] + ); + }); + /** + * Tests the eslint* templates in comments + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 + */ + it("test eslint* template 4", function(done) { + var options = { + buffer: "var f; /* es", + prefix: "es", + offset: 12, + callback: done, + templates: true + }; + testProposals(options, [ + ['', 'Templates'], + ['lint rule-id:0/1 ', 'eslint - ESLint rule enable or disable'], + ['lint-disable rule-id ', 'eslint-disable - ESLint rule disablement directive'], + ['lint-enable rule-id ', 'eslint-enable - ESLint rule enablement directive'], + ['lint-env library', 'eslint-env - ESLint environment directive']] + ); + }); + /** + * Tests that no eslint* templates are in jsdoc comments + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 + */ + it("test eslint* template 5", function(done) { + var options = { + buffer: "/** es", + prefix: "es", + offset: 6, + callback: done, + templates: true + }; + testProposals(options, []); + }); + /** + * Tests that eslint* templates will be proposed further in comment with no content beforehand + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 + * @since 7.0 + */ + it("test eslint* template 6", function(done) { + var options = { + buffer: "/* \n\n es", + prefix: "es", + offset: 10, + callback: done, + templates: true + }; + testProposals(options, [ + ['','Templates'], + ['/* eslint rule-id:0/1*/', 'eslint - ESLint rule enable / disable directive'], + ['/* eslint-disable rule-id */', 'eslint-disable - ESLint rule disablement directive'], + ['/* eslint-enable rule-id */', 'eslint-enable - ESLint rule enablement directive'], + ['/* eslint-env library*/', 'eslint-env - ESLint environment directive']] + ); + }); + /** + * Tests that no eslint* templates are in comments after other content + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 + * @since 7.0 + */ +// it("test eslint* template 7", function(done) { +// var options = { +// buffer: "/* foo \n\n es", +// prefix: "es", +// offset: 10, +// callback: done, +// templates: true +// }; +// testProposals(options, []); +// }); + /** + * Tests that no eslint* templates are proposed when there is already one + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 + * @since 7.0 + */ + it("test eslint* template 9", function(done) { + var options = { + buffer: "/* eslint ", + prefix: "eslint", + offset: 9, + callback: done, + templates: true + }; + testProposals(options, [ + ['', 'Templates'], + [' rule-id:0/1 ', 'eslint - ESLint rule enable or disable'], + ['-disable rule-id ', 'eslint-disable - ESLint rule disablement directive'], + ['-enable rule-id ', 'eslint-enable - ESLint rule enablement directive'], + ['-env library', 'eslint-env - ESLint environment directive']] + ); + }); + /** + * Tests that eslint-env environs are proposed + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 + * @since 7.0 + */ + it("test eslint-env proposals 1", function(done) { + var options = { + buffer: "/* eslint-env ", + prefix: "", + offset: 14, + callback: done, + templates: true + }; + testProposals(options, [ + ['amd', 'amd - ESLint environment name'], + ['browser', 'browser - ESLint environment name'], + ['jasmine', 'jasmine - ESLint environment name'], + ['jquery', 'jquery - ESLint environment name'], + ['meteor', 'meteor - ESLint environment name'], + ['mocha', 'mocha - ESLint environment name'], + ['node', 'node - ESLint environment name'], + ['phantomjs', 'phantomjs - ESLint environment name'], + ['prototypejs', 'prototypejs - ESLint environment name'], + ['shelljs', 'shelljs - ESLint environment name'] + ]); + }); + /** + * Tests that eslint-env environs are proposed + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 + * @since 7.0 + */ + it("test eslint-env proposals 2", function(done) { + var options = { + buffer: "/* eslint-env a", + prefix: "a", + offset: 15, + callback: done, + templates: true + }; + testProposals(options, [ + ['amd', 'amd - ESLint environment name'], + ]); + }); + /** + * Tests that eslint rules are proposed + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 + * @since 7.0 + */ + it("test eslint rule proposals 1", function(done) { + var options = { + buffer: "/* eslint c", + prefix: "c", + offset: 11, + callback: done, + templates: true + }; + testProposals(options, [ + ['curly', 'curly - ESLint rule'] + ]); + }); + /** + * Tests that eslint rules are proposed + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 + * @since 7.0 + */ + it("test eslint rule proposals 2", function(done) { + var options = { + buffer: "/* eslint no-js", + prefix: "no-js", + offset: 15, + callback: done, + templates: true + }; + testProposals(options, [ + ['no-jslint', 'no-jslint - ESLint rule'], + ]); + }); + /** + * Tests that eslint rules are proposed + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 + * @since 7.0 + */ + it("test eslint rule proposals 3", function(done) { + var options = { + buffer: "/* eslint-enable no-js", + prefix: "no-js", + offset: 22, + callback: done, + templates: true + }; + testProposals(options, [ + ['no-jslint', 'no-jslint - ESLint rule'], + ]); + }); + /** + * Tests that eslint rules are proposed + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 + * @since 7.0 + */ + it("test eslint rule proposals 4", function(done) { + var options = { + buffer: "/* eslint-disable no-js", + prefix: "no-js", + offset: 23, + callback: done, + templates: true + }; + testProposals(options, [ + ['no-jslint', 'no-jslint - ESLint rule'], + ]); + }); + /** + * Tests that eslint rules are proposed + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=440569 + * @since 7.0 + */ + it("test eslint rule proposals 5", function(done) { + var options = { + buffer: "/* eslint-enable no-jslint, c", + prefix: "c", + offset: 29, + callback: done, + templates: true + }; + testProposals(options, [ + ['curly', 'curly - ESLint rule'] + ]); + }); + }); +// describe('MySQl Index Tests', function() { +// /** +// * Tests mysql index +// * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=426486 +// * @since 7.0 +// */ +// it("test mysql index 1", function(done) { +// var options = { +// buffer: "require('mysql').createP", +// prefix: "createP", +// offset: 24, +// callback: done +// }; +// testProposals(options, [ +// ['', 'mysql'], +// ['ool', 'createPool(config) : Pool'], +// ['oolCluster', 'createPoolCluster(config) : PoolCluster'] +// ]); +// }); +// /** +// * Tests mysql index +// * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=426486 +// * @since 7.0 +// */ +// it("test mysql index 2", function(done) { +// var options = { +// buffer: "require('mysql').createC", +// prefix: "createC", +// offset: 25, +// callback: done +// }; +// testProposals(options, [ +// ['', 'mysql'], +// ['onnection', 'createConnection(config) : Connection'] +// ]); +// }); +// /** +// * Tests mysql index +// * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=426486 +// * @since 7.0 +// */ +// it("test mysql index 3", function(done) { +// var options = { +// buffer: "require('mysql').createQ", +// prefix: "createQ", +// offset: 25, +// callback: done +// }; +// testProposals(options, [ +// ['', 'mysql'], +// ['uery', 'createQuery(sql, values, cb) : Query'] +// ]); +// }); +// /** +// * Tests mysql index for indirect proposals +// * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=426486 +// * @since 7.0 +// */ +// it("test mysql index 4", function(done) { +// var options = { +// buffer: "require('mysql').createQuery(null,null,null).sta", +// prefix: "sta", +// offset: 47, +// callback:done +// }; +// testProposals(options, [ +// ['', 'mysql'], +// ['rt', 'start()'] +// ]); +// }); +// }); }); -}); +});
\ No newline at end of file |