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

Config: How to disable stan plugin #3157

Closed
andys8 opened this issue Sep 14, 2022 · 18 comments
Closed

Config: How to disable stan plugin #3157

andys8 opened this issue Sep 14, 2022 · 18 comments
Assignees
Labels
component: hls-stan-plugin documentation type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@andys8
Copy link
Collaborator

andys8 commented Sep 14, 2022

Hey there, it's either currently not possible or I don't know how to exactly disable the stan plugin.

  • Config is "stan": { "globalOn": false }
  • Docs don't list stan plugin
  • The default configuration (haskell-language-server-wrapper generate-default-config) doesn't have an entry for stan.

Is globalOn respected for this plugin?

image

Vim

Still enabled, but expected to be off

image

CLI

Still enabled, but expected to be off

image

Additional context

haskell-language-server-wrapper --probe-tools
haskell-language-server version: 1.8.0.0 (GHC: 9.2.4) (PATH: /home/andreas/.ghcup/bin/haskell-language-server-wrapper-1.8.0.0)
Tool versions found on the $PATH
cabal:          3.8.1.0
stack:          2.7.5
ghc:            9.2.4

Tool versions in your project
ghc:            8.10.7
@kokobd
Copy link
Collaborator

kokobd commented Sep 14, 2022

I'm not familiar with the dynamic config, but you can add --constraint "haskell-language-server -stan" to your cabal command if you were building HLS from source. In this way, stan plugin will be disabled at compile time.

@andys8
Copy link
Collaborator Author

andys8 commented Sep 14, 2022

I'm indeed compiling hls from scratch with ghcup compile hls and thanks for the hint. But I'm less interested in "fixing" this for me but to make sure configuration is working as expected for the project. Therefore I'm wondering if it can currently be disabled (like other plugins) and why it's missing in the documentation.

@kokobd kokobd added type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. documentation component: hls-stan-plugin and removed type: enhancement New feature or request status: needs triage labels Sep 14, 2022
@pepeiborra
Copy link
Collaborator

Have you tried "haskell.plugin.span.globalOn": false ?

@andys8
Copy link
Collaborator Author

andys8 commented Sep 14, 2022

The config format would not be the format generate-default-config suggests, but I'm having trouble to find any variant of configuration that has an effect. I'm starting to have doubts regarding the whole editor configuration I'm using.

Could you point me to documentation showing how to configure Vim with Coc with plugin options?


image

image

@AnthonySuper
Copy link

I am also experiencing this issue.

COC config:

{
  "languageserver": {
    "haskell": {
      "command": "haskell-language-server-wrapper",
      "args": ["--lsp"],
      "rootPatterns": ["*.cabal", "stack.yaml", "cabal.project", "package.yaml", "hie.yaml"],
      "filetypes": ["haskell", "lhaskell"],
      "settings": {
        "languageServerHaskell": {
          "plugin": {
            "stan": {
              "globalOn": false
            }
          }
        }
      }
    }
  }
}

If I change it to:

{
  "languageserver": {
    "haskell": {
      "command": "haskell-language-server-wrapper",
      "args": ["--lsp"],
      "rootPatterns": ["*.cabal", "stack.yaml", "cabal.project", "package.yaml", "hie.yaml"],
      "filetypes": ["haskell", "lhaskell"],
      "settings": {
        "languageServerHaskell": {
          "plugin": {
            "stan": {
              "globalOn": false
            },
            "tactics": { "globalOn": false }
          }
        }
      }
    }
  }
}

Wingman is disabled. This suggests to me that the configuration is working, there's just no way to turn off stan.

The stan plugin also seems to be ignoring my .stan.toml file, for what it's worth.

@drewolson
Copy link

I'm experiencing the same issue -- no way to disable nor configure stan.

@pepeiborra
Copy link
Collaborator

Found the bug - Stan diagnostics should be gated in the same way that hlint are:

