Sarcasm / irony-mode

A C/C++ minor mode for Emacs powered by libclang
GNU General Public License v3.0
909 stars 99 forks source link

Irony server crashed when completion in Windows #287

Open wjnnb opened 8 years ago

wjnnb commented 8 years ago

I use Emacs 25.0.91.1 (x86_64-w64-mingw32) in Windows 7 64bit. My irony-mode and company-irony were installed from MELPA. The installation path of irony-server is H:\emacs\.emacs.d\irony\bin where I can find irony-server.exe and run it in console after installation. It seems well since I test it using -v H:\emacs\.emacs.d\irony\bin>irony-server.exe -v irony-server version 0.2.0-cvs4 clang version 3.9.0 (trunk) But when I triggered the completion, it crashed and my OS prompted

Problem signature:
  Problem Event Name:   APPCRASH
  Application Name: irony-server.exe
  Application Version:  0.0.0.0
  Application Timestamp:    56d6ebda
  Fault Module Name:    StackHash_68fd
  Fault Module Version: 6.1.7601.19018
  Fault Module Timestamp:   560a0083
  Exception Code:   c0000374
  Exception Offset: 00000000000bffc2
  OS Version:   6.1.7601.2.1.0.256.1
  Locale ID:    2052

in a message box. My configuration file is give as follows.

;;--------------------------------------------------------
;; =============
;; irony-mode
;; =============
(add-hook 'c++-mode-hook 'irony-mode)
(add-hook 'c-mode-hook 'irony-mode)
;; =============
;; company mode
;; =============
(add-hook 'c++-mode-hook 'company-mode)
(add-hook 'c-mode-hook 'company-mode)
(setq company-idle-delay 0)
(setq company-minimum-prefix-length 1)
;; replace the `completion-at-point' and `complete-symbol' bindings in
;; irony-mode's buffers by irony-mode's function
(defun my-irony-mode-hook ()
(define-key irony-mode-map [remap completion-at-point]
  'irony-completion-at-point-async)
(define-key irony-mode-map [remap complete-symbol]
  'irony-completion-at-point-async))
(add-hook 'irony-mode-hook 'my-irony-mode-hook)
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
(eval-after-load 'company
'(add-to-list 'company-backends 'company-irony))
;; (optional) adds CC special commands to `company-begin-commands' in order to
;; trigger completion at interesting places, such as after scope operator
;;     std::|
(add-hook 'irony-mode-hook 'company-irony-setup-begin-commands)
(setq w32-pipe-read-delay 0)

;; =============
;; eldoc-mode
;; =============
(add-hook 'irony-mode-hook 'irony-eldoc)
;; ==========================================
;; (optional) bind TAB for indent-or-complete
;; ==========================================
(defun irony--check-expansion ()
(save-excursion
  (if (looking-at "\\_>") t
    (backward-char 1)
    (if (looking-at "\\.") t
      (backward-char 1)
      (if (looking-at "->") t nil)))))
(defun irony--indent-or-complete ()
"Indent or Complete"
(interactive)
(cond ((and (not (use-region-p))
            (irony--check-expansion))
       (message "complete")
       (company-complete-common))
      (t
       (message "indent")
       (call-interactively 'c-indent-line-or-region))))
(defun irony-mode-keys ()
"Modify keymaps used by `irony-mode'."
(local-set-key (kbd "TAB") 'irony--indent-or-complete)
(local-set-key [tab] 'irony--indent-or-complete))
(add-hook 'c-mode-common-hook 'irony-mode-keys)
;;--------------------------------------------------------

BTW, sometimes the completion used to work well, but crashed after I modifyed some of my configuration. And I can't fix it even if I recovered my configuation.

Thanks.

3246251196 commented 8 years ago

I think to get an answer you would need to give a small reproducible example including the source code.

Also you can try to run irony server binary from command line with the complete argument with file and line number and see if it It provides a list of completions without the use of emacs at all.

wjnnb commented 8 years ago

Thanks, I have solved the problem by myself. I don't know the reason but I think it's really a complex thing. I fixed my PATH and some of my configuration files which were really wrong and I also recompiled the server using a 32bit LLVM. After that, it works well. Thanks.