Below is the log for M-. on find-project while editing lsp-dylan.dylan:
D 2022-11-05T16:54:39.000+0000 [Main thread] Invoking "textDocument/definition" with id 132 and params {"position":{"character":27,"line":274},"textDocument":{"uri":"file:///home/cgay/dylan/workspaces/lsp/lsp-dylan/lsp-dylan.dylan"}}
D 2022-11-05T16:54:39.000+0000 [Main thread] find-project -> module is {class <module-object>}lsp-dylan-impl
D 2022-11-05T16:54:39.000+0000 [Main thread] definition = {<generic-function-object> 26}, location = {<compiler-range-source-location> {flat file "project-objects"} (56, 0) - (57, 65) 27}
D 2022-11-05T16:54:39.000+0000 [Main thread] definition = {<method-object> 28}, location = {<compiler-range-source-location> {flat file "projects"} (485, 0) - (495, 23) 29}
D 2022-11-05T16:54:39.000+0000 [Main thread] textDocument/definition: Lookup find-project and got target={<posix-file-locator> "/home/cgay/dylan/workspaces/lsp/lsp-dylan/_build/databases/project-objects.dylan"}, line=63, char=0
D 2022-11-05T16:54:39.000+0000 [Main thread] textDocument/definition: Lookup find-project and got target={<posix-file-locator> "/home/cgay/dylan/workspaces/lsp/lsp-dylan/_build/databases/projects.dylan"}, line=491, char=0
D 2022-11-05T16:54:39.000+0000 [Main thread] send-raw-message: {"result":[{"range":{"end":{"character":0,"line":63},"start":{"character":0,"line":63}},"uri":"file:///home/cgay/dylan/workspaces/lsp/lsp-dylan/_build/databases/project-objects.dylan"},{"range":{"end":{"character":0,"line":491},"start":{"character":0,"line":491}},"uri":"file:///home/cgay/dylan/workspaces/lsp/lsp-dylan/_build/databases/projects.dylan"}],"id":132,"jsonrpc":"2.0"}
D 2022-11-05T16:54:39.000+0000 [Main thread] send-response: {"result":[{"range":{"end":{"character":0,"line":63},"start":{"character":0,"line":63}},"uri":"file:///home/cgay/dylan/workspaces/lsp/lsp-dylan/_build/databases/project-objects.dylan"},{"range":{"end":{"character":0,"line":491},"start":{"character":0,"line":491}},"uri":"file:///home/cgay/dylan/workspaces/lsp/lsp-dylan/_build/databases/projects.dylan"}],"id":132,"jsonrpc":"2.0"}
D 2022-11-05T16:54:39.000+0000 [Main thread] lsp-active-state-loop: waiting for message
lsp-mode reports "No definition found". Note that the pathname found was lsp-dylan/_build/databases/project-objects.dylan, which is obviously never going to work.
This makes me suspect that only relative pathnames are stored in the compiler database and they get merged against something. I couldn't find an easy way to dump the db so I'll fall back on adding debug logging in the compiler.
I can't think of a good reason not to store absolute pathnames in the db. It's not as though the db is intended to be moved around, and if sources are moved the code must be rebuilt anyway. Was it just circa 1990s space savings that motivated it? Storing the full pathname might just be the easiest fix. (But this is all just speculation for now.)
Below is the log for
M-.
onfind-project
while editinglsp-dylan.dylan
:lsp-mode
reports "No definition found". Note that the pathname found waslsp-dylan/_build/databases/project-objects.dylan
, which is obviously never going to work.This makes me suspect that only relative pathnames are stored in the compiler database and they get merged against something. I couldn't find an easy way to dump the db so I'll fall back on adding debug logging in the compiler.
I can't think of a good reason not to store absolute pathnames in the db. It's not as though the db is intended to be moved around, and if sources are moved the code must be rebuilt anyway. Was it just circa 1990s space savings that motivated it? Storing the full pathname might just be the easiest fix. (But this is all just speculation for now.)