Skip to content

python layer lsp mode, setting pylsp plugin vars takes no effect #16937

@spacegoing

Description

@spacegoing

I set these vars in dotspacemacs:

(defun dotspacemacs/user-config ()   
(with-eval-after-load 'lsp-mode
  (lsp-register-custom-settings
   '(("pylsp.plugins.ruff.enabled" t t)
     ("pylsp.plugins.ruff.executable" "/root/.venv/base/bin/ruff")
     ("pylsp.plugins.ruff.config" "/root/myCodeLab/GitConfig/python/.config/ruff/ruff.toml")
     ("pylsp.plugins.ruff.formatEnabled" t t)
     ("pylsp.plugins.ruff.severities" (("D212" . "I")))
)

But pylsp keeps using default settings:

2025-04-02 09:16:22,262 UTC - DEBUG - pylsp.config.config -   finish pylsp_settings --> [{'plugins': {'pylint': {'enabled': False, 'args': [], 'executable': None}}}, {'plugins': {'preload': {'modules': ['OpenGL', 'PIL', 'array', '\
audioop', 'binascii', 'cPickle', 'cStringIO', 'cmath', 'collections', 'datetime', 'errno', 'exceptions', 'gc', 'imageop', 'imp', 'itertools', 'marshal', 'math', 'matplotlib', 'mmap', 'mpmath', 'msvcrt', 'networkx', 'nose', 'nt', '\
numpy', 'operator', 'os', 'os.path', 'pandas', 'parser', 'rgbimg', 'scipy', 'signal', 'skimage', 'sklearn', 'statsmodels', 'strop', 'sympy', 'sys', 'thread', 'time', 'wx', 'xxsubtype', 'zipimport', 'zlib']}}, 'rope': {'extensionMo\
dules': ['OpenGL', 'PIL', 'array', 'audioop', 'binascii', 'cPickle', 'cStringIO', 'cmath', 'collections', 'datetime', 'errno', 'exceptions', 'gc', 'imageop', 'imp', 'itertools', 'marshal', 'math', 'matplotlib', 'mmap', 'mpmath', '\
msvcrt', 'networkx', 'nose', 'nt', 'numpy', 'operator', 'os', 'os.path', 'pandas', 'parser', 'rgbimg', 'scipy', 'signal', 'skimage', 'sklearn', 'statsmodels', 'strop', 'sympy', 'sys', 'thread', 'time', 'wx', 'xxsubtype', 'zipimpor\
t', 'zlib']}}, {'plugins': {'ruff': {'enabled': True, 'formatEnabled': True, 'executable': None, 'config': None, 'lineLength': None, 'exclude': None, 'select': None, 'extendSelect': None, 'ignore': None, 'extendIgnore': None, 'per\
FileIgnores': None, 'format': None, 'preview': False, 'unsafeFixes': False, 'severities': None, 'targetVersion': None}, 'pyflakes': {'enabled': False}, 'mccabe': {'enabled': False}, 'pycodestyle': {'enabled': False}, 'yapf': {'ena\
bled': False}, 'autopep8': {'enabled': False}}}] [hook]                                                                                                                                                                                
                                                                                                                                                                                                                                       
2025-04-02 09:16:22,262 UTC - DEBUG - pylsp.config.config - With configuration: {'rope': {'extensionModules': ['OpenGL', 'PIL', 'array', 'audioop', 'binascii', 'cPickle', 'cStringIO', 'cmath', 'collections', 'datetime', 'errno', '\
exceptions', 'gc', 'imageop', 'imp', 'itertools', 'marshal', 'math', 'matplotlib', 'mmap', 'mpmath', 'msvcrt', 'networkx', 'nose', 'nt', 'numpy', 'operator', 'os', 'os.path', 'pandas', 'parser', 'rgbimg', 'scipy', 'signal', 'skima\
ge', 'sklearn', 'statsmodels', 'strop', 'sympy', 'sys', 'thread', 'time', 'wx', 'xxsubtype', 'zipimport', 'zlib']}, 'plugins': {'ruff': {'enabled': True, 'formatEnabled': True, 'executable': None, 'config': None, 'lineLength': Non\
e, 'exclude': None, 'select': None, 'extendSelect': None, 'ignore': None, 'extendIgnore': None, 'perFileIgnores': None, 'format': None, 'preview': False, 'unsafeFixes': False, 'severities': None, 'targetVersion': None}, 'autopep8'\
: {'enabled': False}, 'pyflakes': {'enabled': False}, 'pylint': {'enabled': False, 'args': [], 'executable': None}, 'pycodestyle': {'enabled': False}, 'yapf': {'enabled': False}, 'preload': {'modules': ['OpenGL', 'PIL', 'array', '\
audioop', 'binascii', 'cPickle', 'cStringIO', 'cmath', 'collections', 'datetime', 'errno', 'exceptions', 'gc', 'imageop', 'imp', 'itertools', 'marshal', 'math', 'matplotlib', 'mmap', 'mpmath', 'msvcrt', 'networkx', 'nose', 'nt', '\
numpy', 'operator', 'os', 'os.path', 'pandas', 'parser', 'rgbimg', 'scipy', 'signal', 'skimage', 'sklearn', 'statsmodels', 'strop', 'sympy', 'sys', 'thread', 'time', 'wx', 'xxsubtype', 'zipimport', 'zlib']}, 'mccabe': {'enabled': \
False}}}         

As u can see, plugins ruff has None config

'plugins': {'ruff': {'enabled': True, 'formatEnabled': True, 'executable': None, 'config': None, 'lineLength': Non\
e, 'exclude': None, 'select': None, 'extendSelect': None, 'ignore': None, 'extendIgnore': None, 'perFileIgnores': None, 'format': None, 'preview': False, 'unsafeFixes': False, 'severities': None, 'targetVersion': None}, 

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions