diff options
| author | 2026-05-08 17:47:34 -0700 | |
|---|---|---|
| committer | 2026-05-08 17:47:34 -0700 | |
| commit | b966ed860c726179850da5b58c3224db2d5679d8 (patch) | |
| tree | 9f7ab63b1afe801387f4e564ce87bb279bb55610 | |
| parent | 1f1605f865adbc8b161512b09e86f004529f6fb3 (diff) | |
| download | emacs-config-b966ed860c726179850da5b58c3224db2d5679d8.tar.gz emacs-config-b966ed860c726179850da5b58c3224db2d5679d8.zip | |
oni-php: Add command to ignore the error at point
| -rw-r--r-- | oni-php/oni-php.el | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/oni-php/oni-php.el b/oni-php/oni-php.el index e591983..5e973a3 100644 --- a/oni-php/oni-php.el +++ b/oni-php/oni-php.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse <tom@ryuslash.org> ;; Keywords: local -;; Version: 2026.0501.153153 +;; Version: 2026.0508.174729 ;; Package-Requires: (oni-yasnippet oni-flycheck oni-company oni-hydra oni-smartparens ggtags fic-mode company-php rainbow-delimiters rainbow-identifiers) ;; This program is free software; you can redistribute it and/or modify @@ -197,6 +197,26 @@ Otherwise call FUNC with ARGS. This is meant as advice around "Set any settings for dabbrev that make sense for PHP code." (setq-local dabbrev-abbrev-skip-leading-regexp (rx "$"))) +(defun oni-php-ignore-error-at-point (error-type) + (interactive + (list (let* ((error-types + (seq-uniq + (mapcar (lambda (e) + (let ((str (flycheck-error-message e))) + (string-match (rx "🪪" (one-or-more whitespace) (group (one-or-more (any alnum ".")))) str) + (match-string 1 str))) + (seq-filter (lambda (e) (not (flycheck-error-checker e))) + (flycheck-overlay-errors-at (point)))) + 'string=))) + (if (> 1 (length error-types)) + (completing-read "Ignore type: " error-types) + (car error-types))))) + (save-excursion + (goto-char (line-beginning-position)) + (indent-for-tab-command) + (insert "/** @phpstan-ignore " error-type " */\n") + (indent-for-tab-command))) + (defhydra php-mode-hydra (:color blue) ("a" align-current "Align current selection")) @@ -333,6 +353,7 @@ point." (define-key php-mode-map (kbd "C-c .") nil t) (define-key php-mode-map (kbd "C-c . g") '("Search for symbol at point" . oni-php-grep-symbol)) (define-key php-mode-map (kbd "C-c . a") '("Import symbol at point" . oni-php-add-use)) +(define-key php-mode-map (kbd "C-c . i") '("Ignore error at point" . oni-php-ignore-error-at-point)) (provide 'oni-php) ;;; oni-php.el ends here |
