ray-x / lsp_signature.nvim

LSP signature hint as you type
Apache License 2.0
2.07k stars 57 forks source link

end_col value outside range for `fp-ts`'s `pipe` #114

Closed Gelio closed 3 years ago

Gelio commented 3 years ago

Hey! Thanks for this plugin, it makes my life a lot easier :smile:

When using fp-ts in TypeScript, I've noticed that occasionally I get

Error executing vim.schedule lua callback: ...er/start/lsp_signature.nvim/lua/lsp_signature_helper.lua:533: 

when the signature of the pipe function is shown

image

It is quite a lengthy function signature, so maybe that is why. Also, you can probably see the final line that is shown is wrapped.

Is there any way I could help debug it further?

ray-x commented 3 years ago

Thanks. It will be helpful next time you saw the error run command

:message

So you can see details of the error. Also it will be helpful to post the function triggering the error.

Gelio commented 3 years ago

Here's my reproduction:

https://user-images.githubusercontent.com/889383/138067003-1472caf0-74eb-4689-940b-a9eceaaed661.mp4

I don't think there's much else I can get from :messages - only the error message I posted earlier is printed.

The code that is triggering the problem:

import * as TE from "fp-ts/lib/TaskEither";
import { readFile } from "fs";
import { promisify } from "util";

const promisifiedReadFile = promisify(readFile);

const getStdinContent: TE.TaskEither<Error, string> = TE.tryCatch(
  () => promisifiedReadFile(process.stdin.fd, { encoding: "utf-8" }),
  (error) => {
    if (error instanceof Error) {
      return error;
    } else {
      return new AggregateError([error], "Unexpected error");
    }
  }
);

pipe(getStdinContent, // entering Insert mode here causes the problem

This reliably reproduces the problem - I get the error message every time when entering Insert mode at the end of pipe.

pipe has many overloads (see the docs), which is why its signature is lengthy

Is there any way I can help?

ray-x commented 3 years ago

I submitted a fix for it. Please check if it works for you.

Gelio commented 3 years ago

Thanks! That was quick. The fix seems to be working correctly - I don't see the error anymore (and I believe I am also now able to see the :panda_face: hint, which I think I was not able to see before).

I'll close the issue. Thanks once again :+1:

silva-fj commented 3 years ago

Hi @ray-x, I'm getting the same error but in .tsx files (React app) for any function.

Error executing vim.schedule lua callback: .../plugged/lsp_signature.nvim/lua/lsp_signature_helper.lua:532: end_col value outside range