emacs-lsp / lsp-treemacs

lsp-mode :heart: treemacs
GNU General Public License v3.0
398 stars 47 forks source link

Auto select-window on find references/implementations #33

Closed ericdallo closed 4 years ago

ericdallo commented 4 years ago

Currently when you use lsp-treemacs-errors-list, automatically jumps to the new buffer showing the errors, but lsp-treemacs-references don't do that.

This PR fixes lsp-treemacs-references and lsp-treemacs-implementations to jump like lsp-treemacs-errors-list

ericdallo commented 4 years ago

Thanks @danielmartin, I understand and I really hope we find a solution because I want to replace my lsp-find-references with lsp-treemacs-refereneces because treemacs has a better UX.

yyoncho commented 4 years ago

@ericdallo willing to implement the following behavior?

M-x lsp-treemacs-references - switches to the window. C-u M-x lsp-treemacs-references - show the window but it does not switch to it.

@danielmartin

I've never found any server slow enough for this to be noticeable.

JDT LS could take 20+ seconds. I think that ccls/clangd have everything precalculated and they just return the result.

ericdallo commented 4 years ago

@yyoncho, Can I use the prefix-argument that currently is used for expand the references? https://github.com/emacs-lsp/lsp-treemacs/pull/33/files#diff-f7b652b3dbdcf99d9b44702b250a77e7R1199-R1201

If not, can you give some suggestions on how I can achieve that? Checking if the expand? prefix-argument is (4)? PrefixArgument

yyoncho commented 4 years ago

@yyoncho, Can I use the prefix-argument that currently is used for expand the references?

Ah, I totally forgot about that, sorry:

Can we then make it like that:

C-0 M-x lsp-treemacs-references - async call(this is equivalent to prefix = 0). C-u M-x lsp-treemacs-references - select buffer and expand M-x lsp-treemacs-references - select buffer and no expand

ericdallo commented 4 years ago

Done @yyoncho

ericdallo commented 4 years ago

Done @yyoncho, thanks!

yyoncho commented 4 years ago

Thank you for contributing to lsp-treemacs! I merged the PR. In addition, I did some small adjustments (one of them was to revert my advice to use zerop because (zerop nil) throws).