Skip to content

Commit

Permalink
[ git ] Merge branch 'agda-2.6.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
banacorn committed Dec 16, 2023
2 parents c630eac + db6ae5d commit d6a0274
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 12 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ 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.3 - 2023-12-14

### Fixed
- #15: Add missing handlers for `lsp` methods.
- #24: Fix the encoding of binaries built on GitHub Actions.
- 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.3
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
30 changes: 25 additions & 5 deletions app/Main.hs
Original file line number Diff line number Diff line change
@@ -1,13 +1,33 @@
module Main where

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

main :: IO ()
main = do
-- set locale to UTF-8
-- https://github.com/agda/agda-language-server/issues/24
hSetEncoding stdout utf8
hSetEncoding stdin utf8
hSetEncoding stderr 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
version: 0.2.6.4.0.3
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
2 changes: 1 addition & 1 deletion src/Render/Concrete.hs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ instance Render DoStmt where
prCs [] = mempty
prCs cs' = fsep ["where", vcat (fmap render cs')]
render (DoThen e) = render e
render (DoLet _ ds) = "let" <+> vcat (fmap render $ toList ds)
render (DoLet _ ds) = "let" <+> vcat (render <$> toList ds)

instance Render Declaration where
render d =
Expand Down
5 changes: 3 additions & 2 deletions src/Switchboard.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Language.LSP.Server
import Language.LSP.Types hiding (TextDocumentSyncClientCapabilities (..))
import Data.IORef
import Options (Config)
import System.IO (stderr)

data Switchboard = Switchboard
{ sbPrintLog :: ThreadId
Expand Down Expand Up @@ -42,13 +43,13 @@ destroy switchboard = do
killThread (sbRunAgda switchboard)
writeIORef (sbLanguageContextEnv switchboard) Nothing

-- | Keep printing log
-- | Keep printing log to stderr
-- Consumer of `envLogChan`
keepPrintingLog :: Env -> IO ()
keepPrintingLog env = forever $ do
result <- readChan (envLogChan env)
when (envDevMode env) $ do
Text.putStrLn result
Text.hPutStrLn stderr result

-- | Keep sending reactions
-- Consumer of `envResponseChan`
Expand Down

0 comments on commit d6a0274

Please sign in to comment.