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

fit lsp-ui-imenu to longest line in buffer #764

Merged
merged 1 commit into from
Apr 16, 2024

Conversation

LemonBreezes
Copy link
Contributor

Previously, in buffers with many nested levels of imenu, the long lines would trail off past the width of the window. Now, we properly enlarge the window to fit the longest line.

@LemonBreezes LemonBreezes changed the title fit lsp-ui-imenu to longest line in buffer + 3 fit lsp-ui-imenu to longest line in buffer Feb 18, 2024
Previously, in buffers with many nested levels of imenu, the long lines
would trail off past the width of the window. Now, we properly enlarge
the window to fit the longest line.
@LemonBreezes
Copy link
Contributor Author

LemonBreezes commented Apr 16, 2024

Hello @jcs090218, when you get a chance, can you please review this PR? This PR fixes the window width not being adjusted to the size of the longest imenu entry. Before, imenu entries would trail off past the edge of the window and now they no longer do that for me.

@jcs090218
Copy link
Member

I don't know if this is a good design since there is a chance the imenu window will take up all the space. 🤔

@LemonBreezes
Copy link
Contributor Author

I don't know if this is a good design since there is a chance the imenu window will take up all the space. 🤔

I mean, this only applies when the lsp-ui-imenu-window-width is 0. Basically, what I am saying is that the current behavior for auto-resizing the window to the buffer does not work.

@LemonBreezes
Copy link
Contributor Author

LemonBreezes commented Apr 16, 2024

fit-window-to-buffer does not actually use the longest line in the entire buffer. The documentation for it says: "The new width of WINDOW is calculated from the maximum length of its buffer's lines that follow the current start position of WINDOW." Somehow it doesn't work as intended for this case.

@jcs090218 jcs090218 merged commit 16bdff6 into emacs-lsp:master Apr 16, 2024
9 of 12 checks passed
@jcs090218
Copy link
Member

It makes sense, then. Thank you!

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.

2 participants