Commit Graph

1360 Commits

Author SHA1 Message Date
Jan Hrček
3b24251536 Cleanup CI configs and cabal files 2024-06-20 09:03:31 +01:00
Jan Hrček
cd44ab0ee3 More no-op code cleanup 2024-06-20 09:03:31 +01:00
Jan Hrček
06920497b7 Remove no-longer-needed compat code, remove unused stuff 2024-06-20 09:03:31 +01:00
Zubin Duggal
9d3480a9bc Remove pre-multi component junk for GHC <= 9.2 2024-06-20 09:03:31 +01:00
Michael Peyton Jones
617542dc9c Fix stylish 2024-06-20 09:03:31 +01:00
Michael Peyton Jones
65391062a0 Fix a few things 2024-06-20 09:03:31 +01:00
Michael Peyton Jones
e217112604 Fix loss of 9.2 GHC version 2024-06-20 09:03:31 +01:00
Michael Peyton Jones
512fa5c305 More CPP 2024-06-20 09:03:31 +01:00
Michael Peyton Jones
a478a75c29 WIP evaluate CPP 2024-06-20 09:03:31 +01:00
fendor
287ee42ab5
Prepare release 2.9.0.0 (#4319)
* Prepare release 2.9.0.0

* Bump 'bytestring' version for release CI test scripts

The older 'bytestring-0.11.1.0' version doesn't compile with the recent
GHC 9.10.1 release. Bump the version to '0.12.1.0' which can be
successfully compiled on all supported GHC versions.

* Update supported GHC version table

* Move plugin ghc support conditionals into .cabal file

Having them in the cabal.project file is a very neat way to
enable/disable a plugin, but it negatively affects Hackage users as they
can no longer trivially install HLS from Hackage.

This discussion might be revisited in the future, but not during a
release process.

* Disable tests and benchmarks in release test pipeline

On some platforms, building bytestring-0.12.1.0 is not fully supported
yet. Hence, we disable tests and benchmarks, to allow building on the
platform Windows with GHC 9.10.1.

* Always show debug output in release test ci

* Upgrade cabal version in the release pipeline

* Switch to `text` for release test package

---------

Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
2024-06-19 10:35:14 +02:00
Matthew Pickering
426b068f52
Fix quadratic memory usage in GetLocatedImports (#4318)
At startup `GetLocatedImports` is called on all known files. Say you
have 10000 modules in your project then this leads to 10000 calls to
GetLocatedImports running concurrently.

In `GetLocatedImports` the known targets are consulted and the
targetsMap is created by mapping the known targets. This map is used for
introducing sharing amongst filepaths.  This operation copies a local
copy of the `target` map which is local to the rule.

```
let targetsMap = HMap.mapWithKey const targets
```

So now each rule has a hashmap of size 10000 held locally to it and
depending on how the threads are scheduled there will be 10000^2
elements in total allocated in hashmaps. This used a lot of memory.

Solution: Return the normalising map in the result of the
`GetKnownTargets` rule so it is shared across threads.

Fixes #4317
2024-06-13 17:32:03 +00:00
wz1000
3009a45c74
Support for 9.10 (#4233)
* Support for 9.10

This includes supports for all plugins, other than formatters and hlint.

We need ghc-exactprint and retrie release before merging this.

* Remove indexed-traversable allow-newer

* Fix couple of warnings

* Fix flags job for hls-graph

* foldl' exposed from Prelude since base 4.20

* Fix flags job for hls-plugin-api

* Fix ghcide hover test

* Fix flags job for hls-eval-plugin

* unzip since 4.19

* More pedantic fixes

* Don't CPP in tests, fix another test

* Switch to ghc-exactprint and witherable from hackage

* Fix all warnings in hls-refactor-plugin

* Remove more no longer necessary allow newers

* Fix all warnings in hls-gadp-plugin and hls-qualify-imported-names-plugin

* Remove allow-newer for boring

* Bump to lsp 2.6, remove more allow-newers

* outline tests

* disable simple plugin on 9.10

* Remove allow-newer for ghc-trace-events

* fix appendConstraint

* stylish

* Remove commutative-semigroups and monoid-subclasses from allow-newer

* Remove free from allow-newer

* Fix 'type wilcard actions' tests

* Remove hie-bios from allow-newer

* Fix suggestNewDefinition tests

* Revert "Fix suggestNewDefinition tests"

This reverts commit 2f3300e964.

* Remove makeDeltaAst breaking tests unrelated to addArgument

* Fix 79 code action tests

* Fix 12 more tests

* Remove co-log-core from allow-newer

* Fix 21 more tests

* Fix 8 import disambiguation tests

* fix windows ghcide tests

* Fix adding argument to function body

* update retrie commit, progress in add argument tests

* Fix few stylish-haskell parse errors

* Fix remaining redundant constraint tests

* Remove allow-newer for constraint-extras

* Fix warnings after master merge

* Fix most add argument tests except for one

* Remove dependent-map from allow-newer

* Try removing some allow-newers from lsp

* Ormolu is updated, add links for other tool dependencies

* Revert "Try removing some allow-newers from lsp"

This reverts commit 6f60029ff2.

* Try this

* Fix all gadt plugin and most class plugin tests, enable 2 tests for ghc 9.4+

* Undo spurious changes

* Update eval plugin tests

* Disable broken refactor plugin test for now

* Fix warnings

* Add source-repository-package to unblock floskell

* Make call hierarchy plugin tests green

* fix semantic tokens 9.10

* Fix remaining class plugin test

* Update hls-change-type tests

* Make class plugin more robust

* Fix stylish parse errors, simplify CPP

* Cleanups

* Remove retrie dep from hls-refactor-plugin

* More retrie fixes

* Fix cabal-plugin-tests by respecting maxCompletions client cfg + a bit of CPP

* Fixup ghcide-tests

* disable retrie, splice and floskell plugins for 9.10

* Update tested-with + fix import warning

* Fix stylish

* Fix compilation with 9.2.8, fix stack jobs

* Remove no longer relevant :type +v test

* Disable tests of disabled plugins in CI

* Try a better broken specifier?

* Fix invalid CI config

* Use getClientConfigAction instead of introducing new HandlerM action

* Move CPPd imports to prevent stylish from evaluating CPP

* Disable stan tests with ghc 9.10 in CI

* attempt fixing exactprint <9.10

* Try enabling fourmolu now

* Revert "Try enabling fourmolu now"

This reverts commit 7142686f62.

* Update code-range-plugin tests

* Fix No newline at the end of file

* Use more recent cabal-gild

* Try setting some linker flags for macos

* Ignore non-local variable completion test on windows for GHC 9.8

---------

Co-authored-by: Jan Hrček <honza.hrk@gmail.com>
Co-authored-by: Patrick <fwy996602672@gmail.com>
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
Co-authored-by: Fendor <fendor@posteo.de>
2024-06-13 14:45:57 +00:00
Jan Hrcek
c11f32b62a
Bump stack configs + CI to 9.6.5 and 9.8.2 (#4316) 2024-06-12 19:37:52 +02:00
awjchen
cebd641d06
Use restricted monad for plugins (#4057) (#4304)
* Use restricted monad for plugins (#4057)

* Renaming: PluginM -> HandlerM

* Explain intent for HandlerM

* Fix comment

* Apply stylish-haskell
2024-06-10 10:02:58 +00:00
wz1000
c3236eb4d1
ghcide: drop ghc-check and ghc-paths dependency (#4291)
* ghcide: drop ghc-check and ghc-paths dependency

We don't really need these, as we don't use any of the fancy abi-hash
checking features in ghc-check and instead rely on a wrapper script
to do this.

* Fix stylish

---------

Co-authored-by: soulomoon <fwy996602672@gmail.com>
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
2024-06-09 09:45:40 +00:00
Akshay Mankar
7b8e2e5045
Limit number of valid hole fits to 10 (#4288)
* ghcide: Pass -fmax-valid-hole-fits=10 to GHC

In cases where GHC doesn't know anything about the type of a hole, it suggests
every available symbol as a hole fit, which can cause editors to crash or at
least be very slow. 10 seems to be a fair number to limit hole fits to.

* hls-refactor-plugin: Ignore "Some hole fits suppressed" message when valid hole fits are limited

* hls-refactor-plugin: More predictable hole fit for test

Now that we limit number of hole fits recommended by GHC, the test that
hopes to find `+` being recommended for `Int -> Int -> Int` becomes
unpredictable because there are too many symbols which match that type
and the sorting has little control over which symbols get recommended.

There are way fewer matches for `(Int -> Maybe Int) -> Maybe Int ->
Maybe Int`, so it makes the test consistently succeed.

---------

Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
2024-06-09 08:52:44 +00:00
wz1000
026d0cef5a
FindImports: ThisPkg means some home unit, not "this" unit (#4284)
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
2024-06-09 08:00:54 +00:00
soulomoon
82da33707f
Unify critical session running in hls (#4256)
* add thread to do shake restart
* run session loader in thread

---------

Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
2024-06-08 19:18:59 +00:00
soulomoon
8271db467e
Remove redudant absolutization in session loader (#4280) 2024-06-06 14:51:32 +00:00
Michael Peyton Jones
71aa2d38e0
Bump to new lsp versions (#4279) 2024-06-06 13:19:32 +00:00
soulomoon
246e131770
Delete library ghcide test utils (#4274)
* cleanup

* cleanup

* stylish

* remove library ghcide-test-utils entirely

* fix

* fix

* stylish
2024-06-03 09:40:08 +00:00
soulomoon
9f3e274cc7
Delete testUtil from ghcide-tests (#4272) 2024-06-02 20:37:52 +08:00
Fendor
ce2435d620 hls-test-utils: Add parameterised cursor test utils
Add utils that allows to define parameterised tests for files that
require cursor positions.
This enables us to define run the same tests for multiple inputs
efficiently, and with readable error messages.

The main advantage is the improved specification of the test cases, as
we allow to specify the cursor position directly in the source of the
test files.
2024-05-31 18:08:26 +02:00
soulomoon
3979b27ab2
Migrate UnitTests (#4268)
* Migrate UnitTests
2024-05-29 18:38:13 +00:00
soulomoon
52d7423b19
Migrate SafeTests (#4267) 2024-05-29 17:49:42 +00:00
soulomoon
e40bd2e0bd
Migrate WatchedFileTests (#4269) 2024-05-29 15:54:35 +00:00
soulomoon
764f8fb637
Migrate SymlinkTests (#4266) 2024-05-29 21:32:26 +08:00
soulomoon
496f3137f5
Migrate PluginSimpleTests (#4259) 2024-05-29 11:57:17 +08:00
soulomoon
4f7a0fcd50
Migrate RootUriTests (#4261)
* Migrate RootUriTests
2024-05-28 15:36:20 +00:00
soulomoon
57f7b3f7ba
Migrate PreprocessorTests (#4260) 2024-05-28 11:54:27 +00:00
soulomoon
0d0ec1e0b4
Migrate ClientSettingsTests (#4258) 2024-05-28 10:03:06 +00: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
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
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
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
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