Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 496202
Collapse All | Expand All

(-)a/bundles/org.eclipse.orion.client.javascript/web/javascript/ternPlugins/quickfixes.js (-3 / +10 lines)
Lines 354-363 define([ Link Here
354
		 */
354
		 */
355
		"no-extra-parens": function(annotation, annotations, file) {
355
		"no-extra-parens": function(annotation, annotations, file) {
356
			return applySingleFixToAll(annotations, function(annot) {
356
			return applySingleFixToAll(annotations, function(annot) {
357
				var token = Finder.findToken(annot.start, file.ast.tokens);
357
				var tokens = file.ast.tokens;
358
				var openBracket = file.ast.tokens[token.index-1];
358
				var token = Finder.findToken(annot.start, tokens);
359
				var openBracket = tokens[token.index-1];
359
				if (openBracket.value === '(') {
360
				if (openBracket.value === '(') {
360
					var closeBracket = Finder.findToken(annot.end, file.ast.tokens);
361
					var closeBracket = Finder.findToken(annot.end, tokens);
362
					if (closeBracket.value !== ')') {
363
						// try the next token if ')' is on the next line
364
						if (tokens.length > closeBracket.index + 1) {
365
							closeBracket = tokens[closeBracket.index + 1];
366
						}
367
					}
361
					if (closeBracket.value === ')') {
368
					if (closeBracket.value === ')') {
362
						var replacementText = "";
369
						var replacementText = "";
363
						if (token.index >= 2) {
370
						if (token.index >= 2) {
(-)a/bundles/org.eclipse.orion.client.javascript/web/js-tests/javascript/quickfixTests.js (+15 lines)
Lines 2461-2466 define([ Link Here
2461
								  callback: callback,
2461
								  callback: callback,
2462
								  contentType: 'text/html'});
2462
								  contentType: 'text/html'});
2463
			});
2463
			});
2464
			it("no-extra-parens - multiline expression",function(callback) {
2465
				var rule = createTestRule('no-extra-parens');
2466
				 var expected = [
2467
				 				{value: "",
2468
								start: 10, 
2469
								end: 11},
2470
								{value: "",
2471
								start: 14, 
2472
								end: 15}
2473
								];
2474
				return getFixes({buffer: 'if (a === (\nb\n)){}', 
2475
								  rule: rule,
2476
								  expected: expected,
2477
								  callback: callback});
2478
			});
2464
		});
2479
		});
2465
		//NO-EXTRA-SEMI
2480
		//NO-EXTRA-SEMI
2466
		describe('no-extra-semi', function(){
2481
		describe('no-extra-semi', function(){

Return to bug 496202