Subject: bug#64274: 30.0.50; Eglot requests textDocument/documentSymbol if its not declared in the server capabilities

From: Wilhelm Kirschbaum <[email-masked]>
Date: Sat, 24 Jun 2023 21:40:16 +0200

Calling imenu when eglot is enabled it will request
textDocument/documentSymbol even if the server has not declared it 
as a
capability.  I believe this issue is with `eglot-imenu'.

The client will recover if the server replies with an error, but 
outputs
an ugly error.

In GNU Emacs 30.0.50 (build 11, x86_64-pc-linux-gnu, GTK+ Version
 3.24.38, cairo version 1.17.8) of 2023-06-24 built on 
 melissa.local
Repository revision: a3df33f1c2f8beb08ea9fc4b91eaeae78db79489
Repository branch: master
System Description: Arch Linux

Configured using:
 'configure --with-pgtk --with-tree-sitter --with-json
 --with-native-compilation=aot'
Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ 
JPEG
JSON LCMS2 LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY 
PDUMPER
PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF 
TOOLKIT_SCROLL_BARS
TREE_SITTER WEBP XIM GTK3 ZLIB
Important settings:
  value of $LANG: en_ZA.UTF-8
  locale-coding-system: utf-8-unix

Major mode: mu4e:main

Minor modes in effect:
  mu4e-search-minor-mode: t
  mu4e-update-minor-mode: t
  mu4e-context-minor-mode: t
  global-floatpays-mode: t
  marginalia-mode: t
  savehist-mode: t
  vertico-mode: t
  global-corfu-mode: t
  electric-pair-mode: t
  yas-global-mode: t
  global-flycheck-mode: t
  global-treesit-auto-mode: t
  global-diff-hl-mode: t
  global-git-commit-mode: t
  shell-dirtrack-mode: t
  server-mode: t
  global-jinx-mode: t
  which-key-mode: t
  override-global-mode: t
  pixel-scroll-precision-mode: t
  repeat-mode: t
  winner-mode: t
  save-place-mode: t
  which-function-mode: t
  global-auto-revert-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  overwrite-mode: overwrite-mode-binary

Load-path shadows:
/home/wilhelm/.config/emacs/elpa/transient-20230602.2121/transient 
hides /usr/local/share/emacs/30.0.50/lisp/transient

Features:
(shadow mm-archive sort smiley gnus-cite mail-extr textsec 
uni-scripts
idna-mapping ucs-normalize uni-confusable textsec-check qp view 
emacsbug
goto-addr tramp-cmds magit-extras consult-imenu misearch 
multi-isearch
shortdoc completion help-fns radix-tree pulse bug-reference 
tramp-cache
time-stamp tramp-sh tramp tramp-loaddefs trampver 
tramp-integration
tramp-compat face-remap files-x sgml-mode dired-aux vc-hg vc-bzr 
vc-src
vc-sccs vc-cvs vc-rcs gnus-dired diff-hl-dired cape 
display-line-numbers
disp-table whitespace init.el mu4e-alert advice time ht alert 
log4e
notifications gntp mu4e mu4e-org mu4e-main mu4e-view gnus-art 
mm-uu
mml2015 mm-view mml-smime smime gnutls dig gnus-sum gnus-group 
gnus-undo
gnus-start gnus-dbus dbus gnus-cloud nnimap nnmail mail-source 
utf7 nnoo
parse-time iso8601 gnus-spec gnus-int gnus-range gnus-win gnus 
nnheader
range mu4e-headers mu4e-compose mu4e-draft mu4e-actions smtpmail
mu4e-search mu4e-lists mu4e-bookmarks mu4e-mark mu4e-message 
flow-fill
mule-util hl-line mu4e-contacts mu4e-update mu4e-folders 
mu4e-server
mu4e-context mu4e-obsolete mu4e-vars mu4e-helpers mu4e-config ido 
srht
plz git-related verb js c-ts-common denote mastodon 
mastodon-search
mastodon-toot facemenu mastodon-iso persist mastodon-http request
flycheck-package package-build package-build-badges package-recipe
package-lint let-alist finder lisp-mnt eat elfeed-show 
elfeed-search shr
pixel-fill kinsoku elfeed-csv elfeed elfeed-curl elfeed-log 
elfeed-db
elfeed-lib url-queue url-file xml-query fontaine 
modus-vivendi-theme
modus-themes embark-consult consult magit-bookmark bookmark 
embark-org
org-element org-persist xdg org-id org-refile avl-tree embark ffap
marginalia savehist orderless vertico kind-icon svg-lib svg dom 
xml
corfu-terminal popon corfu elec-pair posframe yasnippet-snippets
yasnippet flycheck treesit-auto avy org-toc org-contrib org-clock
ob-shell ob-elixir async ob-async org ob ob-tangle ob-ref ob-lob
ob-table ob-exp org-macro org-src ob-comint org-pcomplete org-list
org-footnote org-faces org-entities ob-emacs-lisp ob-core ob-eval
org-cycle org-table ol org-fold org-fold-core org-keys oc 
org-loaddefs
cal-menu calendar cal-loaddefs org-version org-compat org-macs 
yaml-mode
terraform-mode hcl-mode php-mode mode-local speedbar ezimage 
dframe
cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align 
php-face
php php-project cc-engine cc-vars cc-defs markdown-mode color 
noutline
outline erlang-start erlang etags fileloop generator tempo align 
mix
elixir-ts-mode heex-ts-mode eglot external-completion jsonrpc xref
flymake-proc flymake project ert debug backtrace find-func
dockerfile-mode sh-script smie treesit executable pcmpl-args 
pcmpl-linux
pcmpl-unix git-modes gitignore-mode gitconfig-mode conf-mode
gitattributes-mode diff-hl log-view vc-dir ewoc vc git-timemachine
vc-git vc-dispatcher magit-submodule magit-blame magit-stash
magit-reflog magit-bisect magit-push magit-pull magit-fetch 
magit-clone
magit-remote magit-commit magit-sequence magit-notes 
magit-worktree
magit-tag magit-merge magit-branch magit-reset magit-files 
magit-refs
magit-status magit magit-repos magit-apply magit-wip magit-log
magit-diff smerge-mode diff diff-mode git-commit log-edit message
sendmail yank-media puny rfc822 mml mml-sec epa epg rfc6068 
epg-config
gnus-util time-date mm-decode mm-bodies mm-encode mail-parse 
rfc2231
rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev 
mail-utils
gmm-utils mailheader pcvs-util add-log magit-core magit-autorevert
magit-margin magit-transient magit-process with-editor comp 
comp-cstr
warnings rx shell pcomplete server magit-mode transient magit-git
magit-base magit-section format-spec cursor-sensor crm functions 
jinx
compat use-package-bind-key which-key ripgrep thingatpt grep ag 
vc-svn
compile text-property-search comint ansi-osc ansi-color find-dired 
s
dired-rainbow dired-subtree dired-hacks-utils dash dired 
dired-loaddefs
all-the-icons all-the-icons-faces data-material data-weathericons
data-octicons data-fileicons data-faicons data-alltheicons
exec-path-from-shell edmacro kmacro bind-key easy-mmode
use-package-ensure use-package-core finder-inf ag-autoloads
all-the-icons-autoloads avy-autoloads cape-autoloads
consult-dir-autoloads corfu-terminal-autoloads corfu-autoloads
deft-autoloads denote-autoloads diff-hl-autoloads
dired-rainbow-autoloads dired-subtree-autoloads
dired-hacks-utils-autoloads dockerfile-mode-autoloads
dumb-jump-autoloads eat-autoloads elfeed-autoloads 
elpher-autoloads
embark-consult-autoloads consult-autoloads embark-autoloads
emmet-mode-autoloads erc-hl-nicks-autoloads erc-image-autoloads
erlang-autoloads exec-path-from-shell-autoloads exunit-autoloads
fireplace-autoloads flycheck-package-autoloads flycheck-autoloads
fontaine-autoloads git-modes-autoloads git-timemachine-autoloads
jinx-autoloads kind-icon-autoloads lsp-mode-autoloads f-autoloads
lv-autoloads magit-autoloads pcase git-commit-autoloads
marginalia-autoloads markdown-mode-autoloads mastodon-autoloads
mix-autoloads mu4e-alert-autoloads ht-autoloads alert-autoloads
log4e-autoloads gntp-autoloads ob-async-autoloads async-autoloads
ob-elixir-autoloads orderless-autoloads org-contrib-autoloads
org-roam-autoloads magit-section-autoloads emacsql-autoloads
ox-hugo-autoloads package-build-autoloads derived 
package-lint-autoloads
pcmpl-args-autoloads persist-autoloads php-mode-autoloads
pkg-info-autoloads epl-autoloads popon-autoloads popup-autoloads
posframe-autoloads request-autoloads ripgrep-autoloads 
spinner-autoloads
srht-autoloads plz-autoloads svg-lib-autoloads 
terraform-mode-autoloads
hcl-mode-autoloads tomelr-autoloads transient-autoloads
treesit-auto-autoloads ts-autoloads s-autoloads dash-autoloads
verb-autoloads vertico-autoloads web-mode-autoloads 
which-key-autoloads
with-editor-autoloads info compat-autoloads yaml-mode-autoloads
yasnippet-snippets-autoloads yasnippet-autoloads package 
browse-url url
url-proxy url-privacy url-expand url-methods url-history 
url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers 
url-parse
auth-source eieio eieio-core cl-macs password-cache json map 
byte-opt gv
bytecomp byte-compile url-vars native cl-extra help-mode 
pixel-scroll
cua-base subr-x repeat winner ring saveplace cl-seq which-func 
imenu
autorevert filenotify cus-edit pp cus-load icons wid-edit 
cl-loaddefs
cl-lib early-init rmc iso-transl tooltip cconv eldoc paren 
electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/pgtk-win pgtk-win term/common-win pgtk-dnd tool-bar dnd 
fontset
image regexp-opt fringe tabulated-list replace newcomment 
text-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow 
isearch
easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple 
cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang 
vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew 
greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button 
loaddefs
theme-loaddefs faces cus-face macroexp files window 
text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget 
keymap
hashtable-print-readable backquote threads dbusbind inotify
dynamic-setting system-font-setting font-render-setting cairo gtk 
pgtk
lcms2 multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 1274429 1936458) (symbols 48 80205 135)
 (strings 32 316832 86354) (string-bytes 1 10274587)
 (vectors 16 143778) (vector-slots 8 3608027 4190577)
 (floats 8 1424 3487) (intervals 56 17512 19707) (buffers 984 69))