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

'height' key must be a positive 'Integer' when opening code actions. #1469

Open
nunocf opened this issue Jun 19, 2024 · 11 comments
Open

'height' key must be a positive 'Integer' when opening code actions. #1469

nunocf opened this issue Jun 19, 2024 · 11 comments
Labels
bug Something isn't working

Comments

@nunocf
Copy link

nunocf commented Jun 19, 2024

Describe the bug

I run Lspsaga code_action on a Haskell file with HLS running and I get the following error:

image

Above it, this also displays: (Sorry, I can only keep one on the screen at a time for a screenshot).
image

Steps to reproduce

I have a simple haskell file open in Nvim, with Haskell language server running.
The code has code actions available, like unused imports:

module HCat where

import Control.Exception qualified as Exception
import Data.ByteString qualified as BS
import Data.Text qualified as Text
import Data.Text.IO qualified as TextIO
import System.Environment qualified as Env
import System.IO.Error qualified as IOError

runHCat :: IO ()
runHCat =
  handleIOError $
    handleArgs
      >>= eitherToErr
      >>= TextIO.readFile
      >>= TextIO.putStrLn
  where
    handleIOError :: IO () -> IO ()
    handleIOError ioAction =
      Exception.catch ioAction $
        \e -> putStrLn "I ran into an error: " >> print @IOError e

eitherToErr :: (Show a) => Either a b -> IO b
eitherToErr (Right a) = return a
eitherToErr (Left e) =
  Exception.throwIO . IOError.userError $ show e

handleArgs :: IO (Either String FilePath)
handleArgs =
  parseArgs <$> Env.getArgs
  where
    parseArgs argumentsList =
      case argumentsList of
        [fname] -> Right fname
        [] -> Left "Error: No arguments provided"
        _ -> Left "Error: Too many arguments provided"

groupsOf :: Int -> [a] -> [[a]]
groupsOf _ [] = []
groupsOf n elems =
  let (hd, tl) = splitAt n elems
   in hd : groupsOf n tl

I run Lspsaga code_action and I get the error messages.

Here's my nixvim flake, if you run it, you should have the exact same config as I do.

Expected behavior

I'd expect no errors.

Neovim version (nvim -v)

0.10.0 commit

lspsaga commit

2024-06-09 (that's the version in nixpackages unstable) I don't know where the commit is.

Terminal name/version

kitty 0.35.1

@nunocf nunocf added the bug Something isn't working label Jun 19, 2024
@Tonelllo
Copy link

I am having the same issue. It happens when trying to execute a code action. For me the problem is on a cpp file.

I noticed that the error happens when using a code action on an unused header file, but not in the code. For example:
image
image
Here there are no problems.

But if I apply a code-action to an unused header:
image
Then the following error appears
image

Neovim version

0.10.0

Lspsaga commit

6f920cf

Terminal name/version

Konsole 23.08.5

@Buer-Nahida
Copy link

Because at file begining has no size to show diff window, so neovim dump a Error, but error window can show normal. I don't know why error code_action can move diff window to under.
2024-07-09-12-25-36

@nunocf
Copy link
Author

nunocf commented Jul 9, 2024

So is this something we can fix locally or is it an LSP Saga bug?
I'd love to be able to help here :)

@Buer-Nahida
Copy link

A bug of LSP Saga.

@Kyren223
Copy link

@nunocf, @Tonelllo I added an option to disable the preview entirely.
This fixes the issue if you don't mind not having the changes preview.

To apply the fix, change the url to 'Kyren223/lspsaga.nvim', and add this option:
code_action = { show_preview = false } (either in opts = {} or setup)

@nunocf
Copy link
Author

nunocf commented Aug 6, 2024

Thank you @Kyren223.

Unfortunately, I use this with nixvim, would it still be possible to use your fork? Or are there plans to merge this into master?

@Kyren223
Copy link

Kyren223 commented Aug 7, 2024

@nunocf I don't use nixvim myself but I am sure there is a way to add custom plugins, all you need to do is to use Kyren223/lspsaga.nvim instead of nvimdev/lspsaga.nvim (or if lspsaga is builtin, then disable it and add my plugin the same way you would add a custom plugin that isn't built in to nixvim)

@yingmanwumen
Copy link

What's the progress of this issue now?

@nunocf
Copy link
Author

nunocf commented Sep 12, 2024

Haven't updated LSP Saga in a while, so the issue is still there for me.
@glepnir @Buer-Nahida has this been fixed?
Have you considered the solution from @Kyren223 ?

@yingmanwumen
Copy link

Haven't updated LSP Saga in a while, so the issue is still there for me.
@glepnir @Buer-Nahida has this been fixed?
Have you considered the solution from @Kyren223 ?

Unfortunately it remains in the newest version, and I don't know how to deal with it neither.

@HusuSama
Copy link

@Tonelllo In Python, there is a similar issue; if you add a comment at the top of the file, it won't result in an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants