diff options
Diffstat (limited to 'oni-php/oni-php.el')
| -rw-r--r-- | oni-php/oni-php.el | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/oni-php/oni-php.el b/oni-php/oni-php.el index e591983..11d4f3b 100644 --- a/oni-php/oni-php.el +++ b/oni-php/oni-php.el @@ -4,8 +4,8 @@ ;; Author: Tom Willemse <tom@ryuslash.org> ;; Keywords: local -;; Version: 2026.0501.153153 -;; Package-Requires: (oni-yasnippet oni-flycheck oni-company oni-hydra oni-smartparens ggtags fic-mode company-php rainbow-delimiters rainbow-identifiers) +;; Version: 2026.0514.120954 +;; Package-Requires: (oni-yasnippet oni-flycheck oni-hydra oni-corfu ggtags fic-mode rainbow-delimiters rainbow-identifiers) ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -28,7 +28,6 @@ ;;; Code: (require 'align) -(require 'company) (require 'hydra) (require 'map) (require 'project) @@ -197,6 +196,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")) @@ -204,7 +223,6 @@ Otherwise call FUNC with ARGS. This is meant as advice around (add-hook 'php-mode-hook #'oni-php--set-require-final-newline) (add-hook 'php-mode-hook #'oni-php--whitespace-mode) -(add-hook 'php-mode-hook 'company-mode) (add-hook 'php-mode-hook 'display-fill-column-indicator-mode) (add-hook 'php-mode-hook 'electric-indent-local-mode) (add-hook 'php-mode-hook 'fic-mode) @@ -218,9 +236,7 @@ Otherwise call FUNC with ARGS. This is meant as advice around (add-hook 'php-mode-hook 'smartparens-mode) (add-hook 'php-mode-hook 'subword-mode) (add-hook 'php-mode-hook 'yas-minor-mode) - -(with-eval-after-load 'company - (add-to-list 'company-backends 'company-ac-php-backend)) +(add-hook 'php-mode-hook 'corfu-mode) (define-key php-mode-map (kbd "C-c m") #'php-mode-hydra/body) (define-key php-mode-map (kbd ".") #'oni-php-insert-dot-dwim) @@ -333,6 +349,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 |
