Skip to content

Commit aaf5268

Browse files
committed
[ change ] Target GHC 9.2.8 instead
2 parents a2cc346 + ab3df9f commit aaf5268

17 files changed

+267
-130
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

7-
## v0.2.6.4.0 - unreleased
7+
## v0.2.6.4.0.3 - 2023-12-14
8+
9+
### Fixed
10+
- #15: Add missing handlers for `lsp` methods.
11+
- #24: Fix the encoding of binaries built on GitHub Actions.
12+
- Patch path to the "data" directory when the executable is built on GitHub Actions.
13+
14+
## v0.2.6.4.0.0 - 2023-12-12
815

916
### Changed
1017
- Embed Agda-2.6.4.

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,15 @@ The version is _x.a.b.c.d.y_ where _a.b.c.d_ is the 4-digit Agda version (2.6.4.
2828
* for less impact on the Agda codebase
2929
* to help [decouple the Agda codebase](https://github.com/agda/agda/projects/5)
3030
* we can always merge it back to Agda later anyway
31+
32+
## Hacking
33+
34+
This language server is co-developed alongside [agda-mode on VS Code](https://github.com/banacorn/agda-mode-vscode).
35+
Enable `agdaMode.connection.agdaLanguageServer` in agda-mode's settings, and then hit *restart* <kbd>C-x</kbd> <kbd>C-r</kbd> to connect to the language server.
36+
The editor extension will search for the language server in the following order:
37+
1. `localhost:4096` via TCP
38+
2. `als` executable on your machine
39+
3. Prebuilt binaries on GitHub
40+
41+
To host the language server locally at `localhost:4096`, run `:main -p` in the REPL (`stack repl`).
42+
This allows us to reload the language server in the REPL without having to recompile and reinstall the whole project on your system every time there is a change.

agda-language-server.cabal

Lines changed: 40 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
cabal-version: 1.12
22

3-
-- This file has been generated from package.yaml by hpack version 0.36.0.
3+
-- This file has been generated from package.yaml by hpack version 0.37.0.
44
--
55
-- see: https://github.com/sol/hpack
66

77
name: agda-language-server
8-
version: 0.2.6.4.0
8+
version: 0.2.6.4.3.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
@@ -22,22 +22,32 @@ extra-source-files:
2222
CHANGELOG.md
2323
package.yaml
2424
stack.yaml
25-
stack-8.10-Agda-2.6.2.2.yaml
26-
stack-9.0-Agda-2.6.2.2.yaml
2725
stack-9.2-Agda-2.6.2.2.yaml
2826
stack-9.2-Agda-2.6.3.yaml
27+
stack-9.2-Agda-2.6.4.yaml
28+
stack-9.2-Agda-2.6.4.3.yaml
2929

3030
source-repository head
3131
type: git
3232
location: https://github.com/banacorn/agda-language-server
3333

3434
flag Agda-2-6-2-2
35-
description: Embed Agda-2.6.2.2 (rather than 2.6.4)
35+
description: Embed Agda-2.6.2.2
3636
manual: True
3737
default: False
3838

3939
flag Agda-2-6-3
40-
description: Embed Agda-2.6.3 (rather than 2.6.4)
40+
description: Embed Agda-2.6.3
41+
manual: True
42+
default: False
43+
44+
flag Agda-2-6-4
45+
description: Embed Agda-2.6.4
46+
manual: True
47+
default: False
48+
49+
flag Agda-2-6-4-3
50+
description: Embed Agda-2.6.4.3
4151
manual: True
4252
default: False
4353

@@ -84,6 +94,8 @@ library
8494
, base >=4.7 && <5
8595
, bytestring
8696
, containers
97+
, directory
98+
, filepath
8799
, lsp
88100
, lsp-types
89101
, mtl
@@ -94,19 +106,20 @@ library
94106
, stm
95107
, strict
96108
, text
109+
, text-icu
97110
default-language: Haskell2010
98-
if flag(Agda-2-6-2-2) && !flag(Agda-2-6-3)
111+
if flag(Agda-2-6-2-2)
99112
build-depends:
100113
Agda ==2.6.2.2
101-
if !flag(Agda-2-6-2-2) && flag(Agda-2-6-3)
114+
if flag(Agda-2-6-3)
102115
build-depends:
103116
Agda ==2.6.3
104-
if !flag(Agda-2-6-2-2) && !flag(Agda-2-6-3)
117+
if flag(Agda-2-6-4)
105118
build-depends:
106119
Agda ==2.6.4
107-
if flag(Agda-2-6-2-2) && flag(Agda-2-6-3)
120+
if flag(Agda-2-6-4-3)
108121
build-depends:
109-
Agda <0
122+
Agda ==2.6.4.3
110123

111124
executable als
112125
main-is: Main.hs
@@ -127,6 +140,8 @@ executable als
127140
, base >=4.7 && <5
128141
, bytestring
129142
, containers
143+
, directory
144+
, filepath
130145
, lsp
131146
, lsp-types
132147
, mtl
@@ -137,19 +152,20 @@ executable als
137152
, stm
138153
, strict
139154
, text
155+
, text-icu
140156
default-language: Haskell2010
141-
if flag(Agda-2-6-2-2) && !flag(Agda-2-6-3)
157+
if flag(Agda-2-6-2-2)
142158
build-depends:
143159
Agda ==2.6.2.2
144-
if !flag(Agda-2-6-2-2) && flag(Agda-2-6-3)
160+
if flag(Agda-2-6-3)
145161
build-depends:
146162
Agda ==2.6.3
147-
if !flag(Agda-2-6-2-2) && !flag(Agda-2-6-3)
163+
if flag(Agda-2-6-4)
148164
build-depends:
149165
Agda ==2.6.4
150-
if flag(Agda-2-6-2-2) && flag(Agda-2-6-3)
166+
if flag(Agda-2-6-4-3)
151167
build-depends:
152-
Agda <0
168+
Agda ==2.6.4.3
153169

154170
test-suite als-test
155171
type: exitcode-stdio-1.0
@@ -197,6 +213,8 @@ test-suite als-test
197213
, base >=4.7 && <5
198214
, bytestring
199215
, containers
216+
, directory
217+
, filepath
200218
, lsp
201219
, lsp-types
202220
, mtl
@@ -211,16 +229,17 @@ test-suite als-test
211229
, tasty-hunit
212230
, tasty-quickcheck
213231
, text
232+
, text-icu
214233
default-language: Haskell2010
215-
if flag(Agda-2-6-2-2) && !flag(Agda-2-6-3)
234+
if flag(Agda-2-6-2-2)
216235
build-depends:
217236
Agda ==2.6.2.2
218-
if !flag(Agda-2-6-2-2) && flag(Agda-2-6-3)
237+
if flag(Agda-2-6-3)
219238
build-depends:
220239
Agda ==2.6.3
221-
if !flag(Agda-2-6-2-2) && !flag(Agda-2-6-3)
240+
if flag(Agda-2-6-4)
222241
build-depends:
223242
Agda ==2.6.4
224-
if flag(Agda-2-6-2-2) && flag(Agda-2-6-3)
243+
if flag(Agda-2-6-4-3)
225244
build-depends:
226-
Agda <0
245+
Agda ==2.6.4.3

app/Main.hs

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,33 @@
11
module Main where
22

3-
import Options
4-
import Server ( run )
5-
import System.Console.GetOpt
6-
import System.Environment ( getArgs )
7-
import Text.Read ( readMaybe )
3+
import Control.Monad (when)
4+
import Options
5+
import Server (run)
6+
import System.Console.GetOpt
7+
import System.Directory (doesDirectoryExist)
8+
import System.Environment
9+
import System.FilePath ((</>))
10+
import System.IO
11+
import Text.Read (readMaybe)
812

913
main :: IO ()
1014
main = do
15+
-- set locale to UTF-8
16+
-- https://github.com/agda/agda-language-server/issues/24
17+
hSetEncoding stdout utf8
18+
hSetEncoding stdin utf8
19+
hSetEncoding stderr utf8
20+
21+
-- The GitHub CI-built executable lacks the correct data directory path.
22+
-- If there's directory named "data" in the executable's directory,
23+
-- then we assume that the executable is built by GitHub CI
24+
-- and we should set the $Agda_datadir environment variable to the correct directory.
25+
executablePath <- getExecutablePath
26+
let dataDir = executablePath </> "data"
27+
isBuiltByCI <- doesDirectoryExist dataDir
28+
when isBuiltByCI $ do
29+
setEnv "Agda_datadir" dataDir
30+
1131
options <- getOptionsFromArgv
1232
if optHelp options
1333
then putStrLn usageMessage

package.yaml

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: agda-language-server
2-
version: 0.2.6.4.0
2+
version: 0.2.6.4.3.0
33
github: "banacorn/agda-language-server"
44
license: MIT
55
author: "Ting-Gian LUA"
@@ -11,10 +11,10 @@ extra-source-files:
1111
- CHANGELOG.md
1212
- package.yaml
1313
- stack.yaml
14-
- stack-8.10-Agda-2.6.2.2.yaml
15-
- stack-9.0-Agda-2.6.2.2.yaml
1614
- stack-9.2-Agda-2.6.2.2.yaml
1715
- stack-9.2-Agda-2.6.3.yaml
16+
- stack-9.2-Agda-2.6.4.yaml
17+
- stack-9.2-Agda-2.6.4.3.yaml
1818

1919
# Metadata used when publishing your package
2020
synopsis: An implementation of language server protocal (LSP) for Agda 2.
@@ -27,34 +27,47 @@ description: Please see the README on GitHub at <https://github.com/agda
2727

2828
flags:
2929
Agda-2-6-2-2:
30-
description: Embed Agda-2.6.2.2 (rather than 2.6.4)
30+
description: Embed Agda-2.6.2.2
3131
manual: true
3232
default: false
3333
Agda-2-6-3:
34-
description: Embed Agda-2.6.3 (rather than 2.6.4)
34+
description: Embed Agda-2.6.3
35+
manual: true
36+
default: false
37+
Agda-2-6-4:
38+
description: Embed Agda-2.6.4
39+
manual: true
40+
default: false
41+
Agda-2-6-4-3:
42+
description: Embed Agda-2.6.4.3
3543
manual: true
3644
default: false
3745

3846
when:
39-
- condition: "flag(Agda-2-6-2-2) && !flag(Agda-2-6-3)"
47+
- condition: "flag(Agda-2-6-2-2)"
4048
dependencies:
4149
- Agda == 2.6.2.2
42-
- condition: "!flag(Agda-2-6-2-2) && flag(Agda-2-6-3)"
50+
- condition: "flag(Agda-2-6-3)"
4351
dependencies:
4452
- Agda == 2.6.3
45-
- condition: "!flag(Agda-2-6-2-2) && !flag(Agda-2-6-3)"
53+
- condition: "flag(Agda-2-6-4)"
4654
dependencies:
4755
- Agda == 2.6.4
48-
- condition: "flag(Agda-2-6-2-2) && flag(Agda-2-6-3)"
56+
- condition: "flag(Agda-2-6-4-3)"
4957
dependencies:
50-
- Agda < 0
58+
- Agda == 2.6.4.3
59+
# - condition: "flag(Agda-2-6-2-2) && flag(Agda-2-6-3)"
60+
# dependencies:
61+
# - Agda < 0
5162

5263
dependencies:
5364
- base >= 4.7 && < 5
5465
- Agda
5566
- aeson
5667
- bytestring
5768
- containers
69+
- directory
70+
- filepath
5871
- lsp-types
5972
- lsp
6073
- mtl
@@ -63,6 +76,7 @@ dependencies:
6376
- strict
6477
- stm
6578
- text
79+
- text-icu
6680
- process
6781
- prettyprinter
6882

src/Render/Concrete.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ instance Render DoStmt where
322322
prCs [] = mempty
323323
prCs cs' = fsep ["where", vcat (fmap render cs')]
324324
render (DoThen e) = render e
325-
render (DoLet _ ds) = "let" <+> vcat (fmap render $ toList ds)
325+
render (DoLet _ ds) = "let" <+> vcat (render <$> toList ds)
326326

327327
instance Render Declaration where
328328
render d =

0 commit comments

Comments
 (0)