redhat-developer / lsp4ij

LSP Client for IntelliJ
Eclipse Public License 2.0
48 stars 9 forks source link

Support file link in hover #376

Closed CppCXY closed 1 week ago

CppCXY commented 1 week ago

image When I press x trying to jump, a vscode pops up: image I hope that IDEA can jump on its own.

CppCXY commented 1 week ago

In VSCode, the supported URI format is "{uri}#{line}:{col}-{line}:{col}", I hope IDEA can also support this.

angelozerr commented 1 week ago

Could you please share your lsp trace hover.

CppCXY commented 1 week ago

Could you please share your lsp trace hover.

[Trace - 17:22:27] Received response 'textDocument/hover - (45)' in 9ms.
Result: {
  "contents": {
    "kind": "markdown",
    "value": "```lua\nlocal t : ambiguous\n```\n\n___\n[x](file:///C:/Users/zc/Desktop/learn/test2.lua)"
  }
}
angelozerr commented 1 week ago

@CppCXY when you write your issue could you please add it the content of your file too.

It will avoid for me to rewriting your sample file by seeing your screenshot. Thanks!

CppCXY commented 1 week ago

@CppCXY when you write your issue could you please add it the content of your file too.

It will avoid for me to rewriting your sample file by seeing your screenshot. Thanks!

ok, the file: learn.zip

angelozerr commented 1 week ago

In VSCode, the supported URI format is "{uri}#{line}:{col}-{line}:{col}", I hope IDEA can also support this.

You mean that you can write this syntax in your comment?

If yes could you give me a sample?

angelozerr commented 1 week ago

Could you please share your lsp trace hover.

[Trace - 17:22:27] Received response 'textDocument/hover - (45)' in 9ms.
Result: {
  "contents": {
    "kind": "markdown",
    "value": "```lua\nlocal t : ambiguous\n```\n\n___\n[x](file:///C:/Users/zc/Desktop/learn/test2.lua)"
  }
}

Thanks!

angelozerr commented 1 week ago

@CppCXY when you write your issue could you please add it the content of your file too. It will avoid for me to rewriting your sample file by seeing your screenshot. Thanks!

ok, the file: learn.zip

Sorry I wanted to say to add your content file in the issue like:


--- [x](file:///C:/Users/zc/Desktop/learn/test.lua)
local t
CppCXY commented 1 week ago

@CppCXY when you write your issue could you please add it the content of your file too. It will avoid for me to rewriting your sample file by seeing your screenshot. Thanks!

ok, the file: learn.zip

Sorry I wanted to say to add your content file in the issue like:

--- [x](file:///C:/Users/zc/Desktop/learn/test.lua)
local t

This file uri is pointing to the file itself.

CppCXY commented 1 week ago

In VSCode, the supported URI format is "{uri}#{line}:{col}-{line}:{col}", I hope IDEA can also support this.

I'm sorry, I was wrong, VSCode only supports {uri}#line.

angelozerr commented 1 week ago
--- [x](file:///C:/Users/zc/Desktop/learn/test.lua)
local t

So you can write this lua file content:


--- [x](file:///C:/Users/zc/Desktop/learn/test.lua#10)
local t

Is that?

CppCXY commented 1 week ago
--- [x](file:///C:/Users/zc/Desktop/learn/test.lua)
local t

So you can write this lua file content:

--- [x](file:///C:/Users/zc/Desktop/learn/test.lua#10)
local t

Is that?

yes

angelozerr commented 1 week ago

Ok and could you write relative path?

CppCXY commented 1 week ago

image We use this feature to implement Go to types in hover

angelozerr commented 1 week ago

@CppCXY I have played in vscode with uri

[x](file:///C:/Users/zc/Desktop/learn/test.lua#10)

is working

[x](file:///C:/Users/zc/Desktop/learn/test.lua#10:5)

doen't work (it doesnt' jump to 5 clumnà)

CppCXY commented 1 week ago

[x](file:///C:/Users/zc/Desktop/learn/test.lua#10:5)

doen't work (it doesnt' jump to 5 clumnà)

Indeed, it does not support column.

angelozerr commented 1 week ago

@CppCXY @FalsePattern the PR about supporting file link in markdown has been merged.

You can install https://github.com/redhat-developer/lsp4ij?tab=readme-ov-file#testing-the-ci-builds to test this feature.

Please play with this feature and give us feedback, thanks!

angelozerr commented 1 week ago

@CppCXY have you tried this feature ? Is it working for your all usecases?

CppCXY commented 1 week ago

@CppCXY have you tried this feature ? Is it working for your all usecases?

I've tried it and found that the format is #L{line}:{col}. In fact, VSCode supports both #{line} and #L{line}, but I've decided to switch to the version you support.

angelozerr commented 6 days ago

I've tried it and found that the format is #L{line}:{col}

I support the both syntax:

angelozerr commented 6 days ago

Could you create please an issue to support too #{line} syntax