【问题标题】:emacs completions or IntelliSense the same as on Visual Studioemacs 完成或 IntelliSense 与 Visual Studio 上的相同
【发布时间】:2010-12-11 07:08:27
【问题描述】:

Linux 上的 emacs 22.2.1

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

例如,在填充结构时,我希望在键入点运算符或箭头运算符时查看成员列表。

对于给我传递的类型的函数签名也是如此。

【问题讨论】:

标签: c++ visual-studio emacs intellisense


【解决方案1】:

我的 .emacs 中有这个,这让事情变得更容易了。

(需要'c-eldoc) (add-hook 'c-mode-hook 'c-turn-on-eldoc-mode)

这样,我就不用查找函数定义了。

我写的不多,但我同意 TAGS 也是一个非常有用的功能。

【讨论】:

    【解决方案2】:

    如果您想使用股票 emacs 来完成您的项目和库包含文件,请尝试 this answer

    【讨论】:

      【解决方案3】:

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

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


      
      
      ;;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”)

      现在,当您键入变量并按 CTRL+SHIFT+ENTER 时,将出现一个选择菜单,其中包含建议。

      此外,如果您已将 semantic-complete-inline-analyzer-idle-displayor-class 变量设置为引用 semantic-displayor-tooltip,则在一段空闲时间(1 或 2 秒)后也会出现带有建议的工具提示。

      有关简短介绍,请参阅http://xtalk.msk.su/~ott/en/writings/emacs-devenv/EmacsCedet.html

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

      祝你好运。

      【讨论】:

        【解决方案4】:

        您需要获取最新版本的CEDET 软件包(更好,直接来自 CVS)。您可以按照本网站文档中的说明进行设置

        【讨论】:

        • 还有一些包(公司模式,自动完成),它们使用 CEDET 获取数据以完成,但实现不同(来自 CEDET)的完成样式
        【解决方案5】:

        Meta-/ 并不完全智能,但它确实会遍历已知名称。

        这个项目提供了你习惯的下拉式菜单:

        http://ecb.sourceforge.net/

        【讨论】:

        • +1 表示 Meta+/。它并不聪明,但大部分时间都能胜任。
        【解决方案6】:

        我认为您正在寻找 etags。 http://tulrich.com/geekstuff/emacs.html

        搜索标签。

        【讨论】:

          猜你喜欢
          • 2021-02-27
          • 2016-09-23
          • 1970-01-01
          • 2018-04-12
          • 1970-01-01
          • 2017-01-08
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多