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

Relative file paths in assists / diagnostics #65

Open
Superpat opened this issue Nov 17, 2023 · 2 comments
Open

Relative file paths in assists / diagnostics #65

Superpat opened this issue Nov 17, 2023 · 2 comments

Comments

@Superpat
Copy link

It would be a bit more readable if file paths in the diagnostics window where relative to the workspace. I think this should be possible, either by doing some magic in the Win or setting the base path of the L win to the workspace.

@rsc
Copy link
Collaborator

rsc commented Apr 6, 2024

Agreed. v0.12.0 does this for the output of things like Ldef and Lrefs, but a few more cases remain to be fixed.

@kmx1
Copy link

kmx1 commented May 12, 2024

Maybe another point for consideration:
previously Lrefs used absolute paths, which is less readable but works always when you click it (buttom3 / jump / plumb it).
now relative paths work great when using Lrefs as cmd inside acme (middle click).
Lrefs writes to stdout, acme opens window as "(pwd)+Errors" window.

but when using Lrefs from outside acme, the new behaviour of using relative paths breaks clicking/jumping to the file:line.
I am using 2 keyboard shortcuts (via xbindkeys) for Ldef and Lrefs.
for Lrefs i use a wrapper script to display the results in acme again, like this:
Lrefs | plumb -i -d edit -a 'action=showdata filename=/LSP/References'
now those paths are relative to where i started the xbindkeys cmd (cause of os.Getwd() in PrintLocations)

while testing this i saw that the underlying issue is probably more acme-related.
windows with tag/names like "/LSP/Xyz" dont correctly jump/plumb to relative file paths. (even though when executing "pwd" inside of "/LSP/Diagnostics" it points to the correct directory, but trying to jump/click ./cmd/L/main.go does not work)

so i guess one would need to manually handle the button3 click inside the diagnostics window to make it work :-/
(or mess with plumbing rules vs. pwd? ; or is there way to set the wd of an acme window explicitly?)

i tried hardcoding acme-lsp/internal/lsp/acmelsp/diagnostics.go:96 to the base dir of the repo (where i started acme and acme-lsp, same as when executing pwd inside "/LSP/Diagnostics" window) but the button3/right click on diagnostics messages does not jump/plumb correctly when relative paths are displayed.

I added a new flag for Lrefs (-show) to show the results in a dedicated acme window, and implemented a workaround for PrintLocations to use an empty basedir (so it prints absolute paths).
https://github.com/kmx1/acme-lsp (i also removed deprecated uses of ioutil)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants