config

Personal configuration.
git clone git://code.dwrz.net/config
Log | Files | Refs

lsp-pylsp.el (25970B)


      1 ;;; lsp-pylsp.el --- python-lsp-server support       -*- lexical-binding: t; -*-
      2 
      3 ;; Copyright (C) 2021  Doug Davis
      4 
      5 ;; Author: Doug Davis <ddavis@ddavis.io>
      6 ;; Keywords: language tools
      7 
      8 ;; This program is free software; you can redistribute it and/or modify
      9 ;; it under the terms of the GNU General Public License as published by
     10 ;; the Free Software Foundation, either version 3 of the License, or
     11 ;; (at your option) any later version.
     12 
     13 ;; This program is distributed in the hope that it will be useful,
     14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
     15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16 ;; GNU General Public License for more details.
     17 
     18 ;; You should have received a copy of the GNU General Public License
     19 ;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
     20 
     21 ;;; Commentary:
     22 
     23 ;; pylsp configuration
     24 
     25 ;;; Code:
     26 
     27 (require 'lsp-mode)
     28 
     29 (defgroup lsp-pylsp nil
     30   "LSP support for Python, using python-lsp's Python Language Server."
     31   :group 'lsp-mode
     32   :link '(url-link "https://github.com/python-lsp/python-lsp-server"))
     33 
     34 (defcustom lsp-clients-pylsp-library-directories '("/usr/")
     35   "List of directories which will be considered to be libraries."
     36   :risky t
     37   :type '(repeat string)
     38   :group 'lsp-pylsp)
     39 
     40 (defcustom lsp-pylsp-server-command '("pylsp")
     41   "Command to start pylsp."
     42   :risky t
     43   :group 'lsp-pylsp
     44   :type '(repeat string))
     45 
     46 (defcustom lsp-pylsp-configuration-sources ["flake8"]
     47   "List of configuration sources to use."
     48   :type 'lsp-string-vector
     49   :group 'lsp-pylsp)
     50 
     51 (defcustom lsp-pylsp-plugins-jedi-completion-enabled t
     52   "Enable or disable the plugin."
     53   :type 'boolean
     54   :group 'lsp-pylsp)
     55 
     56 (defcustom lsp-pylsp-plugins-jedi-completion-include-params t
     57   "Auto-completes methods and classes with tabstops for each
     58 parameter."
     59   :type 'boolean
     60   :group 'lsp-pylsp)
     61 
     62 (defcustom lsp-pylsp-plugins-jedi-definition-enabled t
     63   "Enable or disable the plugin."
     64   :type 'boolean
     65   :group 'lsp-pylsp)
     66 
     67 (defcustom lsp-pylsp-plugins-jedi-definition-follow-imports t
     68   "The goto call will follow imports."
     69   :type 'boolean
     70   :group 'lsp-pylsp)
     71 
     72 (defcustom lsp-pylsp-plugins-jedi-definition-follow-builtin-imports t
     73   "If follow_imports is True will decide if it follow builtin
     74 imports."
     75   :type 'boolean
     76   :group 'lsp-pylsp)
     77 
     78 (defcustom lsp-pylsp-plugins-jedi-hover-enabled t
     79   "Enable or disable the plugin."
     80   :type 'boolean
     81   :group 'lsp-pylsp)
     82 
     83 (defcustom lsp-pylsp-plugins-jedi-references-enabled t
     84   "Enable or disable the plugin."
     85   :type 'boolean
     86   :group 'lsp-pylsp)
     87 
     88 (defcustom lsp-pylsp-plugins-jedi-signature-help-enabled t
     89   "Enable or disable the plugin."
     90   :type 'boolean
     91   :group 'lsp-pylsp)
     92 
     93 (defcustom lsp-pylsp-plugins-jedi-symbols-enabled t
     94   "Enable or disable the plugin."
     95   :type 'boolean
     96   :group 'lsp-pylsp)
     97 
     98 (defcustom lsp-pylsp-plugins-jedi-symbols-all-scopes t
     99   "If True lists the names of all scopes instead of only the
    100 module namespace."
    101   :type 'boolean
    102   :group 'lsp-pylsp)
    103 
    104 (defcustom lsp-pylsp-plugins-mccabe-enabled t
    105   "Enable or disable the plugin."
    106   :type 'boolean
    107   :group 'lsp-pylsp)
    108 
    109 (defcustom lsp-pylsp-plugins-mccabe-threshold 15
    110   "The minimum threshold that triggers warnings about cyclomatic
    111 complexity."
    112   :type 'number
    113   :group 'lsp-pylsp)
    114 
    115 (defcustom lsp-pylsp-plugins-preload-enabled t
    116   "Enable or disable the plugin."
    117   :type 'boolean
    118   :group 'lsp-pylsp)
    119 
    120 (defcustom lsp-pylsp-plugins-preload-modules nil
    121   "List of modules to import on startup"
    122   :type 'lsp-string-vector
    123   :group 'lsp-pylsp)
    124 
    125 (defcustom lsp-pylsp-plugins-pylint-enabled nil
    126   "Enable or disable the plugin."
    127   :type 'boolean
    128   :group 'lsp-pylsp)
    129 
    130 (defcustom lsp-pylsp-plugins-pylint-args []
    131   "Arguments, passed to pylint"
    132   :risky t
    133   :type 'lsp-string-vector
    134   :group 'lsp-pylsp)
    135 
    136 (defcustom lsp-pylsp-plugins-pycodestyle-enabled nil
    137   "Enable or disable the plugin."
    138   :type 'boolean
    139   :group 'lsp-pylsp)
    140 
    141 (defcustom lsp-pylsp-plugins-pycodestyle-exclude nil
    142   "Exclude files or directories which match these patterns."
    143   :type 'lsp-string-vector
    144   :group 'lsp-pylsp)
    145 
    146 (defcustom lsp-pylsp-plugins-pycodestyle-filename nil
    147   "When parsing directories, only check filenames matching these
    148 patterns."
    149   :type 'lsp-string-vector
    150   :group 'lsp-pylsp)
    151 
    152 (defcustom lsp-pylsp-plugins-pycodestyle-select nil
    153   "Select errors and warnings"
    154   :type 'lsp-string-vector
    155   :group 'lsp-pylsp)
    156 
    157 (defcustom lsp-pylsp-plugins-pycodestyle-ignore nil
    158   "Ignore errors and warnings"
    159   :type 'lsp-string-vector
    160   :group 'lsp-pylsp)
    161 
    162 (defcustom lsp-pylsp-plugins-pycodestyle-hang-closing nil
    163   "Hang closing bracket instead of matching indentation of
    164 opening bracket's line."
    165   :type 'boolean
    166   :group 'lsp-pylsp)
    167 
    168 (defcustom lsp-pylsp-plugins-pycodestyle-max-line-length nil
    169   "Set maximum allowed line length."
    170   :type 'number
    171   :group 'lsp-pylsp)
    172 
    173 (defcustom lsp-pylsp-plugins-pydocstyle-enabled t
    174   "Enable or disable the plugin."
    175   :type 'boolean
    176   :group 'lsp-pylsp)
    177 
    178 (defcustom lsp-pylsp-plugins-pydocstyle-convention nil
    179   "Choose the basic list of checked errors by specifying an
    180 existing convention."
    181   :type '(choice (:tag "pep257" "numpy"))
    182   :group 'lsp-pylsp)
    183 
    184 (defcustom lsp-pylsp-plugins-pydocstyle-add-ignore nil
    185   "Ignore errors and warnings in addition to the specified
    186 convention."
    187   :type 'lsp-string-vector
    188   :group 'lsp-pylsp)
    189 
    190 (defcustom lsp-pylsp-plugins-pydocstyle-add-select nil
    191   "Select errors and warnings in addition to the specified
    192 convention."
    193   :type 'lsp-string-vector
    194   :group 'lsp-pylsp)
    195 
    196 (defcustom lsp-pylsp-plugins-pydocstyle-ignore nil
    197   "Ignore errors and warnings"
    198   :type 'lsp-string-vector
    199   :group 'lsp-pylsp)
    200 
    201 (defcustom lsp-pylsp-plugins-pydocstyle-select nil
    202   "Select errors and warnings"
    203   :type 'lsp-string-vector
    204   :group 'lsp-pylsp)
    205 
    206 (defcustom lsp-pylsp-plugins-pydocstyle-match "(?!test_).*\\.py"
    207   "Check only files that exactly match the given regular
    208 expression; default is to match files that don't start with
    209 `test_' but end with `.py'."
    210   :type 'string
    211   :group 'lsp-pylsp)
    212 
    213 (defcustom lsp-pylsp-plugins-pydocstyle-match-dir "[^\\.].*"
    214   "Search only dirs that exactly match the given regular
    215 expression; default is to match dirs which do not begin with a
    216 dot."
    217   :type 'string
    218   :group 'lsp-pylsp)
    219 
    220 (defcustom lsp-pylsp-plugins-pyflakes-enabled nil
    221   "Enable or disable the plugin."
    222   :type 'boolean
    223   :group 'lsp-pylsp)
    224 
    225 (defcustom lsp-pylsp-plugins-rope-autoimport-enabled nil
    226   "Enable or disable the plugin."
    227   :type 'boolean
    228   :group 'lsp-pylsp)
    229 
    230 (defcustom lsp-pylsp-plugins-rope-autoimport-memory nil
    231   "Make the autoimport database memory only.
    232 
    233 Drastically increases startup time."
    234   :type 'boolean
    235   :group 'lsp-pylsp)
    236 
    237 (defcustom lsp-pylsp-plugins-rope-autoimport-completions-enabled nil
    238     "Enable or disable completions from rope-autoimport."
    239     :type 'boolean
    240     :group 'lsp-pylsp)
    241 
    242 (defcustom lsp-pylsp-plugins-rope-autoimport-code-actions-enabled nil
    243     "Enable or disable code actions from rope-autoimport."
    244     :type 'boolean
    245     :group 'lsp-pylsp)
    246 
    247 (defcustom lsp-pylsp-plugins-rope-completion-enabled nil
    248   "Enable or disable the plugin."
    249   :type 'boolean
    250   :group 'lsp-pylsp)
    251 
    252 (defcustom lsp-pylsp-plugins-rope-completion-eager nil
    253   "Resolve documentation and detail eagerly."
    254   :type 'boolean
    255   :group 'lsp-pylsp)
    256 
    257 (defcustom lsp-pylsp-plugins-autopep8-enabled nil
    258   "Enable or disable the plugin."
    259   :type 'boolean
    260   :group 'lsp-pylsp)
    261 
    262 (defcustom lsp-pylsp-plugins-yapf-enabled nil
    263   "Enable or disable the plugin."
    264   :type 'boolean
    265   :group 'lsp-pylsp)
    266 
    267 (defcustom lsp-pylsp-plugins-black-enabled nil
    268   "Enable or disable the plugin."
    269   :type 'boolean
    270   :group 'lsp-pylsp)
    271 
    272 (defcustom lsp-pylsp-plugins-isort-enabled nil
    273   "Enable or disable the plugin."
    274   :type 'boolean
    275   :group 'lsp-pylsp)
    276 
    277 (defcustom lsp-pylsp-rope-extension-modules nil
    278   "Builtin and c-extension modules that are allowed to be
    279 imported and inspected by rope."
    280   :type 'string
    281   :group 'lsp-pylsp)
    282 
    283 (defcustom lsp-pylsp-rope-rope-folder nil
    284   "The name of the folder in which rope stores project
    285 configurations and data. Pass `nil` for not using such a folder
    286 at all."
    287   :type 'lsp-string-vector
    288   :group 'lsp-pylsp)
    289 
    290 (defcustom lsp-pylsp-plugins-flake8-enabled t
    291   "Enable or disable the plugin."
    292   :type 'boolean
    293   :group 'lsp-pylsp)
    294 
    295 (defcustom lsp-pylsp-plugins-flake8-exclude nil
    296   "List of glob patterns to exclude from checks."
    297   :type 'lsp-string-vector
    298   :group 'lsp-pylsp)
    299 
    300 (defcustom lsp-pylsp-plugins-flake8-filename nil
    301   "List of glob patterns to include for checks."
    302   :type 'lsp-string-vector
    303   :group 'lsp-pylsp)
    304 
    305 (defcustom lsp-pylsp-plugins-flake8-hang-closing nil
    306   "Toggle whether pycodestyle should enforce matching the indentation of the
    307 opening bracket’s line. When you specify this, it will prefer that you hang the
    308 closing bracket rather than match the indentation."
    309   :type 'boolean
    310   :group 'lsp-pylsp)
    311 
    312 (defcustom lsp-pylsp-plugins-flake8-ignore nil
    313   "A list of codes to ignore."
    314   :type 'lsp-string-vector
    315   :group 'lsp-pylsp)
    316 
    317 (defcustom lsp-pylsp-plugins-flake8-max-line-length nil
    318   "Set the maximum length that any line (with some exceptions) may be.
    319 Exceptions include lines that are either strings or comments which are
    320 entirely URLs."
    321   :type 'integer
    322   :group 'lsp-pylsp)
    323 
    324 (defcustom lsp-pylsp-plugins-flake8-select nil
    325   "Specify the list of error codes you wish Flake8 to report. Similarly to
    326 `lsp-pylsp-plugins-flake8-ignore'. You can specify a portion of an error code to
    327 get all that start with that string. For example, you can use E, E4, E43, and
    328 E431"
    329   :type 'lsp-string-vector
    330   :group 'lsp-pylsp)
    331 
    332 (defcustom lsp-pylsp-plugins-flake8-config nil
    333   "A path to a config file that will be the only config file read and used.
    334 This will cause Flake8 to ignore all other config files that exist.
    335 
    336 NOTE: other parameters as `lsp-pylsp-plugins-flake8-max-line-length' take
    337 precedence over parameters referenced in config."
    338   :type 'string
    339   :group 'lsp-pylsp)
    340 
    341 (defcustom lsp-pylsp-plugins-jedi-use-pyenv-environment nil
    342   "If enabled, pass the environment got by pyenv to jedi"
    343   :type 'boolean
    344   :group 'lsp-pylsp)
    345 
    346 (defcustom lsp-pylsp-plugins-jedi-environment nil
    347   "Specify the environment that jedi runs on where <environment>/bin/python
    348 should be the python executable. This option will be prioritized over
    349 `lsp-pylsp-plugins-jedi-use-pyenv-environment'."
    350   :type 'string
    351   :group 'lsp-pylsp)
    352 
    353 (defcustom lsp-pylsp-plugins-jedi-completion-fuzzy nil
    354   "If enabled, uses fuzzy completion in jedi. Requires pylsp >= 0.32.0
    355 Can hit performance, as well as lsp-mode implements its own fuzzy search on
    356 completion items."
    357   :type 'boolean
    358   :group 'lsp-pylsp)
    359 
    360 (defcustom lsp-pylsp-plugins-jedi-completion-include-class-objects t
    361   "If enabled, adds class objects to completion in order to avoid snippet
    362 with init args.
    363 
    364 Has no effect if `lsp-pylsp-plugins-jedi-completion-include-params' is disabled.
    365 Requires pylsp >= 0.33.0"
    366   :type 'boolean
    367   :group 'lsp-pylsp)
    368 
    369 ;; See https://github.com/python-lsp/python-lsp-ruff#configuration
    370 
    371 (defcustom lsp-pylsp-plugins-ruff-enabled nil
    372   "Enable or disable the plugin."
    373   :type 'boolean
    374   :group 'lsp-pylsp)
    375 
    376 (defcustom lsp-pylsp-plugins-ruff-executable nil
    377   "Custom path to ruff."
    378   :type 'file
    379   :group 'lsp-pylsp)
    380 
    381 (defcustom lsp-pylsp-plugins-ruff-config nil
    382   "Custom config for ruff to use."
    383   :type 'file
    384   :group 'lsp-pylsp)
    385 
    386 (defcustom lsp-pylsp-plugins-ruff-extend-select nil
    387   "Rules that are additionally used by ruff."
    388   :type 'lsp-string-vector
    389   :group 'lsp-pylsp)
    390 
    391 (defcustom lsp-pylsp-plugins-ruff-extend-ignore nil
    392   "Rules that are additionally ignored by ruff."
    393   :type 'lsp-string-vector
    394   :group 'lsp-pylsp)
    395 
    396 (defcustom lsp-pylsp-plugins-ruff-format nil
    397   "Rules that should be fixed when running textDocument/formatting.
    398 
    399 Note each rule must additionally be marked as fixable by ruff."
    400   :type 'lsp-string-vector
    401   :group 'lsp-pylsp)
    402 
    403 (defcustom lsp-pylsp-plugins-ruff-severities nil
    404   "Optional table of rules where a custom severity is desired."
    405   :type '(alist :key-type (lsp-string-vector :tag "rules") :value-type (string :tag "severity"))
    406   :group 'lsp-pylsp)
    407 
    408 (defcustom lsp-pylsp-plugins-ruff-unsafe-fixes nil
    409   "Whether or not to offer unsafe fixes as code actions.
    410 
    411 Note this is ignored with the \"Fix All\" action."
    412   :type 'boolean
    413   :group 'lsp-pylsp)
    414 
    415 ;; Rules that are ignored when a pyproject.toml or ruff.toml is present
    416 (defcustom lsp-pylsp-plugins-ruff-line-length 88
    417   "Line length to pass to ruff checking and formatting.
    418 
    419 Note this variable will be ignored when a when a pyproject.toml or ruff.toml is
    420 present."
    421   :type 'integer
    422   :group 'lsp-pylsp)
    423 
    424 (defcustom lsp-pylsp-plugins-ruff-exclude nil
    425   "Files to be excluded by ruff checking.
    426 
    427 Note this variable will be ignored when a when a pyproject.toml or ruff.toml
    428 is present."
    429   :type 'lsp-string-vector
    430   :group 'lsp-pylsp)
    431 
    432 (defcustom lsp-pylsp-plugins-ruff-select nil
    433   "Rules to be enabled by ruff.
    434 
    435 Note this variable will be ignored when a when a pyproject.toml or ruff.toml
    436 is present."
    437   :type 'lsp-string-vector
    438   :group 'lsp-pylsp)
    439 
    440 (defcustom lsp-pylsp-plugins-ruff-ignore nil
    441   "Rules to be ignored by ruff.
    442 
    443 Note this variable will be ignored when a when a pyproject.toml or ruff.toml
    444 is present."
    445   :type 'lsp-string-vector
    446   :group 'lsp-pylsp)
    447 
    448 (defcustom lsp-pylsp-plugins-ruff-per-file-ignores nil
    449   "Rules that should be ignored for specific files.
    450 
    451 Note this variable will be ignored when a when a pyproject.toml or ruff.toml
    452 is present."
    453   :type '(alist :key-type (lsp-string-vector :tag "files") :value-type (string :tag "rule"))
    454   :group 'lsp-pylsp)
    455 
    456 (defcustom lsp-pylsp-plugins-ruff-preview nil
    457   "Whether to enable the preview style linting and formatting.
    458 
    459 Note this variable will be ignored when a when a pyproject.toml or ruff.toml
    460 is present."
    461   :type 'boolean
    462   :group 'lsp-pylsp)
    463 
    464 (defcustom lsp-pylsp-plugins-ruff-target-version nil
    465   "The minimum python version to target (applies for both linting and formatting).
    466     
    467 Note this variable will be ignored when a when a pyproject.toml or ruff.toml
    468 is present."
    469   :type 'string
    470   :group 'lsp-pylsp)
    471 
    472 ;; See https://github.com/python-lsp/pylsp-mypy#configuration
    473 
    474 (defcustom lsp-pylsp-plugins-mypy-enabled nil
    475   "Enable or disable the plugin."
    476   :type 'boolean
    477   :group 'lsp-pylsp)
    478 
    479 (defcustom lsp-pylsp-plugins-mypy-live-mode t
    480   "If non-nil, type checking is provided as you type.
    481 
    482 This writes to a tempfile every time a check is done.  Turning off live_mode
    483 means you must save your changes for mypy diagnostics to update correctly."
    484   :type 'boolean
    485   :group 'lsp-pylsp)
    486 
    487 (defcustom lsp-pylsp-plugins-mypy-dmypy nil
    488   "If non-nil, use \"dmypy run\" rather than mypy.
    489 
    490 This uses the dmypy daemon and may dramatically improve the responsiveness of
    491 the pylsp server, however this currently does not work in live_mode.  Enabling
    492 this disables live_mode, even for conflicting configs."
    493   :type 'boolean
    494   :group 'lsp-pylsp)
    495 
    496 (defcustom lsp-pylsp-plugins-mypy-strict nil
    497   "If non-nil, enable the strict option of mypy.
    498 
    499 This option often is too strict to be useful."
    500   :type 'boolean
    501   :group 'lsp-pylsp)
    502 
    503 (defcustom lsp-pylsp-plugins-mypy-overrides [t]
    504   "A list of alternate or supplemental command-line options.
    505 
    506 This modifies the options passed to mypy or the mypy-specific ones passed to
    507 dmypy run.  When present, the special boolean member True is replaced with
    508 the command-line options that would've been passed had overrides not been
    509 specified.  Later options take precedence, which allows for replacing or
    510 negating individual default options (see mypy.main:process_options and mypy
    511 --help | grep inverse)."
    512   :type '(vector (choice string boolean))
    513   :group 'lsp-pylsp)
    514 
    515 (defcustom lsp-pylsp-plugins-mypy-dmypy-status-file ".dmypy.json"
    516   "The status file dmypy should use.
    517 
    518 This modifies the --status-file option passed to dmypy given dmypy is active."
    519   :type 'string
    520   :group 'lsp-pylsp)
    521 
    522 (defcustom lsp-pylsp-plugins-mypy-config-sub-paths nil
    523   "Sub paths under which the mypy configuration file may be found.
    524 
    525 For each directory searched for the mypy config file, this also searches the
    526 sub paths specified here."
    527   :type 'lsp-string-vector
    528   :group 'lsp-pylsp)
    529 
    530 (defcustom lsp-pylsp-plugins-mypy-report-progress nil
    531   "If non-nil, report basic progress to the LSP client.
    532 
    533 With this option, pylsp-mypy will report when mypy is running, given your editor
    534 supports LSP progress reporting.  For small files this might produce annoying
    535 flashing, especially in with live_mode.  For large projects, enabling this can
    536 be helpful to assure yourself whether mypy is still running."
    537   :type 'boolean
    538   :group 'lsp-pylsp)
    539 
    540 (defcustom lsp-pylsp-plugins-mypy-exclude nil
    541   "A list of regular expressions which should be ignored.
    542 
    543 The mypy runner wil not be invoked when a document path is matched by one of the
    544 expressions.  Note that this differs from the exclude directive of a mypy config
    545 which is only used for recursively discovering files when mypy is invoked on a
    546 whole directory.  For both windows or unix platforms you should use forward
    547 slashes (/) to indicate paths."
    548   :type 'lsp-string-vector
    549   :group 'lsp-pylsp)
    550 
    551 (defcustom lsp-pylsp-rename-backend 'jedi
    552   "Choose renaming backend.
    553 
    554 Jedi is preferred but only works for python >= 3.6 and pylsp >= 0.32.0
    555 Beware that Jedi is lazy and doesn't scan the whole project.
    556 So it will rename only references it can find."
    557   :type '(choice (const :tag "jedi" jedi)
    558                  (const :tag "rope" rope))
    559   :group 'lsp-pylsp)
    560 
    561 (defun lsp-pylsp-get-pyenv-environment ()
    562   "Get the pyenv-managed environment for current workspace, where
    563 <ENV>/bin/python is the corresponding Python executable"
    564   (if lsp-pylsp-plugins-jedi-environment
    565       lsp-pylsp-plugins-jedi-environment
    566     (when lsp-pylsp-plugins-jedi-use-pyenv-environment
    567       (let ((pyenv-version (getenv "PYENV_VERSION"))
    568             (root (lsp-seq-first (lsp-find-roots-for-workspace lsp--cur-workspace (lsp-session)))))
    569         (when root
    570           (setenv "PYENV_VERSION" nil)
    571           (let* ((pyenv-command-path (executable-find "pyenv"))
    572                  (python-env (when pyenv-command-path
    573                                (f-parent
    574                                 (f-parent
    575                                  (shell-command-to-string
    576                                   (format "PYENV_DIR='%s' %s which python"
    577                                           root pyenv-command-path)))))))
    578             (if python-env (lsp--info "Configure pylsp with environment: %s" python-env)
    579               (lsp--warn "Can't find the python environment for
    580               %s even if
    581               `lsp-pylsp-plugins-jedi-use-pyenv-environment` is
    582               enabled") root)
    583             (setenv "PYENV_VERSION" pyenv-version)
    584             python-env))))))
    585 
    586 (lsp-register-custom-settings
    587  '(("pylsp.rope.ropeFolder" lsp-pylsp-rope-rope-folder)
    588    ("pylsp.rope.extensionModules" lsp-pylsp-rope-extension-modules)
    589    ("pylsp.plugins.rope_rename.enabled" (lambda () (eq lsp-pylsp-rename-backend 'rope)) t)
    590    ("pylsp.plugins.autopep8.enabled" lsp-pylsp-plugins-autopep8-enabled t)
    591    ("pylsp.plugins.yapf.enabled" lsp-pylsp-plugins-yapf-enabled t)
    592    ("pylsp.plugins.black.enabled" lsp-pylsp-plugins-black-enabled t)
    593    ("pylsp.plugins.pyls_isort.enabled" lsp-pylsp-plugins-isort-enabled t)
    594    ("pylsp.plugins.rope_autoimport.enabled" lsp-pylsp-plugins-rope-autoimport-enabled t)
    595    ("pylsp.plugins.rope_autoimport.memory" lsp-pylsp-plugins-rope-autoimport-memory t)
    596    ("pylsp.plugins.rope_autoimport.completions.enabled" lsp-pylsp-plugins-rope-autoimport-completions-enabled t)
    597    ("pylsp.plugins.rope_autoimport.code_actions.enabled" lsp-pylsp-plugins-rope-autoimport-code-actions-enabled t)
    598    ("pylsp.plugins.rope_completion.enabled" lsp-pylsp-plugins-rope-completion-enabled t)
    599    ("pylsp.plugins.rope_completion.eager" lsp-pylsp-plugins-rope-completion-eager t)
    600    ("pylsp.plugins.pyflakes.enabled" lsp-pylsp-plugins-pyflakes-enabled t)
    601    ("pylsp.plugins.pydocstyle.matchDir" lsp-pylsp-plugins-pydocstyle-match-dir)
    602    ("pylsp.plugins.pydocstyle.match" lsp-pylsp-plugins-pydocstyle-match)
    603    ("pylsp.plugins.pydocstyle.select" lsp-pylsp-plugins-pydocstyle-select)
    604    ("pylsp.plugins.pydocstyle.ignore" lsp-pylsp-plugins-pydocstyle-ignore)
    605    ("pylsp.plugins.pydocstyle.addSelect" lsp-pylsp-plugins-pydocstyle-add-select)
    606    ("pylsp.plugins.pydocstyle.addIgnore" lsp-pylsp-plugins-pydocstyle-add-ignore)
    607    ("pylsp.plugins.pydocstyle.convention" lsp-pylsp-plugins-pydocstyle-convention)
    608    ("pylsp.plugins.pydocstyle.enabled" lsp-pylsp-plugins-pydocstyle-enabled t)
    609    ("pylsp.plugins.pycodestyle.maxLineLength" lsp-pylsp-plugins-pycodestyle-max-line-length)
    610    ("pylsp.plugins.pycodestyle.hangClosing" lsp-pylsp-plugins-pycodestyle-hang-closing t)
    611    ("pylsp.plugins.pycodestyle.ignore" lsp-pylsp-plugins-pycodestyle-ignore)
    612    ("pylsp.plugins.pycodestyle.select" lsp-pylsp-plugins-pycodestyle-select)
    613    ("pylsp.plugins.pycodestyle.filename" lsp-pylsp-plugins-pycodestyle-filename)
    614    ("pylsp.plugins.pycodestyle.exclude" lsp-pylsp-plugins-pycodestyle-exclude)
    615    ("pylsp.plugins.pycodestyle.enabled" lsp-pylsp-plugins-pycodestyle-enabled t)
    616    ("pylsp.plugins.pylint.enabled" lsp-pylsp-plugins-pylint-enabled t)
    617    ("pylsp.plugins.pylint.args" lsp-pylsp-plugins-pylint-args)
    618    ("pylsp.plugins.flake8.enabled" lsp-pylsp-plugins-flake8-enabled)
    619    ("pylsp.plugins.flake8.exclude" lsp-pylsp-plugins-flake8-exclude)
    620    ("pylsp.plugins.flake8.filename" lsp-pylsp-plugins-flake8-filename)
    621    ("pylsp.plugins.flake8.hangClosing" lsp-pylsp-plugins-flake8-hang-closing)
    622    ("pylsp.plugins.flake8.ignore" lsp-pylsp-plugins-flake8-ignore)
    623    ("pylsp.plugins.flake8.maxLineLength" lsp-pylsp-plugins-flake8-max-line-length)
    624    ("pylsp.plugins.flake8.select" lsp-pylsp-plugins-flake8-select)
    625    ("pylsp.plugins.flake8.config" lsp-pylsp-plugins-flake8-config)
    626    ("pylsp.plugins.preload.modules" lsp-pylsp-plugins-preload-modules)
    627    ("pylsp.plugins.preload.enabled" lsp-pylsp-plugins-preload-enabled t)
    628    ("pylsp.plugins.mccabe.threshold" lsp-pylsp-plugins-mccabe-threshold)
    629    ("pylsp.plugins.mccabe.enabled" lsp-pylsp-plugins-mccabe-enabled t)
    630    ("pylsp.plugins.ruff.enabled" lsp-pylsp-plugins-ruff-enabled t)
    631    ("pylsp.plugins.ruff.executable" lsp-pylsp-plugins-ruff-executable)
    632    ("pylsp.plugins.ruff.config" lsp-pylsp-plugins-ruff-config)
    633    ("pylsp.plugins.ruff.extendSelect" lsp-pylsp-plugins-ruff-extend-select)
    634    ("pylsp.plugins.ruff.extendIgnore" lsp-pylsp-plugins-ruff-extend-ignore)
    635    ("pylsp.plugins.ruff.format" lsp-pylsp-plugins-ruff-format)
    636    ("pylsp.plugins.ruff.severities" lsp-pylsp-plugins-ruff-severities)
    637    ("pylsp.plugins.ruff.unsafeFixes" lsp-pylsp-plugins-ruff-unsafe-fixes t)
    638    ("pylsp.plugins.ruff.lineLength" lsp-pylsp-plugins-ruff-line-length)
    639    ("pylsp.plugins.ruff.exclude" lsp-pylsp-plugins-ruff-exclude)
    640    ("pylsp.plugins.ruff.select" lsp-pylsp-plugins-ruff-select)
    641    ("pylsp.plugins.ruff.ignore" lsp-pylsp-plugins-ruff-ignore)
    642    ("pylsp.plugins.ruff.perFileIgnores" lsp-pylsp-plugins-ruff-per-file-ignores)
    643    ("pylsp.plugins.ruff.preview" lsp-pylsp-plugins-ruff-preview t)
    644    ("pylsp.plugins.ruff.targetVersion" lsp-pylsp-plugins-ruff-target-version)
    645    ("pylsp.plugins.pylsp_mypy.enabled" lsp-pylsp-plugins-mypy-enabled t)
    646    ("pylsp.plugins.pylsp_mypy.live_mode" lsp-pylsp-plugins-mypy-live-mode t)
    647    ("pylsp.plugins.pylsp_mypy.dmypy" lsp-pylsp-plugins-mypy-dmypy t)
    648    ("pylsp.plugins.pylsp_mypy.strict" lsp-pylsp-plugins-mypy-strict t)
    649    ("pylsp.plugins.pylsp_mypy.overrides" lsp-pylsp-plugins-mypy-overrides)
    650    ("pylsp.plugins.pylsp_mypy.dmypy_status_file" lsp-pylsp-plugins-mypy-dmypy-status-file)
    651    ("pylsp.plugins.pylsp_mypy.config_sub_paths" lsp-pylsp-plugins-mypy-config-sub-paths)
    652    ("pylsp.plugins.pylsp_mypy.report_progress" lsp-pylsp-plugins-mypy-report-progress t)
    653    ("pylsp.plugins.pylsp_mypy.exclude" lsp-pylsp-plugins-mypy-exclude)
    654    ("pylsp.plugins.jedi_symbols.all_scopes" lsp-pylsp-plugins-jedi-symbols-all-scopes t)
    655    ("pylsp.plugins.jedi_symbols.enabled" lsp-pylsp-plugins-jedi-symbols-enabled t)
    656    ("pylsp.plugins.jedi_signature_help.enabled" lsp-pylsp-plugins-jedi-signature-help-enabled t)
    657    ("pylsp.plugins.jedi_references.enabled" lsp-pylsp-plugins-jedi-references-enabled t)
    658    ("pylsp.plugins.jedi_hover.enabled" lsp-pylsp-plugins-jedi-hover-enabled t)
    659    ("pylsp.plugins.jedi_definition.follow_builtin_imports" lsp-pylsp-plugins-jedi-definition-follow-builtin-imports t)
    660    ("pylsp.plugins.jedi_definition.follow_imports" lsp-pylsp-plugins-jedi-definition-follow-imports t)
    661    ("pylsp.plugins.jedi_definition.enabled" lsp-pylsp-plugins-jedi-definition-enabled t)
    662    ("pylsp.plugins.jedi_completion.include_params" lsp-pylsp-plugins-jedi-completion-include-params t)
    663    ("pylsp.plugins.jedi_completion.enabled" lsp-pylsp-plugins-jedi-completion-enabled t)
    664    ("pylsp.plugins.jedi_completion.include_class_objects" lsp-pylsp-plugins-jedi-completion-include-class-objects t)
    665    ("pylsp.plugins.jedi.environment" lsp-pylsp-get-pyenv-environment)
    666    ("pylsp.plugins.jedi_completion.fuzzy" lsp-pylsp-plugins-jedi-completion-fuzzy t)
    667    ("pylsp.plugins.jedi_rename.enabled" (lambda () (eq lsp-pylsp-rename-backend 'jedi)) t)
    668    ("pylsp.configurationSources" lsp-pylsp-configuration-sources)))
    669 
    670 (lsp-register-client
    671  (make-lsp-client :new-connection (lsp-stdio-connection
    672                                    (lambda () lsp-pylsp-server-command))
    673                   :activation-fn (lsp-activate-on "python")
    674                   :priority -1
    675                   :server-id 'pylsp
    676                   :library-folders-fn (lambda (_workspace) lsp-clients-pylsp-library-directories)
    677                   :initialized-fn (lambda (workspace)
    678                                     (with-lsp-workspace workspace
    679                                       (lsp--set-configuration (lsp-configuration-section "pylsp"))))))
    680 
    681 (lsp-consistency-check lsp-pylsp)
    682 
    683 (provide 'lsp-pylsp)
    684 ;;; lsp-pylsp.el ends here