From 8b4b9350baa09545b8b861660475afcdcebb9ad2 Mon Sep 17 00:00:00 2001 From: Justus Adam Date: Tue, 21 Apr 2020 18:19:48 +0100 Subject: [PATCH] Fixed deprecation pragma Closes #112 --- CHANGELOG.md | 1 + syntaxes/haskell.YAML-tmLanguage | 11 ++++++++++- test/syntax-examples/test.hs | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d47de25..d6d5aa6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - Highlight `INLINEABLE` pragmas ([#107](https://github.com/JustusAdam/language-haskell/pull/107)) - Highlight `COLUMN` pragmas ([#107](https://github.com/JustusAdam/language-haskell/pull/107)) - Fixed highlighting for multi line type aliases ([#111](https://github.com/JustusAdam/language-haskell/issues/111)) +- Fixed highlighting of string literals in deprecation pragmas ([#112](https://github.com/JustusAdam/language-haskell/issues/112)) ## 2.7.0 - 29.12.2019 diff --git a/syntaxes/haskell.YAML-tmLanguage b/syntaxes/haskell.YAML-tmLanguage index 6dc9515..6f68c32 100644 --- a/syntaxes/haskell.YAML-tmLanguage +++ b/syntaxes/haskell.YAML-tmLanguage @@ -289,12 +289,21 @@ repository: patterns: - match: >- (?x) - \b(LANGUAGE|OPTIONS_GHC|INCLUDE|WARNING|DEPRECATED + \b(LANGUAGE|OPTIONS_GHC|INCLUDE|WARNING |MINIMAL|UNPACK|SPECIALISE|OVERLAPS|INCOHERENT |NOUNPACK|SOURCE|OVERLAPPING|OVERLAPPABLE|INLINE |NOINLINE|INLINE?ABLE|CONLIKE|LINE|COLUMN|RULES |SPECIALIZE|COMPLETE)\b name: keyword.other.preprocessor.haskell + - begin: '\b(DEPRECATED)\b' + beginCaptures: + '1': {name: keyword.other.preprocessor.haskell} + end: '(?=#-\})' + name: deprecated.pragma + applyEndPatternLast: 1 + patterns: + - {include: '#string_literal'} + data_constructor: match: >- \b[\p{Lu}\p{Lt}][\p{Ll}_\p{Lu}\p{Lt}\p{Nd}']*(?!\.)\b diff --git a/test/syntax-examples/test.hs b/test/syntax-examples/test.hs index 65f1797..636a5f3 100644 --- a/test/syntax-examples/test.hs +++ b/test/syntax-examples/test.hs @@ -115,6 +115,9 @@ anotherFunc arg = do ; let thing = 5 ; return 8 } + +-- Tests the string literal in the deprecation pragma, should be the same as other string literals. +{-# DEPRECATED "Test string" #-} data Handler a b c