Skip to content

Add global entry - #626

Open
jcs090218 wants to merge 3 commits into
emacs-lsp:masterfrom
jcs-PR:gm
Open

Add global entry#626
jcs090218 wants to merge 3 commits into
emacs-lsp:masterfrom
jcs-PR:gm

Conversation

@jcs090218

Copy link
Copy Markdown
Member

For #625.

Not sure if this is a good idea, but I have implemented first.

@ericdallo ericdallo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM but I don't know if there is any side effects with that, WDYT @yyoncho?

@yyoncho yyoncho left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Don't we need something like this?

(defun lsp-ui-doc-disable (args)
  "..."
  (interactive "P")
  (setq lsp-ui-doc-enable nil)
  (mapc (lambda (b) (with-current-buffer b
                      (lsp-ui-doc-mode -1)))
        (buffer-list)))

for the enable we have to look for all buffers in lsp-mode state.

@jcs090218

Copy link
Copy Markdown
Member Author

for the enable we have to look for all buffers in lsp-mode state.

No, I think the global minor mode will handles this? But the flag would not disable since it's defcustom.

(define-global-minor-mode global-lsp-ui-doc-mode lsp-ui-doc-mode
  (lambda () (lsp-ui-doc-mode 1)))

@yyoncho

yyoncho commented Jun 18, 2021

Copy link
Copy Markdown
Member

Ok, seems like the global mode will handle the turnoff. Don't we need also to set lsp-ui-doc-enable to nil to avoid starting ui-doc in the new buffers?

Comment thread lsp-ui-doc.el
(lsp-ui-doc--callback (lsp-request "textDocument/hover" (lsp--text-document-position-params))
(or (bounds-of-thing-at-point 'symbol) (cons (point) (1+ (point))))
(current-buffer)))
(when lsp-ui-doc-mode

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this will prevent the user from using ui-doc without enabling lsp-ui-doc, right? I think this is the goal of lsp-ui-doc-show

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think it make sense it shows only when the lsp-ui-doc is enabled. So yes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The idea of lsp-ui-doc-show is to be used when automatic lsp-ui-doc is off. This change will allow showing the doc manually only when the automatic popup is enabled which does not make sense.

@jcs090218

jcs090218 commented Jun 18, 2021

Copy link
Copy Markdown
Member Author

Ok, seems like the global mode will handle the turnoff. Don't we need also to set lsp-ui-doc-enable to nil to avoid starting ui-doc in the new buffers?

No, I think the minor-mode will still enable if user have set it up in the config. For instance,

(global-lsp-ui-doc-mode 1)

Then it will automatically be turn on no matter what, and I think that's the default action from Emacs. If user want to disable lsp-ui completely then it will have to evaluate expression manually.

(setq lsp-ui-doc-enable nil)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants