1
0
Fork 0

oni-php: Warn me when I'm trying to use a non-existent class

This commit is contained in:
Tom Willemsen 2024-12-30 14:16:50 -08:00
parent 2b3048fc87
commit 2cbb137dd2

View file

@ -75,9 +75,12 @@ nil for some reason."
(interactive (list (symbol-name (symbol-at-point))))
(let* ((default-directory (project-root (project-current)))
(classes (read (shell-command-to-string (concat (expand-file-name "find-php-class" oni-php-scripts-dir) " " class))))
(class (if (> (length classes) 1)
(completing-read "Use: " classes nil t)
(car classes))))
(class (cond
((null classes)
(user-error "Class %s not found" class))
((> (length classes) 1)
(completing-read "Use: " classes nil t))
(t (car classes)))))
(save-excursion
(goto-char (point-min))
(search-forward "use ")