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

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

问题描述

Linux 上的 emacs 22.2.1

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.

此外,如果您已设置semantic-complete-inline-analyzer-idle-displayor-class 变量来引用semantic-displayor-tooltip,则在一些空闲时间(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天全站免登陆