Skip to content

Commit f6e28ba

Browse files
committed
[ git ] Merge branch 'test' into ci
2 parents df3b47b + b4b5b29 commit f6e28ba

File tree

18 files changed

+324
-43
lines changed

18 files changed

+324
-43
lines changed

agda-language-server.cabal

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ cabal-version: 1.12
55
-- see: https://github.com/sol/hpack
66

77
name: agda-language-server
8-
version: 0.2.6.4.3.0
8+
version: 0.2.7.0.1.0
99
synopsis: An implementation of language server protocal (LSP) for Agda 2.
1010
description: Please see the README on GitHub at <https://github.com/agda/agda-language-server#readme>
1111
category: Development
@@ -171,6 +171,7 @@ test-suite als-test
171171
type: exitcode-stdio-1.0
172172
main-is: Test.hs
173173
other-modules:
174+
Test.LSP
174175
Test.SrcLoc
175176
Agda
176177
Agda.Convert
@@ -216,6 +217,7 @@ test-suite als-test
216217
, directory
217218
, filepath
218219
, lsp >=2
220+
, lsp-test
219221
, lsp-types >=2
220222
, mtl
221223
, network

package.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: agda-language-server
2-
version: 0.2.6.4.3.0
2+
version: 0.2.7.0.1.0
33
github: "banacorn/agda-language-server"
44
license: MIT
55
author: "Ting-Gian LUA"
@@ -130,6 +130,7 @@ tests:
130130
- test
131131
- src
132132
dependencies:
133+
- lsp-test
133134
- tasty
134135
- tasty-hunit
135136
- tasty-golden

src/Agda.hs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ module Agda
88
, runAgda
99
, sendCommand
1010
, getCommandLineOptions
11+
, CommandReq(..)
12+
, CommandRes(..)
1113
) where
1214

1315
import Prelude hiding ( null )
@@ -17,7 +19,10 @@ import Agda.Compiler.Builtin ( builtinBackends )
1719
import Agda.Convert ( fromResponse )
1820
import Agda.Interaction.Base ( Command
1921
, Command'(Command, Done, Error)
22+
#if MIN_VERSION_Agda(2,7,0)
23+
#else
2024
, CommandM
25+
#endif
2126
, CommandState(optionsOnReload)
2227
, IOTCM
2328
, initCommandState
@@ -32,6 +37,10 @@ import Agda.Interaction.InteractionTop
3237
( initialiseCommandQueue
3338
, maybeAbort
3439
, runInteraction
40+
#if MIN_VERSION_Agda(2,7,0)
41+
, CommandM
42+
#else
43+
#endif
3544
)
3645
import Agda.Interaction.Options ( CommandLineOptions
3746
( optAbsoluteIncludePaths
@@ -244,6 +253,7 @@ data CommandReq
244253
| CmdReq String
245254
deriving (Generic)
246255

256+
instance ToJSON CommandReq
247257
instance FromJSON CommandReq
248258

249259
data CommandRes

src/Agda/Convert.hs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ import qualified Data.Map as Map
5858
import Data.String (IsString)
5959
import qualified Render
6060

61+
#if MIN_VERSION_Agda(2,7,0)
62+
import Agda.Interaction.Output ( OutputConstraint )
63+
#endif
64+
6165
responseAbbr :: IsString a => Response -> a
6266
responseAbbr res = case res of
6367
Resp_HighlightingInfo {} -> "Resp_HighlightingInfo"
@@ -67,6 +71,9 @@ responseAbbr res = case res of
6771
Resp_GiveAction {} -> "Resp_GiveAction"
6872
Resp_MakeCase {} -> "Resp_MakeCase"
6973
Resp_SolveAll {} -> "Resp_SolveAll"
74+
#if MIN_VERSION_Agda(2,7,0)
75+
Resp_Mimer {} -> "Resp_Mimer"
76+
#endif
7077
Resp_DisplayInfo {} -> "Resp_DisplayInfo"
7178
Resp_RunningInfo {} -> "Resp_RunningInfo"
7279
Resp_ClearRunningInfo {} -> "Resp_ClearRunningInfo"
@@ -97,6 +104,9 @@ fromResponse (Resp_GiveAction (InteractionId i) giveAction) =
97104
return $ IR.ResponseGiveAction i (fromAgda giveAction)
98105
fromResponse (Resp_MakeCase _ Function pcs) = return $ IR.ResponseMakeCaseFunction pcs
99106
fromResponse (Resp_MakeCase _ ExtendedLambda pcs) = return $ IR.ResponseMakeCaseExtendedLambda pcs
107+
#if MIN_VERSION_Agda(2,7,0)
108+
fromResponse (Resp_Mimer (InteractionId i) s) = return $ IR.ResponseMimer i s
109+
#endif
100110
fromResponse (Resp_SolveAll ps) = return $ IR.ResponseSolveAll (fmap prn ps)
101111
where
102112
prn (InteractionId i, e) = (i, prettyShow e)

src/Agda/IR.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ data Response
4040
ResponseMakeCaseFunction [String]
4141
| ResponseMakeCaseExtendedLambda [String]
4242
| ResponseSolveAll [(Int, String)]
43+
| ResponseMimer Int (Maybe String)
4344
| -- priority: 3
4445
ResponseJumpToError FilePath Int
4546
| ResponseEnd

src/Options.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ options =
5959
]
6060

6161
usage :: String
62-
usage = "Agda Language Server v0.0.3.0 \nUsage: als [Options...]\n"
62+
usage = "Agda v2.7.0.1 Language Server v0\nUsage: als [Options...]\n"
6363

6464
usageAboutAgdaOptions :: String
6565
usageAboutAgdaOptions =

src/Render/Class.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{-# LANGUAGE CPP #-}
22
{-# LANGUAGE FlexibleInstances #-}
33
{-# LANGUAGE TypeFamilies #-}
4-
{-# LANGUAGE TypeSynonymInstances #-}
54

65
module Render.Class
76
( Render (..),
@@ -78,6 +77,10 @@ instance Render Bool where
7877
instance Render Doc where
7978
render = text . Doc.render
8079

80+
instance Render a => Render (Maybe a) where
81+
renderPrec p Nothing = mempty
82+
renderPrec p (Just x) = renderPrec p x
83+
8184
instance Render a => Render [a] where
8285
render xs = "[" <> fsep (punctuate "," (fmap render xs)) <> "]"
8386
instance Render a => Render (List1 a) where

src/Render/Common.hs

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,19 @@ import Agda.Syntax.Common
1616
Cohesion(..),
1717
QωOrigin(..),
1818
LensCohesion(getCohesion),
19-
NameId(..) )
19+
NameId(..),
20+
Erased(..), asQuantity, Lock(..), LockOrigin (..),
21+
#if MIN_VERSION_Agda(2,7,0)
22+
OverlapMode (..),
23+
#endif
24+
)
2025
import qualified Agda.Utils.Null as Agda
2126
import Agda.Utils.List1 (toList)
2227
import Agda.Utils.Functor ((<&>))
2328

2429
import Render.Class
2530
import Render.RichText
31+
import qualified Agda.Utils.List1 as List1
2632

2733
--------------------------------------------------------------------------------
2834

@@ -72,6 +78,19 @@ instance Render Cohesion where
7278

7379
--------------------------------------------------------------------------------
7480

81+
#if MIN_VERSION_Agda(2,7,0)
82+
instance Render OverlapMode where
83+
render = \case
84+
Overlappable -> "OVERLAPPABLE"
85+
Overlapping -> "OVERLAPPING"
86+
Incoherent -> "INCOHERENT"
87+
Overlaps -> "OVERLAPS"
88+
FieldOverlap -> "overlap"
89+
DefaultOverlap -> mempty
90+
#endif
91+
92+
--------------------------------------------------------------------------------
93+
7594
-- | From 'prettyHiding'
7695
-- @renderHiding info visible text@ puts the correct braces
7796
-- around @text@ according to info @info@ and returns
@@ -91,6 +110,17 @@ renderQuantity :: LensQuantity a => a -> Inlines -> Inlines
91110
renderQuantity a d =
92111
if show d == "_" then d else render (getQuantity a) <+> d
93112

113+
instance Render Lock where
114+
render = \case
115+
IsLock LockOLock -> "@lock"
116+
IsLock LockOTick -> "@tick"
117+
IsNotLock -> mempty
118+
119+
#if MIN_VERSION_Agda(2,7,0)
120+
renderErased :: Erased -> Inlines -> Inlines
121+
renderErased = renderQuantity . asQuantity
122+
#endif
123+
94124
renderCohesion :: LensCohesion a => a -> Inlines -> Inlines
95125
renderCohesion a d =
96126
if show d == "_" then d else render (getCohesion a) <+> d
@@ -102,6 +132,9 @@ instance (Render p, Render e) => Render (RewriteEqn' qn nm p e) where
102132
render = \case
103133
Rewrite es -> prefixedThings (text "rewrite") (render . snd <$> toList es)
104134
Invert _ pes -> prefixedThings (text "invert") (toList pes <&> (\ (p, e) -> render p <+> "<-" <+> render e) . namedThing)
135+
#if MIN_VERSION_Agda(2,7,0)
136+
LeftLet pes -> prefixedThings (text "using") [render p <+> "<-" <+> render e | (p, e) <- List1.toList pes]
137+
#endif
105138

106139
prefixedThings :: Inlines -> [Inlines] -> Inlines
107140
prefixedThings kw = \case

0 commit comments

Comments
 (0)