https://github.com/haskell/haskell-language-server/blob/master/plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs#L199-L205

@andys8
Copy link
Collaborator Author

andys8 commented Sep 15, 2022

Update: Not relevant for stan issue, but I figured out my configuration needed to switch to settings andys8/dotfiles@b2f5763

@michaelpj
Copy link
Collaborator

@uhbif19 can you take a look?

@uhbif19
Copy link
Collaborator

uhbif19 commented Sep 16, 2022

@michaelpj Will try to fix on weekend.

@andys8
Copy link
Collaborator Author

andys8 commented Sep 16, 2022

@uhbif19 @michaelpj Here is a suggestion for a fix that works for me: #3179

Documentation

@andys8
Copy link
Collaborator Author

andys8 commented Sep 17, 2022

#3179 merged, configuration should now work.

@m4lvin
Copy link
Contributor

m4lvin commented Jan 25, 2023

How can I disable the stan plugin when using emacs with eglot?

Above it says "Config is "stan": { "globalOn": false }" but where does this configuration go? Is it a config for HLS or editor-specific?

Alternatively, how can I tell HLS to ignore specific stan hints? As @AnthonySuper says above, the .stan.toml seems to be ignored.

Sorry to resurrect this issue, but I could not find the relevant documentation and still have these problems with HLS 1.9.0.0.

@jhrcek
Copy link
Collaborator

jhrcek commented Jan 25, 2023

I'm not that familiar with config. options, but what helped me was to build hls from source using ghcup with stan plugin disabled (https://www.haskell.org/ghcup/guide/#hls).
The -f-stan below is cabal flag which prevents stan plugin from being included in the final hls binary.

ghcup compile hls -g master --ghc 8.10.7 --cabal-update -- -f-stan

This assumes you're building hls to be used with ghc 8.10.7 (because AFAIK stan plugin only works with that version and is automatically disabled when building against more recent ghc versions)

@fendor
Copy link
Collaborator

fendor commented Jan 25, 2023

but where does this configuration go?

I think this is HLS specific, so in some HLS config you should specify that

@andys8
Copy link
Collaborator Author

andys8 commented Jan 25, 2023

Because I had trouble figuring out how the options should look like for Vim, I added an example with options to the docs. For emacs there is none. So in case you're able to tinker and find out how plugins can be configured (it be quite similar to other emacs LS settings), it would be awesome to add a more detailed example to the docs afterwards.

@m4lvin
Copy link
Contributor

m4lvin commented Feb 7, 2023

Thank you all for the replies!

I now managed to disable stan in emacs with eglot, by putting the following in my ~/.emacs 🎉

(use-package eglot
  :ensure t
  :config
  (add-hook 'haskell-mode-hook 'eglot-ensure)
  :config
  (setq-default eglot-workspace-configuration
                '((haskell
                   (plugin
                    (stan
                     (globalOn . :json-false))))))
  )

In particular, then with M-x eglot-show-workspace-configuration one can see the JSON config that eglot will send to the language server. See https://joaotavora.github.io/eglot/#Customizing-Eglot

As for editing the docs: Currently the whole emacs section assumes that lsp-mode is used and not eglot. So before I make a suggestion how to add this, would it be good to have separate (sub)sections for Emacs with lsp and Emacs with eglot?

(As far as I know newer versions of emacs ship with eglot by default, and not with lsp-mode.)

@michaelpj
Copy link
Collaborator

I'd be happy to have a section on eglot. We just need an eglot user to write it, maybe that's you? :)

m4lvin added a commit to m4lvin/haskell-language-server that referenced this issue Mar 1, 2023
michaelpj added a commit that referenced this issue Mar 2, 2023
* Docs: update Emacs section: add eglot with config example

Based on the discussion at #3157

* Update docs/configuration.md

Co-authored-by: Michael Peyton Jones <[email protected]>

---------

Co-authored-by: Michael Peyton Jones <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: hls-stan-plugin documentation 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

10 participants