[gtksourceview: 6/8] typescript.lang: Use case-insensitive matching for some directives
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview: 6/8] typescript.lang: Use case-insensitive matching for some directives
- Date: Fri, 15 Nov 2019 02:33:24 +0000 (UTC)
commit ed3d2f1d4682710a0ce4d67154a696f61893b464
Author: Jeffery To <jeffery to gmail com>
Date: Fri Nov 15 04:58:10 2019 +0800
typescript.lang: Use case-insensitive matching for some directives
The TypeScript compiler appears to use case-insensitive matching for
triple-slash directives and the @jsx pragma. This changes the
highlighting to also be case-insensitive.
data/language-specs/typescript-jsx.lang | 2 +-
data/language-specs/typescript.lang | 4 +++-
tests/syntax-highlighting/file.ts | 7 +++++--
tests/syntax-highlighting/file.tsx | 10 ++++++----
4 files changed, 15 insertions(+), 8 deletions(-)
---
diff --git a/data/language-specs/typescript-jsx.lang b/data/language-specs/typescript-jsx.lang
index 33f065ce..e9c50f90 100644
--- a/data/language-specs/typescript-jsx.lang
+++ b/data/language-specs/typescript-jsx.lang
@@ -59,7 +59,7 @@
<!-- I believe the allowed syntax is less strict but I haven't found
any definitive documentation -->
<context id="_jsx-comment-pragmas" style-ref="js:directive" class="comment">
- <start extended="true">
+ <start case-sensitive="false" extended="true">
/\*\*? \s* @jsx \%]
</start>
<end>\*/</end>
diff --git a/data/language-specs/typescript.lang b/data/language-specs/typescript.lang
index 3989fd29..9031963e 100644
--- a/data/language-specs/typescript.lang
+++ b/data/language-specs/typescript.lang
@@ -193,10 +193,12 @@
can only be preceded by comments or other triple-slash
directives (i.e. at the top of a file)
+ appears to be case-insensitive
+
https://github.com/microsoft/TypeScript/blob/ef0cca7d12a320bc98cefebbf4d391de36003149/src/services/classifier.ts#L768
-->
<context id="_triple-slash-directives" style-ref="js:directive" end-at-line-end="true" class="comment">
- <start extended="true">
+ <start case-sensitive="false" extended="true">
/// \s* <
(
amd-module |
diff --git a/tests/syntax-highlighting/file.ts b/tests/syntax-highlighting/file.ts
index c0b4591f..c9b84f1d 100644
--- a/tests/syntax-highlighting/file.ts
+++ b/tests/syntax-highlighting/file.ts
@@ -274,15 +274,18 @@ let a: string;
// Valid directives
///<reference path="foo" />
-/// <reference lib="es2017.string" />
+/// <REFERENCE lib="es2017.string" />
/// <amd-module name="bar" />
-/// <amd-dependency />
+/// <aMd-dEpEnDeNcY />
// Invalid directives
/// comment
/// <comment
/// < reference
/// <reference-path
+{
+ /// <reference path="foo" />
+}
/* Decorators (experimental, stage 2 proposal) */
diff --git a/tests/syntax-highlighting/file.tsx b/tests/syntax-highlighting/file.tsx
index 7ddc7b17..d6690650 100644
--- a/tests/syntax-highlighting/file.tsx
+++ b/tests/syntax-highlighting/file.tsx
@@ -6,14 +6,13 @@
// Valid pragmas
/*@jsx dom */
-/** @jsx preact.h */
+/** @JSX preact.h */
{
/* @jsx dom */
}
// Invalid pragmas
/* @ jsx dom */
-/** @JSX dom */
/*** @jsx dom */
// @jsx dom
@@ -377,15 +376,18 @@ let a: string;
// Valid directives
///<reference path="foo" />
-/// <reference lib="es2017.string" />
+/// <REFERENCE lib="es2017.string" />
/// <amd-module name="bar" />
-/// <amd-dependency />
+/// <aMd-dEpEnDeNcY />
// Invalid directives
/// comment
/// <comment
/// < reference
/// <reference-path
+{
+ /// <reference path="foo" />
+}
/* Decorators (experimental, stage 2 proposal) */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]