* 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
* 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>
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>
* 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
* 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>
* 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
* 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
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
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
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
* 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
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
* 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
Previously we opened file FooX before FooX+1 which we import from FooX
so there is a race condition if we try to resolve imports in FooX fast
enough. Now we open them in reverse order to fix this.
The other option would be to write all files to disk before opening
them but given that we can easily avoid this here, I’d rather keep
things in memory.
* Rename hie-core to ghcide
The name `hie-core` has caused a lot of confusion as to how we relate
to haskell-ide-engine so changing it should hopefully help with that.
I also think that ghcide is still a good name once we hopefully
integrate with haskell-ide-engine more closely.
The name ghcide seems to have a reasonable amount of support on
Twitter https://twitter.com/ndm_haskell/status/1170681262987710464
which is of course the only good way to come up with names.
* Add a readme that points people to the new directory.
* Fix bogus replacements
* Use a proper link
* links are hard
* Adding more info to dor
* Adding fields to the graph
* Spelling mistakes and params
* Removing single line function
* Moving the duplicated code
* Revert "Moving the duplicated code"
This reverts commit 520b5d9b0d.
* Adding more structure to graph
* Working tests with graph which is more easy to understand and change.
have few more tests to migrate
* Adding edge details
* One more to go
* Adding more verbose field information
* All tests now tests the fields that are being added
* Removing unused Import
* defined not refined
* Unused imports
* Names need to be consitent
* Acutal and Expected, not expected and expected
* Removing unused export
* Lints
* daml visualize with lsp
* Working command execution with ide
* Have to call visual now
* Split function
* Wrong constuctions of world or the module
* Working almost
* Have to gather all modules
* Now works end to end. Considers all the daml files in workspace
* removing unused code
* removing unused dependency
* Removing unused JS code and better error message
* Function re-arrange
* Removing us of heaad, instead handling error
* Format and rearranging
* Removing unused assignment
* Formating everything
* missed dependency
* Generating visual only for the file that is open
* Using modules from generated pkg, error messages
* Bringing back the commands
* Names and formating
* consitent error message
* Removing Just pattern match using _use now
* package
* Moving visual to a different module
* Function simple
* Removing Rule as it increases memeory consumption
* TODO LSP error
* White space
* Fmt things
* Handling if command was executed for a non daml files
* Better error message
* debugging
* Fix executeCommand
* Adding tests to execute command. Thanks moritz
* Unwanted lines
* Spaces and comment
* 3rd time ?
* Spaces are white
* assert equal instead of assert bool
* Only report progress when client supports it
This fixes an issue that some people encountered when running hie-core
in Emacs with a version of haskell-lsp that does not understand
progress events.
* Fix tests
* More test fixes
* Upgrade haskell-lsp and lsp-test
There have been some fixes upstream that should hopefully mean that we
no longer need to mark the lsp-tests as flaky on Windows. I am having
trouble reproducing the flakiness locally, so let’s see what happens
on CI.
* Also bump stack.yaml
* Support depending on potentially stale values in damlc
For now, this is opt-in and only enabled for the scenario service.
Locations should be properly mapped so if lines are inserted above a
scenario, the scenario link will move down.
* hie-core/test: Dedicated test suite for hie-core
* Apply hlint suggestion
Use System.Environment.Blank's setEnv which has a non-overwrite mode
that implements precisely what we were doing with more code before.
* buildifier fixes
* hie-core-exe works on Windows now - ghc-paths was fixed
* DA.Bazel.Runfiles based on bazel-runfiles
* locateRunfilesMb -> locateRunfiles
* .exe extension on Windows
* Add docstring to locateRunfiles
* bazel-runfiles: Normalize on Windows
* Get draft rule in
* Hlint is now firing
* First hlint unit test
* This gets hlint working in the ide
* Select hlint.yaml contextually. Wip
* Fix prod path
* Switch between prod and test versions of hlint.yaml
* Format
* Ignore hlint hints in the language tests
* Add some debugging stuff. LSP stress test is broken
* Update compiler/damlc/daml-ide-core/src/Development/IDE/Core/Rules/Daml.hs
Co-Authored-By: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
* Tidy up some details
* Simplify settings (remove unused parseFlags)
* Fix LSP stress tests
* ./fmt.sh
* Collapse to one hlint.yaml, provide options
* Fix location of hlint runfiles
* Disable hlint by default; enable for shake-ide tests
* lint (ironic)
* Remove filtering of lints from integration test
* ./fmt.sh
* Respect the flag
* Silence opininated lint
* Update compiler/damlc/daml-opts/daml-opts-types/DA/Daml/Options/Types.hs
Co-Authored-By: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
* Update compiler/damlc/lib/DA/Cli/Damlc.hs
Co-Authored-By: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
* I really did mean optHlintEnable here
* Move hlint enabled check to ofInterest like shouldRunScenarios
* Rename variable
* Cache settings
* Missed a merge conflict
* lift liftIO
* Remove the hlint-testing POC
* use useNoFile_
* 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
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.
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.