nvimdev / lspsaga.nvim

improve neovim lsp experience
MIT License
3.37k stars 285 forks source link

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

Open nunocf opened 3 weeks ago

nunocf commented 3 weeks ago

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

Tonelllo commented 2 weeks ago

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 commented 1 week ago

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 commented 1 week ago

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 commented 1 week ago

A bug of LSP Saga.