【Emacs】eglotでbasedpyrightを使う設定

basedpyrightをインストールしたうえでこうする。

(with-eval-after-load 'eglot
  (setq eglot-prefer-plaintext t)
  ;; (setq eglot-events-buffer-config '(:size 0 :format null)) ;; ログをバッファに書き込まない
  (setq eglot-autoshutdown t)
  (setq-default
   eglot-workspace-configuration
   '(:basedpyright (:typeCheckingMode "recommended")
                   :basedpyright.analysis
                   (:diagnosticSeverityOverrides
                    (:reportAny "none" :reportUnusedCallResult "none")
                    :inlayHints (:variableTypes :json-false
                                       :callArgumentNames :json-false)
                    )))
  (setq eglot-ignored-server-capabilities ;; eglotで無効にする機能を追加
        '(
          :documentHighlightProvider ;; カーソル下のシンボルハイライト
          ;; :inlayHintProvider ;; インラインのヒント表示を一括でオフにしたいとき
          ))
  (add-hook 'eglot-server-programs
            '((python-mode python-ts-mode) . ("basedpyright-langserver" "--stdio"))))

最新のeglotにはbasedpyrightの設定もマージされているけども、Emacs 29系にバンドルされているeglotのバージョンは少し古くてbasedpyrightは含まれていない。