Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lsp 2 #23

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ 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

### Changed
- Embed Agda-2.6.4.
- Builds with `lsp` < 1.7 on GHC 9.2 (LTS 20.26),
and with Cabal also on 9.4 and 9.6.

### Added
- Build flag `Agda-2-6-3` to embed Agda-2.6.3 rather than 2.6.4.


## v0.2.6.3.0 - 2023-11-23

### Changed
Expand All @@ -14,13 +25,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Added
- Build flag `Agda-2-6-2-2` to embed Agda-2.6.2.2 rather than 2.6.3.


## v0.2.6.2.2.1 - 2023-11-21

### Added

- Building with `lsp-1.6`.
Builds with `lsp` < 1.7 on GHC 8.10 (LTS 18.28), 9.0 (LTS 19.33), and 9.2 (LTS 20.26).


## v0.2.6.2.2 - 2023-11-21

### Changed
Expand All @@ -29,25 +42,30 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Versioning scheme: _x.a.b.c.d.y_ where _a.b.c.d_ is the 4-digit Agda version (2.6.2.2), _x_ is 0 but may be bumped for revolutionary changes to the agda-language-server, and _y_ is for patch releases.
- Builds with `lsp` < 1.5 on GHC 8.10 (LTS 18.28) and 9.0 (LTS 19.33).


## v0.2.1 - 2021-10-25

No changes.


## v0.2.0 - 2021-10-22

### Fixed
- #2: Allow user to supply command-line options via agda-mode


## v0.1.4 - 2021-10-04

### Fixed
- Resume sending HighlightingInfos to agda-mode


## v0.1.3 - 2021-10-04

### Fixed
- Include DLLs in the bundle


## v0.1.2 - 2021-10-03

### Fixed
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ stack install

## Versioning

The version is _x.y.z.w.a.b.c.d_ where _x.y.z.w_ is the version of the Agda Language Server and _a.b.c.d_ the version of Agda it embeds.
It follows the Haskell PVP (package versioning policy).
The version is _x.a.b.c.d.y_ where _a.b.c.d_ is the 4-digit Agda version (2.6.4.0), _x_ is 0 but may be bumped for revolutionary changes to the agda-language-server, and _y_ is for patch releases.

## Why make it standalone?

Expand Down
59 changes: 46 additions & 13 deletions agda-language-server.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ cabal-version: 1.12
-- see: https://github.com/sol/hpack

name: agda-language-server
version: 0.2.6.3.0
version: 0.2.6.4.0
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
homepage: https://github.com/banacorn/agda-language-server#readme
bug-reports: https://github.com/banacorn/agda-language-server/issues
author: Ting-Gian LUA
maintainer: [email protected]
copyright: 2020 Author name here :)
maintainer: [email protected], Andreas Abel
copyright: 2020-23 Ting-Gian LUA, Andreas ABEL
license: MIT
license-file: LICENSE
build-type: Simple
Expand All @@ -25,13 +25,19 @@ extra-source-files:
stack-8.10-Agda-2.6.2.2.yaml
stack-9.0-Agda-2.6.2.2.yaml
stack-9.2-Agda-2.6.2.2.yaml
stack-9.2-Agda-2.6.3.yaml

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

flag Agda-2-6-2-2
description: Embed Agda-2.6.2.2 (rather than 2.6.3)
description: Embed Agda-2.6.2.2 (rather than 2.6.4)
manual: True
default: False

flag Agda-2-6-3
description: Embed Agda-2.6.3 (rather than 2.6.4)
manual: True
default: False

Expand Down Expand Up @@ -69,6 +75,7 @@ library
default-extensions:
LambdaCase
OverloadedStrings
PatternSynonyms
TypeOperators
ghc-options: -Wincomplete-patterns -Wunused-do-bind -Wunused-foralls -Wwarnings-deprecations -Wwrong-do-bind -Wmissing-fields -Wmissing-methods -Wmissing-pattern-synonym-signatures -Wmissing-signatures -Werror=incomplete-patterns -fno-warn-orphans
build-depends:
Expand All @@ -77,21 +84,29 @@ library
, base >=4.7 && <5
, bytestring
, containers
, lsp <1.7
, lsp
, lsp-types
, mtl
, network
, network-simple
, prettyprinter
, process
, stm
, strict
, text
default-language: Haskell2010
if flag(Agda-2-6-2-2)
if flag(Agda-2-6-2-2) && !flag(Agda-2-6-3)
build-depends:
Agda ==2.6.2.2
else
if !flag(Agda-2-6-2-2) && flag(Agda-2-6-3)
build-depends:
Agda ==2.6.3
if !flag(Agda-2-6-2-2) && !flag(Agda-2-6-3)
build-depends:
Agda ==2.6.4
if flag(Agda-2-6-2-2) && flag(Agda-2-6-3)
build-depends:
Agda <0

executable als
main-is: Main.hs
Expand All @@ -102,6 +117,7 @@ executable als
default-extensions:
LambdaCase
OverloadedStrings
PatternSynonyms
TypeOperators
ghc-options: -Wincomplete-patterns -Wunused-do-bind -Wunused-foralls -Wwarnings-deprecations -Wwrong-do-bind -Wmissing-fields -Wmissing-methods -Wmissing-pattern-synonym-signatures -Wmissing-signatures -threaded -rtsopts -with-rtsopts=-N -Werror=incomplete-patterns -fno-warn-orphans
build-depends:
Expand All @@ -111,21 +127,29 @@ executable als
, base >=4.7 && <5
, bytestring
, containers
, lsp <1.7
, lsp
, lsp-types
, mtl
, network
, network-simple
, prettyprinter
, process
, stm
, strict
, text
default-language: Haskell2010
if flag(Agda-2-6-2-2)
if flag(Agda-2-6-2-2) && !flag(Agda-2-6-3)
build-depends:
Agda ==2.6.2.2
else
if !flag(Agda-2-6-2-2) && flag(Agda-2-6-3)
build-depends:
Agda ==2.6.3
if !flag(Agda-2-6-2-2) && !flag(Agda-2-6-3)
build-depends:
Agda ==2.6.4
if flag(Agda-2-6-2-2) && flag(Agda-2-6-3)
build-depends:
Agda <0

