haskell-language-server icon indicating copy to clipboard operation
haskell-language-server copied to clipboard

hls-cabal-plugin should support completion for shorter file names

Open July541 opened this issue 2 years ago • 2 comments

It'd be great if hls-cabal-plugin could complete shorter names if no ambiguity here, like ./src to src, including stanza

  • main-is
  • hs-source-dirs
  • extra-source-files

July541 avatar Aug 23 '23 15:08 July541

Hi, I would like to work on this issue.

VenInf avatar May 10 '24 16:05 VenInf

The code in question is most likely in this function: https://github.com/haskell/haskell-language-server/blob/master/plugins/hls-cabal-plugin/src/Ide/Plugin/Cabal/Completion/Completer/FilePath.hs#L77

This should be a matter of normalising the FilePath (or stripping away the leading ./).

We have a number of tests for this feature: https://github.com/haskell/haskell-language-server/blob/master/plugins/hls-cabal-plugin/test/Completer.hs#L167

You can run these tests in particular via an invocation like this:

> TASTY_PATTERN="Directory Completer Tests" cabal test hls-cabal-plugin-tests --test-show-details=direct

The tests need to be updated to reflect the new behaviour, e.g. completions @?== ["dir1/", "dir2/"]

fendor avatar May 10 '24 16:05 fendor

Fixed by #4252

fendor avatar Jul 15 '24 08:07 fendor