Skip to content
Discussion options

You must be logged in to vote

Notice that print and sort have been autocompleted without the () parentheses, as opposed to pylsp

This seems to be a limitation of pyright, see emacs-lsp/lsp-pyright#32, for example.

One could try a hack like this, but it will probably not do the right thing in all cases:

(defun fn/pyright-completion-maybe-insert-parens (completion)
  (when (and
         (stringp completion)
         (memq (plist-get
                (get-text-property 0 'lsp-completion-item completion)
                :kind)
               '(2 3)))
    (insert "()")
    (backward-char)))


(when (eq python-lsp-server 'pyright)
  (add-hook 'python-mode-hook
            (lambda ()
              (add-hook 'company-after-c…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by smile13241324
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #16854 on March 03, 2025 20:29.