dhall-haskell/dhall-lsp-server
Frederik Ramcke d5d0224bc3 Preparing Dhall.Import for "Semi-semantic" caching (#1113)
* Fix misleading comment

* Add `Chained` type to capture fully chained imports

Until now we used `Import` two mean two different things:
- The syntactic construct; e.g. `./a.dhall` corresponds to the following
  AST:
  ```
  Embed
    (Import
      (ImportHashed Nothing (Local Here (Directory ["."]) "a.dhall"))
      Code)
  ```

- The physical location the import is pointing to, computed by
'chaining' the syntactical import with the the 'physical' parent import.
For example the syntactic import `./a.dhall` might actually refer to the
remote file `http://host/directory/a.dhall`.

This commit adds a `Chained` newtype on top of `Import` to make this
distinction explicit at type level.

* Use `HTTPHeaders` alias for binary headers

I claim that `HTTPHeaders` is more readable and informative than the
unfolded type `(CI ByteString, ByteString)`.

* Typecheck and normalise http headers earlier

Previously we would typecheck and normalise http headers in
`exprFromImport`, i.e. while loading the import. This commit adds the
invariant that any headers in 'Chained' imports are already typechecked
and normalised, and moves this step into `loadWith` accordingly.

This causes a subtle difference in behaviour when importing remote files
with headers `as Location`: previously, nonsensical expressions like
`http://a using 0 0 as Location` were valid, while they would now cause
a type error.

* Fix dhall-lsp-server

* Fix Dhall.Import API regarding `Chained` imports

Do not expose the `Chained` constructor; we don't want external code
breaking our invariants! Also further clarifies the comment describing
the `Chained` type.

* Fix dhall-lsp-server

Since we are no longer able to construct `Chained` imports directly we
need to export a few additional helper functions from Dhall.Import.
Furthermore, since VSCode (and presumably the other editors out there
implementing the LSP protocol) does not support opening remote files
anyway we can get rid of some complications by dropping support for
remote files entirely on the back-end.

* Generalise decodeExpression, fixes TODO

* Fix tests

* Fix benchmarks

* Remove Travis cache for `~/.local/bin`

* Fix copy-pasted comment

Thanks to @Gabriel439 for spotting this!

* Add clarifying comment to `toHeaders`
2019-07-17 15:20:48 +00:00
..
app Implementation of toMap (#1041) 2019-07-15 08:28:29 -07:00
src/Dhall/LSP Preparing Dhall.Import for "Semi-semantic" caching (#1113) 2019-07-17 15:20:48 +00:00
test Simplify dhall-lsp-server and reorganise its modules (#992) 2019-06-07 07:47:07 +00:00
ChangeLog.md LSP. Fix import errors location. Minor clean-up. Add tests for backend/diagnostics. (#868) 2019-03-26 13:20:25 +00:00
default.nix Add dhall-lsp-server (#843) 2019-03-06 21:41:38 -08:00
dhall-lsp-server.cabal Implementation of toMap (#1041) 2019-07-15 08:28:29 -07:00
LICENSE Add dhall-lsp-server (#843) 2019-03-06 21:41:38 -08:00
README.md LSP. Fix import errors location. Minor clean-up. Add tests for backend/diagnostics. (#868) 2019-03-26 13:20:25 +00:00
Setup.hs Add dhall-lsp-server (#843) 2019-03-06 21:41:38 -08:00
shell.nix Add Nix support for dhall-lsp-server project (#849) 2019-03-10 09:43:44 -07:00

dhall-lsp-server

This is a Language Server Protocol server implementation for the Dhall programming language.

For installation or development instructions, see: