Skip to content

Commit

Permalink
[ fix ] Patch path to the "data" directory when the executable is bui…
Browse files Browse the repository at this point in the history
…lt on GitHub Actions
  • Loading branch information
banacorn committed Dec 14, 2023
1 parent ebfdf18 commit f685bda
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 6 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ All notable changes to this project will be documented in this file.

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

## v0.2.6.4.0 - unreleased
## v0.2.6.4.0.2 - 2023-12-14

### Fixed
- Add missing handlers for `lsp` methods.
- Patch path to the "data" directory when the executable is built on GitHub Actions.

## v0.2.6.4.0.0 - 2023-12-12

### Changed
- Embed Agda-2.6.4.
Expand Down
10 changes: 8 additions & 2 deletions agda-language-server.cabal
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.36.0.
-- This file has been generated from package.yaml by hpack version 0.35.2.
--
-- see: https://github.com/sol/hpack

name: agda-language-server
version: 0.2.6.4.0
version: 0.2.6.4.0.2
synopsis: An implementation of language server protocal (LSP) for Agda 2.
description: Please see the README on GitHub at <https://github.com/agda/agda-language-server#readme>
category: Development
Expand Down Expand Up @@ -83,6 +83,8 @@ library
, base >=4.7 && <5
, bytestring
, containers
, directory
, filepath
, lsp <2
, lsp-types <2
, mtl
Expand Down Expand Up @@ -125,6 +127,8 @@ executable als
, base >=4.7 && <5
, bytestring
, containers
, directory
, filepath
, lsp <2
, lsp-types <2
, mtl
Expand Down Expand Up @@ -194,6 +198,8 @@ test-suite als-test
, base >=4.7 && <5
, bytestring
, containers
, directory
, filepath
, lsp <2
, lsp-types <2
, mtl
Expand Down
15 changes: 14 additions & 1 deletion app/Main.hs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
module Main where

import Control.Monad (when)
import Options
import Server (run)
import System.Console.GetOpt
import System.Environment (getArgs)
import System.Directory (doesDirectoryExist)
import System.Environment
import System.FilePath ((</>))
import System.IO
import Text.Read (readMaybe)

Expand All @@ -14,6 +17,16 @@ main = do
hSetEncoding stdout utf8
hSetEncoding stdin utf8

-- The GitHub CI-built executable lacks the correct data directory path.
-- If there's directory named "data" in the executable's directory,
-- then we assume that the executable is built by GitHub CI
-- and we should set the $Agda_datadir environment variable to the correct directory.
executablePath <- getExecutablePath
let dataDir = executablePath </> "data"
isBuiltByCI <- doesDirectoryExist dataDir
when isBuiltByCI $ do
setEnv "Agda_datadir" dataDir

options <- getOptionsFromArgv
if optHelp options
then putStrLn usageMessage
Expand Down
4 changes: 3 additions & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: agda-language-server
version: 0.2.6.4.0.1
version: 0.2.6.4.0.2
github: "banacorn/agda-language-server"
license: MIT
author: "Ting-Gian LUA"
Expand Down Expand Up @@ -55,6 +55,8 @@ dependencies:
- aeson
- bytestring
- containers
- directory
- filepath
- lsp-types < 2
- lsp < 2
- mtl
Expand Down
4 changes: 3 additions & 1 deletion src/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ handlers =
result <- Handler.onHover uri pos
responder $ Right result,
notificationHandler SInitialized $ \_not -> pure (),
notificationHandler STextDocumentDidOpen $ \_not -> pure ()
notificationHandler STextDocumentDidOpen $ \_not -> pure (),
notificationHandler STextDocumentDidSave $ \_not -> pure (),
notificationHandler STextDocumentDidChange $ \_not -> pure ()
-- -- syntax highlighting
-- , requestHandler STextD_cumentSemanticTokensFull $ \req responder -> do
-- result <- Handler.onHighlight (req ^. (params . textDocument . uri))
Expand Down

0 comments on commit f685bda

Please sign in to comment.