Commit Graph

3669 Commits

Author SHA1 Message Date
dependabot[bot]
87b4d95989
Bump cachix/install-nix-action from V27 to 29 (#4411)
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from V27 to 29. This release includes the previously tagged commit.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](https://github.com/cachix/install-nix-action/compare/V27...v29)

---
updated-dependencies:
- dependency-name: cachix/install-nix-action
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-02 14:28:14 +02:00
Sean Gillespie
838c77cfd6
Avoid expectFail in the test suite (#4402)
* Replace `expectFail` references with explicit checks

* refactor: Make "broken" tests explicit

Create a type-level failure expectations, which allows us to add the
expected failure behavior and the future ideal behavior
2024-09-29 10:36:01 +00:00
awjchen
7385915c99
Get files from Shake VFS from within plugin handlers (#4328)
* Change return type of getFileContents from Text to Rope

- This avoids a few conversions between Rope and Text in the next commit
- Note: Syntactic changes to Development.IDE.Plugin.CodeAction around line
  2000 are to work around the following stylish-haskell failure:

plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction.hs: <string>:2002:5:
error: [GHC-58481]
    parse error (possibly incorrect indentation or mismatched brackets)

* Get virtual files from the Shake VFS in plugins

This commit changes plugins to get virtual files from the Shake VFS
rather than from the language server's VFS.

- Replace `Ide.Types.pluginGetVirtualFile` with
  `Development.IDE.Core.FileStore.getFileContents`
- Replace `Ide.Types.pluginGetVersionedTextDoc` with
  `Development.IDE.Core.FileStore.getVersionedTextDoc`

* Rename `getFileContents` to `getFileModTimeContents`

* Add util functions for common cases of Shake VFS file access

* Cleanup

* Fix warning

* Install notification handlers for cabal files

The cabal formatters read the file contents from the shake VFS. Thus, we
need to make sure there are notification handlers that add the cabal
files to the VFS!

Formatters have to depend on the `hls-cabal-plugin` to have the
necessary notification handlers installed during test time.

---------

Co-authored-by: soulomoon <fwy996602672@gmail.com>
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
Co-authored-by: Fendor <fendor@posteo.de>
Co-authored-by: fendor <fendor@users.noreply.github.com>
2024-09-28 14:23:35 +02:00
fendor
f628754f20
Fix typos in hls-cabal-fmt-plugin (#4399) 2024-09-09 09:19:54 +02:00
Georgii Gerasev
96c3aa7a49
Documentation for build-depends on hover (#4385)
If you hover over the field under `build-depends`
it will give Documentation with a hackage link to a package.

Video with an example:


* + hover

* + hover handler

* working prototype

* bugfix

* rm TODO

* + tests

* docs

* requested changes

* - Debug.Trace

* schema

* Apply suggestions from code review

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

* resolve merge issues

* runActionE -> runAction

* revert prev, useWithStaleE -> useE

* Update plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal.hs

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

* + documentation

---------

Co-authored-by: fendor <fendor@users.noreply.github.com>
2024-09-08 16:16:39 +02:00
jinser
9f4d6732ed
Support Inlay hints for record wildcards (#4351)
* Provide explicit import in inlay hints

* Filter explict imports inlay hints by visible range

* Update lsp dep by source-repository-package

to writing test before new release of haskell/lsp.

* Add test for hls-explicit-imports-plugin inlay hints

* Comment inlay hints start position

* Use `isSubrangeOf` to test if the range is visible

* Remove inlayHintsResolveProvider placeholder for now

* Use explicit InlayHintKind_Type

* Revert "Update lsp dep by source-repository-package"

This reverts commit 245049a580.

* Combine InlayHints by sconcat them

and remove `instance PluginRequestMethod Method_InlayHintResolve`
since have not decide how to combine.

* compress multiple spaces in abbr import tilte

* update test to match inlay hints kind

* rename squashedAbbreviateImportTitle to abbreviateImportTitleWithoutModule

* Request inlay hints with testEdits

* ExplicitImports fallback to codelens when inlay hints not support

* fix explicitImports inlayHints test

* simplify isInlayHintsSupported

* comment fallback

* empty list instead of null codeLens

* clearify name `paddingLeft`

* fix clientCapabilities

* add test for inlay hints without its client caps

* use codeActionNoInlayHintsCaps to avoid error

* simplify isInlayHintSupported

* comment about paddingLeft

* use null as inlay hints kind

* add tooltip for explicit imports inlay hints to improve UX

* chore comments

* refactor

* comment InL [] to indicate no info

* ignore refine inlay hints

* add plcInlayHintsOn config

* update func-test

* keep order to make Parser works

* always provide refine in code lens

* init explicit record fields inlay hints

* dotdot location in label part

* update test for dotdot location in label part

* get(Type)Definition with its Identifier

* add flipped filterByRange

* filter label with name

* update test

* re-generate schema

* fix explict-record-fields plugin in GHC 910

* fix use correct currentPosition

* comment

* rename flippedFilterByRange to elementsInRange

* refactor: lift

* refactor: break pointfree

* refactor

* recover accidentally deleted macros

---------

Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2024-08-28 21:41:34 +00:00
Georgii Gerasev
cbc0cd6999
Update cabal-add dependency (#4389)
* cabal-add release

* update index-state

* bump index-state
2024-08-23 09:19:25 +02:00
Georgii Gerasev
9cc8c622cf
Cabal go to module's definition (#4380)
If you click go-to definition on the field under `exposed-module` or `other-module`
it will open the file where this module was defined.

The go-to definition function compares the highlighted text with modules in the cabal file.
If there is a match, it takes the respective build target and tries to fetch their `hsSourceDirs` from the `PackageDescription`. (by looking at all `buildInfos` with matching names).

After finding them, it constructs a path using directory where the cabal file is located, the info from `hsSourceDirs` and a name of the module converted to a path.
If the file exists it returns the `Definition` with the acquired location.

---------

Co-authored-by: fendor <fendor@users.noreply.github.com>
Co-authored-by: Chrizzl <hochrainer.christoph@gmail.com>
Co-authored-by: VeryMilkyJoe <jana.chadt@nets.at>
2024-08-22 16:12:11 +02:00
dependabot[bot]
225375293d
Bump haskell-actions/setup from 2.7.3 to 2.7.6 (#4384)
Bumps [haskell-actions/setup](https://github.com/haskell-actions/setup) from 2.7.3 to 2.7.6.
- [Release notes](https://github.com/haskell-actions/setup/releases)
- [Commits](https://github.com/haskell-actions/setup/compare/v2.7.3...v2.7.6)

---
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-08-21 09:52:41 +02:00
Sean Gillespie
e6c26bc1be
Improve error message for --probe-tools (#4387)
When `getRuntimeGhcVersion'` throws an error, display that error
2024-08-21 09:50:28 +02:00
dependabot[bot]
d32d3faa5e
Bump haskell-actions/setup in /.github/actions/setup-build (#4383)
Bumps [haskell-actions/setup](https://github.com/haskell-actions/setup) from 2.7.5 to 2.7.6.
- [Release notes](https://github.com/haskell-actions/setup/releases)
- [Commits](https://github.com/haskell-actions/setup/compare/v2.7.5...v2.7.6)

---
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-08-20 22:44:40 +02:00
Georgii Gerasev
56fa0de73e
cabal-add integration as a CodeAction (#4360)
If HLS detects a message like  "module `Bla.Bla.Bla` is a member of a hidden package `bla-1.2.3`" it suggests a quick fix, that finds the closest cabal file and adds the dependency there.

Solution uses [`Distribution.Client.Add`](https://hackage.haskell.org/package/cabal-add-0.1/candidate/docs/Distribution-Client-Add.html) from the `cabal-add` and automaticly adds version requirement, if it's detected.

For now, the `cabal-add` project was linked using [remote package specification](https://cabal.readthedocs.io/en/3.4/cabal-project.html#specifying-packages-from-remote-version-control-locations). Some parts were heavily inspired by the `cabal-add` code in the main module and might be rewritten later. 

`CodeAction` works by parsing all haskell diagnostics, and is constructed if a suited message was found. Parsed information is passed down to a new command, which itself uses tools provided by `cabal-add`. The command conducts IO actions with found cabal file.
2024-08-20 22:31:44 +02:00
fendor
de36c8e363
Remove unused GHCup caches in CI (#4382)
Helps us to avoid running out of disk space during a CI job.
2024-08-20 16:08:27 +02:00
Chrizzl
6f6f75bc41
Add Goto Definition for cabal common sections (#4375)
* Add goto-definitions for cabal common sections

* Add default direct cradle hie.yaml file to testdata

* incorporate changes requested in #4375

* add tests for cabal goto-definition
2024-08-18 10:36:09 +02:00
komikat
9565d0b2d0
Using captureKicksDiagnostics to speed up multiple plugin tests (#4339)
* WIP: Speed up hls-hlint-plugin-tests

Move test data to temporary directory.
Avoid `waitForDiagnosticsWithSource` as it unconditionally waits for
diagnostics.

* use captureKickdiagnostics for cabal plugin

* fix hlint-plugin resolve tests

* haskell-stylish fix

* fix unused imports

* fix unused imports, unused defs

* resolve conflicts with master with refactor kickSignal

* remove redundant imports

* remove more redundant imports

* refactor kicks to use runWithsignal

---------

Co-authored-by: Fendor <power.walross@gmail.com>
2024-08-02 10:09:00 +00:00
Georgii Gerasev
0bf3348f0d
Cabal plugin outline view (#4323)
* working test message cabal file

* trivial outline with rule invocation

* outline with field lines

* complete outline prototype

* small improvements

* remove fieldLines, one line Section display

* stylish haskell

* tests

* imports changes

* outline tests changes

* duplicate defDocumentSymbol

* cabal outline test imports change

* schema 96 94 update

* schema 94 update

* 94 schema update

* 94 schema update

* + cabal-add

* Revert "+ cabal-add"

This reverts commit f77dea526d.

* + docs, refactoring

* Update plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal/Completion/CabalFields.hs

* formatting

* newline

---------

Co-authored-by: fendor <fendor@users.noreply.github.com>
2024-07-30 15:14:58 +02:00
fendor
a4bcaa318e
Add missing documentation for cabal formatters (#4322)
* Add missing documentation for cabal formatters

* Update docs/features.md

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

---------

Co-authored-by: Jan Hrcek <2716069+jhrcek@users.noreply.github.com>
2024-07-26 09:38:19 +01:00
Paweł Dybiec
ce486f7ef4
Add codeactions for cabal field names (#3273)
Add code action for incorrect field names in cabal files

The codeactions will suggest possible corrections for unknown field names in a cabal file.
---------

Co-authored-by: Fendor <fendor@posteo.de>
Co-authored-by: Jana Chadt <jana.chadt@nets.at>
2024-07-11 14:56:07 +00:00
dependabot[bot]
d331019b37
Bump haskell-actions/setup in /.github/actions/setup-build (#4354)
Bumps [haskell-actions/setup](https://github.com/haskell-actions/setup) from 2.7.3 to 2.7.5.
- [Release notes](https://github.com/haskell-actions/setup/releases)
- [Commits](https://github.com/haskell-actions/setup/compare/v2.7.3...v2.7.5)

---
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: soulomoon <fwy996602672@gmail.com>
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
2024-07-09 16:24:37 +00:00
jinser
763f34cb1e
Provide explicit import in inlay hints (#4235)
* Provide explicit import in inlay hints

* Filter explict imports inlay hints by visible range

* Update lsp dep by source-repository-package

to writing test before new release of haskell/lsp.

* Add test for hls-explicit-imports-plugin inlay hints

* Comment inlay hints start position

* Use `isSubrangeOf` to test if the range is visible

* Remove inlayHintsResolveProvider placeholder for now

* Use explicit InlayHintKind_Type

* Revert "Update lsp dep by source-repository-package"

This reverts commit 245049a580.

* Combine InlayHints by sconcat them

and remove `instance PluginRequestMethod Method_InlayHintResolve`
since have not decide how to combine.

* compress multiple spaces in abbr import tilte

* update test to match inlay hints kind

* rename squashedAbbreviateImportTitle to abbreviateImportTitleWithoutModule

* Request inlay hints with testEdits

* ExplicitImports fallback to codelens when inlay hints not support

* fix explicitImports inlayHints test

* simplify isInlayHintsSupported

* comment fallback

* empty list instead of null codeLens

* clearify name `paddingLeft`

* fix clientCapabilities

* add test for inlay hints without its client caps

* use codeActionNoInlayHintsCaps to avoid error

* simplify isInlayHintSupported

* comment about paddingLeft

* use null as inlay hints kind

* add tooltip for explicit imports inlay hints to improve UX

* chore comments

* refactor

* comment InL [] to indicate no info

* ignore refine inlay hints

* add plcInlayHintsOn config

* update func-test

* keep order to make Parser works

* always provide refine in code lens

---------

Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2024-07-09 14:58:37 +00:00
soulomoon
3862e7a227
Remove componentInternalUnits (#4350) 2024-07-08 16:07:37 +08:00
Zubin Duggal
13e579519d ci: upgrade macOS runners to macOS 12 2024-07-05 14:51:10 +05:30
Zubin Duggal
636b194edf ci: work around centos7 deprecation 2024-07-05 14:51:10 +05:30
Zubin Duggal
d72a6a0bec Prepare release 2.9.0.1
This is a bindist only release with no code changes
2024-07-05 14:51:10 +05:30
soulomoon
fa48fdaa69
Fix core file location in GetLinkable (#4347)
Fix #4145
The error case is demonstrated in #4145 (comment)

Include ModLocation in the ModSummaryResult fingerprint.
Instead of getting the core file location from GetModSummary, get it from the result of GetModIface directly since that is the actual location the core file written to.
2024-07-04 22:27:20 +08:00
soulomoon
f0ba40baf6
capture error in worker thread (#4342)
* use safe try that does not catch the asyncException
2024-07-02 21:29:18 +08:00
soulomoon
012e809054
Simplify initPlugins (#4344)
* simplify initPlugins

* fix cabal

* remove initializePlugins

---------

Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
2024-07-01 12:20:41 +00:00
soulomoon
1f5c60d068
ignore simple-multi-def-test for windows since #4270 (#4345) 2024-07-01 10:49:10 +00:00
soulomoon
495af1f565
Formalize the ProgressReporting Type (#4335)
* add ProgressReportingNoTrace

* fix doc

* cleanup

* stylish

* turn ProgressReporting into IO

* rename

* Revert "rename"

This reverts commit 03961fa085.

* rename

* rename to PerFileProgressReporting

* prefix hidden field with `_`
2024-06-30 16:45:02 +00:00
soulomoon
376f7f1802
fix future index time (#4343) 2024-06-29 19:50:34 +00:00
Jan Hrcek
124691f950
Cleanup disabled warnings (#4341)
* Cleanup unnecessarily disabled warnings

* Fix stack nighly build

* stylish
2024-06-28 15:38:40 +01:00
Jan Hrcek
147fb4a291
Cleanup imports after CPP removal + few hlint fixes (#4337) 2024-06-27 06:38:22 +02:00
soulomoon
f523690ada
Migrate indexHieFile progress notification to ProgressReporting API (#4205)
What's done
1. Refactor ProgressReporting to allow external state management
2. Migrate `indexHieFile` progress to ProgressReporting API
3. Add Note [ProgressReporting API and InProgressState] to demonstrate the current status
2024-06-20 18:17:44 +00:00
Michael Peyton Jones
2f00507d97
Remove final allow-newer for 9.10 (#4329)
* Remove final allow-newer for 9.10

Revised on hackage

* Bound cabal-gild to avoid new broken versions
2024-06-20 18:13:36 +01:00
Jan Hrček
54f41086ea Remove unused exactprint dep 2024-06-20 09:03:31 +01:00
Jan Hrček
f95b6175e0 More stylish 2024-06-20 09:03:31 +01:00
Jan Hrček
bd29bc52fb Use newer cabal-fmt, partially lift ghc version restriction 2024-06-20 09:03:31 +01:00
Jan Hrček
e4128a4458 stylish 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
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
a37a4565e9 Remove from CI 2024-06-20 09:03:31 +01:00
Michael Peyton Jones
e5f3455b95 Update docs 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