Andersbakken / rtags

A client/server indexer for c/c++/objc[++] with integration for Emacs based on clang.
http://www.rtags.net
GNU General Public License v3.0
1.82k stars 253 forks source link

Using tab to open files via helm results in flycheck timeout error #1020

Open sbroberg opened 6 years ago

sbroberg commented 6 years ago

Please mark appropriate

Problem description

When using helm to navigate the results of an rtags search (e.g., rtags-find-references-at-point), if I press on a search result line, the file opens normally. However, if I press (which opens the file, highlights the relevant line, and leaves the search results window open), I get the following error:

Error running timer ‘flycheck-buffer’: (user-error "Flycheck mode disabled") It's unclear whether flycheck is actually disabled at this point; since the buffer in question is not really open for editing (it disappears when you close the search results window), I'm assuming that this is occurring because it is read-only. Pressing on the line subsequently results in a buffer that appears to have flycheck enabled, although I'm not certain, since my configuration reloads a file upon saving, and I am relying on rtags checking upon save.

Expected behavior

No error

Actual behavior

The error appears

Environment

;;; package --- Summary ;;; Commentary: ;;; Code:

(if (or (eq system-type 'gnu/linux) (eq system-type 'darwin))
    (progn (defvar rtags-autostart-diagnostics)
           (defvar rtags-completions-enabled)
           (defvar company-backends)
           (defvar c-mode-base-map)
           (defvar rtags-use-helm)
           (defvar rtags-display-result-backend)
           (defvar rtags-enable-unsaved-reparsing)
           (defvar flycheck-highlighting-mode)
           (defvar rtags-periodic-reparse-timeout)
           (defvar flycheck-check-syntax-automatically)

           (require 'helm-rtags)
           (rtags-enable-standard-keybindings)

           (setq rtags-autostart-diagnostics t)
           (rtags-diagnostics)
           (setq rtags-completions-enabled t)

           ;; company integration
           (require 'company)
           (push 'company-rtags company-backends)
           (global-company-mode)
           (delete 'company-backends 'company-clang)

           ;; nice keyboard shortcuts
           (define-key c-mode-base-map (kbd "<M-tab>")
             (function company-complete))
           (define-key c-mode-base-map (kbd "M-.")
             (function rtags-find-symbol-at-point))
           (define-key c-mode-base-map (kbd "M-,")
             (function rtags-find-references-at-point))
           (define-key c-mode-base-map (kbd "<s-right>")
             (function rtags-location-stack-forward))
           (define-key c-mode-base-map (kbd "<s-left>")
             (function rtags-location-stack-back))

           (when (require 'helm nil :noerror)
             (setq rtags-use-helm t)
             )

           ;; flycheck integration
           (require 'flycheck)

           ;; helm integration
           (setq rtags-display-result-backend 'helm)

           (require 'flycheck-rtags)
           (defun my-flycheck-rtags-setup ()
             "Flycheck integration."
             (interactive)
             (flycheck-select-checker 'rtags)
             ;; RTags creates more accurate overlays.
             (setq-local flycheck-highlighting-mode nil)
             (setq-local flycheck-check-syntax-automatically nil)

             (setq-local rtags-periodic-reparse-timeout 10)
             (setq rtags-enable-unsaved-reparsing t)

             )
           ;; c-mode-common-hook is also called by c++-mode
           (add-hook 'c-mode-common-hook #'my-flycheck-rtags-setup)
           ))
Andersbakken commented 6 years ago

I'm not able to reproduce this. I don't normally use helm so I copied your setup for my test. I'm assuming you meant pressing tab here:

However, if I press (which opens the file, highlights the relevant line, and leaves the search results window open),

I only get a submenu saying:

[f1] Select [f2] Select other window

when I do that.

bradprob commented 6 years ago

The same error with ivy (no helm). This is the configuration: `(require 'company) (global-company-mode) (require 'rtags) (cmake-ide-setup)

(defun config-rtags () "configuration of rtags"

(require 'company-rtags) (setq rtags-autostart-diagnostics t) (setq rtags-completions-enabled t) (push 'company-rtags company-backends)

(require 'flycheck) (require 'flycheck-rtags) (flycheck-select-checker 'rtags) (setq-local flycheck-highlighting-mode nil) (setq-local flycheck-check-syntax-automatically nil)

(setq rtags-display-result-backend 'ivy)

(require 'yasnippet) (yas-reload-all)

(require 'doxymacs) (doxymacs-mode 1)

(fci-mode 1)

(yas-minor-mode 1)

(hs-minor-mode 1)

(require 'clang-format) (setq clang-format-style "Mozilla")

(local-set-key (kbd "C-c r .") #'rtags-find-symbol-at-point) (local-set-key (kbd "C-c r r") #'rtags-find-references-at-point) (local-set-key (kbd "C-c r R") #'rtags-rename-symbol) (local-set-key (kbd "C-c r <") #'rtags-find-references) (local-set-key (kbd "C-c r >") #'rtags-find-symbol) (local-set-key (kbd "C-c r ;") #'rtags-find-file) (local-set-key (kbd "C-c r [") #'rtags-location-stack-back) (local-set-key (kbd "C-c r ]") #'rtags-location-stack-forward) (local-set-key (kbd "C-c c c") #'cmake-ide-compile) (local-set-key (kbd "C-c x c") #'xah-lookup-cppreference) (local-set-key (kbd "C-c x b") #'xah-lookup-boost) (local-set-key (kbd "C-c f b") #'clang-format-buffer) )

(add-hook 'c-mode-hook #'config-rtags) (add-hook 'c++-mode-hook #'config-rtags) `