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>
* 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>
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
```
* [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>
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>
* 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>
* 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
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.
* 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>
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.
* 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
* 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>