dhall-haskell/dhall-lsp-server/dhall-lsp-server.cabal

124 lines
3.9 KiB
Plaintext
Raw Normal View History

2019-03-07 06:41:38 +01:00
name: dhall-lsp-server
2019-12-06 04:28:39 +01:00
Version: 1.0.3
cabal-version: 1.12
synopsis: Language Server Protocol (LSP) server for Dhall
2019-03-07 06:41:38 +01:00
homepage: https://github.com/dhall-lang/dhall-haskell/dhall-lsp-server#readme
bug-reports: https://github.com/dhall-lang/dhall-haskell/issues
author: panaeon
2019-07-29 06:46:32 +02:00
maintainer: Gabriel Gonzalez
2019-03-07 06:41:38 +01:00
copyright: 2019 panaeon
license: MIT
license-file: LICENSE
build-type: Simple
extra-source-files:
README.md
ChangeLog.md
tests/fixtures/completion/*.dhall
tests/fixtures/diagnostics/*.dhall
tests/fixtures/linting/*.dhall
tests/fixtures/hovering/*.dhall
2019-03-07 06:41:38 +01:00
source-repository head
type: git
location: https://github.com/dhall-lang/dhall-haskell
library
exposed-modules:
Dhall.LSP.Backend.Completion
Dhall.LSP.Backend.Dhall
Dhall.LSP.Backend.Diagnostics
Dhall.LSP.Backend.Freezing
Dhall.LSP.Backend.Formatting
Dhall.LSP.Backend.Linting
Dhall.LSP.Backend.Parsing
Dhall.LSP.Backend.ToJSON
Dhall.LSP.Backend.Typing
Dhall.LSP.Handlers
Dhall.LSP.Server
dhall-lsp-server: Implement caching (#1040) * Rewriting Dhall.LSP.Backend.Dhall: Implement new API The old "backend" consisted of a random collection of ways to invoke Dhall: - runDhall :: FilePath -> Text -> IO (Expr Src X) - runDhallSafe :: FilePath -> Text -> IO (Maybe (Expr Src X)) - loadDhallExprSafe :: FilePath -> Text -> IO (Maybe (Expr Src X)) The new backend exposes a slightly more though-out API. This also lays the foundation for performance improvements in the dhall lsp server via caching. * Reorder code in Dhall.LSP.Backend.Dhall * Remove unused constructor * Rewrite and document Backend.Formatting * Refactor Dhall.LSP.Backend.Linting * Refactor Dhall.LSP.Backend.ToJSON * Adapt Diagnostics backend to the new Dhall API * Remove old Dhall backend API * Implement caching; revamp LSP frontend This commit implements caching of Dhall expressions: we only need to fetch, typecheck and normalise each import once per session, unless they change! This means that `dhall-lsp-server` is now viable for non-trivial Dhall projects, for example probing around in `dhall-nethack` everything feels near-instantaneous once the imports have been resolved. This implementation currently has a bug: we don't invalidate imports transitively, i.e. if A.dhall loads B.dhall and B.dhall changes we do not discard the cached version of A.dhall. This should be reasonably easy to fix given some time with Dhall's import graph. Furthermore, there is some cleaning up left to do: - Fix warnings - Reorganise things in a less ad-hoc way - Make the code a bit prettier * Fix caching of errors * Use `bimap` instead of `first` and `second` * Re-export `Dhall.lint` rather than aliasing Rids us of some boilderplate * Use MVar instead of TVar for server state The main benefit is that we get to use `modifyMVar_` which does updating of the shared state for us (and gracefully handles any uncaught exceptions). * Don't invalidate hashed imports Fixes a misinterpretation on my end of the correct behaviour regarding the caching of imports. Quoting @Gabriel439: > A hashed import is valid indefinitely once it is successfully > resolved, even when the underlying import later becomes broken. That's > why missing sha256:… works so long as the cache has that import cached > (and this behavior is part of the standard). * Cleanup Dhall.LSP.Backend.Dhall a little bit * Add note about fixing cache invalidation * Use TemplateHaskell to generate state lenses * Make types of `typeAt` and `annotateLet` more expressive Both assume the input to be well-typed; by using `WellTyped` rather than `Expr Src X` as the type of their input we can make this explicit. This change exposed a bug (also fixed in this commit) in the type-on-hover functionality: we run `typeAt` only if the input was well-typed _the last time we checked it_ (which was at the last save); this means that if the code changed without being written to disk we would happily try to normalise (in `typeAt`) non-well-typed code... * Fix type of typecheck Typecheck returned the well-typed _type_ of a given expression, while I was assuming it would certify the input to be well-typed. Silly indeed. * Remove `checkDhall` from Dhall.Backend.Diagnostics Removes the left-over stub from the change to the new Dhall backend. * Update comments and remove TODO note * Remove superfluous parentheses * Simplify MonadState code via lens combinators * Use `guard` instead of matching on True * Remove more superfluous parentheses
2019-07-01 19:30:32 +02:00
Dhall.LSP.State
2019-03-07 06:41:38 +01:00
other-modules:
Paths_dhall_lsp_server
Dhall.LSP.Util
2019-03-07 06:41:38 +01:00
hs-source-dirs:
src
default-extensions: RecordWildCards OverloadedStrings
2019-03-07 06:41:38 +01:00
build-depends:
2019-07-29 06:46:32 +02:00
aeson >= 1.3.1.1 && < 1.5
, aeson-pretty >= 0.8.7 && < 0.9
, base >= 4.11 && < 5
2019-07-29 06:46:32 +02:00
, bytestring >= 0.10.8.2 && < 0.11
, containers >= 0.5.11.0 && < 0.7
, data-default >= 0.7.1.1 && < 0.8
, directory >= 1.2.2.0 && < 1.4
2019-12-06 04:28:39 +01:00
, dhall >= 1.28.0 && < 1.29
, dhall-json >= 1.4 && < 1.7
2019-07-29 06:46:32 +02:00
, filepath >= 1.4.2 && < 1.5
, haskell-lsp >= 0.15.0.0 && < 0.17
, rope-utf16-splay >= 0.3.1.0 && < 0.4
2019-07-29 06:46:32 +02:00
, hslogger >= 1.2.10 && < 1.4
, lens >= 4.16.1 && < 4.19
2019-07-29 06:46:32 +02:00
, lens-family-core >= 1.2.3 && < 2.1
, megaparsec >= 7.0.2 && < 8.1
2019-07-29 06:46:32 +02:00
, mtl >= 2.2.2 && < 2.3
, network-uri >= 2.6.1.0 && < 2.7
, prettyprinter >= 1.5.1 && < 1.6
2019-07-29 06:46:32 +02:00
, text >= 1.2.3.0 && < 1.3
, transformers >= 0.5.5.0 && < 0.6
, unordered-containers >= 0.2.9.0 && < 0.3
, uri-encode >= 1.5.0.5 && < 1.6
2019-03-07 06:41:38 +01:00
default-language: Haskell2010
dhall-lsp-server: Rework diagnostics backend + detailed error messages on hover (#982) * Refactor Diagnostics backend This commits refactors Backend.Dhall.Diagnostics, cleaning things up and adding comments along the way. We also lose Backend.Dhall.DhallErrors. The user-facing result is a step backwards, as we revert to using Dhall's Show instances to print errors, which gives us error messages that don't fit the LSP use case very well at the moment. In the future we should change Dhall's error printing API (the Show instances) to make them more generally useful (in particular for the LSP use case), thus saving us from having to duplicate code (as was previously did, when dhall-lsp-server was not yet part of the upstream project). * Proof of concept: Provide detailed error messages This proof of concept provides detailed explanations on hovering over type errors. Currently this is done by injecting the explanation directly into the hover text, which 1. conflicts with the short error messages, which are still being displayed at the same time and 2. is not particularly readable, since the explanations are meant to be rendered at least 80 characters wide. For future work I am planning to instead only add an "explain" link to the hover window, which when clicked opens the explanation in a separate window (inspired by how the haskell ide engine presents documentation links). This will require a small amount of client-side logic. * Explain error messages via VSCode Command URIs The first proof of concept simply spit out the explanations as hover text; in order to make the feature a bit more useful, we now encode the explanation text into a VSCode command URI (that still needs to be implemented client-side), so that upon hovering over an error the user is presented with a clickable "Explain error message" link. The feature is still in the prototype stage! * Use custom URI scheme instead of command URIs Use URIs of the form "dhall-explain:?text" to present detailed explanations on hovering. Previously we used command URIs, which are specific to VSCode. Needs a correspondingly patched vscode-lsp-server to handle the "dhall-explain" URI scheme. * Fix handling of relative imports in diagnostics In refactoring the diagnostics backend I forgot to initialise the settings passed to the Dhall type-checker, which are needed to properly resolve relative imports. An easy fix for a silly mistake ;) * Remove outdated TODO comment * Make GHC stricter when building dhall-lsp-server Add -Wall and -fwarn-incomplete-uni-patterns to the GHC options when building dhall-lsp-server. This brings it in line with the rest of dhall-haskell. * Fix warnings when building dhall-lsp-server * Fix review comments Fixes Gabriel's PR comments. Note that I leave a proper fix to DhallException for the future (I want to work on something else for a bit ;)). * Use underscores to pacify warnings
2019-06-04 18:48:06 +02:00
GHC-Options: -Wall -fwarn-incomplete-uni-patterns
if impl(eta)
buildable: False
2019-03-07 06:41:38 +01:00
executable dhall-lsp-server
main-is: Main.hs
other-modules:
Paths_dhall_lsp_server
hs-source-dirs:
app
default-extensions: RecordWildCards OverloadedStrings
2019-03-07 06:41:38 +01:00
ghc-options: -rtsopts
build-depends:
base >=4.7 && <5
2019-03-07 06:41:38 +01:00
, dhall-lsp-server
, optparse-applicative
default-language: Haskell2010
dhall-lsp-server: Rework diagnostics backend + detailed error messages on hover (#982) * Refactor Diagnostics backend This commits refactors Backend.Dhall.Diagnostics, cleaning things up and adding comments along the way. We also lose Backend.Dhall.DhallErrors. The user-facing result is a step backwards, as we revert to using Dhall's Show instances to print errors, which gives us error messages that don't fit the LSP use case very well at the moment. In the future we should change Dhall's error printing API (the Show instances) to make them more generally useful (in particular for the LSP use case), thus saving us from having to duplicate code (as was previously did, when dhall-lsp-server was not yet part of the upstream project). * Proof of concept: Provide detailed error messages This proof of concept provides detailed explanations on hovering over type errors. Currently this is done by injecting the explanation directly into the hover text, which 1. conflicts with the short error messages, which are still being displayed at the same time and 2. is not particularly readable, since the explanations are meant to be rendered at least 80 characters wide. For future work I am planning to instead only add an "explain" link to the hover window, which when clicked opens the explanation in a separate window (inspired by how the haskell ide engine presents documentation links). This will require a small amount of client-side logic. * Explain error messages via VSCode Command URIs The first proof of concept simply spit out the explanations as hover text; in order to make the feature a bit more useful, we now encode the explanation text into a VSCode command URI (that still needs to be implemented client-side), so that upon hovering over an error the user is presented with a clickable "Explain error message" link. The feature is still in the prototype stage! * Use custom URI scheme instead of command URIs Use URIs of the form "dhall-explain:?text" to present detailed explanations on hovering. Previously we used command URIs, which are specific to VSCode. Needs a correspondingly patched vscode-lsp-server to handle the "dhall-explain" URI scheme. * Fix handling of relative imports in diagnostics In refactoring the diagnostics backend I forgot to initialise the settings passed to the Dhall type-checker, which are needed to properly resolve relative imports. An easy fix for a silly mistake ;) * Remove outdated TODO comment * Make GHC stricter when building dhall-lsp-server Add -Wall and -fwarn-incomplete-uni-patterns to the GHC options when building dhall-lsp-server. This brings it in line with the rest of dhall-haskell. * Fix warnings when building dhall-lsp-server * Fix review comments Fixes Gabriel's PR comments. Note that I leave a proper fix to DhallException for the future (I want to work on something else for a bit ;)). * Use underscores to pacify warnings
2019-06-04 18:48:06 +02:00
GHC-Options: -Wall -fwarn-incomplete-uni-patterns
if impl(eta)
buildable: False
2019-03-07 06:41:38 +01:00
Test-Suite doctest
Type: exitcode-stdio-1.0
Hs-Source-Dirs: doctest
Main-Is: Main.hs
GHC-Options: -Wall
Build-Depends:
2019-07-29 06:46:32 +02:00
base ,
directory >= 1.3.1.5 && < 1.4 ,
filepath < 1.5 ,
2019-11-02 02:29:26 +01:00
doctest >= 0.7.0 && < 0.17,
QuickCheck
Other-Extensions: OverloadedStrings RecordWildCards
Default-Language: Haskell2010
-- `doctest` doesn't work with `MIN_VERSION` macros before GHC 8
--
-- See: https://ghc.haskell.org/trac/ghc/ticket/10970
if impl(ghc < 8.0)
Buildable: False
Test-Suite tests
Type: exitcode-stdio-1.0
Hs-Source-Dirs: tests
Main-Is: Main.hs
GHC-Options: -Wall
Build-Depends:
base ,
haskell-lsp-types >= 0.15.0 && < 0.16 ,
lsp-test >= 0.6 && < 0.7 ,
tasty >= 0.11.2 && < 1.3 ,
tasty-hspec >= 1.1 && < 1.2 ,
text >= 0.11 && < 1.3
Default-Language: Haskell2010