Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion copilot.el
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,28 @@ Enabling event logging may slightly affect performance."
;; Auto completion
;;

;; based on https://code.visualstudio.com/docs/languages/identifiers
;; (more here https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/)
(defvar copilot-major-mode-alist '(("rustic" . "rust")
("cperl" . "perl"))
("cperl" . "perl")
("c++" . "cpp")
("objc" . "objective-c")
("cuda" . "cuda-cpp")
("docker-compose" . "dockercompose")
("coffee" . "coffeescript")
("js" . "javascript")
("js2" . "javascript")
("js2-jsx" . "javascriptreact")
("typescript-tsx" . "typescriptreact")
("rjsx" . "typescriptreact")
("less-css" . "less")
("text" . "plaintext")
("ess-r" . "r")
("enh-ruby" . "ruby")
("shell-script" . "shellscript")
("sh" . "shellscript")
("visual-basic" . "vb")
("nxml" . "xml"))
"Alist mapping major mode names (with -mode removed) to copilot language ID's.")

(defconst copilot--indentation-alist
Expand Down
9 changes: 9 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,15 @@ Use tab to accept completions (you may also want to bind `copilot-accept-complet

</details>

### Programming language detection

Copilot.el detects the programming language of a buffer based on the major-mode name, stripping the `-mode` part. Resulting languageId should match table [here](https://code.visualstudio.com/docs/languages/identifiers#_known-language-identifiers).
You can add unusual major-mode mappings to `copilot-major-mode-alist`. Without the proper language set suggestions may be of poorer quality.

```elisp
(add-to-list 'copilot-major-mode-alist '("enh-ruby" . "ruby"))
```

## Commands

#### copilot-diagnose
Expand Down