From 90ad285c86c09ff9394015f8686ef78c853dd333 Mon Sep 17 00:00:00 2001 From: Nicholas Wolverson Date: Fri, 7 Mar 2025 14:02:54 +0000 Subject: [PATCH] Fix row types in where clause signatures Fix #65 --- grammars/purescript.cson | 2 +- src/purescript.coffee | 4 +++- test/Main.purs | 8 ++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/grammars/purescript.cson b/grammars/purescript.cson index 0834122..02dacd3 100644 --- a/grammars/purescript.cson +++ b/grammars/purescript.cson @@ -909,7 +909,7 @@ { 'name': 'meta.type.row.purescript' 'begin': '\\((?=\\s*([\\p{Ll}_][\\p{Ll}_\\p{Lu}\\p{Lt}\\p{Nd}\']*|"[\\p{Ll}_][\\p{Ll}_\\p{Lu}\\p{Lt}\\p{Nd}\']*"|"[\\p{Lu}\\p{Lt}][\\p{Ll}_\\p{Lu}\\p{Lt}\\p{Nd}\']*")\\s*(::|∷))' - 'end': '(?=^\\S)' + 'end': '^(?!\\1[ \\t]|[ \\t]*$)' 'patterns': [ { 'name': 'punctuation.separator.comma.purescript' diff --git a/src/purescript.coffee b/src/purescript.coffee index d547336..9d08549 100644 --- a/src/purescript.coffee +++ b/src/purescript.coffee @@ -809,7 +809,9 @@ purescriptGrammar = # begin: /\((?= \s*({functionNameOne}|"{functionNameOne}"|"{classNameOne}")\s*(::|∷))/ # end: / \)/ begin: /\((?=\s*({functionNameOne}|"{functionNameOne}"|"{classNameOne}")\s*(::|∷))/ - end: /(?=^\S)/ + # end: /(?=^\S)/ + end: /{indentBlockEnd}/ + #applyEndPatternsLast: true patterns: [ diff --git a/test/Main.purs b/test/Main.purs index 66108d9..b993883 100644 --- a/test/Main.purs +++ b/test/Main.purs @@ -313,6 +313,14 @@ type EntireRecordCodec = T "Str" ( a :: String , "B" :: Boolean ) type NotRow a = Either Error (Array Int) +-- Rows in a type declaration in a where block persisted row scope for full where block +z = 4 + where + bad :: Record ( x :: Int ) -> Int + bad _ = y + z + + something = ugly + -- record with quoted fields type Quoted = { "A" :: Int -- comment