From 1369ccc134504f92b034f346279b3b4f26544499 Mon Sep 17 00:00:00 2001 From: Bodigrim Date: Tue, 11 Aug 2026 12:54:11 +0200 Subject: [PATCH] Highlight OPAQUE pragma https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/pragmas.html#opaque-pragma --- CHANGELOG.md | 1 + syntax-examples/haskell.hs | 4 ++-- syntaxes/haskell.YAML-tmLanguage | 2 +- test/tests/Opaque.hs | 6 ++++++ 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 test/tests/Opaque.hs diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a4455a..4ad65fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - handle explicit semicolons/braces for layout. - Properly highlight `family`/`instance` in type/data family declarations and instances when `family`/`instance` is on a separate line. +- Highlight `{-# OPAQUE foo #-}` pragma, thanks to [@bodigrim](http://github.com/bodigrim). ## 3.8.0 - 14.06.2026 diff --git a/syntax-examples/haskell.hs b/syntax-examples/haskell.hs index f306de4..6b86bcb 100644 --- a/syntax-examples/haskell.hs +++ b/syntax-examples/haskell.hs @@ -11,12 +11,12 @@ someFunc = do case (a :: Bool) of Nothing -> b return 6 - where + where ident = 4 ident' = 9 -anotherFunc arg = do +anotherFunc arg = do { let thing = 5> ; arg <- doSomething 5 ; let thing = 5 diff --git a/syntaxes/haskell.YAML-tmLanguage b/syntaxes/haskell.YAML-tmLanguage index 7124e2c..5b84958 100644 --- a/syntaxes/haskell.YAML-tmLanguage +++ b/syntaxes/haskell.YAML-tmLanguage @@ -841,7 +841,7 @@ repository: |MINIMAL|UNPACK|OVERLAPS|INCOHERENT |NOUNPACK|SOURCE|OVERLAPPING|OVERLAPPABLE|INLINE |NOINLINE|INLINE?ABLE|CONLIKE|LINE|COLUMN|RULES - |COMPLETE)\b(?!') + |COMPLETE|OPAQUE)\b(?!') name: keyword.other.preprocessor.haskell - begin: '(?i)\b(DEPRECATED|WARNING)\b' beginCaptures: diff --git a/test/tests/Opaque.hs b/test/tests/Opaque.hs new file mode 100644 index 0000000..a97d79f --- /dev/null +++ b/test/tests/Opaque.hs @@ -0,0 +1,6 @@ +-- SYNTAX TEST "source.haskell" "OPAQUE pragma" + +f :: Int -> Int +f x = 3 * x +{-# OPAQUE f #-} +-- ^^^^^^ keyword.other.preprocessor.haskell