Skip to content

Commit

Permalink
feat: add hook run after data is rendered in the result buffer
Browse files Browse the repository at this point in the history
This can be used for custom window alignment routines based on the
number of rows or some additional text insertion in the buffer.
  • Loading branch information
Fuco1 committed May 10, 2023
1 parent e99a712 commit a0dba8f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lsp-mssql.el
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,11 @@ PARAMS the params."
(goto-char (1+ start))
(delete-char -1))))

(defvar lsp-mssql-after-render-table-hook nil
"Hook called after data is rendered in the result buffer.
When the hook is called, the point is at the end of the buffer.")

(defun lsp-mssql--result-set-complete (workspace params)
"Result set complete handler.
WORKSPACE is the active workspace.
Expand Down Expand Up @@ -343,7 +348,8 @@ PARAMS the params."
(insert (lsp-mssql--render-table result))
(org-table-align)
(forward-line 1)
(render-load-more)))
(render-load-more)
(run-hooks 'lsp-mssql-after-render-table-hook)))
:mode 'detached))))
'keymap (-doto (make-sparse-keymap)
(define-key [M-return] 'push-button)
Expand All @@ -352,7 +358,8 @@ PARAMS the params."
(insert "\n\n")
(goto-char (marker-position marker))
(org-table-align)
(display-buffer (current-buffer))))
(display-buffer (current-buffer))
(run-hooks 'lsp-mssql-after-render-table-hook)))
:mode 'detached))))))

(defun lsp-mssql--batch-complete (_workspace _params)
Expand Down

0 comments on commit a0dba8f

Please sign in to comment.