Skip to content

Commit

Permalink
Refactor imenu option to fix window width, and add note.
Browse files Browse the repository at this point in the history
  • Loading branch information
DivvyCr authored and brotzeit committed Jul 4, 2022
1 parent 267a2c9 commit 0a6368d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ Customization:
- `lsp-ui-imenu-kind-position` place to show entries kind
- `lsp-ui-imenu-buffer-position` place to show the buffer window
- `lsp-ui-imenu-window-width` set window width
- `lsp-ui-imenu-window-fix-width` when non-nil, the window will not be resizable (eg. unaffected by `balance-windows`)
- `lsp-ui-imenu--custom-mode-line-format` mode line format
- `lsp-ui-imenu-auto-refresh` auto refresh when necessary
- `lsp-ui-imenu-refresh-delay` delay to refresh imenu
Expand Down
14 changes: 7 additions & 7 deletions lsp-ui-imenu.el
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,6 @@
(const :tag "Right" right))
:group 'lsp-ui-imenu)

(defcustom lsp-ui-imenu-persistent-buffer nil
"If non-nil, the `lsp-ui-imenu' buffer will permanently maintain its size.
ie. it will not be affected by `balance-windows' etc."
:type 'boolean
:group 'lsp-ui-imenu)

(defcustom lsp-ui-imenu-colors '("deep sky blue" "green3")
"Color list to cycle through for entry groups."
:type '(repeat color)
Expand All @@ -78,6 +72,12 @@ ie. it will not be affected by `balance-windows' etc."
:type 'number
:group 'lsp-ui-imenu)

(defcustom lsp-ui-imenu-window-fix-width nil
"If non-nil, the `lsp-ui-imenu' window will permanently maintain its width.
ie. it will not be affected by `balance-windows' etc."
:type 'boolean
:group 'lsp-ui-imenu)

(defcustom lsp-ui-imenu-auto-refresh nil
"Automatically refresh imenu when certain conditions meet."
:type '(choice (const :tag "Enable" t)
Expand Down Expand Up @@ -386,7 +386,7 @@ ITEMS are used when the kind position is 'left."

(define-derived-mode lsp-ui-imenu-mode special-mode "lsp-ui-imenu"
"Mode showing imenu entries."
(setq window-size-fixed (if lsp-ui-imenu-persistent-buffer 'width nil)))
(setq window-size-fixed (if lsp-ui-imenu-window-fix-width 'width nil)))

(defun lsp-ui-imenu--refresh ()
"Safe refresh imenu content."
Expand Down

0 comments on commit 0a6368d

Please sign in to comment.