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(#2349): add "right_align" option for renderer.icons.*_placement #2846

Merged

Conversation

evertonse
Copy link
Collaborator

Context:

The feature from PR #2839 was merged but quickly reverted due to a bug caused by a namespace collision with full_name rendering when renderer.full_name is enabled. This PR addresses the issue by adding a separate namespace and also syncs with the current nvim-tree master branch.

evertonse and others added 4 commits July 14, 2024 00:13
@evertonse evertonse changed the title fix(https://github.com/nvim-tree/nvim-tree.lua/pull/2839) extra namespace added to avoid colision between right_align and full_name features fix(#2839) extra namespace added to avoid colision between right_align and full_name features Jul 22, 2024
@evertonse evertonse changed the title fix(#2839) extra namespace added to avoid colision between right_align and full_name features fix: extra namespace added to avoid colision between right_align and full_name features Jul 22, 2024
@evertonse evertonse force-pushed the feat/icon_placement-right_align branch from bde9b46 to cb56c0d Compare July 22, 2024 18:28
@evertonse evertonse changed the title fix: extra namespace added to avoid colision between right_align and full_name features fix: Icon Placement - namespace added to avoid colision between right_align and full_name feature Jul 23, 2024
Copy link
Member

@alex-courtis alex-courtis left a comment

Choose a reason for hiding this comment

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

Many thanks for the quick turnaround!

lua/nvim-tree/renderer/init.lua Outdated Show resolved Hide resolved
@@ -13,12 +13,13 @@ local M = {}
local SIGN_GROUP = "NvimTreeRendererSigns"

local namespace_id = vim.api.nvim_create_namespace "NvimTreeHighlights"
local namespace_extmarks_id = vim.api.nvim_create_namespace "NvimTreeExtmarks"
Copy link
Member

Choose a reason for hiding this comment

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

Nice find.

Could we play this a bit safer and have a separate namespace for full-name as well?

It's using "NvimTreeHighlights" which is a little concerning now that we've learned of the namespace sharing difficulties.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Would be nice to rename it too, indeed, doesn't have to happen here though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I looked at the the namespace usage in full_name.lua, and it seems to rely on the NvimTreeHighlights namespace being set up beforehand. I thought this because of line 69:

local extmarks = vim.api.nvim_buf_get_extmarks(0, ns_id, { line_nr - 1, 0 }, { line_nr - 1, -1 }, { details = true })

Because of that I don't think I can introduce a separate namespace for full_name rn, also
I did not wrote any code in that file I'm not so sure what I could safely change.

Copy link
Member

Choose a reason for hiding this comment

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

Fair enough; there may all sorts of assumptions there.

Copy link
Member

@alex-courtis alex-courtis left a comment

Choose a reason for hiding this comment

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

Looking good; spacing preserved for long files and full name working:

20240728_132241
20240728_132246

@alex-courtis alex-courtis changed the title fix: Icon Placement - namespace added to avoid colision between right_align and full_name feature feat(#2349): add "right_align" option for renderer.icons.*_placement Jul 28, 2024
@alex-courtis alex-courtis merged commit 48d0e82 into nvim-tree:master Jul 28, 2024
6 checks passed
evertonse added a commit to evertonse/nvim-tree.lua that referenced this pull request Jul 28, 2024
…lacement (nvim-tree#2846)

* feat(icon_placement): Allow right_align icon_placemente for decorator using ext_marks nvim api

* feat(icon_placement): Allow right_align icon_placemente for decorator using ext_marks nvim api

feat(icon_placement): Allow right_align icon_placemente for decorator using ext_marks nvim api

* feat(icon_placement): consolidate doc

* fix: extra namespace added to avoid colision between right_align and full_name features

* style: rename namespace_id

---------

Co-authored-by: Alexander Courtis <[email protected]>
alex-courtis added a commit that referenced this pull request Aug 10, 2024
…files below the tree (#2856)

* feat(icon_placement): Allow right_align icon_placemente for decorator using ext_marks nvim api

* feat(icon_placement): Allow right_align icon_placemente for decorator using ext_marks nvim api

feat(icon_placement): Allow right_align icon_placemente for decorator using ext_marks nvim api

* feat(icon_placement): consolidate doc

* fix: extra namespace added to avoid colision between right_align and full_name features

* feat(hidden_display): Allow fine grained rendering of hidden files in
a folder

* feat(hidden_display): update defaults in Builder to allow rendering

* feat(hidden_display): Rename opts function name for the feature

* feat(#2349): add "right_align" option for renderer.icons.*_placement (#2846)

* feat(icon_placement): Allow right_align icon_placemente for decorator using ext_marks nvim api

* feat(icon_placement): Allow right_align icon_placemente for decorator using ext_marks nvim api

feat(icon_placement): Allow right_align icon_placemente for decorator using ext_marks nvim api

* feat(icon_placement): consolidate doc

* fix: extra namespace added to avoid colision between right_align and full_name features

* style: rename namespace_id

---------

Co-authored-by: Alexander Courtis <[email protected]>

* docs: update docs

* feat(hidden_display): Simplification and better performance by not sorting and grouping virtual lines

* Update doc/nvim-tree-lua.txt

Co-authored-by: Alexander Courtis <[email protected]>

* style: hidden_stats is better

* docs: change to hidden_stats

* add separate namespace for virtual lines

* help: add highlight group

---------

Co-authored-by: Alexander Courtis <[email protected]>
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.

Icon Placement Right
3 participants