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

Added workspace_symbol_picker #1041

Merged
merged 3 commits into from
Nov 14, 2021
Merged

Conversation

EbbDrop
Copy link
Contributor

@EbbDrop EbbDrop commented Nov 9, 2021

closes #1009
Uses space > t to open a workspace wide symbol picker.
helix_wp

@sudormrfbin
Copy link
Member

The start of an item gets truncated if it's too long, which hides the name of symbol (due to #951):

Screenshot_2021-11-09_20-52-45

@EbbDrop
Copy link
Contributor Author

EbbDrop commented Nov 9, 2021

I see two potential solutions:

  1. Move the truncation to the other side for this picker but than we get the same problem as in File Picker: File names are trimmed if the path is too long #945:
Cell (src/m...
Cell (src/a...
  1. Switch the file and symbol names:
...ain.rs: Cell
...elp.rs: Cell

But this does not look so good without truncation:

src/lib.rs: Cell
src/bin/main.rs: Cell

What solution would be preferred? Or does anybody have any other ideas.

@archseer
Copy link
Member

Let's add a field pub truncate_start: bool to Picker. It should default to false, and leave it out of Picker::new parameters, then use it here:

This way you can initialize it like this:

let picker = Picker::new(...);
picker.truncate_start = true;
compositor.push(Box::new(picker))

By the way, what theme are you using? It looks like it's missing the picker border color, that's why it's blue.

@archseer
Copy link
Member

We probably want to set this flag on the other symbol picker too. I'm also wondering whether the key should be space+S to match the other picker maybe?

@EbbDrop
Copy link
Contributor Author

EbbDrop commented Nov 10, 2021

I and the other symbol picker uses FilePicker at the moment. Should i also add the truncate_start field to FilePicker?
ps.
I am using the gruvbox theme edited to have a transparent background but the blue is still there without my edits.

@archseer
Copy link
Member

You can keep FilePicker as is since we always want to show the end of the file path there.

@EbbDrop
Copy link
Contributor Author

EbbDrop commented Nov 10, 2021

FilePicker is used at the moment for all the pickers since it also gives the file preview to the left. So I think it is FilePicker that should get the change to have a truncate_left option.

@archseer
Copy link
Member

Ah sorry, I confused it with the file_picker method. Yeah, you'll need to add this to both FilePicker and Picker

@EbbDrop
Copy link
Contributor Author

EbbDrop commented Nov 11, 2021

Moved the truncation to the other side for both pickers and changed the shortcut to space+S

Screenshot_2021-11-11_16-39-51

Copy link
Member

@sudormrfbin sudormrfbin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, tested with rust-analyzer. There's also a merge conflict btw.

helix-term/src/commands.rs Outdated Show resolved Hide resolved
@EbbDrop
Copy link
Contributor Author

EbbDrop commented Nov 12, 2021

Fixed typo and merge conflict

@archseer
Copy link
Member

Thanks! 🎉

@archseer archseer merged commit edc976b into helix-editor:master Nov 14, 2021
@EbbDrop EbbDrop deleted the workspace_picker branch November 14, 2021 15:54
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

Successfully merging this pull request may close these issues.

Support for LSP workspace/symbol
3 participants