redhat-developer / lsp4ij

LSP Client for IntelliJ
Eclipse Public License 2.0
91 stars 17 forks source link

Wrong code block renderer when documentation contains CLRF #368

Closed CppCXY closed 2 months ago

CppCXY commented 3 months ago

in completion document: image in hover: image

angelozerr commented 3 months ago

What si the result with JetBrains LSP support?

Could you share your LSP traces with hover please.

CppCXY commented 3 months ago

about this completion:

[Trace - 19:27:54] Received response 'completionItem/resolve - (47)' in 3ms.
Result: {
  "label": "f",
  "labelDetails": {
    "detail": "(a)",
    "description": "nil"
  },
  "kind": 2,
  "documentation": {
    "kind": "markdown",
    "value": "```lua\nfunction f(a:aa) -\u003e nil\n```\n\n___\n```plaintext\nparams: a\r\n\n```\n\n___\n"
  },
  "data": "98784247821"
}
CppCXY commented 3 months ago

This is my own Lua language server, not Sumneko Lua. I have not implemented a JetBrains LSP version for it.

angelozerr commented 3 months ago

According this comment @fbricon I think we should keep like this, right?

CppCXY commented 3 months ago

another question about the render. the return of the protocol is like this:

[Trace - 15:01:34] Received response 'textDocument/hover - (9)' in 3ms.
Result: {
  "contents": {
    "kind": "markdown",
    "value": "```lua\nfunction insert(\r\n    list:table,\n    pos:number,\n    value:any\n)\n-\u003e number\n```\n\nin class `table`\r\nInserts element `value` at position `pos` in `list`, shifting up the\n elements to `list[pos]`, `list[pos+1]`, `···`, `list[#list]`. The default\n value for `pos` is ``#list+1`, so that a call `table.insert(t,x)`` inserts\n `x` at the end of list `t`.\r\nGo to: [table](file:///C:/Users/zc/.vscode/extensions/tangzx.emmylua-0.7.7-win32-x64/server/win32-x64/win32-x64/Resources/std/builtin.lua#91:4-91:15)|[number](file:///C:/Users/zc/.vscode/extensions/tangzx.emmylua-0.7.7-win32-x64/server/win32-x64/win32-x64/Resources/std/builtin.lua#40:4-40:16)|[any](file:///C:/Users/zc/.vscode/extensions/tangzx.emmylua-0.7.7-win32-x64/server/win32-x64/win32-x64/Resources/std/builtin.lua#95:4-95:13)\r\n"
  }
}

but I see: image

the error in color might be my fault, but why has "number" become "numbe"?

in vscode: image

fbricon commented 3 months ago

@angelozerr looks like an off-by-1 error in the code block renderer. Hopefully it should be easy to reproduce with a unit test

deanmaster commented 3 months ago

Hello everyone,

Probably this is not the right place, but can you show me documentation to adjust the clientCapabilities in this plugin or all clientCapabilities are hardcoded not matter what are supported from server.

Thanks, Tuan Do

angelozerr commented 3 months ago

@deanmaster could you create a New issue please.

It seems it is an another topic.

To give you a quick answer, client capabilities are hard coded because it defines the LSP4IJ capabilities.

In lsp client initlialize the lsp server by setting the client capabilitues. In vscode context, vscode use the hard coded vscode client capabilities. LSP4IJ does the same thing.

After this initialize, server send to client the server capabilities.

In other words you must not customize the client capabilities or perhaps I miss something?

angelozerr commented 3 months ago

@angelozerr looks like an off-by-1 error in the code block renderer. Hopefully it should be easy to reproduce with a unit test

I need to reproduce it, but I wonder why we have not this problem with other ls?

@CppCXY have you every time this problem?

CppCXY commented 3 months ago

@angelozerr looks like an off-by-1 error in the code block renderer. Hopefully it should be easy to reproduce with a unit test

I need to reproduce it, but I wonder why we have not this problem with other ls?

@CppCXY have you every time this problem?

always meet this problem: image

deanmaster commented 2 months ago

Thanks @angelozerr I got your point. So far, I couldn't build this project in my machine due to many reasons. I'm looking forward to 0.0.3 release or you can give me a build number which I can use in my code project is perfect. Thanks and looking forward to semanticToken feature.

angelozerr commented 2 months ago

@deanmaster you dont need to build yourself the plugin. See 'Testing nightly builds' section from the README.md

deanmaster commented 2 months ago

@angelozerr perfect, I just install nightly i can see it's working great!

angelozerr commented 2 months ago

@angelozerr perfect, I just install nightly i can see it's working great!

Great, but we need to fix some existing issues.

CppCXY commented 2 months ago

@angelozerr looks like an off-by-1 error in the code block renderer. Hopefully it should be easy to reproduce with a unit test

I need to reproduce it, but I wonder why we have not this problem with other ls? @CppCXY have you every time this problem?

always meet this problem

The reason for this issue should be that I occasionally used CRLF in hover.

angelozerr commented 2 months ago

Thanks @CppCXY for your feedback.

I will try to fix it as soon as I will find time.

angelozerr commented 2 months ago

@CppCXY first I have renamed your issue.

I have tried to do a quick fix.

Could you please try to install the LSP4IJ zip at https://github.com/redhat-developer/lsp4ij/actions/runs/10141756236

image

and tell me if it fixes your issue please.

Thanks.

CppCXY commented 2 months ago

and tell me if it fixes your issue please.

Thanks.

I tested it with the previous version, and it is indeed fixed.

angelozerr commented 2 months ago

I tested it with the previous version, and it is indeed fixed.

That's great! Thanks for your feedback.

angelozerr commented 2 months ago

@CppCXY I have published nightly build with the fix.