Skip to content

Imports are not suggested anymore #2013

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

Closed
valyagolev opened this issue Jul 12, 2021 · 8 comments
Closed

Imports are not suggested anymore #2013

valyagolev opened this issue Jul 12, 2021 · 8 comments
Labels
build tool: stack component: imports plugin status: needs info Not actionable, because there's missing information type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@valyagolev
Copy link

Somehow imports are not suggested to me anymore, as they used to be. Which is really sad, it was a great feature:

Screenshot 2021-07-12 at 21 37 06

I've looked all over the plugin settings and the logs. hls correctly determines stack, and it's just a normal stack. Everything works, except those import suggestions. I miss them. What can I do to get them back? Thank you!

@jneira jneira transferred this issue from haskell/vscode-haskell Jul 13, 2021
@jneira
Copy link
Member

jneira commented Jul 13, 2021

Hi, thanks for the bug report. could we have a reproduction case (a link to a github project would be nice for example)?
Does it work for local definitions (definitions written by you in other modules of your project)? Do you have some intuition about when did it start to be broken?

@jneira jneira added component: imports plugin 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 status: needs repro labels Jul 13, 2021
@Kozaky
Copy link

Kozaky commented Jul 18, 2021

Hi @jneira,

I don't know if this will be useful for you, but I am using a Mac and I also have this issue. Just adding a few files to make the 2nd homework from CIS194: https://www.seas.upenn.edu/~cis194/spring13/lectures.html, you can see that there is no imports suggestion, nor for own functions nor for externals:

Screenshot 2021-07-18 at 14 50 25

Hope it will be useful.

Regards,

Kozaky

@jneira
Copy link
Member

jneira commented Jul 18, 2021

thanks for the additional info, I've observed hls suggest disable deferred-out-of-scope-variables, just in case, what does happen if you disable it?

@Kozaky
Copy link

Kozaky commented Jul 18, 2021

Well, if I do so, it is just added to the top as a GHC option and it fails when using stack build.

Screenshot 2021-07-18 at 15 08 10

Screenshot 2021-07-18 at 15 11 10

@valyagolev
Copy link
Author

Hi, thanks for the bug report. could we have a reproduction case (a link to a github project would be nice for example)?

I'm very sorry, I didn't notice the reply in time.

The particular quick action (suggesting an import) stopped showing up for all of my projects, including new ones, generated by stack new ....

When the extensions starts, it puts out the following logs:

[client] run command: "/Users/Valentin/Library/Application Support/Code/User/globalStorage/haskell.haskell/haskell-language-server-1.2.0-darwin-8.10.4 --lsp"
[client] debug command: "/Users/Valentin/Library/Application Support/Code/User/globalStorage/haskell.haskell/haskell-language-server-1.2.0-darwin-8.10.4 --lsp"
[client] server cwd: undefined
haskell-language-server version: 1.2.0.0 (GHC: 8.10.4) (PATH: /Users/Valentin/Library/Application Support/Code/User/globalStorage/haskell.haskell/haskell-language-server-1.2.0-darwin-8.10.4) (GIT hash: be2071e985cb417f984ab00a1aad76dee02d6d0b)
Starting (haskell-language-server)LSP server...
  with arguments: GhcideArguments {argsCommand = LSP, argsCwd = Nothing, argsShakeProfiling = Nothing, argsTesting = False, argsExamplePlugin = False, argsDebugOn = False, argsLogFile = Nothing, argsThreads = 0, argsProjectGhcVersion = False}
  with plugins: [PluginId "pragmas",PluginId "floskell",PluginId "fourmolu",PluginId "tactics",PluginId "ormolu",PluginId "stylish-haskell",PluginId "retrie",PluginId "brittany",PluginId "class",PluginId "haddockComments",PluginId "eval",PluginId "importLens",PluginId "refineImports",PluginId "moduleName",PluginId "hlint",PluginId "splice",PluginId "ghcide-hover-and-symbols",PluginId "ghcide-code-actions-imports-exports",PluginId "ghcide-code-actions-type-signatures",PluginId "ghcide-code-actions-bindings",PluginId "ghcide-code-actions-fill-holes",PluginId "ghcide-completions",PluginId "ghcide-type-lenses",PluginId "ghcide-core"]
  in directory: /Users/Valentin/Work/anna_s/migr-twine-parse
 Starting LSP server...
