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.
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.
* 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)
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.
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.
* 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.
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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)]
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
* 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
* 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
* Move the IdeResult term into the A data type
* Nothing ever consults the errors stored in A, so stop storing them
* Use the new Shake MonadFail Rules instance
* Document the information in the Shake database
* More documentation of the data in the Shake service
* Change getValues to avoid getting the diagnostics
* Avoid fmap over a pair, a bit weird
* Add buildifier targets.
The tool allows to check and format BUILD files in the repo.
To check if files are well formatted, run:
bazel run //:buildifier
To fix badly-formatted files run:
bazel run //:buildifier-fix
* Cleanup dade-copyright-headers formatting.
* Fix dade-copyright-headers on files with just the copyright.
* Run buildifier automatically on CI via 'fmt.sh'.
* Reformat all BUILD files with buildifier.
Excludes autogenerated Bazel files.
* Add location information to DAML-LF produced by damlc
This is required to get error locations in the scenario view. Rigth now,
the location information for `create`/`exercise` still points to the
template/choice. I'll fix that in a separate PR.
* Fix test expectations
* Fix more tests
* Turn off -Woverlowed-literals in damlc
This flag does not play well with location information obtained via `-ticky`.
Also, the error message you get from overflowed literals suggests to use
`-XNegativeLiterals`, which is a bad idea since it changes the meaning of
`(-1)` from `\x -> x - 1` to `negate 1`.
* Fix module name in test
Co-Authored-By: martin-drhu-da <31696042+martin-drhu-da@users.noreply.github.com>