python-language-server icon indicating copy to clipboard operation
python-language-server copied to clipboard

TypeError: unhashable type: 'dict' (when using with doom emacs)

Open chaoflow opened this issue 5 years ago • 3 comments

Using (doom) emacs with lsp-mode, I see the following message when moving the cursor onto code:

LSP :: Error from the Language Server: TypeError: unhashable type: 'dict' (Invalid Parameters)

python-language-server is installed via repo checkout in develop mode into project venv:

pip install -e '../python-language-server[all]'

Emacs Messages buffer shows:

Running direnv in /home/cfl/ternaris/marv/suite/...
Direnv succeeded in /home/cfl/ternaris/marv/suite/
Running direnv in /home/cfl/ternaris/marv/suite/...
Direnv succeeded in /home/cfl/ternaris/marv/suite/
LSP :: Guessed project root is ~/ternaris/marv/suite
LSP :: Connected to [pyls:13295 status:starting].
LSP :: pyls:13295 initialized successfully
LSP :: Error from the Language Server: TypeError: unhashable type: 'dict' (Invalid Parameters) [2 times]

How do I debug this? Can I tell python-language-server to verbosely log to some file? If not, could you point me to the function handling requests, to try/except in there?

Any pointers greatly appreciated.

chaoflow avatar Oct 18 '20 14:10 chaoflow

Please see the server options with

python -m pyls --help

ccordoba12 avatar Oct 18 '20 15:10 ccordoba12

@ccordoba12 Thank you for the fast reply!

It works now with the following:

.doom.d/config.el:

(use-package lsp-mode
  :custom
  (lsp-pyls-server-command '("pyls" "--log-file" "/tmp/pyls.log"))
  (lsp-pyls-configuration-sources ["flake8" "pycodestyle"]))

The error was caused by having a comma in the last line which let to "{',': 'pycodestyle'}" being pass as a config source to pyls.

I think such an error should be caught during server startup and result in an "invalid config source" error instead.

chaoflow avatar Oct 18 '20 15:10 chaoflow

We don't have time to work on this, so it's up to you if you want to submit a pull request for it.

ccordoba12 avatar Nov 07 '20 16:11 ccordoba12