If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option!
Started LSP server in 0.03s
setInitialDynFlags cradle: Cradle {cradleRootDir = "/Users/Valentin/Work/anna_s/migr-twine-parse", cradleOptsProg = CradleAction: Stack}
2021-07-19 10:37:07.095546 [ThreadId 5] INFO hls:	Registering ide configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri 7943515629417308503 "file:///Users/Valentin/Work/anna_s/migr-twine-parse"], clientSettings = hashed Nothing}
2021-07-19 10:37:07.157639 [ThreadId 94] INFO hls:	Consulting the cradle for "src/Lib.hs"
2021-07-19 10:37:07.157824 [ThreadId 94] WARNING hls:	No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for src/Lib.hs.
 Proceeding with [implicit cradle](https://hackage.haskell.org/package/implicit-hie).
You should ignore this message, unless you see a 'Multi Cradle: No prefixes matched' error.
Output from setting up the cradle Cradle {cradleRootDir = "/Users/Valentin/Work/anna_s/migr-twine-parse", cradleOptsProg = CradleAction: Stack}
> Configuring GHCi with the following packages: migr-twine-parse
> /Users/Valentin/Work/anna_s/migr-twine-parse/.stack-work/install/x86_64-osx/1732a24b17cfb9e3e332440dce59ca7ff9e7744f995e8f86f078c4909c28820f/8.10.4/pkgdb:/Users/Valentin/.stack/snapshots/x86_64-osx/1732a24b17cfb9e3e332440dce59ca7ff9e7744f995e8f86f078c4909c28820f/8.10.4/pkgdb:/Users/Valentin/.stack/programs/x86_64-osx/ghc-8.10.4/lib/ghc-8.10.4/package.conf.d
2021-07-19 10:37:09.919059 [ThreadId 94] INFO hls:	Using interface files cache dir: /Users/Valentin/.cache/ghcide/main-354f52094f6a62b19ca38ce88980563ba61cf5cb
2021-07-19 10:37:09.920079 [ThreadId 94] INFO hls:	Making new HscEnv[main]
2021-07-19 10:37:09.959868 [ThreadId 230] INFO hls:	finish: ModuleName.ghcSession (took 0.01s)
2021-07-19 10:37:09.959904 [ThreadId 231] INFO hls:	finish: ModuleName.ghcSession (took 0.00s)
2021-07-19 10:37:10.001346 [ThreadId 253] INFO hls:	finish: Wingman.getIdeDynflags.GetModSummaryWithoutTimestamps (took 0.05s)
2021-07-19 10:37:10.001278 [ThreadId 252] INFO hls:	finish: Wingman.getIdeDynflags.GetModSummaryWithoutTimestamps (took 0.05s)
2021-07-19 10:37:10.072427 [ThreadId 470] INFO hls:	finish: splice.codeAction.GitHieAst (took 0.13s)
2021-07-19 10:37:10.072287 [ThreadId 465] INFO hls:	finish: parsed (took 0.13s)
2021-07-19 10:37:10.072299 [ThreadId 467] INFO hls:	finish: parsed (took 0.12s)
2021-07-19 10:37:10.072609 [ThreadId 465] INFO hls:	finish: importLens (took 0.12s)
2021-07-19 10:37:10.07271 [ThreadId 465] INFO hls:	finish: RefineImports (took 0.13s)

(etc etc)

When I add an import myself (an import I wished would be suggested), I can hover over the imported symbols and see the documentation and the type just fine. All the other features seem to work fine, except:

  • I have to restart the language server manually every time I add a new dependency (not sure if that's not how it supposed to work anyway...)
  • A typical stack template creates code for the library in src/ and for the executable in the app/. There's a bit of import confusion sometimes if I work in both these folders.
  • Sometimes the intra-project imports don't work until I stack install my project. A bit unfortunate and weird, but that's what I found on the web. It might be because I write too much code in the app/ kinds of folders, though.

@jneira jneira added build tool: stack and removed status: needs info Not actionable, because there's missing information labels Aug 2, 2021
@hasufell hasufell added status: needs info Not actionable, because there's missing information and removed old_status: needs repro labels Jul 13, 2022
@aavogt
Copy link

aavogt commented Nov 9, 2022

I can reproduce this with GHC 9.4.2 but not with 8.10.7. Both use HLS 1.8.0.0: https://github.com/aavogt/import-code-action

@fendor
Copy link
Collaborator

fendor commented Nov 9, 2022

For GHC 9.4.2, the plugin which takes care of imports is not enabled yet, afaict.

@michaelpj
Copy link
Collaborator

Closing as old and quiet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build tool: stack component: imports plugin status: needs info Not actionable, because there's missing information 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

7 participants