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

Support workspaceSymbol #104

Closed
matklad opened this issue Oct 11, 2018 · 4 comments
Closed

Support workspaceSymbol #104

matklad opened this issue Oct 11, 2018 · 4 comments

Comments

@matklad
Copy link
Contributor

matklad commented Oct 11, 2018

Hi!

As a heavy IDE user, I find "workspaceSymbol" the most important command IDE has to offer!

It would be cool if kak-lsp supported it :)

@ul ul closed this as completed in dd339ef Oct 11, 2018
@ul
Copy link
Collaborator

ul commented Oct 11, 2018

I've added lsp-workspace-symbol command which takes query as the only parameter. Then it opens result as a separate buffer. Rendering buffer is implemented as lsp-show-workspace-symbol which you can override to, for example, pass matches to fuzzy finder instead. lsp-show-workspace-symbol takes two parameters, first one is project root and second is a list of matches in *grep*-buffer-like format (passed as a single string).

@matklad
Copy link
Contributor Author

matklad commented Oct 11, 2018

Verified that it works!

One thing here is that fuzzy matching is already built into workspace/symbols request. So ideally, the user-visible UI should be an input-field for a query plus a listing of the results, such that results are automatically updated when the input field changes, and "update" is basically a fresh $workspace/symbols request to the language server.

So, internally having an lsp-worksapce-symbol command with one argument which returns a list of strings is right, but the ideal user-visible API probably should not expose that directly, instead wrapping it into some kind of incremental search UI.

@ul
Copy link
Collaborator

ul commented Oct 11, 2018

Yes, it's a good idea, I just didn't realize that it's possible to do with Kakoune builtin functionality. Now I think that prompt with -on-change callback is enough to implement it.

@ul ul reopened this Oct 11, 2018
@ul ul closed this as completed in 3e24be7 Oct 12, 2018
@ul
Copy link
Collaborator

ul commented Oct 12, 2018

As uncovered it's non-trivial to use -on-change with arbitrary commands, but I think I got decent solution. I added lsp-workspace-symbol-incr command which does incremental search using prompt for query input.

Feel free to re-open this issue or create a new one if you think command's UX should be improved or you hit any bugs.

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

2 participants