diff options
| author | Marc Jakobi <marc.jakobi@tiko.energy> | 2023-10-02 12:49:12 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-02 10:49:12 +0000 |
| commit | d96c216c54cc2d48d3c66ba7f0fc3c7c5b71b3b1 (patch) | |
| tree | 576c248909074efcea30d1b49c3c27907eaa341c /tests | |
| parent | Update parsers: wing (diff) | |
| download | nvim-treesitter-d96c216c54cc2d48d3c66ba7f0fc3c7c5b71b3b1.tar nvim-treesitter-d96c216c54cc2d48d3c66ba7f0fc3c7c5b71b3b1.tar.gz nvim-treesitter-d96c216c54cc2d48d3c66ba7f0fc3c7c5b71b3b1.tar.bz2 nvim-treesitter-d96c216c54cc2d48d3c66ba7f0fc3c7c5b71b3b1.tar.lz nvim-treesitter-d96c216c54cc2d48d3c66ba7f0fc3c7c5b71b3b1.tar.xz nvim-treesitter-d96c216c54cc2d48d3c66ba7f0fc3c7c5b71b3b1.tar.zst nvim-treesitter-d96c216c54cc2d48d3c66ba7f0fc3c7c5b71b3b1.zip | |
feat(haskell): highlights improvements + tests (#5466)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/query/highlights/haskell/test.hs | 161 |
1 files changed, 161 insertions, 0 deletions
diff --git a/tests/query/highlights/haskell/test.hs b/tests/query/highlights/haskell/test.hs new file mode 100644 index 000000000..e934e4606 --- /dev/null +++ b/tests/query/highlights/haskell/test.hs @@ -0,0 +1,161 @@ +{-# LANGUAGE QuasiQuotes #-} +-- ^ @preproc + +module Main +-- ^ @include + -- ^ @namespace + ( main + ) where + -- ^ @keyword + +import Prelude hiding (show) +-- ^ @include + -- ^ @namespace + -- ^ @keyword + -- ^ @variable +import Data.Map (fromList) + -- ^ @namespace +import qualified Data.Map as Map + -- ^ @constructor + -- ^ @namespace +import qualified Chronos + -- ^ @namespace + +data ADT +-- ^ @keyword + = A Int + -- ^ @constructor + -- ^ @type + | B + -- ^ @constructor + deriving (Eq, Show) + -- ^ @keyword + -- ^ @type + -- ^ @type + +class Ord a => PartialOrd a + -- ^ @type + -- ^ @type + -- ^ @type + -- ^ @type + +instance Ord ADT where + -- ^ @type + -- ^ @type + +newtype Rec +-- ^ @keyword + -- ^ @type + = Rec + -- ^ @constructor + { field :: Double + -- ^ @punctuation.bracket + -- ^ @field + -- ^ @type + } + -- ^ @punctuation.bracket + deriving Eq + -- ^ @type + +main :: IO () +-- ^ @function + -- ^ @operator + -- ^ @type + -- ^ @symbol +main = undefined +-- ^ @function + -- ^ @exception + +someFunc0 :: Int -> Int + -- ^ @operator +someFunc0 x = someFunc1 x + -- ^ @parameter + -- ^ @function.call + where + -- ^ @keyword + someFunc1 _ = 5 + -- ^ @function + -- ^ @number + +someInfix :: Integral a => a -> Double + -- ^ @type + -- ^ @type + -- ^ @operator + -- ^ @type +someInfix x = fromIntegral x `myAdd` floatVal + -- ^ @function.call + -- ^ @variable + -- ^ @operator + -- ^ @variable + where + myAdd x y = x + y + -- ^ @variable + -- ^ @variable + floatVal = 5.5 + -- ^ @variable + -- ^ @float + +someIOaction :: IO () +-- ^ @function +someIOaction = do + -- ^ @keyword + foo <- SomeModule.someFun <$> getArgs +-- ^ @variable + -- ^ @namespace + -- ^ @function.call + -- ^ @operator + let bar = SomeModule.doSomething $ "a" "b" + -- ^ @variable + -- ^ @namespace + -- ^ @function.call + -- ^ @operator + func x y = x + y - 7 + -- ^ @function + -- ^ @parameter + -- ^ @variable + -- ^ @variable + pure $ func 1 2 + -- ^ @function.call + -- ^ @function.call + +intVal :: Int +-- ^ @variable +intVal = 5 +-- ^ @variable + +mbInt :: Maybe Int +-- ^ @variable +mbInt = Just 5 +-- ^ @variable + +getLambda x = \y -> x `SomeModule.someInfix` y + -- ^ @parameter + -- ^ @namespace + -- ^ @operator + +isVowel = (`elem` "AEIOU") + -- ^ @operator +isVowelQualified = (`SomeModule.elem` "AEIOU") + -- ^ @namespace + -- ^ @operator + +hasVowels = ("AEIOU" `elem`) + -- ^ @operator +hasVowelsQualified = ("AEIOU" `SomeModule.elem`) + -- ^ @namespace + -- ^ @operator + +quasiQuotedString = [qq|Some string|] +-- ^ @variable + -- ^ @function.call + -- ^ @string + +higherOrderFn f x = f x + -- ^ @function + -- ^ @variable + +composition f g = f . g + -- ^ @function + -- ^ @function + -- ^ @function + -- ^ @function |
