redhat-developer / lsp4ij

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

feat: Support file link in hover #379

Closed angelozerr closed 3 months ago

angelozerr commented 3 months ago

feat: Support file link in hover

Fixes #376

@CppCXY here a demo with your Lua LS:

LuaMarkdownLink

angelozerr commented 3 months ago

@FalsePattern please follow this PR, it seems that we do the same thing https://github.com/FalsePattern/ZigBrains/blob/c1f1dd88f14e0c3b631042d92d3880e55670c34c/modules/lsp/src/main/java/com/falsepattern/zigbrains/lsp/contributors/LSPDocumentationLinkHandler.java#L43

fbricon commented 3 months ago

Line numbers should be 1-based, as in vscode: L5 should open the 5th line of the file, not the 6th

angelozerr commented 3 months ago

Line numbers should be 1-based, as in vscode: L5 should open the 5th line of the file, not the 6th

Good catch! It should be fixed now.

angelozerr commented 3 months ago

@fbricon the PR should work now and I have fixed too the renderer with several links which must be aligned in the same line and not in several lines.

Given this ts file:

/**
  Some content...
  > and some links:
 * [bar.ts](bar.ts#L2:2)
  * [lsp4ij](https://github.com/redhat-developer/lsp4ij)

 */
function foo() {
}

foo();

When you hover foo method, links must be aligned in the same line like vscode does:

image

angelozerr commented 3 months ago

Works fine with zls (not using ZigBrains). I just added the zig textmate grammar so it looks fine. Jun-24-2024 13-08-00 Jun-24-2024 13-08-00

@FalsePattern as you can see the demo, you will enjoy with syntax coloration in markdown hover when you will adapt LSP4IJ.