Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
GuillaumeDesforges opened this issue Jun 12, 2020 · 11 comments
Closed

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

GuillaumeDesforges opened this issue Jun 12, 2020 · 11 comments
Labels
build tool: stack component: hie-bios type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@GuillaumeDesforges
Copy link

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)

@ndmitchell
Copy link
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
Copy link
Collaborator

fendor commented Jun 12, 2020

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

@GuillaumeDesforges
Copy link
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
Copy link
Collaborator

fendor commented Jun 13, 2020

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

@GuillaumeDesforges
Copy link
Author

GuillaumeDesforges commented Jun 13, 2020

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
Copy link
Collaborator

fendor commented Jun 14, 2020

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
Copy link
Collaborator

fendor commented Jun 14, 2020

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
Copy link
Collaborator

@fendor can this ticket be closed now?

@pepeiborra pepeiborra transferred this issue from haskell/ghcide Dec 31, 2020
@jneira jneira added build tool: stack component: hie-bios type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. status: needs info Not actionable, because there's missing information type: setup labels Jan 1, 2021
@jneira jneira 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 Jan 12, 2021
@jneira
Copy link
Member

jneira commented Jan 12, 2021

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
Copy link
Author

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

@jneira jneira removed the status: needs info Not actionable, because there's missing information label Aug 17, 2021
@jneira
Copy link
Member

jneira commented Aug 31, 2021

i think we can close it as duplicate of #1068

@jneira jneira closed this as completed Aug 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build tool: stack component: hie-bios type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

No branches or pull requests

5 participants