Skip to content

hls does not detect new dependencies added to packages.yml #775

Closed
@GuillaumeDesforges

Description

@GuillaumeDesforges
Bug description

I'm using VS Code, with the ghcide extension.

When adding a package dependency to the package.yaml, I have to reload to entire VS Code window to restart ghcide to detect and load this new dependency in ghcide.

Desired behaviour

ghcide should reload the dependencies when packages.yaml is updated, so that I don't have to restart it manually.

Version
$ ghcide --version
ghcide version: 0.2.0 (GHC: 8.8.3) (PATH: /nix/store/sdn0dabqvc1g25s8grq7sa9g13ax8fk7-ghcide-exe-ghcide-0.2.0/bin/ghcide)

using Remote SSH extension for VS Code

vscode client on Windows 10
vscode server on NixOS 20.03

I use the ghcide-nix derivation to get GHCIDE (version was recently bumped there)

Activity

ndmitchell

ndmitchell commented on Jun 12, 2020

@ndmitchell
Collaborator

You can do "Restart extension host" to reload just the extensions, which is a bit less violent. Agreed that auto-reloading the right pieces would be desirable - I guess this is a package.yaml file that Stack transforms into a mypackage.cabal file?

fendor

fendor commented on Jun 12, 2020

@fendor
Collaborator

I think that the stack cradle is watching for changes to package.yaml and should detect these changes.

GuillaumeDesforges

GuillaumeDesforges commented on Jun 13, 2020

@GuillaumeDesforges
Author

I think that the stack cradle is watching for changes to package.yaml and should detect these changes.

That was my understanding as well, but it doesn't.

fendor

fendor commented on Jun 13, 2020

@fendor
Collaborator

Is the project structure different to a basic stack new? Or haskeleton template?

GuillaumeDesforges

GuillaumeDesforges commented on Jun 13, 2020

@GuillaumeDesforges
Author

It is a stack project with multiple projects (in subdirectories), and one of the project is a classic component defined by a package.yaml

The hie.yaml defines multiple cradles for the projects, and the concerned cradle has a standard config (stack component)

fendor

fendor commented on Jun 14, 2020

@fendor
Collaborator

Maybe that is the problem, the dependencies ought to be relative to the cradleRootDir. Maybe they are not canonicalized in ghcide?
https://github.com/digital-asset/ghcide/blob/master/exe/Main.hs#L271
Should probably make the filepaths relative to the cradleRootDir or make them even absolute.

fendor

fendor commented on Jun 14, 2020

@fendor
Collaborator

We actually need both, the dependencies could be relative to the cradleRootDir or to componentRootDir e.g.

.
├── cabal.project
├── servant-server
│   └── servant-server.cabal
└─── servant-docs
    └── servant-docs.cabal
Options for 'servant-server'
Root directory:      ./servant
Component directory: ./servant/servant-server
Dependencies:        stack.yaml servant-server.cabal package.yaml
Options for 'servant-docs'
Root directory:      ./servant
Component directory: ./servant/servant-docs
Dependencies:        stack.yaml servant-docs.cabal package.yaml

We need to reload both components in case of change to ./servant/stack.yaml but only one for changes to ./servant/servant-server/servant-server.cabal, ./servant/servant-server/package.yaml and ./servant/servant-docs/servant-docs.cabal, ./servant/servant-docs/package.yaml respectively.

A proposed solution:
Change the API of cradle dependencies in hie-bios to give absolute paths since this is the only location where we can know this. (Another breaking change, yay)
Unfortunately, this does not play nicely with the latest breaking change to extend a CradleError with the dependencies of the component, since we dont know the component dir in that case :(

pepeiborra

pepeiborra commented on Dec 31, 2020

@pepeiborra
Collaborator

@fendor can this ticket be closed now?

transferred this issue fromhaskell/ghcideon Dec 31, 2020
changed the title [-]ghcide 0.2 does not detect new dependencies added to packages.yml[/-] [+]hls does not detect new dependencies added to packages.yml[/+] on Jan 12, 2021
jneira

jneira commented on Jan 12, 2021

@jneira
Member

Recently this issue was noted in the irc channel by an user so i guess this is still an issue.
@fendor the plan could be still this?

Change the API of cradle dependencies in hie-bios to give absolute paths since this is the only location where we can know this.

GuillaumeDesforges

GuillaumeDesforges commented on Jan 12, 2021

@GuillaumeDesforges
Author

I can confirm the issue still happens, I often restart the HLS manually.

removed
status: needs infoNot actionable, because there's missing information
on Aug 17, 2021
jneira

jneira commented on Aug 31, 2021

@jneira
Member

i think we can close it as duplicate of #1068

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @pepeiborra@jneira@ndmitchell@GuillaumeDesforges@fendor

        Issue actions

          hls does not detect new dependencies added to packages.yml · Issue #775 · haskell/haskell-language-server