Commit Graph

77 Commits

Author SHA1 Message Date
Shayne Fletcher
b1a3be5950
copyDirectory, mvDirectory - daml-project-config -> da-hs-base (#4697)
changelog_begin
changelog_end
2020-02-25 14:57:06 -05:00
Moritz Kiefer
8d81399c0f
Add an experimental DAML script REPL (#4660)
As mentioned in the title, this is still very experimental and needs
more work before we want to advertise it. However, the code is in a
somewhat reasonable shape, there are tests and I think even in the
current state it is already useful. Also this PR is already getting
very large so I don’t want to hold off much longer before merging this.

It is included in the SDK but hidden from `damlc --help` and `daml
--help` until the most pressing issues are addressed (primarily around
making sure that it doesn’t just shut down if you have a type error
and better error messages in general).

changelog_begin
changelog_end
2020-02-24 11:06:27 +01:00
Moritz Kiefer
64dbc52d43
Remove telemetry batching (#4644)
This was initially done as an optimization but now that we’ve used
telemetry for a while this hasn’t really been necessary and we’ve
spend way more time on people being confused by the fact that
telemetry messages are only flushed on shutdown.

Furthermore, I’m also slighlty worried that flushing the telemetry
messages on shutdown might go wrong on Windows given that everything
there seems to insist on hard-killing proesses.

changelog_begin
changelog_end
2020-02-21 10:46:56 +01:00
Moritz Kiefer
4147f24ab8
Fall back on the builtin SDK version in damlc telemetry (#4595)
We have seen a few telemetry messages with the SDK version set to
`null` which is obviously not very useful. I suspect this is probably
because some users invoke damlc directly. This change is backwards
compatible since the ToJSON instance does encode `version = Just "x"` as
`"version" = "x"` and version = Nothing as `version = null`.

changelog_begin
changelog_end
2020-02-19 10:10:03 +00:00
associahedron
d9cb5099de
A first draft at telemetry for daml-assistant. (#4506)
* Report assistant commands and errors via a logger.

CHANGELOG_BEGIN
CHANGELOG_END

* Hook up daml-assistant to a GCP logger.

* fix test case

* fix more tests

* Check opted in status in assistant.

* Anonimize args that have unexpected characters.

* More agressive anonimization

* add missing containers dependency
2020-02-14 15:46:25 +00:00
Moritz Kiefer
4582ef7060
Extend telemetry data to log when users ignored the telemetry popup (#4403)
Previously, we did not send any message when users simply clicked away
the telemetry popup. Now we send a special message similar to the
opt-out message which only includes the machine id.

I’ve also changed the opt-out message to include the machine id.

changelog_begin
changelog_end
2020-02-05 14:14:48 +01:00
Moritz Kiefer
5a1a2301c6
Shut down when stdin is closed. (#4365)
* Shut down when stdin is closed.

changelog_begin

- [DAML Assistant] The DAML assistant will now shut down long-running
  processes like sandbox when stdin is
  closed. This is mainly useful on Windows, where process APIs often
  kill the process in a way that does not allow it to do any cleanup, in
  particular, we cannot stop child processes.

changelog_end

For now, the logic for this is only in daml-helper which is the only
thing starting long-running processes (in particular sandbox). There
is a long inline-comment explaining why this is not on the assistant
itself.

fixes #4168
2020-02-04 14:34:34 +01:00
associahedron
d9220c6819 damldocs: Refactoring DA.Daml.Doc.Extract (#4112)
* Refactor damldocs

* Refactor damldocs.

changelog_begin
changelog_end

* More refactoring

* Update copyright headers.

* Add export list for Templates

* Add export list to .Util

* added a little ^
2020-01-20 16:17:25 +00:00
associahedron
e055ad8038 daml-assistant: Install bash completion scripts on Linux and Mac. (#3946)
* Improve bash completions for daml-assistant.

* Install bash completion script automatically

* Better default logic for bash completions

* specifically -> explicitly

* Copyright headers

* Better hook logic and refactoring

* Handle non-standard installations more robustly.

* Handle CI env & add changelog note.

CHANGELOG_BEGIN

- [DAML Assistant] Bash completions for the DAML assistant are now
available via ``daml install``. These will be installed automatically
on Linux and Mac. If you use bash and have bash completions installed,
these bash completions let you use the tab key to autocomplete
many DAML Assistant commands, such as ``daml install`` and
``daml version``.

CHANGELOG_END

* Mention bash completion in assistant docs

* Remove promises
2020-01-06 15:51:32 +00:00
Gary Verhaegen
878429e3bf
update copyright notices to 2020 (#3939)
copyright update 2020

* update template
* run script: `dade-copyright-headers update .`
* update script
* manual adjustments
* exclude frozen proto files from further header checks (by adding NO_AUTO_COPYRIGHT files)
2020-01-02 21:21:13 +01:00
Moritz Kiefer
c48b0ee289 Move Any wrappers and Archive to stable packages (#3890)
* Move Any wrappers and Archive to stable packages

There are no actual API or functionality changes in this PR but the
logic for locating the stable packages has slightly changed since the
Any wrappers package only makes sense for LF 1.7. To address this, we
simply filter out stable packages for newer LF versions since it
doesn’t make sense to depend on those anyway.

CHANGELOG_BEGIN

- [DAML Compiler] Move ``Archive`` type to a separate DALF.

CHANGELOG_END

* More comments

* Fix java codegen tests

* fix more tests

* Force cache reset on Windows

* Revert "Force cache reset on Windows"

This reverts commit 9f2b7d70b2.
2019-12-19 01:26:38 +00:00
Rohan Jacob-Rao
68a35cb055 Map Telemetry severity level to NOTICE so GCP doesn't reject messages (#3282) 2019-11-01 18:34:13 +00:00
Rohan Jacob-Rao
00fc6bf100 Log when user views scenario results (#3271)
* Extend Priority type with Telemetry value

* Include Telemetry logging level in logger

* Log viewing of scenario results

* Update ghcide with telemetry logging level
2019-10-28 23:42:20 +00:00
Moritz Kiefer
9decc6b25f Fix getSrcRoot for A/B.daml (#2989)
Previuosly we would return A for module A.B in A/B.daml which resulted
in us including /B.daml in the DAR instead of /A/B.daml.
2019-09-24 00:31:52 +00:00
Andreas Herrmann
ed39800a9f Rename hazel_deps to hackage_deps (#2789)
* hazel_deps --> hackage_deps

Mechanical change:

```
sed -i 's/hazel_deps/hackage_deps/g' $(ag -l hazel_deps)
```

* Hazel dependencies --> Hackage dependencies
2019-09-06 09:01:09 +00:00
Robin Krom
7fca591df0
replace main file with a pointer to the source root (#2687)
* language: compile everything in the source directory

This removes the need to specify a 'main'. Instead we 'source' in
daml.yaml should point to the source root directory.
2019-08-29 13:42:33 +02:00
Moritz Kiefer
0e777d9fc8 Delete obsolete proto3-suite patch (#2601)
* Delete obsolete proto3-suite patch

My patch has been upstreamed so no need to keep it around in our repo.

* Upgrade proto3-wire

* Adapt to changes in proto3-suite
2019-08-20 10:17:26 +00:00
Martin Huschenbett
4a952d59ea Make the detail level of damlc inspect configurable (#2498)
Add a command line option to `damlc inspect` which allows for configuring the
details level of the pretty printed DAML-LF. Right now the only difference is
that levels bigger than 0 print all location information. Level 0, which is
the default, also prints location information top level declarations.

This feature is useful for debugging location information.
2019-08-14 07:54:20 +00:00
Gary Verhaegen
99ea93168d
update copyright notices (#2499) 2019-08-13 17:23:03 +01:00
Andreas Herrmann
a1c21d9829
Update rules haskell (#2509)
* update rules_haskell

* adapt rules_haskell patches

* io_tweag_rules_haskell --> rules_haskell

* io_tweag_rules_haskell --> rules_haskell

* haskell:haskell.bzl --> haskell:defs.bzl

* rules_haskell_dependencies
2019-08-13 16:46:31 +02:00
Martin Huschenbett
4d0a62801c Fix pretty printing of empty annotations in DAML-LF AST (#2453)
For example, we print two spaces if there's no annotation between `def` and
the function. This PR fixes this by using the `empty` document instead of the
document containing the empty string. (Please don't ask me why they are
different.)
2019-08-08 12:11:56 +00:00
Moritz Kiefer
50a04397e4
Supporting producing sdist tarballs for the HS ledger bindings (#2336)
* Supporting producing sdist tarballs for the HS ledger bindings

The README.md has an explanation for how you can use this.

This should hopefully allow others to experiment with the bindings.
2019-07-30 14:34:16 +02:00
nickchapman-da
b90862ebec
improve haskell module hierarchy to be more consistent (#2319) 2019-07-29 15:55:55 +01:00
Moritz Kiefer
da9fb464db Improve debugging output (#2281)
* Improve debugging output

Displaying the exception makes it easier to figure out what is going
wrong.

I’ve also added a HasCallStack constraint to `locateRunfiles` since it
looked like that was failing. Turned out to be a call to `create` that
didn’t go via `locateRunfiles` but I think it’s useful either way.
Should be more useful with https://github.com/tweag/rules_haskell/pull/1007

* Update compiler/hie-core/src/Development/IDE/Core/Shake.hs

Co-Authored-By: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>
2019-07-25 10:33:57 +00:00
nickchapman-da
b30228ab95
{-# LANGUAGE OverloadedStrings #-} is now on by default (#2270) 2019-07-24 08:09:26 +01:00
Andreas Herrmann
63b46304eb
Base DA.Bazel.Runfiles on bazel-runfiles (#2147)
* DA.Bazel.Runfiles based on bazel-runfiles

* locateRunfilesMb -> locateRunfiles

* .exe extension on Windows

* Add docstring to locateRunfiles

* bazel-runfiles: Normalize on Windows
2019-07-17 09:48:44 +02:00
Moritz Kiefer
8b4d8872f0 s/save/safe/ (#2107) 2019-07-11 16:57:58 +00:00
Moritz Kiefer
1083b23fc0
Use a separate thread for sending GCP log messages (#2102)
Apart from simplifying the code, this should also make startup
significantly faster in some cases, e.g., when the initial log request
times out.
2019-07-11 13:19:02 +02:00
Moritz Kiefer
c3531ca815 Refactor GCP logging (#2089) 2019-07-10 13:08:24 +00:00
Moritz Kiefer
75ea177e87
Run exception handlers on SIGTERM in daml assistant (#2069) 2019-07-09 15:44:09 +02:00
Moritz Kiefer
2371d173b1
Move all damlc tests to compiler/damlc/tests (#2057)
I’ve also changed some of the names to be more sensible.
2019-07-09 13:38:58 +02:00
Neil Mitchell
ac4272edc5
hie-core Logging and exceptions (#1933)
* 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
2019-06-28 12:47:45 +01:00
Neil Mitchell
ee3b62c380
Clean up the logging in hie-core (#1839)
* 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
2019-06-24 12:46:51 +01:00
Neil Mitchell
282f8b4432 Delete prettyprinter-syntax (#1829)
* 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
2019-06-24 08:00:42 +01:00
Fran
728c1c9204
Implement daml install --install-assistant flag. (#1761)
* Add --install-assistant option

* Better doc on iActivate

* Determine whether to install assistant based on new flag

* Fix logic and update install warning

* Remove --activate from install.sh

* Add missing ]

* Change deprecation warning.

* Add release notes for new option.

* Update help text for install-assistant

* Fix release notes
2019-06-19 14:00:13 +01:00
Neil Mitchell
1a55df1abc
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
DavidM-D
10f0e92d1b
Added a small readme for importing GCP data (#1616) 2019-06-13 17:58:42 +02:00
Moritz Kiefer
c5a1212ecc 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
38f3b99d9a
Remove Data.Aeson.TH.Extended (#1635)
The only remaining user is DA.Daml.GHC.DamlDoc.Types and I replaced
that by Generics based deriving. The instances should produce
identical output.
2019-06-13 14:26:04 +02:00
Moritz Kiefer
8029080fc7
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
Moritz Kiefer
4537a936dc
Avoid errors due to unhandled requests in VSCode (#1538) 2019-06-06 14:44:42 +02:00
Moritz Kiefer
217c56d072
Add an option to the IDE to disable the scenario service (#1522)
* Add an option to the IDE to disable the scenario service

This is useful for several reasons:

1. We currently have to disable all tests using the scenario service
on Windows since they are extremely flaky due to issues we haven’t
been able to solve so far. This allows us to run at least a subset of
tests on CI.

2. The LSP tests currently start a new instance of damlc for each
test (we might want to revisit this but it seems to be sufficiently
fast so far) and not starting the scenario service allows us to speed
things up a bit.

3. On large projects, this could be useful to avoid having the IDE use
up even more memory and speed things up a bit. However, this PR does
not yet expose this in a convenient way so there is more work to be
done (in separate PRs) to make that a viable option.

* Fix LSP tests on Windows
2019-06-06 12:06:07 +02:00
Moritz Kiefer
9689f00e58
Initial boilerplate for an LSP-based test suite (#1516)
This needs more work but I’d like to get the initial boilerplate in
first. We will also have to make some changes to lsp-test and expand
it in various ways but those should hopefully be upstreamable.
2019-06-04 20:48:18 +02:00
Moritz Kiefer
e400bc7eb8
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
96fda7f4a0
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
Moritz Kiefer
d4ccf0af75
Handle exceptions when sending logOptOut messages (#1492)
We already do this for all other log messages and it makes sense to do
it for the opt out message as well.

This should fix #1487.
2019-06-03 15:09:54 +02:00
Moritz Kiefer
d438616521
Remove unused LSP code (#1471)
Now that we use haskell-lsp for most things, we can klil
da-hs-json-rpc completely and most of da-hs-language-server as well.
2019-05-31 14:42:24 +02:00
Moritz Kiefer
6467a3b5a4
Switch to using haskell-lsp for IO (#1466)
* Switch to using haskell-lsp for IO

I’ve tried to keep this as small as possible for review so this PR
does not attempt to remove a lot of the things that are now unused.

There is also still a compatibility layer in place to avoid changing
too many things at once.

I tested this in the IDE on Linux and Windows and diagnostics,
scenario results, hover, goto definition all seem to work as expected.
2019-05-31 13:53:16 +02:00
Moritz Kiefer
df674c5569
Move DA.LanguageServer.Protocol to haskell-lsp-types (#1437)
There are still a few types left over that I will replace in separate PRs.
2019-05-28 20:45:29 +02:00
A. F. Mota
2329b1b97a
Display warnings in daml build. (#1375)
* Display warnings in daml build.

* Prevent errors from showing twice.

* Use flagYesNoAuto for scenario service.
2019-05-24 14:36:48 +02:00