Commit Graph

88 Commits

Author SHA1 Message Date
dylant-da
2216cd70aa
Fix missing import suggestions (#16944)
* Point to updated GHCIDE

* Add test for infix operator import code actions
2023-06-16 11:16:17 +00:00
dylant-da
6058070637
Remove daml visualize / damlc visual (#16901)
* Remove daml visualize / damlc visual

* fix redundant imports

* remove visual-web subtest
2023-05-30 10:50:36 +01:00
dylant-da
eb537914a4
Make scripts cancellable (#16588)
* Begin work on cancellable scenarios

* Stubs that pass typechecking, for bidirectional streams

* Place default value in running handlers

* Support start/stop requests

* switch script to scenario

* ScenarioServiceMain lint

* Fix nonexhaustive check

* Working but ugly

* Remove ugliness / print debugging

* lint

* Distinguish cancellation by timeout vs request, refactor ior

* lint

* Implement automatic cancellation of outdated scripts, and test

* lint

* Fix boolean blindness in script cancellation signal

* Add timeout & steps to script interrupt test case

* Add test case for hover resetting script progress

* Remove unused ReplacedByOtherThread datatype

* remove dead debugging print statements

* Improve semaphore code

* Turn handler structure into a Semigroup, handle multiple response error
2023-05-02 17:51:45 +00:00
Samuel Williams
67f87ad75f
Convert LSP tests (#16615)
* Convert lsp tests to scripts

* Tests are still flaky
2023-03-29 11:41:29 +01:00
dylant-da
c7ae5f1c93
Allow run tests manually (#16211)
* Add rules for running single scenarios, redefine RunScenario using them

* Turn runScenario into an action, not IO

* Add FormattingStarted custom message type

* Redefine OfInterest rule in terms of RunSingleScript

* lint

* fix broken renamed var

* Use getFilesOfInterest for diagnostics & uncompilable check

* explicitly run tests that need to be run

* Amend test

* Remove commented out code

* Remove vr formatting message
2023-02-02 17:59:11 +00:00
Gary Verhaegen
151e12b81a
bump copyright (#16002)
This is the result of:

- Updating `./COPY` to say `2023`.
- Running `./dev-env/bin/dade-copyright-headers update .`
2023-01-04 18:21:15 +01:00
Remy
d071e5e505
Remove TemplateOrInterface type class (#15347) 2022-11-15 09:44:51 +01:00
Moisés Ackerman
06892a4ae9
Clean up uses of locateRunfiles (#15446)
* Define DA.Bazel.Runfiles.locateResource as an alternative to locateRunfiles

* Use locateResource to get default dlint rules file

Fixes #15443

* Use locateResource to get scenario-service.jar

* Use locateResource to get ghc-pkg executable

* Use locateResource to get stable-packages directory

* Use locateResource to get ghcversion.h

* Use locateResource to get hpp executable

* Use locateResource to get builtin package dbs

* Drop unused function DA.Daml.Options.Types.getBaseDir

* Use locateResource to get d3{,plus}.min.js

* Use locateResource to get repl-service.jar

* data Resource now takes a runfilesPathPrefix instead of a runfilesPath

* Add hlint warning 'locateRunfiles/package_app'

* Let locateRunfiles crash when used outside of bazel target

* typo
2022-11-10 13:20:43 +01:00
Moisés Ackerman
8411a960b1
Daml Studio: Suggested type signatures no longer qualify HasField typeclass (#15106)
* Add test for typesignature.add codelens with HasField

* Reexport class HasField from DA.Internal.RebindableSyntax

* Update expected signature in test for typesignature.add codelens with HasField

changelog_begin
- [Daml Studio] Suggested type signatures no longer qualify HasField typeclass
  See `#13790 <https://github.com/digital-asset/daml/issues/13790>`__.
changelog_end

* Update expected error in RelTimeDetailsHidden1 daml-test-file
2022-09-28 10:38:32 +00:00
Moritz Kiefer
ea62021eaf
Upgrade ghcide (#12579)
* Upgrade ghcide

Spun out from the GHC 9 upgrade to make it easier to review. All
credit goes to Moisés.

changelog_begin
changelog_end

* .

changelog_begin
changelog_end

Co-authored-by: Moisés Ackerman <6054733+akrmn@users.noreply.github.com>
2022-01-26 16:00:20 +01:00
Gary Verhaegen
d2e2c21684
update copyright headers (#12240)
New year, new copyright, new expected unknown issues with various files
that won't be covered by the script and/or will be but shouldn't change.

I'll do the details on Jan 1, but would appreciate this being
preapproved so I can actually get it merged by then.

CHANGELOG_BEGIN
CHANGELOG_END
2022-01-03 16:36:51 +00:00
Moisés Ackerman
ba0c6c9841
Set --enable-scenarios to False by default (#12156)
* Set --enable-scenarios to False by default

changelog_begin
changelog_end

* Enable scenarios for shake test

* Add --enable-scenarios=yes for //compiler/lsp-tests

* Add enable_scenarios arg to rules_daml/daml.bzl helpers

* daml_compile
* daml_build_test
* daml_test

* Add enable_scenarios to ledger/test-common helper da_scala_dar_resources_library

* Add --enable-scenarios=yes for //ledger/test-common

* Remove unused scenario in //ledger/test-common PingPong test

* Add --enable-scenarios=yes for //daml-lf/tests

* Add --enable-scenarios=yes for //language-support/java tests

* Add --enable-scenarios=yes for group-chat example

* Add --enable-scenarios for //ledger/sandbox-perf LargeTransaction test

* Add --enable-scenarios=yes for //docs tests

* Add --enable-scenarios=yes for //daml-lf/scenario-interpreter tests

* format bazel

* Add --enable-scenario=yes for 'daml_doc_test's

* Add --enable-scenarios=yes for DamlDocTestIntegration

* Add --enable-scenarios=yes for DamlcTest

* Add --enable-scenarios=yes for Test/DataDependencies

* Add --enable-scenarios=yes for daml-ghc-deterministic.sh

* Add --enable-scenarios=yes for Test.IncrementalBuilds

* Add --enable-scenarios=yes for tests:memory-bond-trading and tests:memory-examples

* Add --enable-scenarios=yes for daml-assistant/integratio-tests
2021-12-20 19:31:06 +01:00
Moritz Kiefer
cde80df2c4
Mark lsp tests as flaky (#11958)
* Mark lsp tests as flaky

Not quite sure what is going wrong and doesn’t seem worth prioritizing
right now so marking them flaky again (they were marked flaky until a
few weeks ago).

changelog_begin
changelog_end

* .

changelog_begin
changelog_end
2021-12-03 07:42:52 +01:00
Moritz Kiefer
d8b92b7c99
Drop flaky marker from lsp-tests (#11442)
I can’t reproduce flakiness anymore. I suspect #11395 fixed it.

fixes #4904

changelog_begin
changelog_end
2021-10-28 12:21:01 +02:00
Moritz Kiefer
b1fed31ca4
Fix missing script results (#11395)
fixes #11007

changelog_begin

- [Daml Studio] Fix a bug where script results in Daml Studio
  sometimes do not show up.

changelog_end
2021-10-26 15:00:55 +02:00
Robin Krom
3115d104aa
daml script interfaces (#11124)
* interfaces: introduce TemplateOrInterface class in stdlib

The template typeclass is to strong for many applications. The new
constraint `TemplateOrInterface` only contains the methods to convert
contract IDs and choices.

CHANGELOG_BEGIN
CHANGELOG_END

* ghc-lib update, interface script tests

* pinned stackage on unix

* added missing implementation in preprocessor

* added test

* fixing tests

* remove Iface type

* pinned stackage windows

* make sure createAndExercise is not called on interfaces
2021-10-11 18:22:40 +02:00
Moritz Kiefer
8830eaa2ec
Drop controller can syntax from compiler tests (#10807)
You definitely want to review this with whitespace disabled.

changelog_begin
changelog_end
2021-09-08 15:28:09 +02:00
Moritz Kiefer
fa80f1b615
Bump ghcide and upgrade to lsp/lsp-types (#10139)
* Bump ghcide and upgrade to lsp/lsp-types

changelog_begin
changelog_end

* Bump rev

changelog_begin
changelog_end
2021-06-30 12:16:12 +00:00
Remy
a6b536f3c4
Compiler: Make LF 1.13 the default output (#9907)
* Compiler: Roll LF Version

Fix #8591

CHANGELOG_BEGIN
- [Compiler] Default ouput LF version is now 1.13
CHANGELOG_END
2021-06-24 11:58:50 +02:00
Robin Krom
e79966b890
ghcide: cached goto definitions (#8751)
We update ghcide, which enables cached goto definitions that keep
working when the document doesn't compile anymore. This also adds a test
to lsp-tests for this feature.

CHANGELOG_BEGIN
CHANGELOG_END
2021-02-04 21:05:12 +01:00
Robin Krom
6bb76bda58
lsp-tests: test for no internal symbols (#8708)
This updates the daml-ghcide dependency and also adds a test to check
that we are not showing any internal symbols and dependencies in the
outline in daml studio.

CHANGELOG_BEGIN
CHANGELOG_END
2021-02-02 11:28:22 +01:00
Robin Krom
5c5c2527a2
lsp-tests: test for no internal imports (#8699)
We add a test to check that there are no internal imports returned by
the `getDocumentSymbols` endpoint for an empty module.

CHANGELOG_BEGIN
CHANGELOG_END
2021-01-29 22:17:21 +01:00
Moritz Kiefer
e0c5abd647
Switch to GHC 8.10.3 (#8394)
* Switch to GHC 8.10.3

changelog_begin
changelog_end

* Update bazel-haskell-deps.bzl

Co-authored-by: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>

* Comment on rules_haskell patch

changelog_begin
changelog_end

* .

changelog_begin
changelog_end

Co-authored-by: Andreas Herrmann <42969706+aherrmann-da@users.noreply.github.com>
2021-01-25 11:53:53 +00:00
Gary Verhaegen
a925f0174c
update copyright notices for 2021 (#8257)
* update copyright notices for 2021

To be merged on 2021-01-01.

CHANGELOG_BEGIN
CHANGELOG_END

* patch-bazel-windows & da-ghc-lib
2021-01-01 19:49:51 +01:00
Sofia Faro
e9cd92f061
Deprecate the "daml 1.2" version header. (#7513)
* changelog_begin

- [DAML] The "daml 1.2" version header is now deprecated.

changelog_end

* fix some line numbers

* fix some more locations
2020-09-29 13:14:59 +00:00
Sofia Faro
220cfc5c79
Disable multipackage LSP tests on Windows. (#7360)
* Disable multi-package lsp-tests on windows.

These are consistently timing out on Windows for unknown reasons.
Disabling until we figure out how to fix the tests. See #4904

changelog_begin
changelog_end

* fix definition
2020-09-09 12:50:30 +00:00
Andreas Herrmann
d937a5ebad
Track source locations on Daml.Script.submit (#7252)
* Track source locations on Daml.Script.submit

Adds a `HasCallStack` constraint on `HasSubmit.submit` and
`HasSubmit.submitMustfail`.

We need to move the definition of `HasCallStack` to `GHC.Stack.Types` to
avoid a cyclic dependency between `DA.Stack` and `DA.Internal.LF`.
Alternatively, we could inline `HasCallStack` in `DA.Internal.LF` but it
seems preferable to use the alias on the signature of
`submit(MustFail)`.

We need to adapt the type of the builtins for scenario `submit` and
`submitMustfail`.

changelog_begin
changelog_end

* Test-case for scenario/script source locations

* Test second commit with intermediate definition

Addressing review comment
https://github.com/digital-asset/daml/pull/7252/files#r478518834

* Store the full callstack on submit

For forwards compatibility.

Addressing review comment
https://github.com/digital-asset/daml/pull/7252/files#r478520268

* Document unused location definition

Addressing review commit
https://github.com/digital-asset/daml/pull/7252/files#r478522373

* Make user facing `SrcLoc` zero based

Following LSP precedent rather than GHC

Addressing review comment
https://github.com/digital-asset/daml/pull/7252/files#r478529138

* Add comment for backwards compatibility code

Addressing review comment
https://github.com/digital-asset/daml/pull/7252/files#r478529138

* fmt

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-08-28 12:22:15 +00:00
Andreas Herrmann
b812f09da9
Disable lsp-tests script tests on Windows (#7235)
The similar scenario tests are also disabled on Windows and the script
tests are flaky on Windows due to timeouts.

changelog_begin
changelog_end

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-08-26 07:56:12 +00:00
Moritz Kiefer
d33e130f47
Enable DAML Script service by default and document it (#7229)
* Enable DAML Script service by default and document it

fixes #7193

changelog_begin

- [DAML Script] DAML Scripts are now run in DAML Studio just like
  scenarios. The functionality for inspecting the results is
  identical. If you encounter issues, please report them.

changelog_end

* fix double "is identical"

changelog_begin
changelog_end
2020-08-25 19:53:59 +02:00
Andreas Herrmann
9f2367f6cc
IDE distinguish scripts and scenarios (#7197)
* IDE distinguish scripts and scenarios

The code lens above DAML script definitions now reads `Script results`
instead of `Scenario results`.

This also adds DAML Script test cases to the lsp-tests.

The functionality for testing scenario and script code-lenses in the
`Utils` module is identical. However, this adds dedicated definitions
for scripts to clearly distinguish the scenario and script test-cases.

changelog_begin
changelog_end

* Add sum type to distinguish Scenario and Script

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
2020-08-20 16:36:23 +00:00
Moritz Kiefer
75eb554841
Prefix IDE include paths with project root (#6463)
* Prefix IDE include paths with project root

As described in #6174, `--include` is broken pretty badly in the IDE
atm. LSP works based on absolute file paths so if you have a relative
include dir you run into two issues:

1. You end up with two GHC sessions e.g, one for `/multidir` and one
   for `.`. That results in fun type errors like “Couldn’t match expected
   type `Text` with actual type `Text`”.
2. The same file can end up being represented twice. Apart from being
   horribly inefficient, this breaks as soon as we try to build a DALF
   since the function for constructing that (correctly) explodes when
   there are two files with the same module name.

This change does not break `daml build` since the project root is
relative there.

fixes #6174

changelog_begin

- [DAML Studio] Fix an issue where use of the `--include` option
  resulted in various confusing type errors. See
  https://github.com/digital-asset/daml/issues/6174

changelog_end

* Stop wasting my time hlint

changelog_begin
changelog_end
2020-06-23 16:58:14 +02:00
Moritz Kiefer
c0e28d83ee
Turn warnings for module name/record name mismatches into errors (#5266)
* Turn warnings for module name/record name mismatches into errors

The module name warning existed for ages. We started warning about the
record name mismatch in 0.13.55 so I’d like to turn it into an error
before 1.0

changelog_begin

- [DAML Compiler] File names must now match up with module names. This
  already produced a warning in previous releases.

- [DAML Compiler] It is now an error to define a record with a single
  constructor where the constructor does not match the type
  name. To fix the error you need to change ```data X = Y { … }``` to
  ```data X = X { … }```.  This restriction only applies to
  single-constructor records. Variants and enums are not affected.
  This already produced a warning in 0.13.55.

changelog_end

* Fix integration tests

* Fix docs

* Fix lsp tests
2020-03-30 10:21:53 +00:00
Gary Verhaegen
1872c668a5
replace DAML Authors with DA in copyright headers (#5228)
Change requested by Manoj.

CHANGELOG_BEGIN
CHANGELOG_END
2020-03-27 01:26:10 +01:00
Moritz Kiefer
aa48f3026e
Bump ghcide (#5128)
This PR bumps ghcide, haskell-lsp and haskell-lsp-types. There aren’t
really any important changes in ghcide itself but the haskell-lsp
update includes my fix for crashing completions.

One change in ghcide itself is that NormalizedFilePath got moved to
haskell-lsp. ghcide needs special treatment for empty file paths so we
use `toNormalizedFilePath'` from ghcide instead of
`toNormalizedFilePath` from `haskell-lsp`. I’ve added an hlint rule to
enforce this.

changelog_begin
changelog_end
2020-03-23 12:09:36 +00:00
Shayne Fletcher
2525a4610a
Update hlint (#5123)
changelog_begin
changelog_end
2020-03-22 16:30:11 +00:00
Moritz Kiefer
be7f0802c6
Bump ghcide (#5103)
This includes some completion improvements.

changelog_begin
changelog_end
2020-03-20 16:43:59 +00:00
Moritz Kiefer
58c101c3ab
Mark lsp tests as flaky on Windows (#4906)
:sadpanda:

changelog_begin
changelog_end
2020-03-09 16:53:36 +01:00
Moritz Kiefer
cc4f1430fb
Fix flaky lsp tests (#4541)
I’ve failed to reproduce this locally so far but on CI we sometimes
get the DLint warning that `True == True` is redundant before we get the
parse error which results in the tests failing. There is no reason why
we need to use `True == True` here anyway so the fix is to simply
replace it by `True`.

changelog_begin
changelog_end
2020-02-17 12:50:53 +01:00
Moritz Kiefer
4e3cad411b
Extend LSP multi-package tests (#4481)
This adds a test for running the LSP server directly in the project
directory to make sure that we do not need to build first in that case
and that no --package flags are necessary.

changelog_begin
changelog_end
2020-02-12 10:21:01 +01:00
Moritz Kiefer
1dc40ca239
Support multiple-packages in damlc ide (#4445)
* Support multiple-packages in `damlc ide`

changelog_begin

- [DAML Studio] You can now open DAML Studio in the root of a
  multi-package project instead of opening it separately for each
  package. Take a look at the documentation for details on how to set
  this up.

changelog_end

There are a few caveats here:

1. You need a ``daml.yaml`` in the root of your project directory. I
think this is somewhat sensible but we should add a warning to VSCode
if you open it in a directory that does not have a ``daml.yaml`` (in a
separate PR).

2. Changes are not picked up accross dependencies. This is a larger
undertaking and given the current setup simply impossible (we don’t
know that the source files of one package belong to the DAR referenced
in the ``dependencies`` field of the other package. We can make this a
bit better by at least detecting that the ``.dar`` has changed but
let’s do that separately.

3. Since ``daml init`` runs once on startup, it will run in the root
directory instead of initializing the package db of the individual
packages. This is fixable but will conflict with #4391 so let’s
address this separately.

I’ve added docs to the daml studio section that explain the caveats.

* Use the proper sdk version in lsp-tests
2020-02-10 12:20:56 +00:00
Moritz Kiefer
52d4f60aec
Switch to ghcide 0.1.0 (#4381)
* Switch to ghcide 0.1.0

changelog_begin
changelog_end

* Bump hie-bios
2020-02-04 18:40:43 +01:00
Moritz Kiefer
93d7b1a472 Bump ghcide to fix GHC panics in LSP tests (#4176)
fixes #4152

changelog_begin
changelog_end
2020-01-24 08:40:57 +00:00
Moritz Kiefer
57d0e32c3e
Mark lsp-tests as flaky (#4158)
This makes me a :sadpanda: but until we have figured out what is going
on, this seems better than forcing manual restarts.

changelog_begin
changelog_end
2020-01-22 16:55:44 +01:00
Moritz Kiefer
74d12ce39a Bump ghcide to include bugfix (#4074)
* Bump ghcide to include bugfix

This includes a fix for a bug in completions which we introduced in
the latest ghcide bump which in turn broke the DAML IDE completely.

changelog_begin

- [DAML Studio] Fix a bug in completions that caused DAML Studio to
stop responding after the first completion was requested.

changelog_end

* Use ghcide from master branch and simplify test
2020-01-16 18:38:58 +00:00
Moritz Kiefer
42c586f8d4
Bump ghcide (#3943)
* Bump ghcide

* Fix ghcide build

* Include bugfix for Windows
2020-01-04 07:51:51 +01: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
d675156e2c
Bump ghcide to fix flakiness in LSP tests (#3813)
fixes #3821

see https://github.com/digital-asset/ghcide/pull/235 for the actual
fix, I’ll change the commit before merging.
2019-12-12 17:11:35 +01:00
Moritz Kiefer
d6bf6f6c04 Mark lsp tests flaky (#3818) 2019-12-11 14:10:48 +00:00
Andreas Herrmann
f4d0eb636e Replace Hazel by stack_snapshot (#2743)
* Unmangled libz.so and libbz2.so

* Use stack_snapshot instead of Hazel

* Remove Hazel

* Define stack_snapshot

* Update rules_haskell

* Document stack_snapshot

* Clean stack's lock file from aborted builds
2019-11-22 14:24:08 +00:00
Moritz Kiefer
8615266230 Switch the default DAML-LF version to 1.7 (#3530) 2019-11-19 19:18:07 +00:00