Skip to content

Commit

Permalink
fix ruff server config for lsp-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
wyuenho committed Sep 30, 2024
1 parent e5e3f9f commit 75b371a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
18 changes: 9 additions & 9 deletions pet.el
Original file line number Diff line number Diff line change
Expand Up @@ -952,8 +952,8 @@ FN is `eglot--guess-contact', ARGS is the arguments to
(defvar lsp-pylsp-plugins-jedi-environment)
(defvar lsp-pyright-python-executable-cmd)
(defvar lsp-pyright-venv-path)
(defvar lsp-ruff-lsp-ruff-path)
(defvar lsp-ruff-lsp-python-path)
(defvar lsp-ruff-server-command)
(defvar lsp-ruff-python-path)
(defvar dap-python-executable)
(defvar dap-variables-project-root-function)
(defvar python-pytest-executable)
Expand All @@ -980,14 +980,14 @@ buffer local values."
(setq-local lsp-pylsp-plugins-jedi-environment python-shell-virtualenv-root)
(setq-local lsp-pyright-venv-path python-shell-virtualenv-root)
(setq-local lsp-pyright-python-executable-cmd python-shell-interpreter)
(setq-local lsp-ruff-lsp-ruff-path (pet-executable-find "ruff"))
(setq-local lsp-ruff-lsp-python-path python-shell-interpreter)
(setq-local lsp-ruff-server-command (list (pet-executable-find "ruff") "server"))
(setq-local lsp-ruff-python-path python-shell-interpreter)
(setq-local dap-python-executable python-shell-interpreter)
(setq-local dap-variables-project-root-function #'pet-project-root)
(setq-local python-pytest-executable (pet-executable-find "pytest"))
(setq-local python-black-command (pet-executable-find "black"))
(setq-local python-isort-command (pet-executable-find "isort"))
(setq-local ruff-format-command lsp-ruff-lsp-ruff-path)
(setq-local ruff-format-command (pet-executable-find "ruff"))
(setq-local blacken-executable python-black-command)
(setq-local yapfify-executable (pet-executable-find "yapf"))
(setq-local py-autopep8-command (pet-executable-find "autopep8"))
Expand All @@ -1008,8 +1008,8 @@ buffer local values."
(kill-local-variable 'lsp-pylsp-plugins-jedi-environment)
(kill-local-variable 'lsp-pyright-venv-path)
(kill-local-variable 'lsp-pyright-python-executable-cmd)
(kill-local-variable 'lsp-ruff-lsp-ruff-path)
(kill-local-variable 'lsp-ruff-lsp-python-path)
(kill-local-variable 'lsp-ruff-python-path)
(kill-local-variable 'lsp-ruff-server-command)
(kill-local-variable 'dap-python-executable)
(kill-local-variable 'dap-variables-project-root-function)
(kill-local-variable 'python-pytest-executable)
Expand Down Expand Up @@ -1060,8 +1060,8 @@ has assigned to."
lsp-pylsp-plugins-jedi-environment
lsp-pyright-python-executable-cmd
lsp-pyright-venv-path
lsp-ruff-lsp-ruff-path
lsp-ruff-lsp-python-path
lsp-ruff-server-command
lsp-ruff-python-path
dap-python-executable
dap-variables-project-root-function
dape-command
Expand Down
20 changes: 10 additions & 10 deletions test/pet-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -1331,8 +1331,8 @@
(kill-local-variable 'lsp-pylsp-plugins-jedi-environment)
(kill-local-variable 'lsp-pyright-venv-path)
(kill-local-variable 'lsp-pyright-python-executable-cmd)
(kill-local-variable 'lsp-ruff-lsp-ruff-path)
(kill-local-variable 'lsp-ruff-lsp-python-path)
(kill-local-variable 'lsp-ruff-server-command)
(kill-local-variable 'lsp-ruff-python-path)
(kill-local-variable 'dap-python-executable)
(kill-local-variable 'dap-variables-project-root-function)
(kill-local-variable 'python-pytest-executable)
Expand Down Expand Up @@ -1381,8 +1381,8 @@
(expect (local-variable-p 'lsp-pylsp-plugins-jedi-environment) :to-be-truthy)
(expect (local-variable-p 'lsp-pyright-venv-path) :to-be-truthy)
(expect (local-variable-p 'lsp-pyright-python-executable-cmd) :to-be-truthy)
(expect (local-variable-p 'lsp-ruff-lsp-ruff-path) :to-be-truthy)
(expect (local-variable-p 'lsp-ruff-lsp-python-path) :to-be-truthy)
(expect (local-variable-p 'lsp-ruff-server-command) :to-be-truthy)
(expect (local-variable-p 'lsp-ruff-python-path) :to-be-truthy)
(expect (local-variable-p 'dap-python-executable) :to-be-truthy)
(expect (local-variable-p 'dap-variables-project-root-function) :to-be-truthy)
(expect (local-variable-p 'python-pytest-executable) :to-be-truthy)
Expand All @@ -1400,8 +1400,8 @@
(expect lsp-pylsp-plugins-jedi-environment :to-equal "/home/user/project/.venv/")
(expect lsp-pyright-venv-path :to-equal "/home/user/project/.venv/")
(expect lsp-pyright-python-executable-cmd :to-equal "/usr/bin/python")
(expect lsp-ruff-lsp-ruff-path :to-equal "/usr/bin/ruff")
(expect lsp-ruff-lsp-python-path :to-equal "/usr/bin/python")
(expect lsp-ruff-server-command :to-equal '("/usr/bin/ruff" "server"))
(expect lsp-ruff-python-path :to-equal "/usr/bin/python")
(expect dap-python-executable :to-equal "/usr/bin/python")
(expect dap-variables-project-root-function :to-equal #'pet-project-root)
(expect python-pytest-executable :to-equal "/usr/bin/pytest")
Expand All @@ -1422,8 +1422,8 @@
(kill-local-variable 'lsp-pylsp-plugins-jedi-environment)
(kill-local-variable 'lsp-pyright-venv-path)
(kill-local-variable 'lsp-pyright-python-executable-cmd)
(kill-local-variable 'lsp-ruff-lsp-ruff-path)
(kill-local-variable 'lsp-ruff-lsp-python-path)
(kill-local-variable 'lsp-ruff-server-command)
(kill-local-variable 'lsp-ruff-python-path)
(kill-local-variable 'dap-python-executable)
(kill-local-variable 'dap-variables-project-root-function)
(kill-local-variable 'python-pytest-executable)
Expand Down Expand Up @@ -1453,8 +1453,8 @@
(expect (local-variable-p 'lsp-pylsp-plugins-jedi-environment) :not :to-be-truthy)
(expect (local-variable-p 'lsp-pyright-venv-path) :not :to-be-truthy)
(expect (local-variable-p 'lsp-pyright-python-executable-cmd) :not :to-be-truthy)
(expect (local-variable-p 'lsp-ruff-lsp-ruff-path) :not :to-be-truthy)
(expect (local-variable-p 'lsp-ruff-lsp-python-path) :not :to-be-truthy)
(expect (local-variable-p 'lsp-ruff-server-command) :not :to-be-truthy)
(expect (local-variable-p 'lsp-ruff-python-path) :not :to-be-truthy)
(expect (local-variable-p 'dap-python-executable) :not :to-be-truthy)
(expect (local-variable-p 'dap-variables-project-root-function) :not :to-be-truthy)
(expect (local-variable-p 'python-pytest-executable) :not :to-be-truthy)
Expand Down

0 comments on commit 75b371a

Please sign in to comment.