* Run typechecker in damldocs (but don't use result yet)
* Add Modulename to TypeApp constructor.
* Add md_name where appropriate.
* Thread a DocCtx through each doc extractor.
* Move template set and choices map into docctx
* Use Typename for template set and choice map
* Make Anchor a newtype and move it to Types
* Make Modulename in TypeApp an Anchor instead.
* Remove import of hidden module.
* Qualify that which doth need be qualified
* Update tests
* Build stdlib in such a way that it passes typechecking.
* Update release notes.
* Remove MOVE Prelude directives in daml-prim.
* Use optional in damldoc options
* Update function hashes
* Compile base packages to json first
* Proof of concept : hlint/daml
* Copyright check is naieve
* Missing copyright
* Move hlint-testing out of compiler
fmt.sh tries to invoke hlint on the compiler directory. This then fails like,
```
2019-07-08T21:04:48.8037836Z $ hlint --git -j4
2019-07-08T21:04:48.9217137Z Couldn't find file: hlint-testing/data/HLint_QuickCheck.hs
2019-07-08T21:04:48.9277694Z UNEXPECTED HLINT FAILURE: The Bazel rules should have spotted this, please raise a GitHub issue
```
* Reformat
* This linting and formatting and so on is getting tiresome...
* Replace links with real files
* Strip the data directory
* Move files back under compiler/hlint-testing
* Copyright report_template.html so that format checks pass
* Calculate a hlint data directory path
* Whitespace and delete unneccessary file
* The format script uses this
* Use locateRunfiles
* Tweak record initialization formatting
* Reformat build file
Previously, we unconditionally assumed that GHC will only use those on
Enum-like types, i.e., types with only nullary constructors. This
assumption turns out to be incorrect so this PR introduces additional
checks.
* Move files in daml-foundations/daml-ghc to compiler/damlc
There is also a bit of refactoring going on to actually split things
apart into sensible targets. What is still missing is a cleanup of the
module hierarchy and a cleanup of the test targets but I’ll leave
those for separate PRs.
As a nice bonus, this also reduces dependencies between targets so it
will speed up compiles.
* Update .hie-bios
Previously we rewrote references to `PRSelf` to `PRImport` references
every time we call `initWorld`. However, we call `initWorld` quite
often (e.g. every time we run a scenario) while the packages that need
to be rewritten stay constant. Since rewriting the package references
requires traversing the whole package, this can be quite expensive.
This PR moves the rewriting of package references out of `initWorld`
and caches it as part of `GeneratePackageMap`.
On a large project where I tested this, this caused a drop in the
runtime of `daml test` from 250s to 200s. In the IDE this can also
make a pretty big difference since we call this everytime we run a
scenario which we do on every file change.
* check that submitter is in maintainers when looking up keys
Fixes#1866. Note that this limitation applies both for `lookupByKey`
and `fetchByKey` -- anything involving retrieving a key is affected.
* add UNTIL-LF to run tests up to a certain version of DAML-LF
* name targets for DAML tests better
* add notes about DAML-LF changes
* commit Test.daml with DAML-LF 1.5 rather than compiling it on the fly
* add scenario tests for #1866
* add warnings about future key behavior in docs
* use flag rather than version when executing
Most of them were caused by off-by-one errors in goto definition.
There was also one test that was marked as an expected failure but the
actual bug has been fixed for some time and the only reason it was
failing is that the error message was different than the test
expected.
I’ve also renamed daml-ghc-shake-test-ci to damlc-shake-tests which is
something that I might actually be able to remember :)
Previously, we only checked two diagnostics messages. However, the
second diagnostics messages does not actually need to correspond to
the latest change but can just be a message that has been in the queue
from one of the 1000 changes before. Now we make sure to actually
check all (or at least every second) diagnostic.
This was technically also an issue before but since we only emitted
diagnostics when they changed and we alternate between two states it
worked fine. The way we implement debouncing means that we can now
also end up emitting two consecutive diagnostics changes for the same
set of diagnostics which made this test flaky.
Given that we already made the max message size configurable it only
seems reasonable to also make the timeout configurable and on very
large projects, we do sometimes hit this.
Previously, we emitted diagnostics notifications as soon as we got
them. This resulted in a lot of flickering due to diagnostics getting
cleared briefly when typing only to immediately reappear.
Now, we buffer them for 0.1s so that a new event restoring the
same diagnostics for a slightly modified file will overwrite the
initial clear of diagnostics for the new document version.
* Split off addRelativeImport from modifying the session
* Switch located imports to adding their own relative imports
* Delete the unused getGhcDynFlags
* Make runGhcEnv no longer need to consult import paths
* Call runGhcEnv directly
* Move getSrcSpanInfos out to Spans
* Remove a redundant import
* Make findImports in Either rather than ExceptT
* Move getImports over to the right place
* Switch to liftEither
* Get rid of orphan usage in Convert
* Get rid of orphan usage in AtPoint
* Delete one entirely unused orphan
* Remove a comment that is no longer true
* Add a .gitignore just for the hie-core piece
* Add standalone pieces to make hie-core work with a global Cabal install
* Add more things to .gitignore, PR suggestion
* Add copyright header
* Allow shadowing of type variables in DAML and DAML-LF
We relax the DAML-LF type checker to allow for shadowing of type variables.
This does not need big changes since the substitution we use already avoids
name capture. The test for alpha equivalence converts to de Bruijn indices
on the fly and is hence not a problem either.
We inline type synonyms during the conversion from GHC Core to DAML-LF. This
requires alpha renaming. The cheapest way to get this, is to use the unique
names of type variables instead of their surface names.
This fixes#1915.
* Fix Scala test
* Relax memory constraints for bond-trading test
Previously we sometimes ended up declaring the expected exit of the
scenario service as an unexpected exit. This PR addresses this by
adding a new variable that we set to True before we ask the scenario
service to exit by closing stdin.
* Allow controlling the gRPC message limit via daml.yaml
We have had to raise that in the past since it caused issues on large
projects so it makes sense to make it configurable.
* Update unreleased.rst
Co-Authored-By: Beth Aitman <bethaitman@users.noreply.github.com>
* Fix running the IDE on damlc
There were two issues:
1. Missing include paths.
2. Files where the module name does not match the file name.
I’ve fixed both and added a test that we can load the damlc Main.hs.
* Update rules_haskell and static GHC
Remove patches that have been upstreamed or are no longer required.
Update still required patches to match the new rules_haskell version.
Previously we patched rules_haskell to coerce GHC into using static
Haskell libraries in most places. In particular we moved hs-libraries
entries into extra-libraries entries in the package configuration files.
A much cleaner approach is to compile GHC with a static RTS, then GHC
will by itself choose to load static Haskell libraries.
* Remove haskell_cc_import
* da-hs-daml-cli -> daml-cli
* da-hs-damlc-app -> damlc-app
* Push the suggestion work further up
* Make LspFuncs an argument to the handlers
* Actually pass around the contents of the buffer to suggestAction
* Make suggestAction do sensible figuring out if you remove the next line too
* Better indentation
* Code action to add GHC extensions as required
* Deal with extra arguments to LSP handler
* Add a code action
* Update comments
* Remove logging, since its too verbose
* Fix a few warnings, add a final case
* Add an example of what the code action matches
* Add more comments to shakeRun
* Delete the multiple versions of runActions, since they weren't used and parallel is good enough
* Delete runActionsSync entirely
* Make sure runAction returns even if shakeRun throws an exception
* Remove the callback from shakeRun - it was never used
* Fix one last use
* More comments
* Rename reportSeriousError to reportInternalError
* Stop using logError for logging things that are warnings to the user, not errors by us
* Rename logError
* Sort the log fields properly
* Delete tagAction from Logger
* Strip down the pure logger
* Delete unused pieces of the logger
* A quick check suggests the call stack will be useful in approximately none of the callers of logging, so just remove it
* When reporting an internal error, give as much detail as we can
* Change our logger to be based on Priority values
* HLint fixes
* Rename makeNopLogger
* In hie-core say what level of message you are setting
* Delete the unused makeOneLogger
* Make sure we can show messages floating around
* If a notification/response handler throws an exception, report it upwards
* Remove reportInternalError in favour of a general logging mechanism
* Add missing dependencies
* Just call fail for a dodgy error report
* Add a FIXME
* Make missing modules just an error
* Pull the CPP into a separate module
* Pass Nothing to indicate that a text buffer shoud just be used from disk
* Add save handlers, since the version changing to ModTime may have an impact
* Rename contents to mbContents in one place
* Change runCpp to take a Maybe StringBuffer and attempt to reuse the existing file, if it can
* Add a Bazel alias for hie-core
* Add notes about the sad path
* Avoid one use of filePathToUri
* Avoid another use of filePathToUri which went wrong for CPP output
* Normalize Uri's by replacing adjacent // with a single /
* Improve how CPP works if you have a modified buffer
* Move textToStringBuffer out to Util
* Switch to hPutStringBuffer which is in GHC 8.8
* Note why we are escaping to /
* Refactoring suggested by review
* Move the hie-core demo files around (they aren't really a demo anymore)
* Split the command line parsing into a separate module
* Give messages about how long starting something takes
* Make the interactive mode say what it is doing a bit more
* Add a --cwd flag to hie-core
* Take a list of files and directories for hie-core
* Update the readme to say how to test using hie-core
* Fix up the bazel file
* Add HLint exception
* specify the new fields for interning package IDs
* percolating intern tables
* crawl packages for package IDs as a pre-phase: generic prep
* stub case for interned_id in Scala packageref reader
* HasPackageRefs instances for the rest of the ast
* make intern table and use when encoding PackageRefs in v1
* don't need where
* stub out decode for interned package IDs
* no benefit to using uint32 instead of uint64
* percolate in encode one step
* interned case for decoding PackageRefs
* naming details
* intern table decoder
* finish propagating the intern table in encoder
* encode the package ID table
* document the vital assumption of encodeInternedPackageIds
* propagate the intern table through the LF decoder
- done by stacking ReaderT on top of Decode internally,
as discussed with @hurryabit
* daml-lf-proto requires mtl
* stub out interned case in Scala LF decoder
* stub interface decoder function
* get the interned table to most places in InterfaceReader
* support for interned package IDs in Scala decoder
* use ImmArraySeq instead of Vector for Scala intern decode table
* adding that ghc extension didn't make sense
* implement interned ID decoding for InterfaceReader
* scenario service won't have interned package IDs
* test the interned ID resolution in Scala by examining the proto -> AST in detail
* proper precondition for the dev phase of interned IDs testing
* better error reporting for malformed DALFs in intern test
* just import Data.Int
- suggested by @neil-da; thanks
* pass around the lookup function instead of the vector in decoder
- suggested by @neil-da; thanks
* remove derivations for types deleted in e63b012d2d
* rename VersionAware to EncodeCtx
- suggested by @hurryabit; thanks
* rename MDecode to MonadDecode
- suggested by @hurryabit; thanks
* pass a function through the encoder instead of a set
- based on suggestions by @hurryabit and @neil-da; thanks
* daml-ghc test that interned IDs are generated
- suggested by @hurryabit; thanks
* adapt to 5b480c99ec#1844
* Move mergeHandlers into Server
* Make partial handlers a proper newtype
* Pass the options in to runLanguageServer
* Take in user handlers
* Remove the code lens handler since we don't advertise it
* Add setSomethingModified, rather than faking it for the LSP VFS
* Rewrite the LSP notifications
* Improve the display of info messages around openning and modifying text documents
* Make sure stdout and stderr don't have buffering, so we see their output immediately
* Handle exit properly
* Make notifications forward on to their previous values
* Remove the exit handler, HIE already has a good default for it
* Add comments on FileStore
language: upgrades: dont derive generics for data types having the instances already
We only derive generic instances on the fly for data types that don't
have them already.
* Inline chunks of LSP.Server into LanguageServer
* Inline runServer
* Start figuring out a better API for gotoDefinition
* Remove old JIRA ticket numbers
* Add a hover handler in the new form
* Change the new handlers slightly
* Add a new module to handle notifications updating the virtual file system
* Rewrite the language server in hie-core to use the Handler more directly
* Add a cancel handler
* Ignore a few more handlers
* HLint
* REname functions that set handlers
* Rename a few more set handlers
* Delete the unused makeResponse
* Move mergeHandlers over to LanguageServer
* Rename RunHandler to WithMessage
* Switch from STM to IO
* Avoid the Protocol module
* Rename AddItem to Message
* Document why we use clientMsgChan
* Add comments around Message
* Delete unused package dependencies
* Eliminate the use of pretty
* Don't export some things that weren't necessary
* Add a missing dependency
* Avoid reexporting files of interest methods
* Put toIdeResult back
* add scenario Module decoding to Decode.OfPackage
* use purely data-driven decoding in scenario service in Scala
- decouples scenario service from LF decoder implementation
* make DecodeV1 companion private
* make extension to LFv2 more obvious
* Move prettyPosition over to a more sensible place
* Avoid some pretty printing
* Remove duplicate methods and switch to having a function to get the logger handle
* Remove unncessary bits of the logger
* Remove reportSeriousErrorDie - was unused
* Rename the Logger methods to Logger rather than Handle
* Delete the unique supply
* Decrease the use of getServiceEnv
* Move getIdeOptions inside Service
* Add getFilesOfInterest rule
* Hide the existence of Env
* Inline some redundant forwarding methods
* Add a FIXME for a dodgy function
* Delete some redundant imports
* Rename Map to HMap, since I need to use Data.Map too
* Make the Shake-specific Diagnostics functions into that module
* Delete errorDiag which was unused
* Inline the diagnostic function, since it had one user
* Add ofInterest rule as a separate module
* Sort the exposed modules
* Fix up the demo
* Make sure you add the OfInterestVar global
* HLint
* Get rid of some of interest stuff in other places
* Remove the OfInterest stuff from Service
* Delete LoadPackageResult, was unused
* Delete tmrOccEnvName from Compile
* Push orphan instances around a bit, avoiding some
* Make convertModule take an explicit filename to report against (since we have a good one in our hands)
* Get rid of GhcModule - only one field was ever used
* Collapse setVritualFileContents and removeVirtualFile into one
* Make the VFSHandle abstract
* Make it clear runGhcSession does not need IdeOptions
* Avoid passing around IdeOptions so much when they aren't required
* Get rid of runGhcSessionExcept
* Make catchSrcErrors be in Either, not ExceptT
* Don't import ExceptT qualified
* Don't import Exception qualified
* Rewrite and simplify computePackageDeps
* Delete the entirely unused reflow function
* Don't have Data.Text.Prettyprint.Doc.Syntax reexport stuff
* Move most of the pretty printing inside hie-core
* Get rid of the prettyprinter-syntax dependency from hie-core
* Get rid of prettyprinter-syntax, by collapsing the one definition into DA.Pretty
* Update the hie-bios commit SHA
* Also update the SHA in our bazel WORKSPACE
* Update the hash too
* Tutorial for Emacs integration
* Update hie-bios patch
My primary goal is to avoid confusion when starting to support DAML-LF's
enum types. I also think these types were never particularly useful,
although I introduced them myself...
* Move the span related functionality to one place
* Fuse docHeaders away
* Decouple AtPoint from the rest of the rule database, simplifying the dependencies
* Move the import related functionality to one place
* Move all the closely tied to GHC modules together
* Rename the Logger module
* Push the other module renames through the code base
* Rename Development.IDE.State to Development.IDE.Core
* Rename Functions.Compile to Core.Compile
* Fix up some module names
* Cut down on non-sensicle exports
* Don't worry about setting source - no one uses it
* Reorder the module header
* Give more sensible names to the diagnostic creating functions
* Use more appropriate diagnostic functions
* Simplify the internal diagnostic creations
* Rewrite the diagnostics to go direct, not via GHC error types
* Remove redundant dflags from some functions
* Make sure the warning vs error distinction remains
* Remove unnecessary extensions
* Make atPoint generate either haskell or daml syntax, depending on options
* Get rid of data HoverText
* Move VirtualResource out from hie-core
* Rename hie-core to the right name
* Drop Types.LSP, merge it into LSP.Protocol
* Remove orphans that aren't actually used in our code
* Delete redundant newlines
* Add a defaultIdeOptions function
* Move ideTryIOException over to its one user
* Delete unused exports
* Delete the ProjectDiagnostic newtype - the type index was always Key
* Don't reexport position information from Diagnostic
* Delete the unused bits from Location
* Delete unused stuff from getSrcSpan
* Move URL stuff into Location from Diagnostic
* Remove unnecessary CPP
* Remove unnecessary extension
* Change from stage being polymorphic to being a Text
* Fix up the test suite too
* Push the cleanup to the edges
* More dependencies
* Patch up the tests now they need to find the type signature inside a ```daml block
Previously, we got the package id by listing all packages and taking
the first. That is not a valid assumption and broke with a PR. This PR
changes the tests to use the DAR reader that we already used for
visualization (now factored into a separate library) and reads the
main dalf using that.
* Move IDE stress test to lsp-tests
* Lower timeout.
The test case takes < 3 seconds on my machine. The 180 seconds timeout
seems far too much.
* Data.Text.Extended -> Data.Text
Handle is kind of a mess at the moment, this is a first step towards
cleaning it up:
1. We had two functions called getDalfDependencies with one wrapping
the other. This PR merges them into one to make this less confusing.
2. buildDar called runAction a bunch of times directly and via other
functions. This PR switches it to use a single call to runAction.
3. The logic for turning a Maybe into an `ExceptT [FileDiagnostic]`
was duplicated in various places. This PR factor out the logic into a
single function.
There is certainly more cleanup to be done (e.g., I don’t think
ExceptT buys us anything here, that module should probably die
completely with the logic being moved to other modules, …) but I’d
like to do it incrementally.
Previously we had a weird mix of using ExceptT to shortcircuit on
failed dependencies where the list of diagnostics was always empty and
throwing BadDependency exceptions.
This PR switches everything over to use BadDependency for failed
dependencies and removes a lot of conversions from one style to the
other.
I find the current names very confusing and unintuitive.
I'm aware that there are other primitives called `TO_TEXT_X`. But there the
`X` is meant to be a type index to `TO_TEXT`. This doesn't make much sense in
the context of `TO_TEXT_CODE_POINTS` though since there's no type named
`CodePoints`.
Previously, we always reverted back to the table view when the
scenario results changed. This PR changes this to preserve the
selected view.
I’ve also tested that this does not break backwards compatibility: If
you use the newer extension with an older SDK, you will get the
previous behavior of reverting to the table view and you can still
switch by clicking on the button.
Fixes#1675
* Make runActions return Return as soon as results are available
Previously, we were waiting for all rules to finish, in particular the
ofInterestRule. That doesn’t really make any sense, e.g., a goto
definition request should not be waiting for all scenarios to run.
The next step will be to change the LSP side such that requests and
notifications are processed in parallel where possible.
* language: feature: initial implementation of a 'migrate' command
We add a 'migrate' command to daml assistant that generates a project
that allows to migrate contract instances from package1 to package2.
This first version reads both package1 and package2 from source. As a
next step we read only the dalfs from package1, because it might have
been created with a different compiler.
This is a temporary fix to unblock users that have run into this
limit. The long-term solution here is to use compression and/or make
the limit configurable.
* Add more package.json attributes
* Rename ide-demo to haskell-ide-core
* Change the default flags for the IDE
* Update the README with how to install things