Commit Graph

3633 Commits

Author SHA1 Message Date
soulomoon
0d0ec1e0b4
Migrate ClientSettingsTests (#4258) 2024-05-28 10:03:06 +00:00
soulomoon
4ebe191148
Enable cabal flaky test (#4263) 2024-05-28 10:41:10 +02:00
soulomoon
838a51f761
Refactor hls-test-util and reduce getCurrentDirectory after initilization (#4231)
What's done
* [x] Refactor the `runSession*` family function, properly add `TestConfig`, `runSessionWithTestConfig`, as the most generic `runSession*` function.
* [x] remove raraly used variants of `runSession*` functions and replaced by `runSessionWithTestConfig`. 
* [x] migrate `ExceptionTests ClientSettingsTests CodeLensTests CPPTests CradleTests` to use the `hls-test-utils`
* [x] Only shift to lsp root when current root is different from the lsp root in DefaultMain of ghcide. 
* [x] Remove most usage for `getCurrentDirectory`(After DefaultMain is called), Only remain those in top level of wrapper and exe, implement https://github.com/haskell/haskell-language-server/issues/3736#issuecomment-1924507928
* [x] add Note [Root Directory]

Co-authored-by: fendor <fendor@users.noreply.github.com>
2024-05-27 14:03:43 +00:00
Georgii Gerasev
a6cb43b411
Shorter file names completion (#4252)
Don't autocomplete `./` in cabal filepaths (e.g. `hs-source-dirs` or `main-is`), unless the user explicitly wrote `./`.
2024-05-27 13:01:21 +00:00
dependabot[bot]
8f075d0cc3
Bump haskell-actions/setup from 2.7.2 to 2.7.3 (#4254)
Bumps [haskell-actions/setup](https://github.com/haskell-actions/setup) from 2.7.2 to 2.7.3.
- [Release notes](https://github.com/haskell-actions/setup/releases)
- [Commits](https://github.com/haskell-actions/setup/compare/v2.7.2...v2.7.3)

---
updated-dependencies:
- dependency-name: haskell-actions/setup
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
2024-05-27 10:32:43 +00:00
dependabot[bot]
032a96b37b
Bump haskell-actions/setup in /.github/actions/setup-build (#4253)
Bumps [haskell-actions/setup](https://github.com/haskell-actions/setup) from 2.7.2 to 2.7.3.
- [Release notes](https://github.com/haskell-actions/setup/releases)
- [Commits](https://github.com/haskell-actions/setup/compare/v2.7.2...v2.7.3)

---
updated-dependencies:
- dependency-name: haskell-actions/setup
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-27 10:36:28 +01:00
Michael Peyton Jones
e32468df78
Fix progress start delay (#4249)
I think I dropped this for testing, but it should be set to what it says
it is.
2024-05-24 13:02:46 +00:00
dependabot[bot]
7b1021da9e
Bump cachix/install-nix-action from 26 to 27 (#4245)
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 26 to 27.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](https://github.com/cachix/install-nix-action/compare/v26...V27)

---
updated-dependencies:
- dependency-name: cachix/install-nix-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-20 16:13:36 +00:00
dependabot[bot]
e5cae74c48
Bump haskell-actions/setup from 2.7.1 to 2.7.2 (#4244)
Bumps [haskell-actions/setup](https://github.com/haskell-actions/setup) from 2.7.1 to 2.7.2.
- [Release notes](https://github.com/haskell-actions/setup/releases)
- [Commits](https://github.com/haskell-actions/setup/compare/v2.7.1...v2.7.2)

---
updated-dependencies:
- dependency-name: haskell-actions/setup
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
2024-05-20 15:14:08 +00:00
dependabot[bot]
37ede72020
Bump haskell-actions/setup in /.github/actions/setup-build (#4243)
Bumps [haskell-actions/setup](https://github.com/haskell-actions/setup) from 2.7.1 to 2.7.2.
- [Release notes](https://github.com/haskell-actions/setup/releases)
- [Commits](https://github.com/haskell-actions/setup/compare/v2.7.1...v2.7.2)

---
updated-dependencies:
- dependency-name: haskell-actions/setup
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-20 15:15:51 +01:00
Michael Peyton Jones
0651c5c904
Another attempt at using the lsp API for some progress reporting (#4218)
* Another attempt at using the lsp API for some progress reporting

* Fixing tests

* Remove trace

* Make splice plugin tests not depend on progress

* More test fixing

* Switch to hackage

* stack

* warnings

* more

* Put tests back

---------

Co-authored-by: Patrick <fwy996602672@gmail.com>
2024-05-19 16:06:38 +01:00
soulomoon
b43dcbb8cf
3944 extend the properties api to better support nested configuration (#3952)
The implementation closely aligns with the original design, extensively incorporating existing code to minimize workload costs. The new API maintains a consistent style with the old API, which remains unchanged.
Features
With new expose stuff:
`KeyNamePath` -- path to search for properties
`definePropertiesProperty` -- define nested property
`usePropertyByPath` -- extract property by path
`usePropertyByPathEither` -- same as above
`usePropertyByPathAction` -- action api for `usePropertyByPath`
`HasPropertyByPath` -- constraint for using `usePropertyByPath` like the `HasProperty`

We can now define properties upon properties to create nested one. And use KeyNamePath to retrieve the property
```
    nestedPropertiesExample = emptyProperties
        & definePropertiesProperty #parent "parent" (emptyProperties & defineStringProperty #foo "foo" "foo")
        & defineStringProperty #baz "baz" "baz"

    nestedPropertiesExample2 = emptyProperties
        & definePropertiesProperty #parent "parent" (emptyProperties & defineStringProperty #foo "foo" "xxx")
        & defineStringProperty #baz "baz" "baz"

    examplePath1 = SingleKey #baz
    examplePath2 = ConsKeysPath #parent (SingleKey #foo)
```
To retrieve we can have 
```
usePropertyByPathEither examplePath2 nestedPropertiesExample object
```
2024-05-18 12:39:37 +00:00
soulomoon
fb5506c83f
Enable test for #717 (#4241) 2024-05-18 13:22:45 +08:00
Michael Peyton Jones
88c26eb796
Remove Pepe from CODEOWNERS (#4239) 2024-05-17 13:22:46 +00:00
soulomoon
a1fe52fde9
[Migrate BootTests] part of #4173 Migrate ghcide tests to hls test utils (#4227)
* migrate boot test

* add comment
2024-05-14 09:13:52 +02:00
Jan Hrcek
4985793137
Actually enable pedantic flag in ci flags job (#4224)
* Actually enable pedantic flag in ci flags job

* Address reviwe comments

* Fixes after rebase

* Tweak warning configs
2024-05-13 10:10:32 +01:00
soulomoon
61fd5c4648
[Migrate diagnosticTests] part of #4173 Migrate ghcide tests to hls test utils (#4207)
* [x] migrate diagnosticTests, figure out how to pass `--test-no-kick`. 
* [x] migrate openCloseTests
* [x] Lift a few functions from ghcide-test-utils to hls-test-utils
* [x] fixed `deeply nested cyclic module dependency`
* [x] modify `runSessionWithServer'` and ghcIde arguments to admit additional a switch for `no-kick`.

---------

Co-authored-by: fendor <fendor@users.noreply.github.com>
2024-05-13 02:18:51 +00:00
Jan Hrcek
23005f8b1d
Cleanup cabal files, ghc compat code, fix ghc warnings (#4222) 2024-05-12 06:01:37 +02:00
wz1000
2b8f3438ca
Prepare release 2.8.0.0 (#4191)
* Prepare release 2.8.0.0

* try maerwald runners

* Update version support

* Schedule nightly job to run weekly instead of daily

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2024-05-10 22:22:19 +00:00
soulomoon
3084c7f0d0
Stabilize the build system by correctly house keeping the dirtykeys and rule values [flaky test #4185 #4093] (#4190)
The main problem is the out of sync state in the build system. Several states involved, the shake database running result state for key. shake extra's dirty state for key and shake extra's rule values state.
To stablize the build system. This PR force some of the updates of these state into a single STM block.

1. collect dirtykeys and ship it to session restart directly. No more invalid removal before session restart. Fixing Flaky test failure result in error of GetLinkable #4093
2. move the dirtykey removal and rules values updating to hls-graph by adding a call back fucntion to RunResult. Properly handle the dirtykeys and rule value state after session start and closely followed by another session restart Fixing ghcide-tests' addDependentFile test #4194
3. properly handle clean up by wrapping the asyncWithCleanUp to refreshDeps

---------

Co-authored-by: wz1000 <zubin.duggal@gmail.com>
Co-authored-by: Jan Hrcek <2716069+jhrcek@users.noreply.github.com>
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
2024-05-11 04:43:26 +08:00
soulomoon
3822586db9
force complete pattern (#4209) 2024-05-06 04:14:57 +08:00
soulomoon
863d0cdca6
Add performace diff benchmarks (#4203)
* add performance diff `resultDiff.csv` showing the performance different between two version

* add resultDiff CI

---------

Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
Co-authored-by: Jan Hrcek <2716069+jhrcek@users.noreply.github.com>
2024-05-05 21:24:50 +08:00
soulomoon
ced09a7456
Add thread id in ghcide tests log (#4204)
* add threadId to ghcide test

* add threadId to ghcide test

* add thread id by default in ghcide-tests

* remove redundant log
2024-05-04 12:39:12 +01:00
soulomoon
75cb0b9ab8
Migrate FindDefinitionAndHoverTests and HighlightTests part of #4173 and fix HighlightTests (#4202)
* migrate FindDefinitionAndHoverTests

* migrate highlighttests

* fix highlight
2024-05-02 16:02:16 +00:00
soulomoon
877e75c46e
[Migrate IfaceTests] part of #4173 Migrate ghcide tests to hls test utils and use canonicalizePath path in tmp dir in hls-test-utils (#4201)
* use canonicalizePath path in tmp dir in hls-test-utils

* migrate IfaceTests to hls-test-utils
2024-05-02 11:22:07 +00:00
soulomoon
0e52d91972
[Migrate AsyncTests] part of 4173 Migrate ghcide tests to hls test utils (#4199)
* migrate AsyncTests to hls-test-utils
2024-05-01 17:10:25 +08:00
Jan Hrcek
a339277ba1
Upgrade to latest lsp / lsp-types / lsp-test (#4166) 2024-04-30 19:33:24 +02:00
soulomoon
c7f8ceda49
[merge hls-test-utils and ghcide-test-utils] part of #4173 Migrate ghcide tests to hls test utils (#4197)
* pull ghcide-bench out of ghcide and merge some of the hls-test-utils with ghcide-tests

* fix style
2024-04-30 10:20:33 +01:00
soulomoon
a3e4b95991
[Migrate DependentFileTest] part of #4173 Migrate ghcide tests to hls test utils (#4195)
* wip trace flaky

* clena up trace

* cleanup

* cleanup
2024-04-29 14:38:48 +00:00
soulomoon
8afc65a95b
[Migrate CompletionTests] part of 4173 Migrate ghcide tests to hls test utils (#4192)
* migrate ghcide-tests CompletionTests to hls-test-utils

* cleanup
2024-04-26 17:53:42 +01:00
soulomoon
8ef854ab9e
[Migrate OutlineTests.hs ferenceTests.hs] part of 4173 Migrate ghcide tests to hls test utils (#4182)
* move ghcide-tests to haskell-language-server.cabal and make it depend on hls-test-utils

* migrate initializeResponseTests

* cleanup

* migrate initializeResponseTests

* remove duplication

* fix test name

* migrate referenceTests

* fix github action

* fix test dir location

* Fix hls-semantic-tests

* fix 9.2 build

* cleanup

* add doc for CopiedDirectory

* only copy files in git

* cleanup

* add --others to show un staged files

* cleanup

* cleanup

* copy dir recursively

* use wrapper version to provide file system
2024-04-26 13:27:17 +01:00
fendor
a6f0008956
Allow users to specify whether to use cabal's multi-repl feature (#4179)
We add an option to `Config` that allows clients to specify how HLS
should load components.

We support two loading strategies:

* SessionLoadSingleComponent: Always load only a single component
    when a new component is discovered.
* SessionLoadMultipleComponents: Always allow the cradle to load
    multiple components at once. This might not be always possible,
    e.g., if the tool doesn't support multiple components loading.
    The cradle decides how to handle these situations.

By default, we use the conservative `SessionLoadSingleComponent` mode.

Additionally, changing the config at run-time leads to a reload of the
GHC session, allowing users to switch between the modes without
restarting the full server.
2024-04-23 13:53:06 +00:00
wz1000
d33f5f0eec
Replace checkHomeUnitsClosed with a faster implementation (#4109)
* Use a faster implementation of checkHomeUnitsClosed
GHC had an implementation of this function, but it was horribly inefficient
We should move back to the GHC implementation on compilers where
https://gitlab.haskell.org/ghc/ghc/-/merge_requests/12162 is included

Fixes #4046

* Update ghcide/src/Development/IDE/GHC/Compat/Core.hs

Co-authored-by: Jan Hrcek <2716069+jhrcek@users.noreply.github.com>

* Update ghcide/session-loader/Development/IDE/Session.hs

Co-authored-by: Jan Hrcek <2716069+jhrcek@users.noreply.github.com>

* Follow guidelines

---------

Co-authored-by: Jan Hrcek <2716069+jhrcek@users.noreply.github.com>
2024-04-23 10:41:58 +01:00
dependabot[bot]
9b0699dd92
Bump haskell-actions/setup from 2.7.0 to 2.7.1 (#4189)
Bumps [haskell-actions/setup](https://github.com/haskell-actions/setup) from 2.7.0 to 2.7.1.
- [Release notes](https://github.com/haskell-actions/setup/releases)
- [Commits](https://github.com/haskell-actions/setup/compare/v2.7.0...v2.7.1)

---
updated-dependencies:
- dependency-name: haskell-actions/setup
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jan Hrcek <2716069+jhrcek@users.noreply.github.com>
2024-04-22 07:48:55 +02:00
dependabot[bot]
54806cfc64
Bump haskell-actions/setup in /.github/actions/setup-build (#4188)
Bumps [haskell-actions/setup](https://github.com/haskell-actions/setup) from 2.7.0 to 2.7.1.
- [Release notes](https://github.com/haskell-actions/setup/releases)
- [Commits](https://github.com/haskell-actions/setup/compare/v2.7.0...v2.7.1)

---
updated-dependencies:
- dependency-name: haskell-actions/setup
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-22 06:21:56 +02:00
soulomoon
f8379bb42c
Fix CI (#4184) 2024-04-21 11:16:49 +00:00
Sean Gillespie
463eb2f88d
Rename only if the current module compiles (#3799) (#3848)
* Rename only if the current module compiles (#3799)

Prefer `useE` over `useWithStaleE`

* Add a rename test that tests for compilation errors
2024-04-21 10:39:15 +01:00
soulomoon
9593d04a76
move ghcide-tests to haskell-language-server.cabal and make it depend on hls-test-utils (#4176)
* move ghcide-tests to haskell-language-server.cabal and make it depend on hls-test-utils

* migrate initializeResponseTests

* cleanup
2024-04-17 20:12:04 +01:00
Jan Hrcek
e6f7be7ec4
Fix ghc and hlint warnings (#4181) 2024-04-17 08:48:39 +02:00
soulomoon
81f267243e
enable ThreadId for when testing (#4174)
enable ThreadId for when testing

---------

Co-authored-by: fendor <fendor@users.noreply.github.com>
2024-04-16 18:25:58 +00:00
fendor
5deb99605f
Drop Logger from HLS code base. (#4171)
Move ghcide completely to colog-logging style.
Move plugins that were relying on `ideLogger` to colog style logging.
Move opentelemetry to colog-logging style.

This allows us to drop legacy code and unify the logging experience in
HLS.

We add a bunch of new Log constructors at various locations that aim to
be identical to their previous `Logger` statements.
2024-04-16 07:43:26 +00:00
Jan Hrcek
64e0acf002
Improve parsing of import suggestions extending multiple multiline imports (fixes #4175) (#4177) 2024-04-15 16:40:21 +02:00
soulomoon
97aac543bc
get rid of the unsafeInterleaveIO at start up (#4167) 2024-04-10 17:27:33 +08:00
Michael Peyton Jones
334b4d4c7d
Remove EKG (#4163)
It's always been a pain and it's not really used.

Fixes #3993
2024-04-07 20:16:55 +02:00
Jan Hrcek
1dd54a5049
Fix references to old CPP names in tests, update tests (#4159) 2024-04-06 19:20:22 +02:00
Michael Peyton Jones
097d990236
Mark plugins as not buildable if the flag is disabled (#4160)
* Mark plugins as not buildable if the flag is disabled

This ensures that cabal does not consider them at all, and won't try to
solve for their dependencies. So if we turn off the fourmolu plugin, cabal
really won't consider fourmolu at all.

This gets us some of the benefits of #4156 with much less work.

Fixes #4100.

* Stick to no space after flag for consistency
2024-04-06 15:01:29 +00:00
dependabot[bot]
7f5f3b43a3
Bump haskell-actions/setup from 2.6.3 to 2.7.0 (#4158)
Bumps [haskell-actions/setup](https://github.com/haskell-actions/setup) from 2.6.3 to 2.7.0.
- [Release notes](https://github.com/haskell-actions/setup/releases)
- [Commits](https://github.com/haskell-actions/setup/compare/v2.6.3...v2.7.0)

---
updated-dependencies:
- dependency-name: haskell-actions/setup
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
2024-04-03 11:37:39 +00:00
dependabot[bot]
81a72b909e
Bump haskell-actions/setup in /.github/actions/setup-build (#4157)
Bumps [haskell-actions/setup](https://github.com/haskell-actions/setup) from 2.6.3 to 2.7.0.
- [Release notes](https://github.com/haskell-actions/setup/releases)
- [Commits](https://github.com/haskell-actions/setup/compare/v2.6.3...v2.7.0)

---
updated-dependencies:
- dependency-name: haskell-actions/setup
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-03 10:23:24 +00:00
wz1000
d38af0dbd2
session-loader: Don't loop forever when we don't find a file in any multi component (#4096)
* session-loader: Don't loop forever when we don't find a file in any multi component

We add a check for if the current file is a target we know about, and emit a
diagnostic if that is the case, refusing to load the file in.

This doesn't change the implicit adding of the current file as a target for a
single component case, as we need the old behaviour to support bare GHC/Direct
cradles where not all targets may be listed.

* Update ghcide/session-loader/Development/IDE/Session.hs

Co-authored-by: fendor <fendor@users.noreply.github.com>

---------

Co-authored-by: fendor <fendor@users.noreply.github.com>
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
2024-04-02 10:54:26 +00:00
Peter Matta
c3b0b37adc
hls-eval-plugin: Replicate #4139 (#4140)
* main function eval bug

* hls-eval-plugin: set ghci backend for evaluation

* Fixes #4139

* bench: add hls-eval-plugin experiments

---------

Co-authored-by: Peter Matta <developer@mattepet.com>
Co-authored-by: soulomoon <fwy996602672@gmail.com>
2024-03-27 10:04:05 +00:00