Closed muirdm closed 4 years ago
Make sense. As a side note, you may wanna try M-x lsp-treemacs-references
and related.
lsp-treemacs-references
Interesting. Does it support (next-error)
functionality to cycle through results? How does it order results?
Also, I got an error trying lsp-treemacs-references on a larger project (it worked on a small project):
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
directory-file-name(nil)
(file-name-nondirectory (directory-file-name path))
f-filename(nil)
...
Interesting. Does it support (next-error) functionality to cycle through results?
Do you mean next reference? I think that treemacs might have next-node or something.
How does it order results?
ATM it is grouping the results, sorting them is a single liner.
Also, I got an error trying lsp-treemacs-references on a larger project (it worked on a small project):
Is this the full callstack? Can you provide recipe to reproduce that? Most likely filename is missing for some of the results.
@leungbk sorry, I was playing around with this today and didn't assign myself. I didn't do any heuristics beyond basic file/line/column sorting. It was a learning experience for me so no hard feelings if you do/did something better 😅
@leungbk sorry, I was playing around with this today and didn't assign myself. I didn't do any heuristics beyond basic file/line/column sorting. It was a learning experience for me so no hard feelings if you do/did something better sweat_smile
It's fine, go ahead and PR when you're ready.
Should we add any additional sorting heuristics like preferring the current file/folder or just leave it like this for now?
Should we add any additional sorting heuristics like preferring the current file/folder or just leave it like this for now?
Leaving up to you to decide. I guess it should be configurable because looks like something that some might want to turn off.
OK. I've lost steam on this so let's just let the simple sorting percolate and see if people complain or request smarter sorting.
Currently gopls returns find-references, find-implementations, go-to-definition, etc. results in a random/useless order. I opened https://github.com/golang/go/issues/40904 to discuss, but previously they have not been receptive to ordering on the server.
It would be useful if lsp-mode would sort the results for me. I propose we sort by file name and then by position within file. For file name, I propose we prefer the origin file, then we prefer files within the same directory (sorted lexicographically), then we just sort remaining files lexicographically.