haskell-language-server
haskell-language-server copied to clipboard
incorrect suggestion for module name - missing first character of directory name
Your environment
Which OS do you use?
Which version of GHC do you use and how did you install it? debian 11 actualized ghc 8.10.7 installed with ghcup 3.6.2.0 of the Cabal library
I have in a directory Lib a file Example.hs in my project; it compiles without error.
In VScode I see a problem:
Set module name to ib.Example
above the line
module Lib.Example
This is systematic and happens with all my modules.
Which LSP client (editor/plugin) do you use?
Which version of HLS do you use and how did you install it? Version: 1.69.1 Commit: b06ae3b2d2dbfe28bca3134cc6be65935cdfea6a Date: 2022-07-12T08:28:29.328Z Electron: 18.3.5 Chromium: 100.0.4896.160 Node.js: 16.13.2 V8: 10.0.139.17-electron.0 OS: Linux x64 5.10.0-16-amd64
Have you configured HLS in any way (especially: a hie.yaml
file)?
no hie.yaml file - rely on automatic one
The Haskell Language server with the plugin for VScode works well - except it drops the first character of the directory for a suggested module name.
For example:
I have in a directory Lib a file Example.hs in my project; it compiles without error.
In VScode I see a problem:
Set module name to ib.Example
above the line
module Lib.Example
This is systematic and happens with all my modules. Is there a problem in any of my setup files and which files should I check?
Steps to reproduce
open a file, see the suggestion for a change in the module name.
Expected behaviour
no suggestion - resp. a correct suggestion (which would then not be made). correct means with the first character of the directory name. (e.g. Lib, when directory is Lib and current suggestion is ib
).
Actual behaviour
Debug information
@July541 you looked at the module name plugin not that long ago, maybe you have an idea?
@adamgundry, Thank you for your report!
I can't repro this, did I miss something? Or would you mind sharing a repo that can reproduce this?
I am not surprised; i suppose it is a strange interaction. I currently work on https://github.com/andrewufrank/CategoryCoreConcepts and this shows the problem with my setupp of vscode (see above). anything else I can help? (i have the impression I effects of caching data for HLS; for example I copy a .hs file, then rename it and fix it. still I see problems reported for the short period the file existed - long after i renamed it... - is there a simple method to clean all caches for HLS?).
Confirmed on your project. It's weird and can't figure out what happened with one glance. I'll check it while I have enough bandwidth (Or someone is pleased to chime in).
As I can repro, it doesn't look like about caching. FYI, I often follow the following steps to clear hls caches:
- Clear ghcide cache at
~/.cache/ghcide
- Clear hie-bios cache at
~/.cache/hie-bios
- Clear project's build caching by
cabal clean
orstack clean --full
For a reminder, implementing #1682 may be useful.
Thank you for the confirmation that you can see the same problem in my project, and special thanks for the procedures to clean the caches.
I can report that the but happens if the code is structured such that the whole directory (not just src) is
library:
source-dirs: .
When the code structure is changed moving the libraries into src
and then adapt source-dirs: src
the suggestions include the first character.
I changed my directory layout to the more common layout, but guess it would be worthwile to fix the bug for the not so common, but still legal, directory layout.
Btw, possibly linked to the bug that single character directores (e.g. in includ-dirs) are treated differently and cause error messages like not a relative path
).
Thank you for a tool so helpful that I was willing to change my layout to avoid problems with the tool!
Thank you!