Skip to content

Commit 71bd04b

Browse files
authored
fix subtraction (#4041)
1 parent a3da824 commit 71bd04b

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

plugins/hls-semantic-tokens-plugin/src/Ide/Plugin/SemanticTokens/Tokenize.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ focusTokenAt leaf = do
148148
return (Rope.toText prefix, suffix)
149149
sub :: Char.Position -> Char.Position -> Maybe Char.Position
150150
sub (Char.Position l1 c1) (Char.Position l2 c2)
151-
| l1 == l2 && c1 > c2 = Just $ Char.Position 0 (c1 - c2)
151+
| l1 == l2 && c1 >= c2 = Just $ Char.Position 0 (c1 - c2)
152152
| l1 > l2 = Just $ Char.Position (l1 - l2) c1
153153
| otherwise = Nothing
154154
realSrcLocRopePosition :: RealSrcLoc -> Char.Position

plugins/hls-semantic-tokens-plugin/test/testdata/TOperator.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
4:4-5 TFunction "f"
33
4:6-7 TVariable "x"
44
4:10-11 TFunction "f"
5-
4:12-13 TOperator "$"
6-
4:14-15 TVariable "x"
5+
4:11-12 TOperator "$"
6+
4:12-13 TVariable "x"
77
6:2-6 TOperator "$$$$"
88
7:1-2 TVariable "x"
99
7:7-11 TOperator "$$$$"

plugins/hls-semantic-tokens-plugin/test/testdata/TOperator.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module TOperator where
22

33
-- imported operator
4-
go f x = f $ x
4+
go f x = f$x
55
-- operator defined in local module
66
($$$$) = b
77
x = 1 $$$$ 2

0 commit comments

Comments
 (0)