Emacs/CEDET.多个项目和代码完成 [英] Emacs/CEDET. Multiple projects and code completion

查看:29
本文介绍了Emacs/CEDET.多个项目和代码完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 CEDET 1.0 和 ECB 2.40 设置了 emacs 23.1.50.1(受到 http://github.com/alexott/emacs-configs/blob/master/rc/emacs-rc-cedet.el 和他的温柔介绍到 Cedet ( http://alexott.net/en/writings/emacs-devenv/EmacsCedet.html ),谢谢亚历克斯).它工作得很好,但我需要更多地了解在处理多个项目时如何处理代码完成和符号引用.

I've setup emacs 23.1.50.1 with CEDET 1.0 and ECB 2.40 (heavily inspired by Alex Otts setup at http://github.com/alexott/emacs-configs/blob/master/rc/emacs-rc-cedet.el and his gentle introduction to Cedet ( http://alexott.net/en/writings/emacs-devenv/EmacsCedet.html ), thanks Alex). It works quite well, but I need more understanding about how code-completion and symbol-references are handled when working with multiple projects.

我创建了一个简单的 ede 项目,如下所示:

I've created a simple ede project like this:

(ede-cpp-root-project "test"
                      :file "~/src/sw/anchor"
                      :include-path '("/Common")
                      :system-include-path '("~/include"))

当这个项目被加载时,Semantic 会不会只在项目配置中指定的各个目录中寻找补全?

When this project is loaded, will Semantic only look for completions in the various directories specified in the project configurations?

我关注了http://mmmyddd.freeshell.net/blog/Computer/Emacs/usecscopesemanticdbbackend 使用cscope 作为semanticdb 的后端.我可以运行semanticdb-enable-cscope-in​​-buffer,而emacs 不会抛出任何错误,但我不知道semantic 是否使用了我的数据库.我是否也可以在我的项目定义中添加对 cscope.out 的引用,以便更好地控制在当前上下文中搜索哪些文件?

I followed http://mmmyddd.freeshell.net/blog/Computer/Emacs/usecscopesemanticdbbackend to use cscope as backend for semanticdb. I can run semanticdb-enable-cscope-in-buffer without emacs throwing any errors, but I have no idea if semantic uses my database. Can I add a reference to a cscope.out in my project-definition as well, to have more control over which files to search for references in my current context?

一些奇怪的事情:

当我尝试打开一个新的源文件时,出现错误应用:正在搜索程序:没有这样的文件或目录,全局",但没有任何反应.如果我再次尝试打开它,一切都很好.

When I try to open a new source file I get the error "apply: Searching for program: no such file or directory, global" and nothing happens. If I try to open it again, everything is fine.

当我尝试通过指向锚文件加载项目时,出现此错误:如果:错误类型参数:class-p,ede-cpp-root"

When I try to load a project by pointing at the anchor file, I get this error: "if: Wrong type argument: class-p, ede-cpp-root"

推荐答案

当您的配置出现错误时,最好的做法是:

When you get errors in your configuration, the best thing to do is:

M-x toggle-debug-on-error RET

并获取将指向问题区域的堆栈跟踪.通常这有助于识别配置问题.

and get the stack trace which will point at the problem area. Often times that is helpful in identifying the configuration issue.

CEDET 将尝试将每个文件与单个项目相关联,并且在该缓冲区中操作的所有命令都将限制在该项目的范围内.对于CScope的支持,它也会使用EDE来识别根目录,这将有助于找到cscope.out文件,这与补全工具和参考工具都有关系.

CEDET will try to associate every file with a single project, and all the commands that operate in that buffer will be restricted to the bounds of that project. For the CScope support, it too will use EDE to identify the root directory, and that will help find the cscope.out file, and that is related to both the completion and reference tools.

当然,例外是系统包含路径,它通常是/usr/include 或其他什么.这是对使用 GCC 支持计算的默认系统包含路径的增强.在您的 C 文件之一中,您可以执行以下操作:

The exception, of course, is the system include path which is usually /usr/include or whatever. This is an augmentation to the default system include path which is calculated with the GCC support. In one of your C files you can do:

M-x semantic-c-describe-environment RET

这应该表明 Semantic 将尝试使用什么.

and that should show what Semantic will try to use.

要仔细检查 CScope 是否用于代码完成,您可以检查:

To double check if CScope is being used for code completion, you can check with:

M-x semanticdb-find-test-translate-path RET

并检查列表末尾是否有一些 CScope 内容.

and check the end of the list for some CScope thing.

这篇关于Emacs/CEDET.多个项目和代码完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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