You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm encountering an issue where the flycheck creates a host of errors that seems to be related to the way the lsp checker interprets the errors from what appears to be the ruff linter
you can see a screenshow of my emacs window with the error
I'm pasting my emacs init.el file below
If anyone could point me in the right direction on how to fix this and whether this is just a configuration issue or an actual bug triggered by an unusual configuration, that'd be much appreciated...
(setq inhibit-splash-screen t)
(setq-default indent-tabs-mode nil)
;; (setq package-check-signature nil)
(require 'package)
(setq
package-archives
'(
("gnu" . "https://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/")))
(package-initialize)
(unless (package-installed-p 'use-package)
(package-install 'use-package))
(use-package pyvenv
:ensure t
:config
;; Enable pyvenv-mode whenever a python file is opened
(add-hook 'python-mode-hook 'pyvenv-mode))
(defun my/poetry-find-and-activate ()
"Automatically find and activate the Poetry virtual environment for the project."
(interactive)
(message "attempting to load venv")
(let ((venv (string-trim (shell-command-to-string "poetry env info --path"))))
(if (file-exists-p venv)
(pyvenv-activate venv)
(message (concat venv "No virtualenv found for this project")))))
(add-hook 'python-mode-hook 'my/poetry-find-and-activate)
(use-package flycheck
:ensure t
:init (global-flycheck-mode))
(use-package company
:ensure t
:hook (lsp-mode . company-mode))
(use-package treemacs
:ensure t
:defer t)
(use-package ivy
:ensure t
:defer t
:config
(ivy-mode 1))
(use-package lsp-mode
:ensure t
:init
(setq lsp-keymap-prefix "C-c l")
;; :commands lsp
:hook (
(python-mode . lsp-deferred)
(lsp-mode . lsp-enable-which-key-integration))
:config
(setq lsp-prefer-flymake t)) ;; Disable `flymake`
(use-package lsp-ui
:ensure t
:hook (lsp-mode . lsp-ui-mode)
:commands lsp-ui-mode)
(use-package lsp-ivy
:ensure t
:commands lsp-ivy-workspace-symbol)
(use-package lsp-treemacs
:ensure t
:commands lsp-treemacs-errors-list)
(use-package dap-mode
:ensure t)
(use-package dap-python
)
;;(add-hook 'python-mode-hook
;; (lambda () (setq flycheck-disabled-checkers '(lsp))))
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages '(gnu-elpa-keyring-update use-package)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
The text was updated successfully, but these errors were encountered:
ltrojan
changed the title
[python] [flycheck] [ruff] unclear issue with diagnostics provider, flycheck and ruff
[python] [emacs] [flycheck] [ruff] unclear issue with diagnostics provider
Sep 16, 2024
Unsure if I can help as I use eglot rather than lsp-mode. However, a couple of points.
You probably don't want flymake and flycheck enabled at the same time.
(setq lsp-prefer-flymake t)) ;; Disable `flymake`
This suggests you enable flymake rather than disable it and you prefer it presumably over flycheck.
Your pyproject.toml also seems incorrect.
You list python-lsp-ruff under poetry dependencies.
You list python as a poetry dependency. I appreciate it is a python project manager but does python have to be listed here?
If you are using ruff then isort and black are probabaly unnecessary.
In addition ruff is a dependency of python-lsp-ruff so shouldn't need to be listed separately.
I don't understand why you have a separate table for emacs dependencies when none of those are dependencies of emacs.
You make no mention of how you have installed python-lsp-server. You probably want to install it once and make it available to all your projects rather than install it for each project. If so I suggest you install with pipx for your own user which will make it available globally.
3a. First install pipx either through your system package manager in the usual way or with pip as follows:
python3 -m pip install --user pipx
3b. Use pipx to install python-lsp-server into an isolated virtual environment with pylsp made available globally
python3 -m pipx install python-lsp-server
3c. Use pipx to inject python-lsp-ruff into the same isolated virtual environment as python-lsp-server making ruff (and pylsp) globally available
I'm encountering an issue where the
flycheck
creates a host of errors that seems to be related to the way thelsp
checker interprets the errors from what appears to be the ruff linteryou can see a screenshow of my emacs window with the error
I'm pasting my emacs
init.el
file belowIf anyone could point me in the right direction on how to fix this and whether this is just a configuration issue or an actual bug triggered by an unusual configuration, that'd be much appreciated...
The text was updated successfully, but these errors were encountered: