Skip to content

HtProjectHelpers.get_package_name should read from stack.yaml instead of inferring from project directory name  #342

@gabrielsimoes

Description

@gabrielsimoes

Neovim version (nvim -v)

0.9.5

Operating system/version

Arch

Output of :checkhealth haskell-tools

==============================================================================
haskell-tools: require("haskell-tools.health").check()

Checking for Lua dependencies ~
- OK [nvim-telescope/telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) installed.

Checking external dependencies ~
- OK haskell-language-server: found haskell-language-server version: 2.5.0.0 (GHC: 9.2.8) (PATH: /home/gabriel/.ghcup/hls/2.5.0.0/lib/haskell-language-server-2.5.0.0/bin/haskell-language-server-wrapper)
- WARNING       hoogle: not found.
  Install [ndmitchell/hoogle](https://github.com/ndmitchell/hoogle) for extended capabilities.
  Recommended for better Hoogle search performance.
  Without a local installation, the web API will be used by default.
  Required if the hoogle mode is set to "telescope-local".
  
  
- WARNING       fast-tags: not found.
  Install [fast-tags](https://hackage.haskell.org/package/fast-tags) for extended capabilities.
  Optional, for generating tags as a `tagfunc` fallback.
  
- OK curl: found curl 8.6.0 (x86_64-pc-linux-gnu) libcurl/8.6.0 OpenSSL/3.2.1 zlib/1.3.1 brotli/1.1.0 zstd/1.5.5 libidn2/2.3.7 libpsl/0.21.2 libssh2/1.11.0 nghttp2/1.59.0
- WARNING       haskell-debug-adapter: not found.
  Install [haskell-debug-adapter](https://github.com/phoityne/haskell-debug-adapter) for extended capabilities.
  Optional, for `dap` support.
  
- WARNING       ghci-dap: not found.
  Install [ghci-dap](https://github.com/phoityne/ghci-dap) for extended capabilities.
  Optional, for `dap` support.
  

Checking config ~
- OK No errors found in config.

Checking for conflicting plugins ~
- OK No conflicting plugins detected.

How to reproduce the issue

Opening the REPL :HtReplToggle will fail to import a project in case the project's directory does not match the package name in stack.yaml. The plugin will execute stack ghci <DIRECTORY_NAME> instead of stack ghci <PROJECT_NAME> and stack will error:

Warning: Some targets (<DIRECTORY_NAME>) are not local packages, and so cannot be directly loaded. In future versions of Stack, this might be supported - see https://github.com/commercialhaskell/stack/issues/1441 . It can still be useful to specify these, as they will be passed to ghci via -package flags.

Note: No local targets specified, so a plain ghci will be started with no package hiding or package options.
 
You are using snapshot: lts-21.25

If you want to use package hiding and options, then you can try one of the following:

* If you want to start a different project configuration than <DIRECTORY>/stack.yaml, then you can use stack init to create a new stack.yaml for the packages in the current directory. 
 * If you want to use the project configuration at <DIRECTORY>/stack.yaml, then you can add to its 'packages' field.

Expected behaviour

stach ghci <PROJECT_NAME> is called.

Actual behaviour

stack ghci <DIRECTORY_NAME> is called.

Log files

No response

The minimal config used to reproduce this issue.

default config

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions