问题描述
在Linux上的emacs 22.2.1
我正在使用emacs进行一些C / C ++编程。我想知道emacs是否支持完成(Visual Studio中的IntelliSense)。
例如,当填充结构时,我想看到成员列表,当我键入点运算符或
同样的,函数签名会给我传递的类型。
我使用cedet与emacs。我尝试在Debian使用cedet版本,但它有一些错误,所以我卸载,并从
我在〜/ tmp / emacs-stuff /目录中编译它,然后添加以下行到我的〜/ .emacs.d / custom.el文件:
;;如果cedet在自定义位置则需要
(加载文件〜/ tmp / emacs-stuff / cedet / common / cedet.el )
;;启用EDE(项目管理)功能
(global-ede-mode t)
;;启用代码折叠
(全局语义标记折叠模式)
;;启用语义(代码解析,智能完成)特性
;; (仅选择一个)
;;(semantic-load-enable-minimum-features)
;;(semantic-load-enable-code-helpers)
(semantic-load-
$ b(全局语义空闲调度程序模式1);空闲(全局语义空闲调度程序模式1);
;;(semantic-load-enable-all-exuberent-ctags-调度器在空闲时间自动重新缓冲缓冲区。
(global-semantic-idle-completions-mode 1);显示一个带有光标附近可能完成列表的工具提示。
(global-semantic-idle-summary-mode 1);显示光标下的词汇令牌的标签摘要。
;;使用我的包含文件和cedet
(semantic-add-system-include〜/ include'c ++ - mode)
(semantic-add- -include〜/ include'c-mode)
;;使用额外的功能来完成名称和显示标签和类的信息,
;;您还需要加载semantic-ia包。这可以用以下命令执行:
(require'semantic-ia)
;;使用systme包含文件和gcc
(require'semantic-gcc)
;;整合语义与Imenu
(defun my-semantic-hook()
(imenu-add-to-menubarTAGS))
(add-hook'semantic-init-hooks'my-semantic-hook)
;;加载语义db
(require'semanticdb)
;; -mode 1)
;;使用标签
;; gnu全局支持
(需要语义db-global)
(semanticdb-enable-gnu-global-databases'c-mode)
(semanticdb-enable-gnu-global-databases'模式)
;; ctags
(require'semanticdb-ectag)
(semantic-load-enable-primary-exuberent-ctags-support)
(defun my-semantic-hook $ b(imenu-add-to-menubarTAGS))
(add-hook'semantic-init-hooks'my-semantic-hook)
这个文件被我的〜/ .emacs文件调用
(加载文件〜/ .emacs.d / custom.el)
现在当你键入一个变量和按CTRL + SHIFT + ENTER,选择菜单将显示建议。
此外,如果您已设置semantic-complete-inline-analyzer-idle-displayor-类变量引用semantic-displayor-tooltip,一个带有建议的工具提示也会在一些空闲时间(1或2秒)后出现。
有关Cedet文档,请参阅:
祝你好运。
emacs 22.2.1 on Linux
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.
解决方案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
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)
This file gets called by my ~/.emacs file which the following line in it:(load-file "~/.emacs.d/custom.el")
Now when you are typing a variable and press CTRL+SHIFT+ENTER, a menu of selections will come up with suggestions.
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).
For some short intro, see http://xtalk.msk.su/~ott/en/writings/emacs-devenv/EmacsCedet.html
For Cedet docs, see: http://cedet.sourceforge.net/
Good luck.
这篇关于emacs完成或IntelliSense与Visual Studio相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!