Skip to content

How do I use the Eval plugin? #425

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
googleson78 opened this issue Sep 23, 2020 · 8 comments
Closed

How do I use the Eval plugin? #425

googleson78 opened this issue Sep 23, 2020 · 8 comments
Labels
component: hls-eval-plugin type: support User support tickets, questions, help with setup etc.

Comments

@googleson78
Copy link
Contributor

googleson78 commented Sep 23, 2020

I'm using LanguageClient-neovim.

When I write something like, let's say

-- >>> 3 + 5

the only thing that happens is that the string Evaluate... pops up on the right of the comment (as nvim virtual text). I don't know how to interact with this - I only tried a codeAction and nothing pops up.

How do I interact with this via the lsp interface?

@Anrock
Copy link
Contributor

Anrock commented Sep 24, 2020

I believe this question is about LanguageClient-neovim, not hls. Check out the docs of to see if there is something about triggering a codelens or create an issue about it in LanguageClient-neovim repo.

@googleson78
Copy link
Contributor Author

Thanks, it does support "code lens actions"!

My issue is rather that I can't find if it's mentioned anywhere that the evaluate thing is a "code lens" and that you're supposed to use the action associated with it.

Is it documented somewhere, and if not, would it be alright to put it in the README next to the feature description?

On a side-note if someone is willing to explain/give a pointer:
For someone who hasn't programmed/directly used lsp: what's the decision process between deciding that something should be a "code lens" vs a "code action"?

@jneira jneira added editor: vim/neovim type: support User support tickets, questions, help with setup etc. component: hls-eval-plugin labels Sep 24, 2020
@jneira
Copy link
Member

jneira commented Sep 24, 2020

Is it documented somewhere, and if not, would it be alright to put it in the README next to the feature description?

It would make sense for me.

what's the decision process between deciding that something should be a "code lens" vs a "code action"?

Afaik there is no a explicit process to take the decision, it depends on the implementer and varies from case to case.

@Anrock
Copy link
Contributor

Anrock commented Sep 24, 2020

Quick'n'dirty PR with readme update: #428

@tek
Copy link
Contributor

tek commented Sep 24, 2020

@googleson78 does anything happen when you run that code lens action thingy? I'm using coc.nvim, and when I hit code lens action, nothing happens on an Evaluate... line

@googleson78
Copy link
Contributor Author

@tek
With the following file:
asdf.hs

module Main where
-- >>> 3 + 5

if I do :call LanguageClient#handleCodeLensAction()
I get the option to evaluate it (via LanguageClients mechanism for showing options), and if I select it my file changes to this:

module Main where
-- >>> 3 + 5
-- 8

the Main is there because of some bug (I think?, and I also think it was recently discussed somewhere around here and potentially fixed?)
so I'm guessing either try adding a module declaration, or look at what coc.nvim does for "code lens action"

@tek
Copy link
Contributor

tek commented Sep 24, 2020

I'm seeing this in the hls output:

2020-09-24 12:41:26.209277786 [ThreadId 1442559] - finish: runEvalCmd.ghcSession (took 0.00s)
2020-09-24 12:42:14.50019892 [ThreadId 1442564] - Plugin.makeCodeLens (ideLogger)
2020-09-24 12:42:14.500492612 [ThreadId 1442565] - finish: codeLens (took 0.00s)
2020-09-24 12:42:14.500763445 [ThreadId 1442567] - finish: importLens (took 0.00s)
2020-09-24 12:42:14.500818535 [ThreadId 1442569] - finish: importLens (took 0.00s)
[Error  - 12:42:15 PM] Request workspace/executeCommand failed.
  Message: BadDependency "GhcSessionDeps"
  Code: -32603
2020-09-24 12:42:15.212794328 [ThreadId 1442576] - finish: runEvalCmd.ghcSession (took 0.00s)

@googleson78
Copy link
Contributor Author

My original motivation/issue is now resolved, so I'm closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: hls-eval-plugin type: support User support tickets, questions, help with setup etc.
Projects
None yet
Development

No branches or pull requests

4 participants