emacs完成或IntelliSense与Visual Studio相同 [英] emacs completions or IntelliSense the same as on Visual Studio

查看:192
本文介绍了emacs完成或IntelliSense与Visual Studio相同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

emacs 22.2.1在Linux上

emacs 22.2.1 on Linux

我正在使用emacs进行一些C / C ++编程。我想知道emacs支持完成(Visual Studio中的IntelliSense)。

I am doing some C/C++ programming using emacs. I am wondering does emacs support completions (IntelliSense in Visual Studio).

例如,当填写结构时,我想看到成员列表,当我键入点运算符或箭头运算符。

For example when filling structures I would like to see the list of members when I type the dot operator or arrow operator.

同样的功能签名将会给我我传递的类型将显示。

The same would go for function signatures that give me the types I am passing would display.

推荐答案

我正在使用cedet与emacs。我尝试在Debian中使用cedet版本,但它有一些错误,所以我卸载了,并从 http下载cvs版本://sourceforge.net/projects/cedet/develop

I am using cedet with emacs. I tried using the cedet version in Debian but it has some bugs so I uninstalled that and downloaded the cvs version from http://sourceforge.net/projects/cedet/develop

我将其编译到我的〜/ tmp / emacs-stuff /目录中,然后添加以下内容行到我的〜/ .emacs.d / custom.el文件:

I compiled it in my ~/tmp/emacs-stuff/ directory and then added the following lines to my ~/.emacs.d/custom.el file:



;;needed if cedet is in a custom location
(load-file "~/tmp/emacs-stuff/cedet/common/cedet.el")

;; Enable EDE (Project Management) features
(global-ede-mode t)

;;to enable code folding
(global-semantic-tag-folding-mode)

;; Enabling Semantic (code parsing, smart completion) features
;; (select only one)
;;(semantic-load-enable-minimum-features)
;;(semantic-load-enable-code-helpers)
(semantic-load-enable-gaudy-code-helpers)
;;(semantic-load-enable-all-exuberent-ctags-support)

(global-semantic-idle-scheduler-mode 1) ;The idle scheduler with automatically reparse buffers in idle time.
(global-semantic-idle-completions-mode 1) ;Display a tooltip with a list of possible completions near the cursor.
(global-semantic-idle-summary-mode 1) ;Display a tag summary of the lexical token under the cursor.

;;to work with my include files and cedet
(semantic-add-system-include "~/include" 'c++-mode)
(semantic-add-system-include "~/include" 'c-mode)


;;To use additional features for names completion, and displaying of information for tags & classes,
;; you also need to load the semantic-ia package. This could be performed with following command:
(require 'semantic-ia)

;;to work with systme include files and gcc
(require 'semantic-gcc)


;;integrate semantic with Imenu
(defun my-semantic-hook ()
  (imenu-add-to-menubar "TAGS"))
(add-hook 'semantic-init-hooks 'my-semantic-hook)

;;load Semanticdb
(require 'semanticdb)
;;(global-semanticdb-minor-mode 1)

;;working with tags
;; gnu global support
(require 'semanticdb-global)
(semanticdb-enable-gnu-global-databases 'c-mode)
(semanticdb-enable-gnu-global-databases 'c++-mode)

;; ctags
(require 'semanticdb-ectag)
(semantic-load-enable-primary-exuberent-ctags-support)

(defun my-semantic-hook ()
  (imenu-add-to-menubar "TAGS"))
(add-hook 'semantic-init-hooks 'my-semantic-hook)






此文件由我的〜/ .emacs文件调用,其中的以下行:
(加载文件〜/ .emacs.d / custom.el)


This file gets called by my ~/.emacs file which the following line in it: (load-file "~/.emacs.d/custom.el")

当您输入变量并按CTRL + SHIFT + ENTER时,选择菜单将提出建议。

Now when you are typing a variable and press CTRL+SHIFT+ENTER, a menu of selections will come up with suggestions.

此外,如果您设置了语义完整内联分析器 - 空闲显示器类变量来引用语义显示 - 工具提示,具有建议的工具提示也会在空闲时间(1或2秒)后出现。

Further, if you have set semantic-complete-inline-analyzer-idle-displayor-class variable to quote semantic-displayor-tooltip, a tooltip with suggestions will also come up after some idle time (1 or 2 seconds).

对于一些简短的介绍,请参阅 http://xtalk.msk.su/~ott/en/writings/emacs-devenv/ EmacsCedet.html

For some short intro, see http://xtalk.msk.su/~ott/en/writings/emacs-devenv/EmacsCedet.html

对于Cedet文档,请参阅: http://cedet.sourceforge.net/

For Cedet docs, see: http://cedet.sourceforge.net/

祝你好运。

这篇关于emacs完成或IntelliSense与Visual Studio相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