test-suite als-test
type: exitcode-stdio-1.0
Expand Down Expand Up @@ -164,6 +188,7 @@ test-suite als-test
default-extensions:
LambdaCase
OverloadedStrings
PatternSynonyms
TypeOperators
ghc-options: -Wincomplete-patterns -Wunused-do-bind -Wunused-foralls -Wwarnings-deprecations -Wwrong-do-bind -Wmissing-fields -Wmissing-methods -Wmissing-pattern-synonym-signatures -Wmissing-signatures -threaded -rtsopts -with-rtsopts=-N -Werror=incomplete-patterns -fno-warn-orphans
build-depends:
Expand All @@ -172,10 +197,12 @@ test-suite als-test
, base >=4.7 && <5
, bytestring
, containers
, lsp <1.7
, lsp
, lsp-types
, mtl
, network
, network-simple
, prettyprinter
, process
, stm
, strict
Expand All @@ -185,9 +212,15 @@ test-suite als-test
, tasty-quickcheck
, text
default-language: Haskell2010
if flag(Agda-2-6-2-2)
if flag(Agda-2-6-2-2) && !flag(Agda-2-6-3)
build-depends:
Agda ==2.6.2.2
else
if !flag(Agda-2-6-2-2) && flag(Agda-2-6-3)
build-depends:
Agda ==2.6.3
if !flag(Agda-2-6-2-2) && !flag(Agda-2-6-3)
build-depends:
Agda ==2.6.4
if flag(Agda-2-6-2-2) && flag(Agda-2-6-3)
build-depends:
Agda <0
33 changes: 23 additions & 10 deletions package.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: agda-language-server
version: 0.2.6.3.0
version: 0.2.6.4.0
github: "banacorn/agda-language-server"
license: MIT
author: "Ting-Gian LUA"
maintainer: "[email protected]"
copyright: "2020 Author name here :)"
maintainer: "[email protected], Andreas Abel"
copyright: "2020-23 Ting-Gian LUA, Andreas ABEL"

extra-source-files:
- README.md
Expand All @@ -14,6 +14,7 @@ extra-source-files:
- stack-8.10-Agda-2.6.2.2.yaml
- stack-9.0-Agda-2.6.2.2.yaml
- stack-9.2-Agda-2.6.2.2.yaml
- stack-9.2-Agda-2.6.3.yaml

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

flags:
Agda-2-6-2-2:
description: Embed Agda-2.6.2.2 (rather than 2.6.3)
description: Embed Agda-2.6.2.2 (rather than 2.6.4)
manual: true
default: false
Agda-2-6-3:
description: Embed Agda-2.6.3 (rather than 2.6.4)
manual: true
default: false

when:
- condition: flag(Agda-2-6-2-2)
then:
dependencies:
- condition: "flag(Agda-2-6-2-2) && !flag(Agda-2-6-3)"
dependencies:
- Agda == 2.6.2.2
else:
dependencies:
- condition: "!flag(Agda-2-6-2-2) && flag(Agda-2-6-3)"
dependencies:
- Agda == 2.6.3
- condition: "!flag(Agda-2-6-2-2) && !flag(Agda-2-6-3)"
dependencies:
- Agda == 2.6.4
- condition: "flag(Agda-2-6-2-2) && flag(Agda-2-6-3)"
dependencies:
- Agda < 0

dependencies:
- base >= 4.7 && < 5
- Agda
- aeson
- bytestring
- containers
- lsp < 1.7
- lsp-types
- lsp
- mtl
- network
- network-simple
- strict
- stm
- text
- process
- prettyprinter

default-extensions:
- LambdaCase
- OverloadedStrings
- PatternSynonyms
- TypeOperators

library:
Expand Down
10 changes: 10 additions & 0 deletions src/Agda.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ module Agda
, getCommandLineOptions
) where

import Prelude hiding ( null )

import Agda.Compiler.Backend ( parseBackendOptions )
import Agda.Compiler.Builtin ( builtinBackends )
import Agda.Convert ( fromResponse )
Expand All @@ -23,6 +25,9 @@ import Agda.Interaction.Base ( Command
, parseIOTCM
#endif
)
#if MIN_VERSION_Agda(2,6,4)
import Agda.Syntax.Common.Pretty ( render, vcat )
#endif
import Agda.Interaction.InteractionTop
( initialiseCommandQueue
, maybeAbort
Expand Down Expand Up @@ -53,6 +58,7 @@ import Agda.Utils.Impossible ( CatchImpossible
)
, Impossible
)
import Agda.Utils.Null ( null )
import Agda.VersionCommit ( versionWithCommitInfo )
import Control.Exception ( SomeException
, catch
Expand Down Expand Up @@ -218,7 +224,11 @@ runAgda p = do
s2s <- prettyTCWarnings' =<< getAllWarningsOfTCErr err
s1 <- prettyError err
let ss = filter (not . null) $ s2s ++ [s1]
#if MIN_VERSION_Agda(2,6,4)
let errorMsg = render $ vcat ss
#else
let errorMsg = unlines ss
#endif
return (Left errorMsg)

handleImpossible :: Impossible -> TCM (Either String a)
Expand Down
Loading
Loading