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