copilot-emacs / copilot.el

An unofficial Copilot plugin for Emacs.
MIT License
1.83k stars 129 forks source link

[jsonrpc] Server exited with status 9 #101

Closed Ghibranalj closed 1 year ago

Ghibranalj commented 1 year ago

My copilot.el hasnt been working for a couple of days now. im not sure what the problem is, but when i run (copilot-diagnose) this message appears in the *Messages* buffer

[jsonrpc] Server exited with status 9
Copilot agent started.
Copilot OK.

im not sure what it is. im running node 19 on arch, but ive tried it on node 16 and 18 still the same problem. when i try copilot on vscode it works perfectly.

zerolfx commented 1 year ago

Please paste related logs in the *copilot events* and *copilot stderr* buffer.

EzequielRamis commented 1 year ago

Hi! I'm having the same error OP's mentioning.

These are my logs:

*Messages*

[jsonrpc] Server exited with status 9
Copilot agent started.
copilot--start-agent: Invalid function: (buf (current-buffer))

*copilot events*

(:message "Connection state changed" :change "killed\n")

----------b---y---e---b---y---e----------
[stderr] 
[stderr] 
[stderr] nil
[stderr] nil
[stderr] Process copilot agent stderr finished
[client-request] (id:1) Wed Mar  8 23:20:45 2023:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
          (:capabilities 'nil))
[server-notification] Wed Mar  8 23:20:46 2023:
(:jsonrpc "2.0" :method "LogMessage" :params
          (:level 0 :message "[DEBUG] [agent] [2023-03-09T02:20:46.464Z] Agent service starting" :metadataStr "[DEBUG] [agent] [2023-03-09T02:20:46.464Z]" :extra
                  ["Agent service starting"]))
[server-reply] (id:1) Wed Mar  8 23:20:46 2023:
(:jsonrpc "2.0" :id 1 :result
          (:capabilities
           (:textDocumentSync
            (:openClose t :change 2)
            :workspace
            (:workspaceFolders
             (:supported :json-false :changeNotifications :json-false)))))
zerolfx commented 1 year ago

@EzequielRamis Are you currently using the latest commit? Also check #98.

EzequielRamis commented 1 year ago

I had updated it hours before that commit 😅 now it works, thank you!

Ghibranalj commented 1 year ago

Hello. Thank you to respond quickly. To answer your question. My copilot.el is the latest version. The buffers that you mention *copilot events* seem to always be empty. And *copilot stderr* doesnt seem to exist.

zerolfx commented 1 year ago

@Ghibranalj Please try to run node /path/to/copilot.el/dist/agent.js in your terminal.

Ghibranalj commented 1 year ago

I ran node agent.js and the output was:

Content-Length: 232

{"jsonrpc":"2.0","method":"LogMessage","params":{"level":0,"message":"[DEBUG] [agent] [2023-03-09T09:49:11.541Z] Agent service starting","metadataStr":"[DEBUG] [agent] [2023-03-09T09:49:11.541Z]","extra":["Agent service starting"]}}
zerolfx commented 1 year ago

It looks okay. But *copilot events* should not be empty, please set copilot-log-max to nil and try again.

Ghibranalj commented 1 year ago

Okay.. this was the content of *copilot events* after (setq copilot-log-max nil)

(:jsonrpc "2.0" :id 26 :result
          (:completions
           []))
[server-notification] Thu Mar  9 12:13:30 2023:
(:jsonrpc "2.0" :method "statusNotification" :params
          (:status "InProgress" :message ""))
[server-notification] Thu Mar  9 12:13:30 2023:
(:jsonrpc "2.0" :method "LogMessage" :params
          (:level 1 :message "[INFO] [default] [2023-03-09T11:13:30.108Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex" :metadataStr "[INFO] [default] [2023-03-09T11:13:30.108Z]" :extra
                  ["[fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex"]))
[internal] Thu Mar  9 12:13:38 2023:
(:message "Connection state changed" :change "killed\n")

----------b---y---e---b---y---e----------
[internal] (id:27) ERROR Thu Mar  9 12:13:38 2023:
(:message "error ignored, status set (Server died)" :id 27 :error -1)
[stderr] 
[stderr] 
[stderr] nil
[stderr] nil
[stderr] Process copilot agent stderr finished
[client-request] (id:1) Thu Mar  9 12:13:38 2023:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
          (:capabilities 'nil))
[server-notification] Thu Mar  9 12:13:41 2023:
(:jsonrpc "2.0" :method "LogMessage" :params
          (:level 0 :message "[DEBUG] [agent] [2023-03-09T11:13:41.199Z] Agent service starting" :metadataStr "[DEBUG] [agent] [2023-03-09T11:13:41.199Z]" :extra
                  ["Agent service starting"]))
[server-reply] (id:1) Thu Mar  9 12:13:41 2023:
(:jsonrpc "2.0" :id 1 :result
          (:capabilities
           (:textDocumentSync
            (:openClose t :change 2)
            :workspace
            (:workspaceFolders
             (:supported :json-false :changeNotifications :json-false)))))
[client-request] (id:2) Thu Mar  9 12:13:41 2023:
(:jsonrpc "2.0" :id 2 :method "setEditorInfo" :params
          (:editorInfo
           (:name "Emacs" :version "28.2")
           :editorPluginInfo
           (:name "copilot.el" :version "0.9.9")))
[client-request] (id:3) Thu Mar  9 12:13:41 2023:
(:jsonrpc "2.0" :id 3 :method "getCompletions" :params
          (:doc
           (:version 0 :source "\n" :path "" :uri "" :relativePath "" :languageId "text" :position
                     (:line 0 :character 0))))
[server-notification] Thu Mar  9 12:13:41 2023:
(:jsonrpc "2.0" :method "LogMessage" :params
          (:level 0 :message "[DEBUG] [agent] [2023-03-09T11:13:41.272Z] Telemetry initialized" :metadataStr "[DEBUG] [agent] [2023-03-09T11:13:41.272Z]" :extra
                  ["Telemetry initialized"]))
[server-reply] (id:2) Thu Mar  9 12:13:41 2023:
(:jsonrpc "2.0" :id 2 :result "OK")
[server-reply] (id:3) Thu Mar  9 12:13:42 2023:
(:jsonrpc "2.0" :id 3 :result
          (:completions
           []))
zerolfx commented 1 year ago

Hmmm, very weird. The Copilot process died for no reason and I can't think of any reason. You may want to try 20ce5cf.

Ghibranalj commented 1 year ago

After monitoring the log for a while, I think copilot always get timed out

[server-notification] Fri Mar 10 17:14:06 2023:
(:jsonrpc "2.0" :method "LogMessage" :params
          (:level 1 :message "[INFO] [default] [2023-03-10T16:14:06.647Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex" :metadataStr "[INFO] [default] [2023-03-10T16:14:06.647Z]" :extra
                  ["[fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex"]))
[internal] (id:42) Fri Mar 10 17:14:16 2023:
(:timed-out getCompletions :id 42 :params
            (:doc
             (:source ";;; $DOOM_DIR/config.el -*- lexical-binding: t; -*-\n\n(load! \"keymap.el\")\n(setq display-line-numbers-type 'relative)\n(setq org-directory \"~/org/\")\n\n(setq doom-theme 'doom-material-dark)\n(setq doom-font (font-spec\n                 :family \"Source Code Pro\"\n                 :size 15))\n\n(setq doom-variable-pitch-font (font-spec\n                                :family \"Source Code Pro\"\n                                :size 15))\n\n(setq doom-big-font (font-spec\n                     :family \"Source Code Pro\"\n                     :size 22))\n\n(setq doom-bin \"doom\")\n\n;; Auto save\n(setq auto-save-default t\n      make-backup-files t)\n\n(load! \"my-packages/evil-megasave-mode.el\")\n(add-hook! 'prog-mode-hook 'evil-megasave-mode)\n(add-hook! 'git-commit-mode-hook 'evil-megasave-mode)\n(add-hook! 'conf-mode-hook 'evil-megasave-mode)\n(add-hook! 'yaml-mode-hook 'evil-megasave-mode)\n\n(defvar my-new-frame-hook nil\n  \"Hook run after a any new frame is created.\")\n\n(defvar my-new-gui-frame-hook nil\n  \"Hook run after a any new gui frame is created.\")\n\n(defun on-new-frame ()\n  \"This is executed when a new frame is created.\"\n  (run-hooks 'my-new-frame-hook)\n  (if window-system\n      (run-hooks 'my-new-gui-frame-hook)))\n\n;; Running on daemon startup\n(if (daemonp)\n    (add-hook 'after-make-frame-functions (lambda (frame)\n                                            (with-selected-frame frame\n                                              (on-new-frame))))\n  (on-new-frame))\n\n;; Scroll bar\n(global-yascroll-bar-mode 1)\n\n;; Tabs\n(after! centaur-tabs\n  (setq centaur-tabs-set-bar 'under\n        centaur-tabs-set-close-button nil\n        centaur-tabs-height 42))\n\n\n;; tremacs colors\n(custom-set-faces!\n  '(treemacs-root-face :foreground \"#F78C6C\")\n  '(doom-themes-treemacs-root-face :foreground \"#F78C6C\"))\n\n\n;; Coplilot\n(defun +copilot/tab ()\n  \"Copilot completion.\"\n  (interactive)\n  (or (copilot-accept-completion)\n      (indent-relative)))\n\n(use-package! copilot\n  :hook (prog-mode . copilot-mode)\n  :bind ((\"<backtab>\" . 'copilot-accept-completion-by-word)\n         (\"<backtab>\" . 'copilot-accept-completion-by-word)\n         :map company-active-map\n         (\"<tab>\" . '+copilot/tab)\n         (\"TAB\" . '+copilot/tab)\n         :map company-mode-map\n         (\"<tab>\" . '+copilot/tab)\n         (\"TAB\" . '+copilot/tab)))\n\n;; man pages\n(setq Man-notify-method 'pushy)\n;; (add-hook! 'Man-mode-hook 'writeroom-mode)\n;; (remove-hook! 'writeroom-mode-hook '+zen-enable-text-scaling-mode-h)\n;; (remove-hook! 'writeroom-mode-hook '+zen-enable-mixed-pitch-mode-h)\n\n(defun my-comment-or-uncomment()\n  \"Comment or uncomment the current line or region.\"\n  (interactive)\n  (if mark-active\n      (comment-or-uncomment-region (region-beginning) (region-end))\n    (comment-or-uncomment-region (line-beginning-position) (line-end-position))))\n\n(beacon-mode 1)\n(setq scroll-margin 16\n      scroll-conservatively 101\n      scroll-up-aggressively 0.01\n      scroll-down-aggressively 0.01\n      scroll-preserve-screen-position t\n      auto-window-vscroll t)\n\n;; misc hook\n(use-package! company-box\n  :hook (company-mode . company-box-mode))\n\n(setq lsp-ui-sideline-show-diagnostics t)\n(setq lsp-ui-sideline-show-hover t)\n(setq lsp-ui-sideline-show-code-actions t)\n(setq lsp-ui-sideline-update-mode 'line)\n(add-hook! 'prog-mode-hook #'lsp-ui-mode)\n(add-hook! 'lsp-mode-hook #'lsp-ui-sideline-mode)\n(add-hook! 'lsp-mode-hook #'lsp-headerline-breadcrumb-mode)\n(setq lsp-headerline-breadcrumb-enable t)\n(add-hook! 'prog-mode-hook #'lsp-headerline-breadcrumb-mode)\n\n(setq magit-clone-default-directory \"~/Workspace/\")\n\n(defun my-eval-line ()\n  \"Evaluate the current line.\"\n  (interactive)\n  (eval-region (line-beginning-position) (line-end-position)))\n\n\n;; eaf and browser\n(defun my-setup-browser ()\n  \"Setup eaf and browser.\"\n  (message \"Browser is being setup\")\n  (add-to-list 'load-path \"~/.emacs.d/site-lisp/emacs-application-framework/\")\n  (require 'eaf)\n  (require 'eaf-browser)\n  (require 'eaf-video-player)\n  (require 'eaf-pdf-viewer)\n  ;; (setq eaf-browser-enable-bookmark t)\n  (setq eaf-browser-enable-adblocker t)\n  (defvar eaf-browser-default-search-engine \"google\")\n  (add-hook! 'eaf-mode-hook 'my-add-buffer-to-project)\n  (add-hook! 'eaf-mode-hook 'hide-mode-line-mode)\n\n  (require 'evil)\n  (evil-collection-define-key 'normal 'eaf-mode-map*\n    \"j\" 'eaf-send-down-key\n    \"k\" 'eaf-send-up-key\n    \"h\" 'eaf-send-left-key\n    \"l\" 'eaf-send-right-key\n    \"Q\" 'kill-current-buffer\n    \"R\" 'eaf-restart-process\n    \"B\" '(lambda () (interactive) (eaf-execute-app-cmd 'eaf-py-proxy-insert_or_save_as_bookmark))\n    )\n  )\n\n(add-hook! 'my-new-gui-frame-hook 'my-setup-browser)\n\n(defun my-open-browser(url &optional args)\n  \"Open URL with ARGS on eaf-browser when not terminal, chrome when terminal.\"\n  (if window-system\n      (eaf-open-browser url args)\n    (browse-url-chrome url args)))\n\n\n(setq browse-url-browser-function 'my-open-browser)\n\n(defun my-open-selected-link ()\n  \"Open URL with ARGS on eaf-browser when not terminal, chrome when terminal.\"\n  (interactive)\n  (if (region-active-p)\n      (let ((url (buffer-substring-no-properties (region-beginning) (region-end))))\n        (my-open-browser url))\n    (message \"No region selected\")))\n\n(defun my-google-search ()\n  \"Search Google inside eaf-browser.\"\n  (interactive)\n  (my-open-browser\n   (concat\n    \"https://www.google.com/search?q=\"\n    (url-hexify-string (if mark-active\n                           (buffer-substring (region-beginning) (region-end))\n                         (my-read-string-hist \"Search Google: \" 'my-google-search-history))))))\n\n(defun my-clear-google-search-history ()\n  \"Clear google search history.\"\n  (interactive)\n  (persist-reset 'my-google-search-history)\n  (setq my-google-search-history nil))\n\n(defun my-open-github ()\n  \"Open github in eaf-browser.\"\n  (interactive)\n  (require 'browse-at-remote)\n  (if (car (browse-at-remote--get-remotes))\n      (+vc/browse-at-remote-homepage)\n    (my-open-browser \"github.com\")))\n\n;; TODO diferenciate between video player and browser maybe?\n(defvar my-consult--eaf-source\n  (list :name     \"Browser\"\n        :category 'buffer\n        :narrow   ?o\n        :face     'consult-buffer\n        :history  'buffer-name-history\n        :state    #'consult--buffer-state\n        :require-match t\n        :items\n        (lambda ()\n          (mapcar #'buffer-name\n                  (seq-filter\n                   (lambda (x)\n                     (eq (buffer-local-value 'major-mode x) 'eaf-mode))\n                   (persp-buffer-list))))))\n\n(defvar my-consult--terminal-source\n  (list :name     \"Terminal\"\n        :category 'buffer\n        :narrow   ?o\n        :face     'consult-buffer\n        :history  'buffer-name-history\n        :state    #'consult--buffer-state\n        :require-match t\n        :items\n        (lambda ()\n          (mapcar #'buffer-name\n                  (seq-filter\n                   (lambda (x)\n                     (or\n                      (eq (buffer-local-value 'major-mode x) 'vterm-mode)))\n                   (persp-buffer-list))))))\n\n(defvar my-consult--dired-source\n  (list :name     \"Dired\"\n        :category 'buffer\n        :narrow   ?o\n        :face     'consult-buffer\n        :history  'buffer-name-history\n        :state    #'consult--buffer-state\n        :require-match t\n        :items\n        (lambda ()\n          (mapcar #'buffer-name\n                  (seq-filter\n                   (lambda (x)\n                     (or\n                      (eq (buffer-local-value 'major-mode x) 'dired-mode)))\n                   (persp-buffer-list))))))\n\n(defvar my-consult--workspace-source\n  (list :name    \"Workspace Buffers\"\n        :category 'buffer\n        :narrow   ?o\n        :face     'consult-buffer\n        :history  'buffer-name-history\n        :state    #'consult--buffer-state\n        :require-match t\n        :items\n        (lambda ()\n          (mapcar #'buffer-name\n                  (seq-filter\n                   (lambda (x)\n                     (and\n                      (not (eq (buffer-local-value 'major-mode x) 'vterm-mode))\n                      (not (eq (buffer-local-value 'major-mode x) 'eaf-mode))\n                      (not (eq (buffer-local-value 'major-mode x) 'dired-mode))\n                      (or (not (boundp 'minimap-buffer-name))\n                          (not (string= (buffer-name x) minimap-buffer-name)))))\n                   (persp-buffer-list))))))\n\n(after! consult\n  (add-to-list 'consult-buffer-sources 'my-consult--eaf-source 'append)\n  (add-to-list 'consult-buffer-sources 'my-consult--terminal-source 'append)\n  (add-to-list 'consult-buffer-sources 'my-consult--workspace-source 'append)\n  (add-to-list 'consult-buffer-sources 'my-consult--dired-source 'append)\n  )\n\n(require 'consult)\n(defun my-consult-browser ()\n  \"Open eaf-browser.\"\n  (interactive)\n  (consult-buffer '(my-consult--eaf-source)))\n\n(defun my-consult-terminal ()\n  \"Open terminal.\"\n  (interactive)\n  (consult-buffer '(my-consult--terminal-source)))\n\n(defun my-consult-workspace ()\n  \"Switch to buffer in workspace.\nShows terminal in seperate section. Also shows browsers.\"\n  (interactive)\n  (consult--multi\n   '(my-consult--dired-source my-consult--terminal-source my-consult--workspace-source my-consult--eaf-source )\n   :require-match\n   (confirm-nonexistent-file-or-buffer)\n   :prompt (format \"Switch to buffer (%s): \"\n                   (+workspace-current-name))\n   :history 'consult--buffer-history\n   :sort nil))\n\n\n(use-package! sidekick\n  :hook (sidekick-mode . (lambda () (require 'sidekick-evil)))\n  :config\n  (setq sidekick-window-hide-footer t)\n  (setq sidekick-window-take-focus t))\n\n(add-hook! 'Man-mode-hook 'my-add-buffer-to-project)\n\n(defun remove-scratch-buffer ()\n  (if (get-buffer \"*scratch*\")\n      (kill-buffer \"*scratch*\")))\n\n(if (and (daemonp) (string= (daemonp) \"term\"))\n    (progn\n      (add-hook 'after-change-major-mode-hook 'remove-scratch-buffer)\n      (add-hook 'server-after-make-frame-hook 'remove-scratch-buffer)))\n\n(require 'persist)\n(persist-defvar my-ssh-user-history nil\n                \"History for ssh user.\")\n\n(persist-defvar my-ssh-host-history nil\n                \"History for ssh host.\")\n\n(persist-defvar my-google-search-history nil\n                \"History for google search.\")\n(add-hook! 'my-new-frame-hook\n           '(lambda ()\n              (dolist (x persist--symbols)\n                (persist-load x))))\n\n(add-hook! 'after-delete-frame-functions '(lambda (frame) (persist--save-all)))\n\n(defun my-connect-remote-ssh()\n  \"Connect to remote ssh in a new workspace.\"\n  (interactive)\n  (let (( conn-str (format \"%s@%s\"\n                           (my-read-string-hist \"User (ssh): \" 'my-ssh-user-history)\n                           (my-read-string-hist \"Host (ssh): \" 'my-ssh-host-history))))\n    (progn\n      (+workspace-switch conn-str t)\n      (dired (format \"/scp:%s:\" conn-str))\n      ;; save\n      (persist-save my-ssh-user-history)\n      (persist-save my-ssh-host-history)\n      )))\n\n(setq projectile-indexing-method 'hybrid)\n;; (setq projectile-enable-caching t)\n\n(defun my-save-current-workspace ()\n  \"Save current workspace.\"\n  (interactive)\n  (+workspace/save (+workspace-current-name)))\n\n(put 'dired-find-alternate-file 'disabled nil)\n(use-package! dired\n  :hook\n  (dired-mode . dired-hide-dotfiles-mode)\n  (dired-mode . lsp-dired-mode)\n  :config\n  (setq dired-listing-switches \"-agho --group-directories-first\"\n        dired-dwim-target t\n        delete-by-moving-to-trash t\n        dired-mouse-drag-files t)\n  (evil-collection-define-key 'normal 'dired-mode-map\n    \"h\" '(lambda () (interactive) (find-alternate-file \"..\"))\n    ;; \"l\" 'dired-find-alternate-file\n    \"l\" 'my-dired-navigate-into\n    \".\" 'dired-hide-dotfiles-mode\n    \",\" 'dired-posframe-show\n    \"s\" 'my-dired-posframe-scroll-down\n    \"w\" 'my-dired-posframe-scroll-up\n    ))\n\n(defun dired-count-files-total ()\n  (goto-char (point-min))\n  (search-forward-regexp dired-move-to-filename-regexp nil t)\n  (- (count-lines (line-beginning-position) (point-max)) 2)\n  )\n\n(defun my-disable-dotfiles-hide-when-empty ()\n  (interactive)\n  (let ((dired-files (dired-count-files-total)))\n    (if (and (eq dired-files 0)  dired-hide-dotfiles-mode)\n        (progn\n          (dired-hide-dotfiles-mode -1)\n          (message \"Showing all dotfiles.\")\n          )))\n  )\n\n(add-hook 'dired-after-readin-hook 'my-disable-dotfiles-hide-when-empty)\n\n(defun my-setup-ivy ()\n  (require 'ivy)\n  (require 'ivy-posframe)\n  (setq ivy-posframe-border-width 2)\n  (set-face-attribute 'ivy-posframe-border nil :background \"#585858\")\n  (set-face-attribute 'ivy-posframe nil :background \"#212121\" :foreground \"#EEFFFF\")\n  (define-key ivy-minibuffer-map (kbd \"<escape>\") 'minibuffer-keyboard-quit)\n  (setq ivy-posframe-display-functions-alist '((t . ivy-posframe-display-at-frame-top-center)))\n  (setq ivy-posframe-parameters\n        '((left-fringe . 8)\n          (right-fringe . 8)))\n  (ivy-posframe-mode 1))\n\n(add-hook! 'my-new-gui-frame-hook 'my-setup-ivy)\n\n(defun my-read-string-hist (prompt &optional hist)\n  \"Read a string from the minibuffer with PROMPT. History is stored in HIST.\"\n\n  (let ((histlen (+ (length (symbol-value hist)) 1)))\n    (setq vertico-posframe-height histlen))\n\n  (setq vertico-count-format  (cons \"%-0s\" \"\"))\n\n  (let ((result\n         (completing-read prompt (symbol-value hist) nil nil nil hist)))\n    (if (string= result \"\")\n        nil\n      result)))\n\n(defun my-add-buffer-to-project ()\n  \"Add current buffer to current project.\"\n  (interactive)\n  (persp-add-buffer (current-buffer)))\n\n\n(add-hook! 'daemons-mode-hook 'my-add-buffer-to-project)\n(add-hook! 'daemons-output-mode-hook 'my-add-buffer-to-project)\n(after! 'daemons\n  (evil-collection-define-key 'normal 'daemons-mode-map\n    \"<ret>\" 'daemons-status-at-point\n    \"s\" 'daemons-start-at-point\n    \"S\" 'daemons-stop-at-point\n    \"r\" 'daemons-reload-at-point\n    \"R\" 'daemons-restart-at-point\n    \"e\" 'daemons-enable-at-point\n    \"d\" 'daemons-disable-at-point\n    \"t\" 'daemons-systemd-toggle-user))\n\n(setq vterm-always-compile-module t)\n\n(defun my-delete-other-workspace ()\n  (interactive)\n  (dolist (workspace (+workspace-list-names))\n    (unless (eq workspace (+workspace-current-name))\n      (+workspace/delete workspace))))\n\n(setq rainbow-delimiters-max-face-count 6)\n(custom-set-faces!\n  '(rainbow-delimiters-depth-1-face :foreground \"#B23F77\")\n  '(rainbow-delimiters-depth-2-face :foreground \"#B69457\")\n  '(rainbow-delimiters-depth-3-face :foreground \"#7BA55D\")\n  '(rainbow-delimiters-depth-4-face :foreground \"#4F86A0\")\n  '(rainbow-delimiters-depth-5-face :foreground \"#B55C2B\")\n  '(rainbow-delimiters-depth-6-face :foreground \"#144BC3\"))\n\n(add-hook! 'prog-mode-hook 'rainbow-delimiters-mode)\n\n(defun my-highlight-function (level responsive display)\n  \"Highlight the current line with a face according to LEVEL.\nRESPONSIVE and DISPLAY are ignored.\"\n\n  (let* ((lvl (% level 6)))\n    (cond\n     ((eq lvl 0) 'rainbow-delimiters-depth-1-face)\n     ((eq lvl 1) 'rainbow-delimiters-depth-2-face)\n     ((eq lvl 2) 'rainbow-delimiters-depth-3-face)\n     ((eq lvl 3) 'rainbow-delimiters-depth-4-face)\n     ((eq lvl 4) 'rainbow-delimiters-depth-5-face)\n     ((eq lvl 5) 'rainbow-delimiters-depth-6-face)\n     )\n    ))\n\n(setq highlight-indent-guides-highlighter-function 'my-highlight-function)\n\n(require 'async-completing-read)\n(setq acr-refresh-completion-ui 'consult-vertico--refresh)\n(defun my-find-file-in-directory (directory)\n  \"Finds file in DIRECTORY recursively\"\n  (interactive `(,default-directory))\n  (let*(\n        (shell \"bash\")\n        (find (if (executable-find \"fd\")\n                  \"fd -tf -tl -c never -H -E .git -I --prune -L\"\n                \"find -type f -printf '%P\\n'\"))\n        (tramp-p (string-match-p \"\\/scp:\" directory))\n        (command (if tramp-p\n                     find\n                   (format \"cd %s; %s\" directory find)))\n        (display-directory (if (and (not tramp-p) (string-match-p (getenv \"HOME\") directory))\n                               (replace-regexp-in-string \"/\\./$\" \"\"\n                                                         (format \"~/%s\" (file-relative-name directory (getenv \"HOME\"))))\n                             directory))\n        (file\n         (async-completing-read (format \"Find file (%s): \" display-directory ) (acr-lines-from-process shell \"-c\" command)\n                                (lambda (x) (not (string-match-p  \"\\*async-completing-read\\*\" x))))))\n    (when file\n      (if tramp-p\n          (find-file (expand-file-name file directory))\n        (find-file (expand-file-name file))))))\n\n(define-generic-mode 'xmodmap-mode\n  '(?!)\n  '(\"add\" \"clear\" \"keycode\" \"keysym\" \"pointer\" \"remove\")\n  nil\n  '(\"[xX]modmap\\\\(rc\\\\)?\\\\'\")\n  nil\n  \"Simple mode for xmodmap files.\")\n\n(add-hook! 'xmodmap-mode-hook 'display-line-numbers-mode)\n(add-hook! 'c-mode-hook (lambda () (c-toggle-comment-style -1)))\n(add-hook! magit-post-refresh-hook 'forge-pull)\n\n(defun my-lookup-password (&rest keys)\n  (auth-source-forget-all-cached)\n  (let ((result (apply #'auth-source-search keys)))\n    (if result\n        (funcall (plist-get (car result) :secret))\n      result)))\n\n(setq smudge-oauth2-callback-port \"3725\")\n(defun my-start-smudge ()\n  (interactive)\n  (require 'smudge)\n  (unless (my-is-service-active-p \"spotifyd\")\n    (my-reload-spotifyd))\n  (setq smudge-oauth2-client-secret (my-lookup-password :host \"api.spotify.com\"))\n  (setq smudge-oauth2-client-id (my-lookup-password :host \"id.spotify.com\"))\n  (global-smudge-remote-mode)\n  )\n\n(defun my-pause-music-start-again (time)\n  (interactive '(\"2 min\"))\n  (unless (featurep 'smudge)\n    (my-start-smudge))\n  (smudge-api-pause)\n  (run-at-time time nil #'smudge-api-play)\n  )\n\n(defun my-reload-spotifyd ()\n  (interactive)\n  (shell-command \"systemctl reload-or-restart --user spotifyd\"))\n\n(defun my-smudge-set-volume (volume)\n  (interactive `(,(read-string \"Volume: \" nil)))\n\n  (if (stringp volume)\n      (setq volume (string-to-number volume)))\n\n  (when (and  smudge-selected-device-id (<= volume 100) (>= volume 0) )\n    (smudge-api-set-volume smudge-selected-device-id volume))\n  )\n\n(defun my-is-service-active-p (service &optional root)\n  \"Return t if SERVICE is active. use --user if ROOT is nil\"\n  (let ((active (s-trim\n                 (shell-command-to-string\n                  (format \"systemctl is-active %s %s\" (if root \"\" \"--user\") service)))))\n    (string= active \"active\")))\n\n(defun my-open-man (page)\n  (interactive `(,(read-string \"Man: \" nil)))\n  (man page))\n\n\n(after! web-mode\n  (defun +web/indent-or-yas-or-emmet-expand ()\n    \"Just run (+copilot/tab)\"\n    (interactive)\n    (+copilot/tab)\n    ))\n\n\n(defun my-setup-tcp-server ()\n  (interactive)\n  (setq   server-use-tcp t\n          server-host \"127.0.0.1\"\n          server-port 6666\n          server-auth-dir \"~/.emacs.d/server\"\n          server-auth-key \"1234\"\n          )\n  )\n\n(defun my-chmod-this-file ( mode )\n  (interactive `(,(read-string \"File Mode: \" nil)))\n  (if (and (buffer-file-name) (file-exists-p (buffer-file-name)))\n      (shell-command (format \"chmod %s %s\" mode (buffer-file-name)))\n    (message \"Buffer has no file.\")\n    )\n  )\n\n(add-hook! 'lsp-mode-hook '(lambda ()\n                             (add-to-list 'lsp-file-watch-ignored-directories \"[/\\\\\\\\]\\\\tmp\\\\'\")\n                             ))\n\n(add-hook! 'projectile-mode-hook '(lambda ()\n                                    (add-to-list 'projectile-globally-ignored-directories \"tmp\")\n                                    (add-to-list 'projectile-globally-ignored-directories \"vendor\")\n                                    (add-to-list 'projectile-globally-ignored-directories \"CMakeFiles\")\n                                    (add-to-list 'projectile-globally-ignored-directories \"build\")\n                                    ))\n\n(defun my-dap-debug-last()\n  (interactive)\n  (call-interactively '+make/run-last)\n  (call-interactively 'dap-debug-last)\n  ;; (call-interactively 'dap-hydra)\n  )\n\n(defun my-dap-debug ()\n  (interactive)\n  (call-interactively '+make/run)\n  (call-interactively 'dap-debug)\n  ;; (call-interactively 'dap-hydra)\n  )\n\n(use-package! dap-mode\n  :custom\n  ;; (sessions locals breakpoints expressions controls tooltip)\n  (dap-auto-configure-features '(locals controls tooltip))\n  )\n\n(with-eval-after-load 'lsp-mode\n  (add-to-list 'lsp-language-id-configuration\n               '(glsl-mode . \"glsl\"))\n  (lsp-register-client\n   (make-lsp-client :new-connection (lsp-stdio-connection '(\"glslls\" \"--stdin\"))\n                    :activation-fn (lsp-activate-on \"glsl\")\n                    :server-id 'glslls)))\n\n(use-package blamer\n  :bind ((\"s-i\" . blamer-show-commit-info))\n  :defer 20\n  :custom\n  (blamer-idle-time 1)\n  (blamer-min-offset 40)\n  (blamer-author-formatter \"  ✎ %s \")\n  (blamer-datetime-formatter \"[%s] \")\n  :custom-face\n  (blamer-face ((t :foreground \"#805d96\"\n                   :background nil\n                   :height 80\n                   :italic t)))\n  :config\n  (global-blamer-mode 1))\n\n\n(defun my-poshandler (info)\n  ;; (cons x y)\n  (cons\n   (/ (- (plist-get info :parent-frame-width) (plist-get info :posframe-width)) 2) ;x\n   25 ; y\n   )\n  )\n\n(use-package! vertico-posframe\n  :after vertico\n  :config\n  (setq vertico-posframe-parameters\n        '((left-fringe . 10)\n          (right-fringe . 10)\n          ))\n  (setq vertico-posframe-width 110)\n  (setq vertico-posframe-poshandler 'my-poshandler)\n  )\n(add-hook! 'my-new-gui-frame-hook 'vertico-posframe-mode)\n\n(use-package! which-key-posframe\n  :config\n  (setq which-key-posframe-poshandler 'my-poshandler)\n  (setq which-key-posframe-parameters\n        '((left-fringe . 20)\n          (right-fringe . 20))))\n\n(add-hook! 'my-new-gui-frame-hook 'which-key-posframe-mode)\n\n(defun my-load-read-string()\n  (load! \"read-string.el\" doom-user-dir)\n  )\n\n(add-hook! 'my-new-gui-frame-hook 'my-load-read-string)\n\n(defun my-find-major-mode-for-file (filename)\n  \"Find the major mode associated with the given file name.\"\n  (let ((alist auto-mode-alist)\n        (mode nil))\n    (while (and alist (not mode))\n      (if (string-match (caar alist) filename)\n          (setq mode (cdar alist))\n        (setq alist (cdr alist))))\n    mode))\n\n(defun my-dired-posframe-highlight()\n  (let* ((file (dired-get-filename nil t))\n         (themode (my-find-major-mode-for-file (file-name-nondirectory file)))\n         )\n    (if (file-directory-p file)\n        (setq themode 'dired-mode))\n    (with-current-buffer (get-buffer  dired-posframe-buffer)\n      (if (not (eq themode nil))\n          (progn\n            (funcall themode)\n            ( goto-char (point-min))\n            (read-only-mode -1)\n            (insert (format \"%s %s %s\\n\" comment-start (file-name-nondirectory file) comment-end))\n            )\n        )\n      )\n    )\n  )\n\n(after! dired-posframe\n  :config\n  (setq dired-posframe-width 65)\n  (setq dired-posframe-height 25)\n  (setq dired-posframe-min-height nil)\n  (setq dired-posframe-min-width nil)\n  (setq dired-posframe-parameters\n        '((left-fringe . 10)\n          (right-fringe . 10)\n          ))\n  (advice-add 'dired-posframe--show :after 'my-dired-posframe-highlight)\n  (advice-add 'keyboard-quit :before 'posframe-delete-all)\n  (fset 'dired-posframe--hide 'ignore)\n  )\n\n(defun my-dired-posframe-scroll-down()\n  (interactive)\n  (with-current-buffer (get-buffer  dired-posframe-buffer)\n    (read-only-mode -1)\n    (goto-char (point-min))\n    ;; copy first line\n    (let ((line (buffer-substring-no-properties (point) (line-end-position))))\n      (delete-region (point) (line-end-position))\n      (delete-char 1)\n      (goto-char (point-max))\n      (insert (format \"%s\\n\" line))\n      )\n    )\n  )\n\n(defun my-dired-posframe-scroll-up()\n  (interactive)\n  (with-current-buffer (get-buffer  dired-posframe-buffer)\n    (read-only-mode -1)\n    (goto-char (point-max))\n    ;; copy last line\n    (let ((line (buffer-substring-no-properties (line-beginning-position) (point))))\n      (delete-region (line-beginning-position) (point))\n      (delete-char -1)\n      (goto-char (point-min))\n      (insert (format \"%s\\n\" line))\n      )\n    )\n  )\n\n(defun my-dired-navigate-into ()\n  \"Open directory in same dired buffer. Open file in new buffer\"\n  (interactive)\n  (let (\n        (file (dired-get-filename nil t)))\n    (if (file-directory-p file)\n        (dired-find-alternate-file)\n      (dired-find-file)\n      )\n    )\n  )\n\n(evil-define-command my-evil-chmod (mode)\n  (interactive \"<a>\")\n  (my-chmod-this-file mode)\n  )\n\n(evil-ex-define-cmd \"chmod\" 'my-evil-chmod)\n(evil-ex-define-cmd \"sr\" 'projectile-replace-regexp)\n\n(setq copilot-log-max nil)\n\n(defun say-hello ()\n      (message \"hello world\")\n      )\n\n(say-hello)\n\n" :tabSize 8 :indentSize 8 :insertSpaces t :path "/home/gibi/.dotfiles/home/.doom.d/config.el" :uri "file:///home/gibi/.dotfiles/home/.doom.d/config.el" :relativePath "home/.doom.d/config.el" :languageId "emacs-lisp" :position
                      (:line 785 :character 10))))

edit: Either that or the server responds with no completions

[server-notification] Fri Mar 10 17:17:42 2023:
(:jsonrpc "2.0" :method "LogMessage" :params
          (:level 1 :message "[INFO] [ghostText] [2023-03-10T16:17:42.621Z] Cancelled by contextual filter" :metadataStr "[INFO] [ghostText] [2023-03-10T16:17:42.621Z]" :extra
                  ["Cancelled by contextual filter"]))
[server-reply] (id:77) Fri Mar 10 17:17:42 2023:
(:jsonrpc "2.0" :id 77 :result
          (:completions
           []))
github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

Ghibranalj commented 1 year ago

I havent tried the newest commit yet. Ill give update once i do

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] commented 1 year ago

This issue was closed because it has been stalled for 5 days with no activity.