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

Wrong code block renderer when documentation contains CLRF #368

Closed
CppCXY opened this issue Jun 19, 2024 · 20 comments · Fixed by #432 · May be fixed by #370
Closed

Wrong code block renderer when documentation contains CLRF #368

CppCXY opened this issue Jun 19, 2024 · 20 comments · Fixed by #432 · May be fixed by #370
Assignees
Labels
bug Something isn't working completion enhancement New feature or request hover
Milestone

Comments

@CppCXY
Copy link
Contributor

CppCXY commented Jun 19, 2024

in completion document:
image
in hover:
image

@angelozerr
Copy link
Contributor

What si the result with JetBrains LSP support?

Could you share your LSP traces with hover please.

@CppCXY
Copy link
Contributor Author

CppCXY commented Jun 19, 2024

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
Copy link
Contributor Author

CppCXY commented Jun 19, 2024

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

angelozerr added a commit to angelozerr/lsp4ij that referenced this issue Jun 19, 2024
@angelozerr angelozerr added this to the 0.0.2 milestone Jun 19, 2024
@angelozerr angelozerr added bug Something isn't working completion hover labels Jun 19, 2024
angelozerr added a commit to angelozerr/lsp4ij that referenced this issue Jun 19, 2024
@fbricon fbricon added enhancement New feature or request and removed bug Something isn't working labels Jun 20, 2024
@angelozerr angelozerr removed this from the 0.0.2 milestone Jun 21, 2024
@angelozerr
Copy link
Contributor

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

@CppCXY
Copy link
Contributor Author

CppCXY commented Jun 21, 2024

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
Copy link
Contributor

fbricon commented Jun 21, 2024

@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
Copy link

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
Copy link
Contributor

@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
Copy link
Contributor

@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
Copy link
Contributor Author

CppCXY commented Jul 1, 2024

@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
Copy link

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
Copy link
Contributor

angelozerr commented Jul 4, 2024

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

@deanmaster
Copy link

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

@angelozerr
Copy link
Contributor

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

Great, but we need to fix some existing issues.

@CppCXY
Copy link
Contributor Author

CppCXY commented Jul 22, 2024

@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
Copy link
Contributor

Thanks @CppCXY for your feedback.

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

@angelozerr angelozerr changed the title The plaintext rendering color on the completion document is too dark. Wrong code block renderer when documentation contains CLRF Jul 29, 2024
angelozerr added a commit to angelozerr/lsp4ij that referenced this issue Jul 29, 2024
@angelozerr
Copy link
Contributor

angelozerr commented Jul 29, 2024

@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.

@angelozerr angelozerr self-assigned this Jul 29, 2024
@angelozerr angelozerr added this to the 0.4.0 milestone Jul 29, 2024
@angelozerr angelozerr moved this to 👀 In review in IDE Cloudaptors Jul 29, 2024
@CppCXY
Copy link
Contributor Author

CppCXY commented Jul 29, 2024

and tell me if it fixes your issue please.

Thanks.

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

angelozerr added a commit to angelozerr/lsp4ij that referenced this issue Jul 29, 2024
@angelozerr
Copy link
Contributor

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

That's great! Thanks for your feedback.

@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in IDE Cloudaptors Jul 29, 2024
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in IDE Cloudaptors Jul 29, 2024
@angelozerr
Copy link
Contributor

@CppCXY I have published nightly build with the fix.

@angelozerr angelozerr added the bug Something isn't working label Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working completion enhancement New feature or request hover
Projects
Status: ✅ Done
4 participants