Skip to content

Commit a42e9bb

Browse files
authored
Enable @ filepath completion by default (#274)
1 parent b807af0 commit a42e9bb

4 files changed

Lines changed: 21 additions & 4 deletions

File tree

README.org

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ Enable installation of packages from MELPA by adding an entry to package-archive
102102
(global-set-key (kbd "C-c a") #'ai-code-menu)
103103
;; Optional: Use eat if you prefer, by default it is vterm
104104
;; (setq ai-code-backends-infra-terminal-backend 'eat) ;; config for native CLI backends. for external backends such as agent-shell, claude-code-ide.el and claude-code.el, please check their own config
105-
;; Optional: Enable @ file completion in comments and AI sessions
106-
(ai-code-prompt-filepath-completion-mode 1)
105+
;; Optional: Disable @ file completion in comments and AI sessions
106+
;; (ai-code-prompt-filepath-completion-mode -1)
107107
;; Optional: Ask AI to run test after code changes, for a tighter build-test loop
108108
(setq ai-code-auto-test-type 'ask-me)
109109
;; Optional: In AI session buffers, SPC in Evil normal state triggers the prompt-enter UI

ai-code-input.el

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,10 @@ END-POS defaults to the current '#' position."
507507
(message "Filepath @ completion is %s"
508508
(if ai-code-prompt-filepath-completion-mode "enabled" "disabled")))
509509

510+
;; Keep @ filepath completion available out of the box.
511+
(unless ai-code-prompt-filepath-completion-mode
512+
(ai-code-prompt-filepath-completion-mode 1))
513+
510514
;;; Code Link Navigation
511515

512516
(defconst ai-code--session-link-file-base-regexp

ai-code.el

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
;; ;; Optional: use a narrower transient menu on smaller frames
5555
;; ;; (setq ai-code-menu-layout 'two-columns)
5656
;; (global-set-key (kbd "C-c a") #'ai-code-menu)
57-
;; ;; Optional: Enable @ file completion in comments and AI sessions
58-
;; (ai-code-prompt-filepath-completion-mode 1)
57+
;; ;; Optional: Disable @ file completion in comments and AI sessions
58+
;; ;; (ai-code-prompt-filepath-completion-mode -1)
5959
;; ;; Optional: Configure AI test prompting mode (e.g., ask about running tests/TDD) for a tighter build-test loop
6060
;; (setq ai-code-auto-test-type 'ask-me)
6161
;; ;; Optional: In the AI session buffer (Evil normal state), SPC triggers the prompt entry UI

test/test_ai-code-input.el

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,19 @@
302302

303303
;;; Tests for ai-code-prompt-filepath-completion-mode
304304

305+
(ert-deftest ai-code-test-filepath-completion-mode-default-enabled ()
306+
"Test that @ filepath completion starts enabled by default."
307+
(ai-code-prompt-filepath-completion-mode -1)
308+
(load-file (expand-file-name "ai-code-input.el" default-directory))
309+
(should ai-code-prompt-filepath-completion-enabled)
310+
(should ai-code-prompt-filepath-completion-mode)
311+
(should (memq 'ai-code--comment-auto-trigger-filepath-completion
312+
post-self-insert-hook))
313+
(should (memq 'ai-code--session-auto-trigger-filepath-completion
314+
post-self-insert-hook))
315+
(should (memq 'ai-code--comment-filepath-setup
316+
after-change-major-mode-hook)))
317+
305318
(ert-deftest ai-code-test-filepath-completion-mode-enable ()
306319
"Test that enabling the mode sets up hooks and variable correctly."
307320
(let ((ai-code-prompt-filepath-completion-mode nil))

0 commit comments

Comments
 (0)