-
I'm trying to enable some extra paths which contain stubs for micropython. I have a ((python-mode
. ((eglot-workspace-configuration
. ((:pylsp . (:plugins (:jedi (:extra_paths [".stubs/cpython_core/"]))))))))) This works, but only for python files at the root level. Is there a way to refer to the project root generically in ((python-mode
. ((eglot-workspace-configuration
. ((:pylsp . (:plugins (:jedi (:extra_paths [".stubs/cpython_core/",".stubs/micropython-esp32-1_16/"]))))))))) pylsp complains about unhashable dict:
Is my syntax above for multiple |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
OK I solved this myself. It turns out Emacs 27's fast ((python-mode
. ((eval . (let* ((stubs '("micropython_cpython_core" ;order matters
"micropython-1_14-frozen/esp32/RELEASE"
"micropython-esp32-1_16"))
(project-path (expand-file-name
(locate-dominating-file default-directory ".dir-locals.el")))
(stub-paths
(vconcat ; json-serialize hates lists
(mapcar (lambda (x) (concat project-path ".stubs/" x "/")) stubs))))
(setq eglot-workspace-configuration ;an alist
`((:pylsp . (:plugins (:jedi (:extra_paths ,stub-paths))))))))))) This allows me to symlink a full directory of stubs files (I'm using micropython-stubs) into every |
Beta Was this translation helpful? Give feedback.
OK I solved this myself. It turns out Emacs 27's fast
json-serialize
is rather fussy, and can only serialize vectors, not lists (unlikejson-encode
, which it replaces). Here's how I solved both issues (in.dir-locals.el
):