Commit Graph

58 Commits

Author SHA1 Message Date
Neil Mitchell
58100cb74c Update haskell-ide-core.cabal (#1659) 2019-06-14 01:12:34 +02:00
Neil Mitchell
9a3fa3fe8b Change the IDE demo to use runLanguageServer (#1655) 2019-06-13 18:21:27 +02:00
Neil Mitchell
795f7b20bb Inline da-hs-language-server into haskell-ide-core (#1652)
* Inline da-hs-language-server into haskell-ide-core

* Fix up the bazel file for new dependencies
2019-06-13 18:03:26 +02:00
Moritz Kiefer
4300283193 Remove one level of tracking files of interest and open VRs (#1650)
Previously we tracked this both at the Shake level and at the LSP
level which doesn’t make any sense. This PR removes the outer LSP
layer.
2019-06-13 15:14:34 +00:00
Moritz Kiefer
794846dd28 Remove the dependency of da-hs-language-server and language-server on da-hs-base (#1642) 2019-06-13 13:48:25 +00:00
Moritz Kiefer
41d693ad03 Introduce a newtype for file paths with normalized slashes (#1633)
This implements part 2 of #1507 and fixes the daml-ghc-test-dev test
suite on Windows (not enabled on CI due to GRPC issues).

I have also tested this in the IDE on Windows and Linux.
2019-06-13 15:11:47 +02:00
Moritz Kiefer
3fd52a88ab Normalize percent-encoding in URIs (#1603)
This implements step 1. from #1507 and also adds a test that uses an
insane percent-encoding to verify that we can handle that.

I also tested this in the IDE on Windows and Linux.
2019-06-12 15:20:23 +02:00
Moritz Kiefer
35e2d881dd Use FromServerMessage directly (#1583)
Previously we had two layers of indirection:

In the compiler we emitted Event, we then translated this to
ClientNotification which was then translated to
FromServerMessage.

Apart from being confusing and convoluted this also resulted in us
doing the conversion to generic LSP types too late so we had scenario
specific code in places where it shouldn’t be.

This PR removes the indirection and just uses FromServerMessage
directly.
2019-06-11 16:03:44 +02:00
Shayne Fletcher
44b366e720 Up-(actually down-)grade to ghc-lib-8.8.0.20190610 (#1576)
* Up-(actually down-)grade to ghc-lib-8.8.0.20190610

* A `#ifndef GHC_STABLE` removed. `ml_hie_file` must be set unconditionally

* Pass Opt_WriteHie in xFlagsSet

* Oops. Revert. This breaks Windows. Very confusing

* Disable test; track in issue https://github.com/digital-asset/daml/issues/1582

* Remove Opt_WriteHie flag (Causes test failures trying to write into a read-only filesystem in CI)
2019-06-11 08:58:16 -04:00
Moritz Kiefer
1d3d46ea76 Remove EventFileValidation (#1579)
We never actually emit this event so it’s pretty much useless. If we
do want to add progress reporting at some point, we should go with the
recently added official support for that in LSP
https://github.com/Microsoft/language-server-protocol/issues/70#issuecomment-483252666.
2019-06-11 09:15:12 +00:00
Martin Huschenbett
501a4a1b9f Make it explicit that contract key maintainers are computed from key (#1527)
* Use ghc-lib-0.20190604

* HieFile fix

* Update to ghc-lib-0.20190604.1

* Make maintainers depend directly on key

* Remove useless tests

* Adjust documentation

* Add release notes

* Simplify some code

* Fix tests to use new syntax

* Fix template desugaring docs

* Fix more tests
2019-06-05 10:27:38 -04:00
Moritz Kiefer
b6fd3c1a75 Remove use of managed for starting the scenario service (#1508)
Ironically `managed` didn't turn out to make our code more manageable
and we ended up mostly using it in very isolated places only to then
immediately convert it back to bracket-style functions using `with`.

This PR also removes the use of `managed` from the GcpLogger which was
the only other place where we are using it and it finally kills the
rather silly logic that starting up the scenario service was tied to
having an event logger.
2019-06-04 17:17:05 +02:00
Moritz Kiefer
30b531a51f Escape colons in URIs to be consistent with VSCode (#1504)
The details are described in a comment but the short story is
that a roundtrip Uri -> FilePath -> Uri necessarily loses information
on which characters were escaped. The long-term solution here is to
avoid this roundtrip altogether but this at least fixes the issue for
now.
2019-06-04 09:45:29 +02:00
Moritz Kiefer
7c3213c3c5 Use haskell-lsp’s builtin VFS in "damlc ide" (#1489)
* Use haskell-lsp’s builtin VFS in "damlc ide"

haskell-lsp has a builtin VFS that it updates automatically on the
corresponding requests. This PR removes our own VFS implementation and
uses that builtin VFS in "damlc ide". To allow the use of functions
like setBufferModified (we use that heavily in daml-ghc-shake-test-ci)
without having to spawn an LSP server, we also add a fallback where we
spin up our own LSP implementation.
2019-06-03 16:19:30 +02:00
DavidM-D
85379f55dd Added a barebones readme for haskell-ide-core as I've linked it from... (#1493)
...the zurihac project page
2019-06-03 14:03:15 +01:00
Shayne Fletcher
3769dd41ca Ghc lib 0.20190531 (#1486)
* Upgrade to ghc-lib-0.20190531

* Listen up Wally, Remove redundant commented code!

* Argh! WhattamistakeAtomakeA!

* Whitespace to force Azure pipeline to reconsider ignoring this PR

* Repackage ghc-lib, update SHAs and push again

* Refer to a non-existent release as an experiment

* Put the release number back

* Fix build of haskell-ide-core-public
2019-06-01 06:48:49 -04:00
Moritz Kiefer
e370589e77 Switch Hover from MarkedString to MarkupContent (#1473)
MarkedString is deprecated in LSP (both the protocol itself and the
Haskell library) so we should move away from it.
2019-05-31 13:43:36 +00:00
Moritz Kiefer
6cba2e57a4 Separate diagnostics from rule results (#1423) 2019-05-28 14:18:59 +02:00
Moritz Kiefer
1fa783b876 Fix an issue in module chasing caused by unnormalized file paths (#1303)
On Windows we can end up with rootModDir having / in the filepath
while rootPathDir uses \ so stripSuffix didn’t work.

This fixes #1284
2019-05-22 11:58:22 +00:00
Neil Mitchell
a290aab694 Add a haskell-ide-core demo project (#1251)
* Demo program for haskell-ide-core as a library

* Fix all warnings in the Demo file

* Build the IDE demo

* Give a better error message than undefined

* HLint

* Fix copyright header

* Sort the dependencies

* Improve the comment

* Bazel formatting

* Disable building on Windows until ghc-paths is fixed

* Bazel formatting

* Specify the main function
2019-05-20 16:36:08 +01:00
Neil Mitchell
60f0177f9b Move packaging logic out of haskell-ide-core (#1239)
* The PackageDynFlags instances are no longer required because its not a rule result

* Move all the package custom pieces out of the ide-core

* Move the optMbPackageName out to daml-ghc

* Make sure we clean up all temporary files

* Clean up the import list

* Move runGhcFast to its one use site
2019-05-20 12:05:21 +01:00
Neil Mitchell
2e704bdabd Delete redundant code (#1199) 2019-05-16 17:34:54 +01:00
Neil Mitchell
46c3867409 Remove NameCache modification in the IDE (#1189)
* Remove NameCache modification

* Change the suggested list of replacements
2019-05-16 16:01:26 +01:00
Neil Mitchell
749ee7d699 Feedback from PR to improve import path finding (#1188)
* Feedback from PR to improve import path finding

* Update compiler/haskell-ide-core/src/Development/IDE/Functions/Compile.hs
2019-05-16 15:14:08 +01:00
Neil Mitchell
718e3389c8 Move to creating a single HscEnv that we reuse in all GHC sessions rather than a fresh one each time (#1179) 2019-05-16 13:17:17 +01:00
Neil Mitchell
8158587b89 IDE GHC 8.6 Compatibilty (#1148)
* Rename the #ifdef for GHC_STABLE

* More CPP required for GHC stable

* Add a compatibility wrapper for HIE functionality which is new in GHC HEAD

* HLint ignores

* Finish the dummy implementations

* Add a bazel build for the ide-core library against GHC
2019-05-15 11:21:21 +01:00
Shayne Fletcher
849908d52c Upgrade to ghc-lib-0.20190514.1 (#1139)
* Upgrade to ghc-lib-0.20190514.1

* Whitespace fix.
2019-05-15 06:34:58 +00:00
Neil Mitchell
cbbe589e0c Support CPP in the IDE (#1131)
* Hide ghc-boot by default

* Add support for CPP

* Delete redundant comment
2019-05-14 20:00:19 +01:00
Neil Mitchell
3d66a7aed6 Add utility function for the IDE Logger (#1132) 2019-05-14 16:51:20 +01:00
Robin Krom
160554ac95 language: fix: move interface files to a different (#1074)
* language: fix: move interface files to a different

This fixes https://github.com/digital-asset/daml/issues/1009. We move
the created interface files and hie files to a hidden directory
".interfaces" when creating a package.

* removing the ifaceDir option and hardcode the dir
2019-05-10 16:40:15 +00:00
Shayne Fletcher
0ac72a4340 Update to ghc-lib-0.20190509 (#1064) 2019-05-10 00:50:55 +00:00
Neil Mitchell
bec100b635 Improvements to the IDE (#1006)
* Make the extensions of the Haskell files configurable

* Make sure we capture the errors from parsing, not the warnings
2019-05-08 14:27:51 +01:00
Robin Krom
73b9de2536 compiler: follow ghc convention and put conf files in package.conf.d dir (#978)
* compiler: follow ghc convention and put conf files in package.conf.d dir

We follow the ghc convention and locate all .conf files for the package
database in the `package.conf.d` dir.

* addressed neil's comment
2019-05-08 14:23:04 +02:00
Moritz Kiefer
56d7dac830 Implement cross-package goto definition (#972)
* Implement cross-package goto definition

This is more tricky than one might think at first:

- The interface files do not contain proper source spans so we cannot
  use the information in there.
- We could theoretically try to get the source location from the DALFs
  but that is the wrong layer and also not an option when we want to
  act as a Haskell IDE.

So what we do instead is whenever we write interface files we also
write .hie files and consult those instead when we get useless source
spans otherwise.

* Move optLocateHieFile and optLocateSrcFile to a separate type
2019-05-07 15:39:46 +02:00
Neil Mitchell
d3aacb316e Clean up UtilGHC (#963)
* Remove a duplicated comment

* Remove traverse from the convertor

* Move removing typeable to the converter

* Don't reexport getGhcCore

* Move coresForFile to its usage

* Just print out the GHC Core for everything, including internal modules

* Move modIsInternal out of haskell-ide-core

* Move some DynFlags setters over to Config

* Remove an unused orphan instance

* Move the orphans out to a different module

* Move functions for generating import syntax out of haskell-ide-core

* Expose fakeDynFlags as a blob, not the pieces

* Clean up the definition of fakeDynFlags

* Inline showSDocDefault

* HLint

* Fix the comment on IDE.Orphans
2019-05-07 12:42:48 +01:00
Neil Mitchell
1c27ffe760 Clean up the IDE (#961)
* Split the Options into a separate module

* Make the Logger handle live in IO

* Reduce the amount of IDE logging to just two

* Rename CompileOpts to IdeOptions

* Rename PackageState to PackageDynFlags

* Clean up setting the PackageDynFlags

* Stop hiding PackageState, we no longer clash on it

* Introduce a helper for collecting the package flags

* Move the StringBuffer conversion to its only use
2019-05-07 10:19:12 +01:00
Neil Mitchell
c0e9c90429 GHC 8.6 compat for the IDE (#955)
* I have no idea now LPat and Pat previously managed to unify...

* Avoid using unRealSrcSpan as its only introduced for GHC 8.8

* Add some CPP to permit compiling with GHC 8.6

* Permit CPP in one more place
2019-05-06 21:29:22 +01:00
Neil Mitchell
b9dfd499dd Minor IDE cleanups (#945)
* Kill RealLocated, it just duplicates something already in GHC

* Move some things back to UtilGHC, they are useful for setting DynFlags values
2019-05-06 18:35:43 +01:00
Neil Mitchell
af56be6dfb Move the DAML config stuff out of haskell-ide-core (#940)
* Move the GHC config stuff out of haskell-ide-core

* Add an export list to UtilGHC
2019-05-06 14:11:36 +01:00
Neil Mitchell
9600e400ea IDE cleanups and progress towards external usability (#930)
* Remove the requirement for Binary on Shake rules (was not used)

* Add a deriving Show on Event, easier for external integrations

* Rename GeneratePackageState to LoadPackageState and move its fields to the rule, rather than the key

* Inline getPackageState away

* Change to passing a ModRenaming to the package loader. Two reasons:
1) When loading non-DAML things we might want to omit the renaming
2) The type ModRenaming has documentation of semantics, unlike [(String, String)]
2019-05-06 10:57:17 +01:00
Neil Mitchell
73768254d6 Avoid using package imports (#924)
* Hide the package ghc-boot-th by default

* Don't use package imports in haskell-ide-core
2019-05-05 21:22:15 +02:00
DavidM-D
32b6a5fe00 Changed Diagnostics to FileDiagnostics (#897)
* Changed Diagnostics to FileDiagnostics

* Hlint fixes

* Fix tests

* Removed the lenses
2019-05-03 17:43:40 +00:00
Neil Mitchell
b7e7ae5692 Fix prettyRange so it prints ranges like it used to (#882)
Before it was garbled and wrong:
Range:    Range Start: Position Line: 2Character: 15End:   Position Line: 2Character: 15

After it's correct and like it was before:
Range:    3:15-3:17
2019-05-03 12:49:51 +01:00
DavidM-D
a410abc82c Restored filepaths to their error messages (#862) 2019-05-03 08:33:56 +02:00
Neil Mitchell
8483aed07c Improve the error message if we can't find the file (#858) 2019-05-02 19:16:32 +00:00
Shayne Fletcher
828f3af028 Enable -Wprepositive-qualified-module (#823) 2019-05-01 21:09:38 +00:00
Neil Mitchell
6e785c5267 Start cleaning up pretty-print (#821)
* Move from prettyDiagnostic to prettyDiagnostics

* Remove as much pretty print stuff as we can

* Try moving duplicate named functions with similar semantics and identical types to different names

* Change to returning pretty printed outputs from Diagnostics

* Remove a redundant import
2019-05-01 19:06:00 +01:00
DavidM-D
c72b7344e2 New diagnostics implementation (#737)
* Switch to haskell-lsp

* Fix build of data-default on Windows

* Use ghc environment files to avoid overflowing CLI length limits
2019-04-30 22:51:53 +02:00
Neil Mitchell
3f6eabadf3 Add explicit export list (#806)
* Add explicit export lists in some places

* Add another explicit export
2019-04-30 21:08:36 +01:00
Neil Mitchell
70524321ad #564, fix JUnit tests (#799)
* Make the ScenarioService take an IO callback, not STM

* Remove a redundant space

* Use IO in preference to STM where we really don't care which is in use

* #564, always print out diagnostics for tests

* #564, fix getting the scenario names so if they can't be computed you give an answer

* Add a proper data type to represent pass/fail in the tests

* Centrailse printing a failure message

* Pull the test execution into a separate file, ensuring it always gives back an exit code

* Use nubOrd instead of Set

* Clean up how we figure out which files to test

* Fail if there are any errors

* Delete all the brittle failure tracking stuff

* Rename the compiler handle to h

* Only print out the successful results to stdout, since the unsuccessful ones end up in diagnostics

* Make JUnit output still print out the test results

* Make JUnit print out all the details

* Delete the stdio command path

* Break the bigger pieces apart in the test runner

* Inline testJUnit

* Shorten to UseColor

* Shorten to color

* Inline and comment part of the JUnit tests

* HLint

* Update daml-foundations/daml-tools/da-hs-daml-cli/DA/Cli/Damlc/Test.hs

Co-Authored-By: neil-da <35463327+neil-da@users.noreply.github.com>

* Fix an HLint refactoring snafu

* Fix up the damlc tests

* Tighten up a test by demanding it throws ExitFailure
2019-04-30 18:07:08 +00:00