From 3bccf8e212a58464cf5e493f3302c33e487fcf15 Mon Sep 17 00:00:00 2001 From: Guillaume Allais Date: Mon, 13 Feb 2023 14:28:13 +0000 Subject: [PATCH] [ fix ] highlight record constructor --- src/Idris/Parser.idr | 2 +- tests/ideMode/ideMode005/expected1 | 1 + tests/ideMode/ideMode005/expected2 | 1 + tests/ideMode/ideMode005/expectedE | 1 + tests/ideMode/ideMode005/expectedG | 1 + 5 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Idris/Parser.idr b/src/Idris/Parser.idr index 40a69a77f..f12aa8f16 100644 --- a/src/Idris/Parser.idr +++ b/src/Idris/Parser.idr @@ -1553,7 +1553,7 @@ getVisibility v (_ :: xs) = getVisibility v xs recordConstructor : OriginDesc -> Rule Name recordConstructor fname - = do exactIdent "constructor" + = do decorate fname Keyword $ exactIdent "constructor" n <- mustWork $ decoratedDataConstructorName fname pure n diff --git a/tests/ideMode/ideMode005/expected1 b/tests/ideMode/ideMode005/expected1 index 6521e62c7..1aea86712 100644 --- a/tests/ideMode/ideMode005/expected1 +++ b/tests/ideMode/ideMode005/expected1 @@ -108,6 +108,7 @@ 000073(:output (:ok (:highlight-source ((((:filename "Syntax.idr") (:start 18 0) (:end 18 6)) ((:decor :keyword)))))) 1) 000071(:output (:ok (:highlight-source ((((:filename "Syntax.idr") (:start 18 7) (:end 18 11)) ((:decor :type)))))) 1) 000075(:output (:ok (:highlight-source ((((:filename "Syntax.idr") (:start 18 12) (:end 18 17)) ((:decor :keyword)))))) 1) +000074(:output (:ok (:highlight-source ((((:filename "Syntax.idr") (:start 19 2) (:end 19 13)) ((:decor :keyword)))))) 1) 000072(:output (:ok (:highlight-source ((((:filename "Syntax.idr") (:start 19 14) (:end 19 20)) ((:decor :data)))))) 1) 000074(:output (:ok (:highlight-source ((((:filename "Syntax.idr") (:start 20 2) (:end 20 6)) ((:decor :function)))))) 1) 000073(:output (:ok (:highlight-source ((((:filename "Syntax.idr") (:start 20 7) (:end 20 8)) ((:decor :keyword)))))) 1) diff --git a/tests/ideMode/ideMode005/expected2 b/tests/ideMode/ideMode005/expected2 index dd7223006..043e9d100 100644 --- a/tests/ideMode/ideMode005/expected2 +++ b/tests/ideMode/ideMode005/expected2 @@ -16,6 +16,7 @@ 000073(:output (:ok (:highlight-source ((((:filename "Interface.idr") (:start 2 34) (:end 2 38)) ((:decor :type)))))) 1) 000076(:output (:ok (:highlight-source ((((:filename "Interface.idr") (:start 2 38) (:end 2 39)) ((:decor :keyword)))))) 1) 000076(:output (:ok (:highlight-source ((((:filename "Interface.idr") (:start 2 40) (:end 2 45)) ((:decor :keyword)))))) 1) +000075(:output (:ok (:highlight-source ((((:filename "Interface.idr") (:start 3 2) (:end 3 13)) ((:decor :keyword)))))) 1) 000073(:output (:ok (:highlight-source ((((:filename "Interface.idr") (:start 3 14) (:end 3 22)) ((:decor :data)))))) 1) 000074(:output (:ok (:highlight-source ((((:filename "Interface.idr") (:start 5 2) (:end 5 3)) ((:decor :keyword)))))) 1) 0000d7(:output (:ok (:highlight-source ((((:filename "Interface.idr") (:start 5 4) (:end 5 7)) ((:name "Doc") (:namespace "Interface") (:decor :function) (:implicit :False) (:key "") (:doc-overview "") (:type "")))))) 1) diff --git a/tests/ideMode/ideMode005/expectedE b/tests/ideMode/ideMode005/expectedE index 1ba58b889..e6f7dc9d8 100644 --- a/tests/ideMode/ideMode005/expectedE +++ b/tests/ideMode/ideMode005/expectedE @@ -8,6 +8,7 @@ 00007b(:output (:ok (:highlight-source ((((:filename "RecordProjections.idr") (:start 0 17) (:end 0 21)) ((:decor :type)))))) 1) 00007e(:output (:ok (:highlight-source ((((:filename "RecordProjections.idr") (:start 0 21) (:end 0 22)) ((:decor :keyword)))))) 1) 00007e(:output (:ok (:highlight-source ((((:filename "RecordProjections.idr") (:start 0 23) (:end 0 28)) ((:decor :keyword)))))) 1) +00007d(:output (:ok (:highlight-source ((((:filename "RecordProjections.idr") (:start 1 2) (:end 1 13)) ((:decor :keyword)))))) 1) 00007b(:output (:ok (:highlight-source ((((:filename "RecordProjections.idr") (:start 1 14) (:end 1 20)) ((:decor :data)))))) 1) 00007d(:output (:ok (:highlight-source ((((:filename "RecordProjections.idr") (:start 2 2) (:end 2 8)) ((:decor :function)))))) 1) 00007d(:output (:ok (:highlight-source ((((:filename "RecordProjections.idr") (:start 2 9) (:end 2 10)) ((:decor :keyword)))))) 1) diff --git a/tests/ideMode/ideMode005/expectedG b/tests/ideMode/ideMode005/expectedG index fff95dc4d..4b8df8d28 100644 --- a/tests/ideMode/ideMode005/expectedG +++ b/tests/ideMode/ideMode005/expectedG @@ -12,6 +12,7 @@ 000074(:output (:ok (:highlight-source ((((:filename "LetBinders.idr") (:start 3 18) (:end 3 22)) ((:decor :type)))))) 1) 000077(:output (:ok (:highlight-source ((((:filename "LetBinders.idr") (:start 3 22) (:end 3 23)) ((:decor :keyword)))))) 1) 000077(:output (:ok (:highlight-source ((((:filename "LetBinders.idr") (:start 3 24) (:end 3 29)) ((:decor :keyword)))))) 1) +000076(:output (:ok (:highlight-source ((((:filename "LetBinders.idr") (:start 4 2) (:end 4 13)) ((:decor :keyword)))))) 1) 000074(:output (:ok (:highlight-source ((((:filename "LetBinders.idr") (:start 4 14) (:end 4 19)) ((:decor :data)))))) 1) 000076(:output (:ok (:highlight-source ((((:filename "LetBinders.idr") (:start 5 2) (:end 5 6)) ((:decor :function)))))) 1) 000075(:output (:ok (:highlight-source ((((:filename "LetBinders.idr") (:start 5 7) (:end 5 8)) ((:decor :keyword)))))) 1)