Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completion not working when in a project #359

Open
dorneanu opened this issue Jan 6, 2025 · 3 comments
Open

Completion not working when in a project #359

dorneanu opened this issue Jan 6, 2025 · 3 comments

Comments

@dorneanu
Copy link

dorneanu commented Jan 6, 2025

Hi! I've configured copilot.el this way:

(use-package copilot
  :straight (:host github :repo "copilot-emacs/copilot.el" :files ("*.el"))
  :bind ((:map prog-mode-map
               ("M-k" . copilot-complete))
         (:map copilot-completion-map
               ("M-l" . copilot-accept-completion)
               ("M-1" . copilot-accept-completion-by-word)
               ("M-2" . copilot-accept-completion-by-line)))
  :config
  (add-to-list 'copilot-indentation-alist '(prog-mode 4))
  (setq copilot-idle-delay 0.12)
  (setq copilot-max-char -1))
  ;;(add-to-list 'copilot-major-mode-alist '("go-ts" . "go")))

(add-hook 'prog-mode-hook 'copilot-mode)

I just noticed that completion is not working when I open a buffer in a project (I use project.el). In the screenshot below I have $HOME/tmp/bla.go opened and copilot works as expected.

image

However, putting the same file into a folder (which is part of a project) stops the autocompletion.

image

copilot is definitely enabled for that buffer:

image

Any ideas what could be the issue? Thanks in advance.

@guilhXavier
Copy link

Hi! I'm also using project.el and I've also run into the same issue. I get completions when it's just a file by itself, but not inside of a project

@guilhXavier
Copy link

guilhXavier commented Feb 2, 2025

Hi, just an udpate: I did manage to spot an event via the copilot events buffer that mentioned not being able to fetch repository policy and so making copilot inactive

[jsonrpc] e[11:24:52.686] <-- statusNotification 
(:jsonrpc "2.0" :method "statusNotification" :params
	  (:status "Inactive" :message "Copilot is disabled because we could not fetch the repository policy"))
[jsonrpc] e[11:24:52.687] <-- getCompletions[12] 
(:jsonrpc "2.0" :id 12 :result
	  (:completions
	   []
	   :cancellationReason "CopilotNotAvailable"))

@guilhXavier
Copy link

This also seems to mostly happen with files tracked by git. Untracked files or those outside a git repository seem unaffected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants