如何使RSENSE自动完成并跳转到Rails项目的定义是什么? [英] How to make RSense autocomplete and jump to definitions of a rails project?

查看:202
本文介绍了如何使RSENSE自动完成并跳转到Rails项目的定义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从NetBeans中emacs的交换和我pretty高兴的变化。我错过最多的东西是自动完成,并跳转到定​​义。为了得到这一点,我已经安装了RSENSE的。它工作正常的宝石code,不过,据我所定义的方法,我不能跳对我的定义Rails项目也不是自动完成的。

I switched from netbeans to emacs and I am pretty happy with the change. The thing I am missing the most is autocompletion and jump to definitions. In order to get this I have installed Rsense. It works fine for the gems code, though, I cannot jump-to-definitions of my Rails project nor autocomplete according to the methods I defined.

我想我的项目的负载路径添加到RSENSE的的LOAD_PATH配置,但是,它仍然不能正常工作。

I tried to add my project's load path to Rsense's load_path configuration, though, it still doesn't work.

有谁知道如何得到这个工作?

Does anyone know how to get this working?

推荐答案

您可以使用标签,通过文件浏览并直接跳转到函数定义。
我用旺盛Ctags的(它得到了Ruby支持)。您可以从 rel=\"nofollow\">下载。

You can use tags for browsing through files and jumping directly to function definitions. I use Exuberant Ctags (its got Ruby support). You can download it from here.

我假设你在Windows上运行。获取代码,以便在窗口最初的工作是特别是如果你使用emacs首次疼痛。

I am assuming that you are working on windows. Getting the tags to work initially on windows is a pain especially if you are using emacs for the first time.

以上是我遵循的步骤:


  1. 从这里 安装Cygwin。

  2. 包括在你的环境变量 PATH 的cygwin的\\斌\\文件夹中。例如。 这里

  3. 安装exhuberant CTAGS。需要注意的是emacs的某个时候可能有一个内置的ctags。后来,你将不得不使用的ctags 命令Cygwin中创建标签。在那个时候,你可能会遇到的情况下,它使用的ctags在Emacs,而不是旺盛CT​​AG的一些错误。

  4. 一旦你已经安装的ctags,添加到环境变量 PATH 以及

  5. 如果你有相对较少数量的文件(小于500),一个小型项目。所以,你只需要一个单一的全球标签文件。对于开放的cygwin,在命令将目录更改为您的项目和类型的根目录的ctags -R -e 检查了这一点其他的办法

  6. 您的标记文件将被创建。它将被命名为标签,将在你的项目的根目录present。

  7. 接下来打开的Emacs,并通过code浏览。如果你遇到一个函数,要跳转到它的定义,把你的光标放在函数名和preSS M - 那么你的小缓冲区应该显示类似查找标签(默认<作用-名称>): preSS输入,瞧!你神游到函数定义!
    注意:您可能需要指定标签文件使用 M上的第一次 - 这需要经过emacs的启动只需要做一次。您还可以修改您的.emacs文件采取在标签上自动启动文件。

  1. Install Cygwin from here.
  2. Include the cygwin\bin\ folder in your environment variable PATH. E.g. here
  3. Install exhuberant ctags. Note that emacs may sometime have a built in ctags. Later on you will have to use the ctags command in cygwin to create tags. At that time you may encounter some errors in case it uses the ctags in emacs instead of exuberant ctag.
  4. Once you have installed ctags, add that to the environmental variable PATH as well.
  5. If you have a small project with relatively lesser number of files (<500). So you just need a single global TAGS file. For that open cygwin, change your directory to the root directory of your project and type in the command ctags -R -e Check this out for other approaches
  6. Your tags file will be created. It will be named "TAGS" and will be present in the root directory of your project.
  7. Next open emacs, and browse through the code. In case you come across a function and want to jump to its definition, put your cursor on the function name and press M-. your minibuffer should then show something like Find tag (default <function-name>): Press Enter and voila!!! you are magically transported to the function definition!!! Note: You may have to specify the TAGS file the first time you use the M-. This needs to be done only once after emacs startup. You can also modify your .emacs file to take in the TAGS file automatically on startup.

请参阅获取更多信息的相关标签在Emacs命令。

Refer to this and this for more info for tags related commands in emacs.

这篇关于如何使RSENSE自动完成并跳转到Rails项目的定义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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