From 21c234f92b2c674e590bb19605e8bf3925968cc5 Mon Sep 17 00:00:00 2001 From: Fendor Date: Mon, 21 Oct 2024 17:00:01 +0200 Subject: [PATCH 1/2] Fix formatting of the `cabal-version` error message Add docs for `cabal-add` based CodeAction --- docs/features.md | 8 ++++++++ plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal.hs | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/features.md b/docs/features.md index 92594d2c69..df2ccceb7f 100644 --- a/docs/features.md +++ b/docs/features.md @@ -316,6 +316,14 @@ Code action kind: `quickfix` Correct common misspelling of SPDX Licenses such as `BSD-3-Clause`. +### Add dependency to `cabal` file + +Provided by: `hls-cabal-plugin` + +Code action kind: `quickfix` + +Add a missing dependency to your `.cabal` file. + ## Code lenses ### Add type signature diff --git a/plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal.hs b/plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal.hs index 8202d7c1e0..da58c5f874 100644 --- a/plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal.hs +++ b/plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal.hs @@ -254,8 +254,10 @@ cabalRules recorder plId = do -- user did not do anything wrong. Instead we cast it to a warning regex = "Unsupported cabal-version [0-9]+.[0-9]*" unsupportedCabalHelpText = unlines - [ "The used cabal version is not fully supported by HLS. This means that some functionality might not work as expected." - , "If you face any issues try to downgrade to a supported cabal version." + [ "The used `cabal-version` is not fully supported by this `HLS` binary." + , "Either the `cabal-version` is unknown, or too new for this executable." + , "This means that some functionality might not work as expected." + , "If you face any issues, try downgrading to a supported `cabal-version` or upgrading `HLS` if available." , "" , "Supported versions are: " <> List.intercalate ", " From 0a7e40fc7c4b27c404e51867048994ee0412b11a Mon Sep 17 00:00:00 2001 From: fendor Date: Tue, 22 Oct 2024 11:54:58 +0200 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: VeryMilkyJoe --- docs/features.md | 2 +- plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/features.md b/docs/features.md index df2ccceb7f..897552dff7 100644 --- a/docs/features.md +++ b/docs/features.md @@ -322,7 +322,7 @@ Provided by: `hls-cabal-plugin` Code action kind: `quickfix` -Add a missing dependency to your `.cabal` file. +Add a missing package dependency to your `.cabal` file. ## Code lenses diff --git a/plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal.hs b/plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal.hs index da58c5f874..2abee54b5c 100644 --- a/plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal.hs +++ b/plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal.hs @@ -257,7 +257,7 @@ cabalRules recorder plId = do [ "The used `cabal-version` is not fully supported by this `HLS` binary." , "Either the `cabal-version` is unknown, or too new for this executable." , "This means that some functionality might not work as expected." - , "If you face any issues, try downgrading to a supported `cabal-version` or upgrading `HLS` if available." + , "If you face any issues, try downgrading to a supported `cabal-version` or upgrading `HLS` if possible." , "" , "Supported versions are: " <> List.intercalate ", "