javascript.tmbundle icon indicating copy to clipboard operation
javascript.tmbundle copied to clipboard

pls fix the damn highlight

Open OpenA opened this issue 8 years ago • 2 comments

code example:

var example = function(a1) {

	var $class = 'unfunc';
	var $count = parseInt('1', 10) + parseInt (a1, 10);
	
	if(isNaN($count)) {
		$count = new Number(1);
	}
	
	if (isNaN ($count)) {
		$count = new Number (1);
	}
	
	switch($count) {
		case 1:
			$class = 'unfunc-one';
			break
		case 2:
			$class = 'unfunc-two';
			break;
		default:
			$class = 'unfunc-max';
	}
	
	switch ($count) {
		case 1:
			$class = 'unfunc-one';
			break
		case 2:
			$class = 'unfunc-two';
			break;
		default:
			$class = 'unfunc-max';
	}
	
	return $class;
}

and this is how it looks in textmate: default

OpenA avatar Sep 06 '17 06:09 OpenA

The problem appears since the following commit: https://github.com/textmate/javascript.tmbundle/commit/a25c4879b77c1fecd68712fb1e1a02e5516b68ec#diff-f9061b7ed77660fb3007f1ac9e80f984

@patrickrgaffney Do you have an idea? Thank you!

nipuman avatar Sep 12 '17 09:09 nipuman

some grammar fixes

diff --git a/Syntaxes/JavaScript.plist b/Syntaxes/JavaScript.plist
index dd46b1f..cd80a4b 100644
--- a/Syntaxes/JavaScript.plist
+++ b/Syntaxes/JavaScript.plist
@@ -48,7 +48,7 @@
 		</dict>
 		<dict>
 			<key>begin</key>
-			<string>(?&lt;!\.)\b(import)(?!\s*:)\b</string>
+			<string>(?&lt;!\.|\$)\b(import)(?!\s*:)\b</string>
 			<key>beginCaptures</key>
 			<dict>
 				<key>1</key>
@@ -266,7 +266,7 @@
 		</dict>
 		<dict>
 			<key>begin</key>
-			<string>(?&lt;!\.)\b(export)(?!\s*:)\b</string>
+			<string>(?&lt;!\.|\$)\b(export)(?!\s*:)\b</string>
 			<key>beginCaptures</key>
 			<dict>
 				<key>1</key>
@@ -628,7 +628,7 @@
 		<dict>
 			<key>begin</key>
 			<string>(?x)
-                \b(class)(?=\s|$)
+                (?<!\.|\$)\b(class)(?=\s|$)
                 (?:
                     \s+
                     ([\p{L}\p{Nl}$_][\p{L}\p{Nl}$\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*)
@@ -825,7 +825,7 @@
 				</dict>
 			</dict>
 			<key>match</key>
-			<string>(?&lt;!\.)\b(yield)(?!\s*:)\b(?:\s*(\*))?</string>
+			<string>(?&lt;!\.|\$)\b(yield)(?!\s*:)\b(?:\s*(\*))?</string>
 			<key>name</key>
 			<string>meta.control.yield.js</string>
 		</dict>
@@ -1239,7 +1239,7 @@
 				</dict>
 			</array>
 		</dict>
-		<key>function-call</key>
+	<!-- key>function-call</key>
 		<dict>
 			<key>patterns</key>
 			<array>
@@ -1280,7 +1280,7 @@
 					</array>
 				</dict>
 			</array>
-		</dict>
+		</dict -->
 		<key>function-params</key>
 		<dict>
 			<key>patterns</key>

OpenA avatar Apr 08 '19 06:04 OpenA