Skip to content

Commit f685bda

Browse files
committed
[ fix ] Patch path to the "data" directory when the executable is built on GitHub Actions
1 parent ebfdf18 commit f685bda

File tree

5 files changed

+35
-6
lines changed

5 files changed

+35
-6
lines changed

CHANGELOG.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ 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.2 - 2023-12-14
8+
9+
### Fixed
10+
- Add missing handlers for `lsp` methods.
11+
- Patch path to the "data" directory when the executable is built on GitHub Actions.
12+
13+
## v0.2.6.4.0.0 - 2023-12-12
814

915
### Changed
1016
- Embed Agda-2.6.4.

agda-language-server.cabal

+8-2
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.35.2.
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.0.2
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
@@ -83,6 +83,8 @@ library
8383
, base >=4.7 && <5
8484
, bytestring
8585
, containers
86+
, directory
87+
, filepath
8688
, lsp <2
8789
, lsp-types <2
8890
, mtl
@@ -125,6 +127,8 @@ executable als
125127
, base >=4.7 && <5
126128
, bytestring
127129
, containers
130+
, directory
131+
, filepath
128132
, lsp <2
129133
, lsp-types <2
130134
, mtl
@@ -194,6 +198,8 @@ test-suite als-test
194198
, base >=4.7 && <5
195199
, bytestring
196200
, containers
201+
, directory
202+
, filepath
197203
, lsp <2
198204
, lsp-types <2
199205
, mtl

app/Main.hs

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
module Main where
22

3+
import Control.Monad (when)
34
import Options
45
import Server (run)
56
import System.Console.GetOpt
6-
import System.Environment (getArgs)
7+
import System.Directory (doesDirectoryExist)
8+
import System.Environment
9+
import System.FilePath ((</>))
710
import System.IO
811
import Text.Read (readMaybe)
912

@@ -14,6 +17,16 @@ main = do
1417
hSetEncoding stdout utf8
1518
hSetEncoding stdin utf8
1619

20+
-- The GitHub CI-built executable lacks the correct data directory path.
21+
-- If there's directory named "data" in the executable's directory,
22+
-- then we assume that the executable is built by GitHub CI
23+
-- and we should set the $Agda_datadir environment variable to the correct directory.
24+
executablePath <- getExecutablePath
25+
let dataDir = executablePath </> "data"
26+
isBuiltByCI <- doesDirectoryExist dataDir
27+
when isBuiltByCI $ do
28+
setEnv "Agda_datadir" dataDir
29+
1730
options <- getOptionsFromArgv
1831
if optHelp options
1932
then putStrLn usageMessage

package.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: agda-language-server
2-
version: 0.2.6.4.0.1
2+
version: 0.2.6.4.0.2
33
github: "banacorn/agda-language-server"
44
license: MIT
55
author: "Ting-Gian LUA"
@@ -55,6 +55,8 @@ dependencies:
5555
- aeson
5656
- bytestring
5757
- containers
58+
- directory
59+
- filepath
5860
- lsp-types < 2
5961
- lsp < 2
6062
- mtl

src/Server.hs

+3-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ handlers =
110110
result <- Handler.onHover uri pos
111111
responder $ Right result,
112112
notificationHandler SInitialized $ \_not -> pure (),
113-
notificationHandler STextDocumentDidOpen $ \_not -> pure ()
113+
notificationHandler STextDocumentDidOpen $ \_not -> pure (),
114+
notificationHandler STextDocumentDidSave $ \_not -> pure (),
115+
notificationHandler STextDocumentDidChange $ \_not -> pure ()
114116
-- -- syntax highlighting
115117
-- , requestHandler STextD_cumentSemanticTokensFull $ \req responder -> do
116118
-- result <- Handler.onHighlight (req ^. (params . textDocument . uri))

0 commit comments

Comments
 (0)