emacs24语义完成 [英] emacs24 semantic completion

查看:274
本文介绍了emacs24语义完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用emacs 24和其附带的cedet版本来完成语义完成。完成工作适用于我在自己的源文件中定义的类,但完成不适用于标准库或STL的东西这是我的emacs配置:

 code(需要'cedet)
(require'semantic)
(require'semantic / ia)
(require'semantic / bovine / gcc)
(semantic- add-system-include/usr/include/c++/4.6.3'c ++ - mode)
(setq semantic-default-submodes
'(global-semantic-idle-scheduler-mode
global-semanticdb-minor-mode
global-semantic-idle-summary-mode
全局语义空闲完成模式
全局语义高亮功能模式
全局语义装饰模式
全局语义Mru书签模式)
(setq semanticdb-default-save-directory〜/ .semanticdb /
semantic- complete-inline-analyzer-idle-displayor-class'semantic-displayor-ghost)
(语义模式t)

在我的〜/ .semanticdb目录中,我只看到!usr!in clude!c ++!4.6!x86_64-linux-gnu!bits!semantic.cache,甚至没有使用我在config中指定的版本。



当我在std :: list上尝试Mx语义分析可能的完成时,例如,我收到一条错误:找不到std ::列表



有关如何调试这个或如何修复它的任何建议?

解决方案

我正在安装一个新的Ubuntu 13.04在我的新的SSD,
,这是我的步骤来配置CEDET(我检查它为 std :: list )。



基本设置




  1. 获取一个新的 emacs ,并从源代码构建。
    这很简单,如



    ./ configure& amp;&制作&& sudo make install


  2. 添加到 .emacs
    (semantic-mode 1) p>


这是整个设置。



测试




  1. 运行emacs而不加载任何东西:



    emacs -q test.cc


  2. 输入代码



    #include< list>

      int main(){
    std :: list lst;
    lst。$
    return 0;
    }


  3. Mx 语义模式


  4. 指向 $ Mx < kbd> 语义ia-show-variants



疑难解答



如果东西不起作用,则可能是semanticdb已损坏。



只要找到它在哪里,对我来说 semanticdb-default-save-directory =〜/ .emacs.d / semanticdb,
并从中删除所有内容。



然后,当访问源文件时,调用语义强制刷新


I'm trying to get semantic completions working with emacs 24 and the version of cedet that comes with it. Completions work for classes I defined in my own source file, but completion isn't working for the standard library or STL stuff Here is my emacs config:

(require 'cedet)
(require 'semantic)
(require 'semantic/ia)
(require 'semantic/bovine/gcc)
(semantic-add-system-include "/usr/include/c++/4.6.3" 'c++-mode)
(setq semantic-default-submodes
      '(global-semantic-idle-scheduler-mode
        global-semanticdb-minor-mode
        global-semantic-idle-summary-mode
        global-semantic-idle-completions-mode
        global-semantic-highlight-func-mode
        global-semantic-decoration-mode
        global-semantic-mru-bookmark-mode))
(setq semanticdb-default-save-directory "~/.semanticdb/"
  semantic-complete-inline-analyzer-idle-displayor-class 'semantic-displayor-ghost)
(semantic-mode t)

In my ~/.semanticdb directory I only see "!usr!include!c++!4.6!x86_64-linux-gnu!bits!semantic.cache", which isn't even using the version I specified in the config.

When I try M-x semantic-analyze-possible-completions on a std::list, for example, I get an error saying: "Cannot find types for std::list"

Any suggestions for how to debug this or how to fix it?

解决方案

I was installing today a fresh Ubuntu 13.04 on my new SSD, and here are my steps to configure CEDET ( I checked that it gives completions for std::list).

Basic setup

  1. Get a fresh emacs and build it from source. It's as easy as

    ./configure && make && sudo make install

  2. Add to .emacs (semantic-mode 1)

That's the whole setup.

Testing

  1. Run emacs without loading anything:

    emacs -q test.cc

  2. Enter the code

    #include <list>

    int main() {
        std::list lst;
        lst.$
        return 0;
    }
    

  3. M-x semantic-mode

  4. with point at $, M-x semantic-ia-show-variants

Troubleshooting

If stuff doesn't work, it's likely that the semanticdb is corrupt.

Just find where it is, for me it's semanticdb-default-save-directory="~/.emacs.d/semanticdb", and remove everything from there.

Then, when visiting a source file, call semantic-force-refresh.

这篇关于emacs24语义完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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