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

feat: Picker titles #12520

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

feat: Picker titles #12520

wants to merge 11 commits into from

Conversation

nik-rev
Copy link
Contributor

@nik-rev nik-rev commented Jan 13, 2025

Pickers now have titles, making it easier to tell what the picker does at a glance

image

The new File Explorer also gets bonus contextual information: what is the current directory of the picker (relative to helix's working directory)

image

picker type title
thread_picker -
dap_launch -
dap_switch_stack_frame -
diag_picker Diagnostics: <diagnostic count>
symbol_picker Document Symbols
lsp_workspace_command LSP Commands
workspace_symbol_picker Workspace Symbols
goto_reference Goto Reference
goto_single_impl Goto Implementation
file_picker Files
command_palette Command Palette
changed_file_picker Changed Files
jumplist_picker Jump List
buffer_picker Buffers
global_search Search
file_explorer File Explorer: <directory of picker>

Closes #10186

@nik-rev
Copy link
Contributor Author

nik-rev commented Jan 16, 2025

reverted

~Note: I made it so that the titles are in the center instead of the left. ~

To do this I made a TitlePosition::{Left,Center} enum. This is how it looks like:

image

@darshanCommits
Copy link
Contributor

personally I think the left looked better, but okay not anything major.

@David-Else
Copy link
Contributor

I also think the left looked much better, thanks for this great PR!

@nik-rev
Copy link
Contributor Author

nik-rev commented Jan 16, 2025

Ok, since 3 of you said you prefer the old look, I'll revert it!

@nik-rev nik-rev force-pushed the picker-title branch 3 times, most recently from 5ebd086 to 5aad11b Compare January 16, 2025 10:23
@nik-rev nik-rev requested a review from the-mikedavis January 16, 2025 18:33
@kirawi kirawi added C-enhancement Category: Improvements A-helix-term Area: Helix term improvements S-waiting-on-review Status: Awaiting review from a maintainer. labels Jan 19, 2025
@nik-rev
Copy link
Contributor Author

nik-rev commented Jan 24, 2025

Just updated this PR to also use the new File Explorer's current working directory, as I mentioned before

image

@nik-rev
Copy link
Contributor Author

nik-rev commented Jan 24, 2025

I also added diagnostic count as well
image

@David-Else
Copy link
Contributor

I am afraid I don't think showing the working directory and errors in the title bar look good. They seem out of place and cluttered.

  • If we are to display the current directory in the explorer it should show immediately, not only when we browse to a directory
  • Having the current directory in the title bar seems out of place, it should be displayed at the top of the actual explorer if anywhere and be integrated into it
  • The number of errors are shown in the status line, seems redundant to show them also in the picker and makes the picker interface cluttered.

Sorry to be a downer, giving the pickers titles is a great idea, but I think the latest additions need a rethink. Showing the current directory should be part of the explorer not in the title of the picker.

@nik-rev
Copy link
Contributor Author

nik-rev commented Jan 24, 2025

I am afraid I don't think showing the working directory and errors in the title bar look good. They seem out of place and cluttered.

* If we are to display the current directory in the explorer it should show immediately, not only when we browse to a directory

* Having the current directory in the title bar seems out of place, it should be displayed at the top of the actual explorer if anywhere and be integrated into it

* The number of errors are shown in the status line, seems redundant to show them also in the picker and makes the picker interface cluttered.

Sorry to be a downer, giving the pickers titles is a great idea, but I think the latest additions need a rethink. Showing the current directory should be part of the explorer not in the title of the picker.

The file explorer actually always shows the current directory relative to Helix's. When Helix's working directory is the same as the explorer's working directory, it makes no sense to show a path as it is empty ("")

I've been using the File Explorer for several weeks now, and not knowing its current directory is unfortunate. When I added this change, it instantly became easier to know where you are in the filesystem when you navigate.

Next, what exactly do you mean by "it should be displayed at the top of the actual explorer if anywhere and be integrated into it"? It is already displayed at the top.

If you're talking about displaying it at the top of the preview, that is even worse because the picker's current directory just makes sense to group with that directory's children.

Now, you've mentioned that the diagnostic count is in the statusline. This isn't true for everyone, not all people use render_diagnostics. Even if everyone used it, they only show diagnostics for the current file. Seeing how many diagnostics there are in the Document Diagnostics picker and the Workspace Diagnostics is useful.

I disagree that it looks cluttered, and "out of place", but I understand this part is subjective. I think that information such as how many diagnostics are in the picker, and picker's current working directory is information that is useful.

If you're saying it should be positioned elsewhere, then where? Where do you think the current title + the decorations should be? Here's the thing, Box already has a Box::titled API. It was extremely easy to use that in this PR.

Could you elaborate on what you mean by "Showing the current directory should be part of the explorer"? Because the explorer is actually a picker, we don't really have a lot of control over it. We don't have anything fancy or custom to display custom components, and a PR that implements that would be really out of scope here, and exactly the same reason why previous File Explorer pull requests were denied.

I've given some thought to your idea, but I'm not satisfied with placing this information elsewhere other than the title, and I think it makes the most sense there.

@David-Else
Copy link
Contributor

The file explorer actually always shows the current directory relative to Helix's. When Helix's working directory is the same as the explorer's working directory, it makes no sense to show a path as it is empty ("")

I've been using the File Explorer for several weeks now, and not knowing its current directory is unfortunate. When I added this change, it instantly became easier to know where you are in the filesystem when you navigate.

I don't know the technicalities of what is and is not possible right now in the interface, I am just commenting as a user, so please excuse my lack of knowledge of how it all works behind the scenes.

The most important time for the current directory to be show is when you open the explorer so you know where you are in the file system. I understand this is a technical problem at the moment, but until this is fixed I would consider it a blocker.

Next, what exactly do you mean by "it should be displayed at the top of the actual explorer if anywhere and be integrated into it"? It is already displayed at the top.

I agree that not knowing the current directory is bad, but showing this in the title looks out of place to me. I think it should be roughly where the arrow points, but I don't know how easy this is to do:

Screenshot from 2025-01-24 11-45-42

Maybe this is impossible now as you explained, but then I think we should wait rather than having a hack.

Regarding the diagnostic errors, we can just agree to disagree on that.

Thanks for all the great work you are doing, I hope I didn't come across as negative in any way.

@nik-rev
Copy link
Contributor Author

nik-rev commented Jan 24, 2025

The file explorer actually always shows the current directory relative to Helix's. When Helix's working directory is the same as the explorer's working directory, it makes no sense to show a path as it is empty ("")

I've been using the File Explorer for several weeks now, and not knowing its current directory is unfortunate. When I added this change, it instantly became easier to know where you are in the filesystem when you navigate.

I don't know the technicalities of what is and is not possible right now in the interface, I am just commenting as a user, so please excuse my lack of knowledge of how it all works behind the scenes.

The most important time for the current directory to be show is when you open the explorer so you know where you are in the file system. I understand this is a technical problem at the moment, but until this is fixed I would consider it a blocker.

Next, what exactly do you mean by "it should be displayed at the top of the actual explorer if anywhere and be integrated into it"? It is already displayed at the top.

I agree that not knowing the current directory is bad, but showing this in the title looks out of place to me. I think it should be roughly where the arrow points, but I don't know how easy this is to do:

Screenshot from 2025-01-24 11-45-42

Maybe this is impossible now as you explained, but then I think we should wait rather than having a hack.

Regarding the diagnostic errors, we can just agree to disagree on that.

Thanks for all the great work you are doing, I hope I didn't come across as negative in any way.

I think discussions like these are good to have! When a maintainer reviews, they can leave a comment on how "extra information" (such as the amount of diagnostics, or current directory of the picker) would be best handled

@nik-rev
Copy link
Contributor Author

nik-rev commented Jan 24, 2025

@David-Else Regarding this:

The most important time for the current directory to be show is when you open the explorer so you know where you are in the file system. I understand this is a technical problem at the moment, but until this is fixed I would consider it a blocker.

I should've been more clear; Try opening the "File Explorer in Current Buffer's Directory" when you are not at the root

image

You'll notice that the path instantly appears. See how it says helix-lsp? It's using the relative path and not the absolute, which is consistent with how it's like in the statusline

If you navigate up a directory, it won't show anymore:

image

That's because the explorer's directory is the same as Helix's directory. So that's why it doesn': show anything there

I made it like this on purpose to be consistent with the status line, and because having the absolute path there all the time takes up a lot of characters

It would be easy to make it so that it will show the absolute path. But for consistency, would it make sense to always show the absolute path?

We could make a special case: Show the relative path, but when file explorer's current directory is the same as Helix's, we show the absolute path. I don't know whether this is a good idea, it may give a feeling of inconsistency. But we could do it. Would like your opinion on this

@David-Else
Copy link
Contributor

I should've been more clear; Try opening the "File Explorer in Current Buffer's Directory" when you are not at the root

Thanks for your explanation, I had not used your PR for long enough to notice that it instantly showed the current directory when you were not on the root.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants