-
-
Notifications
You must be signed in to change notification settings - Fork 810
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
Adds option to reverse path display with highlighting #3010
Adds option to reverse path display with highlighting #3010
Conversation
I've added the highlighting code of @chrisgrieser, as it was the most simple and straightforward solution for highlighting: I tried the code posted here, put I guess it has not yet been implemented: |
I've pushed a new commit as a proof-of-concept: ![]() I've a hardcoded value (4) in there that I want to get rid of, but I need to learn more about unpacking tables dynamically in Lua. That way I could return a relative style position in the functions and shift it to the right absolute position where I need it. |
I've removed the hardcoded value (4) with a function to shift the offset dynamically: |
So far, it seems to be working quite well. Does this align with what you envision? @jamestrew Find Files![]() LSP definitions![]() Live Grep![]() Quickfix![]() |
Thanks @alycklama |
b3167da
to
f702ad2
Compare
Take all the time you need! In the meantime I'm trying to fix the tests, but I'm having some issues running them. Any idea what the easiest way would be? I've created a local Docker container to install Ubuntu 22.04. However, I'm not able to run nvim --headless --noplugin -u scripts/minimal_init.vim -c "PlenaryBustedDirectory lua/tests/automated/ { minimal_init = './scripts/minimal_init.vim' }"
Error detected while processing command line:
E492: Not an editor command: PlenaryBustedDirectory lua/tests/automated/ { minimal_init = './scripts/minimal_init.vim' } To workaround this, I've manually created a ![]() Any tips regarding testing? |
Yeah I have another PR to improve the CI and local testing workflow better. set rtp+=.
set rtp+=../plenary.nvim/ " changed this to your plenary installation path
" set rtp+=../tree-sitter-lua/ not needed for testing
runtime! plugin/plenary.vim
runtime! plugin/telescope.lua
" I think you can comment this out as well
" outputs unnecessary warnings
" runtime! plugin/ts_lua.vim
let g:telescope_test_delay = 100 |
f702ad2
to
883b238
Compare
@jamestrew I've updated the initial post, fixed the tests. However, the nightly OSX build seems to fail in the preparation phase. Any idea what could be wrong? If that's fixed then this PR is ready for review. |
lua/telescope/make_entry.lua
Outdated
local function get_offset() | ||
local offset = 0 | ||
|
||
if hl_group then | ||
offset = #icon + 1 | ||
end | ||
|
||
return offset | ||
end | ||
|
||
if hl_group then | ||
return display, { { { 0, #icon }, hl_group } } | ||
local style = { { { 0, get_offset() }, hl_group } } | ||
style = utils.merge_styles(style, path_style, get_offset()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this get_offset
function necessary? Seems redundant to me. Something similar to what been done to gen_from_vimgrep
should work no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct. I cleaned it up and pushed my changes.
Yeah don't worry about that. I think I'm pretty good with these changes. It's slightly unfortunate that entry makers using |
Ok, that's great to hear! If there are discussions going on regarding the plans around |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on neovim nightly and worked great. Thanks.
1199f9b
to
10ac537
Compare
Good to hear, thanks! I've rebased the PR and resolved the conflict. |
That worked. Thank you. |
99cbf40
to
3489b5c
Compare
I fixed some formatting (and rebased to try something with our docgen CI but didn't work, whatever 🤷). I'll need to think deeper about some of the loose ends like Thanks! |
Hi, was testing these changes and I saw that with Config:
This is probably not the expected behavior right? |
|
I didn't realize the options are composable. Straight from the documentation:
I don't think filename_first is going to be composable in any way. The reason for that is it's the only option with the filename in front. What do you guys want to do with this? I can document that this option is not composable with any of the other options for now. If we want it to be make it composable, then the internals need to be refactored. You can't do any logic on a string. So maybe returning a tuple instead |
What vscode does and what I expected to happen But it would be awesome if the current truncate behavior was not changed, i.e. the path end is visible, not the start Basically, I would want it to be truncated like it currently is: |
In terms of general composability, I think moving the For flipping which side of the path (start vs end) is truncated, we would need to tweak the edit: nvm I misinterpreted, maybe we just keep truncating at the start. |
@jamestrew I created a new PR fixing this issue: Thanks for reporting! @Tronikelis |
@alycklama awesome 🚀 |
@alycklama Telescope git_files not useful |
@Leiyi548 Could you be a bit more specific? What is not useful and why is it not useful? A quick check on my side makes me believe everything works as intended: ![]() |
This is my config |
@Leiyi548 Would you be able to post a screenshot of what you see as well? |
|
@Leiyi548 I can't reproduce it. Are you sure you are on the latest commit? Please check and report back. |
maybe I use neovim in windows11? |
From your screenshot it seems you're not using the latest code, hence it'll never show correctly. I asked you earlier if you could check which commit you are at. If you can't answer this question, then unfortunately, I won't be able to help you further. |
@Leiyi548 please open a bug report for this and provide info there. |
thanks to the merge of nvim-telescope/telescope.nvim#3010 I was able to simplify my telescope config quite a bit without sacrificing on looks :)
thanks to the merge of nvim-telescope/telescope.nvim#3010 I was able to simplify my telescope config quite a bit without sacrificing on looks :) [skip ci] Automated sync from scottmckendry/Windots
Description
Long paths make it sometimes difficult to see the file name. You can create a custom formatter, but I thought it would be great if we can all have a format similar to Intelij, where the file name is in front.
Type of change
How Has This Been Tested?
I've tested my code with the following configurations:
Simple config:
Screenshots
Find Files
Live Grep
Quickfix
Find Word
Configuration:
Checklist: