Commit Graph

372 Commits

Author SHA1 Message Date
Jan Hrček
bd29bc52fb Use newer cabal-fmt, partially lift ghc version restriction 2024-06-20 09:03:31 +01:00
Jan Hrček
3b24251536 Cleanup CI configs and cabal files 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
VeryMilkyJoe
62892ae546
Add completion for import fields in cabal files (#4305)
At the moment import fields always suggest any common stanza names
occuring in the file, while it should be only the ones defined before
the cursor position.

Also moves all CabalFields utility into a separate module

Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
2024-06-16 21:15:50 +00:00
Brandon Chinn
4b344d3346
Add support for Fourmolu 0.16 (#4314) 2024-06-14 07:26:59 +02: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
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
013fefe578 Refactor context search to use readFields
Instead of custom parsing of the cabal file, we use `readFields` to parse
the cabal file, as accurately as cabal supports. This allows us to
additionally benefit from future improvements to the cabal lexer.

Then, we traverse the fields and find the most likely location of the
cursor in the cabal file.
Based on these results, we can then establish the context accurately.

Further, we extend the known rules for the cabal plugin, to avoid
expensive reparsing using `readFields`.

Co-authored-by: VeryMilkyJoe <jana.chadt@nets.at>
2024-05-31 18:08:26 +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
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
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
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
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
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
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
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
fendor
16912ccebd
Add cabal-gild as a cabal file formatter plugin (#4101)
* Add cabal-gild as a cabal file formatter plugin

* Add support for multiple cabal formatters

In addition, allow different cabal file formatter provider to specify an
explicit file path, instead of searching only on $PATH.

* Fix cabal formatter test flags
2024-03-11 17:23:29 +00:00
Jan van Brügge
03d418c92c
hls-notes-plugin: Initial implementation (#4126)
* hls-notes-plugin: Initial implementation

* hls-notes-plugin: add to feature list and plugin table

* hls-notes-plugin: Add more documentation comments

* hls-notes-plugin: Fix tests after #3846, add CI job

* hls-notes-plugin: Address review comments

* hls-notes-plugin: Allow Note definition within single line comments

* hls-notes-plugin: Improve "Note not found" error message

* hls-notes-plugin: Allow single line notes to be indented

* treewide: Add missing underscores to note definitions

* hls-notes-plugin: Wait until HLS is done in tests

* hls-notes-plugin: Fix tests on windows

The regex did not allow windows line endings in note definitions

---------

Co-authored-by: Jan Hrcek <2716069+jhrcek@users.noreply.github.com>
Co-authored-by: fendor <fendor@users.noreply.github.com>
2024-03-11 15:19:51 +00:00
Jan Hrcek
a2a9991158
Enable floskell and hlint plugins for ghc 9.8 (#4125)
* Enable floskell and hlint plugins for ghc 9.8

* Update golden extension schema

* Renererate default-config.golden.json
2024-03-09 21:21:51 +00:00
Jan Hrcek
c50a0e118b
Integrate stylish-haskell into hls executable with ghc 9.8 (#4124) 2024-03-09 14:02:37 +01:00
soulomoon
8a8f59bf2e
Benchmark: Enable 9.6, 9.8 (#4118)
Fix bench for newer ghc versions
The following have been done:
1. No longer use the implicit-hie to generate the hie.yaml for the bench examples and in favor of using "cradle:\n cabal:\n", seems to be working with modern cabal.
2. upgrade benchmark to use 9.6, 9.8 (The latest two we support for now).
3. upgrade bench examples to `Cabal version: 3.10.2.1, lsp-types version: 2.1.1.0`
4. fix minor error that `*.hp` files duplicates its extension name

---------

Co-authored-by: fendor <fendor@users.noreply.github.com>
2024-03-07 13:40:18 +00:00
Raoul Hidalgo Charman
7610872c9a
Reintroduce ghc-lib flag for hlint plugin (#3757)
* Remove bitrotted CPP gated code

A lot of the HLINT_ON_GHC_LIB gated code has been bitrotting since this
flag was removed. This could be reintroduced if we wanted to directly
work on the same parsed AST, but as the hlint ghc plugin showed this
may not make much difference: https://www.haskellforall.com/2023/09/ghc-plugin-for-hlint.html

* Reintroduce ghc-lib flag for hlint plugin

The ghc-lib flag was removed in haskell#3015, but it's still useful to
be able to compile hls-hlint-plugin using the GHC API if you've done so
for hlint and ghc-lib-parser-ex, rather than using ghc-lib-parser as it
simplifies the build and dependencies.
2024-03-07 11:09:47 +00:00
Jan Hrcek
5502b76c95
Improve handling of nonsense rename attempts (#4111) 2024-03-02 16:47:09 +01:00
fendor
b377ab3985
Don't distribute gifs or plugin readmes (#4107) 2024-02-29 18:58:34 +01:00
fendor
829e1f47c2
Track extra-source-files of plugins more accurately (#4105)
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
2024-02-29 16:53:33 +01:00
Fendor
59ae88ad85 Generate ChangeLog, update supported GHC versions 2024-02-27 15:17:05 +01:00
Fendor
26fa28c50e Update HLS version in .cabal files 2024-02-27 15:17:05 +01:00
Michael Peyton Jones
949f3b8d0f
Remove ghcide-test-utils as a separate package (#4032)
* Actually build everything

* Remove ghcide-test-utils as standalone package
2024-02-26 10:49:41 +00:00
Jan Hrcek
fae6b83b47
Enable pedantic for remaining plugins (#4091) 2024-02-24 17:44:17 +00:00
soulomoon
24b40ca42d
Add Method_TextDocumentSemanticTokensFullDelta (#4073)
* add Method_TextDocumentSemanticTokensFullDelta

* remove persistentGetSemanticTokensRule

* add doc about semanticTokensCache location

* add Note [Semantic Tokens Cache Location]

---------

Co-authored-by: fendor <fendor@users.noreply.github.com>
2024-02-21 22:54:52 +01:00
Brandon Chinn
310b842ef0
Add support for fourmolu 0.15 (#4086) 2024-02-20 15:55:44 +01:00
Jan Hrček
e93528bae7 Bump to hiedb 0.6.0.0 2024-02-16 12:07:26 +05:30
Jan Hrcek
7b6986ba8c
Fix -Wall in retrie plugin (#4071)
* Fix -Wall in retrie plugin

* Fix ImportDecl initialization across ghc versions
2024-02-14 18:46:26 +01:00
Jan Hrcek
409bf3ba83
Fix -Wall in qualified imported names plugin (#4070) 2024-02-12 18:47:58 +01:00
Jan Hrcek
f844a29a9e
Fix -Wall in refactor plugin (#4065)
* Fix -Wall in refactor plugin

* Fix hlint warnings

* stylish-haskell
2024-02-12 09:23:32 +01:00
Jan Hrcek
1bbe7806ac
Fix weird behavior of OPTIONS_GHC completions (fixes #3908) (#4031) 2024-02-10 10:20:48 +01:00
Jan Hrcek
e37ec7dbb3
Enable pedantic for more components (#4061) 2024-02-09 15:17:34 +01:00
Michael Peyton Jones
0b0eee328f
Bump lsp versions (#4052)
* Bump lsp versions

Broadly:
- A few places where we need to pipe `ProgressToken`s around.
   - I also just removed the progress reporting from resolve commands,
     since it's going to often be costly to do progress reporting on
     something that short. Possibly we could revisit after https://github.com/haskell/lsp/issues/549
- Some changes to the registration options we infer
- A few places where we need to adapt to ignoring registrations or not
- Adapting to use the ghcide verison of `getCompletionPrefix` everywhere
- Adapting to use the new mixed rope format

* stack

* More fixes
2024-02-08 17:32:10 +00:00
Jan Hrcek
9021c39925
Add -Wunused-packages to common warnings (#4053)
* Add -Wunused-packages to common warnings

* Get rid of common deps

* Wrapper needs process on windows

* Refine

* Does it work like this?

* More cleanups in ghcide

* Fix build with stack

* Also fix stack --test

* Less noisy workaround

* Fix new warnings
2024-02-08 15:26:21 +00:00
soulomoon
3c511b0b03
Optimize semantic token extraction logic (#4050)
A follow up of #3958 , we have added a tokenizor to walk the hieAst along with the file rope, it means we no longer need to do the detour of storing temperal result as Map Range (Set identifier), instead we can optimize by fusing most of the logic into tokenizer and return [(Range, HsSemanticTokenType)] directly.
2024-02-07 18:07:13 +00:00
Michael Peyton Jones
975db494a2
Use GHC2021 (#4033)
Co-authored-by: Jan Hrček <honza.hrk@gmail.com>
2024-02-02 12:10:51 +00:00
Jan Hrcek
a0baa4d09e
Fix -Wall and -Wunused-packages in stan plugin (#4014)
* Fix -Wall and -Wunused-packages in stan plugin

* Rename binding

---------

Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
2024-02-02 07:48:58 +00:00
Jan Hrcek
4b95e55511
Fix -Wall and -Wunused-packages in hlint plugin (#4019) 2024-02-02 04:42:31 +01:00
Michael Peyton Jones
5af02dcf70
Fix various issues (#4024)
* Fix various issues

- Make sure that we are always referring to the local libraries and not
  the published Hackage packages!
    - This needs a `cabal-version` bump
- Make sure every component imports the default stanzas
- Add a `defaults` stanza for `default-language`
- Add a `tests-default` stanza for making sure test suites are built
  threaded
- Remove unnecessary warning-related `ghc-options`
- Use the `pedantic` stanza instead of manual checks for `pedantic`

* Comments
2024-02-01 15:13:53 +00:00