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.83k stars 252 forks source link

Integrate rtags with flycheck instead of flymake #324

Closed ddovod closed 8 years ago

ddovod commented 9 years ago

http://www.flycheck.org/

Flycheck is more fresh and maintained tool than flymake. It will be great to have rtags as a flycheck backend

Andersbakken commented 9 years ago

We're actually doing our own overlays currently (e.g. no flymake integration) but flycheck integration sounds like a good idea. Do you have any experience with writing backends for flycheck?

Anders

On Sun, Mar 29, 2015 at 3:22 PM, ddovod notifications@github.com wrote:

http://www.flycheck.org/

Flycheck is more fresh and maintained tool than flymake. It will be great to have rtags as a flycheck backend

— Reply to this email directly or view it on GitHub https://github.com/Andersbakken/rtags/issues/324.

ddovod commented 9 years ago

Unfortunately I'm not experienced in elisp, so i do not have any experience with writing backends for flycheck

Hylen commented 8 years ago

I'm willing to do this, when I get time for it. A flycheck integration with RTags could be really neat. I have no experience with flycheck other than using it, so it might take me a while though.

Andersbakken commented 8 years ago

Sure, give it a go. I haven't looked into it but it's probably not that hard.

Anders

On Sun, Oct 4, 2015 at 10:40 AM, Karl Hylen notifications@github.com wrote:

I'm willing to do this, when I get time for it. A flycheck integration with RTags could be really neat. I have no experience with flycheck other than using it, so it might take me a while though.

— Reply to this email directly or view it on GitHub https://github.com/Andersbakken/rtags/issues/324#issuecomment-145368485.

cocreature commented 8 years ago

FTR, I have a very crappy implementation. I probably won’t clean it up and finish it anytime soon but if anybody else wants to do so go for it!

(use-package flycheck
    :config
    (eval '(defun flycheck-rtags-start (checker callback)
             (let ((buffer (current-buffer))
                   (mychecker checker)
                   (diagnostics-buffer (get-buffer-create "*rtags-diagnostics*")))
               (setq lexical-binding t)
               (message (format "%s" checker))
               (setq rtags-diagnostics-process (start-file-process "RTags Diagnostics flycheck" diagnostics-buffer "rc" "-m" "--elisp"))
               (set-process-filter
                rtags-diagnostics-process
                (lambda (process output)
                  (message (format "%s" (type-of output)))
                  (let ((parsed-output (cdadr (eval (read output)))))
                    (message (format "%s" parsed-output))
                    (let ((errors (-map (lambda (e) (flycheck-rtags-parse-error checker buffer e)) parsed-output)))
                      (funcall callback 'finished (delq nil errors))))))
               (set-process-query-on-exit-flag rtags-diagnostics-process nil))) t)

    (defun flycheck-rtags-parse-error (checker buffer input)
      (let ((line (cadr input))
            (column (caddr input))
            (level (car (cddddr input)))
            (message (cadr (cddddr input))))
        (when level
          (flycheck-error-new-at line column level message
                                 :checker checker
                                 :buffer buffer
                                 :filename (buffer-file-name buffer)))))
    (flycheck-define-generic-checker 'flycheck-rtags
      "flycheck rtags"
      :start 'flycheck-rtags-start
      :modes '(c++-mode c-mode)))

Ignore the eval and use-package stuff, I needed lexical bindings for this and that was the easiest way to get this. I just copied it from my config.

casch-at commented 8 years ago

Initial implementation has been added, however, it is far from perfect yet. https://github.com/Andersbakken/rtags/commit/62e0391bc8d91820503de3575f9811f33e1848b1

Closing this issue now

regards, Christian