diff --git a/CHANGELOG.md b/CHANGELOG.md index ca83bb0..fe2d2da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 2.2.3 - unreleased + +- Adapted increaseIndentPattern to skip keywords followed by `'` +- Fixed terminating type signatures on `else`, `then` etc. +- Fixed not increasing indent for one line `if` + ## 2.2.2 - 27.06.2017 - Fixed highlighting for `where` keyword in GADT definition diff --git a/src/extension.ts b/src/extension.ts index 04253de..8e40316 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -8,7 +8,7 @@ export function activate(context: vscode.ExtensionContext) { indentationRules: { // ^.*\{[^}"']*$ - increaseIndentPattern: /(\bif\b(?!').*|\b(then|else|m?do|of|let|in|where)\b(?!')|=|->|>>=|>=>|=<<|(^(data)( |\t)+(\w|')+( |\t)*))( |\t)*$/, + increaseIndentPattern: /(\bif\b(?!')(.(?!then))*|\b(then|else|m?do|of|let|in|where)\b(?!')|=|->|>>=|>=>|=<<|(^(data)( |\t)+(\w|')+( |\t)*))( |\t)*$/, decreaseIndentPattern: null }, wordPattern: /([\w'_][\w'_\d]*)|([0-9]+\.[0-9]+([eE][+-]?[0-9]+)?|[0-9]+[eE][+-]?[0-9]+)/ diff --git a/test.hs b/test.hs index e0518a8..a46b020 100644 --- a/test.hs +++ b/test.hs @@ -40,8 +40,8 @@ someFunc = do a `func` b a :: Bool <- something if a then b :: Int else g - case a :: Bool of - Nothing -> b + case (a :: Bool) of + Nothing -> b return 6 where ident = 4 @@ -61,7 +61,9 @@ explicitRecDo = do anotherFunc :: MyData -> Int anotherFunc arg = - let something = "hello" :: String in expression + let something = "hello" :: String + in case a :: B of + Just _ -> g where expression argument = arg + 7