Skip to content

Commit a0dba8f

Browse files
committed
feat: add hook run after data is rendered in the result buffer
This can be used for custom window alignment routines based on the number of rows or some additional text insertion in the buffer.
1 parent e99a712 commit a0dba8f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lsp-mssql.el

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,11 @@ PARAMS the params."
262262
(goto-char (1+ start))
263263
(delete-char -1))))
264264

265+
(defvar lsp-mssql-after-render-table-hook nil
266+
"Hook called after data is rendered in the result buffer.
267+
268+
When the hook is called, the point is at the end of the buffer.")
269+
265270
(defun lsp-mssql--result-set-complete (workspace params)
266271
"Result set complete handler.
267272
WORKSPACE is the active workspace.
@@ -343,7 +348,8 @@ PARAMS the params."
343348
(insert (lsp-mssql--render-table result))
344349
(org-table-align)
345350
(forward-line 1)
346-
(render-load-more)))
351+
(render-load-more)
352+
(run-hooks 'lsp-mssql-after-render-table-hook)))
347353
:mode 'detached))))
348354
'keymap (-doto (make-sparse-keymap)
349355
(define-key [M-return] 'push-button)
@@ -352,7 +358,8 @@ PARAMS the params."
352358
(insert "\n\n")
353359
(goto-char (marker-position marker))
354360
(org-table-align)
355-
(display-buffer (current-buffer))))
361+
(display-buffer (current-buffer))
362+
(run-hooks 'lsp-mssql-after-render-table-hook)))
356363
:mode 'detached))))))
357364

358365
(defun lsp-mssql--batch-complete (_workspace _params)

0 commit comments

Comments
 (0)