如何获得Elixir的可靠跳转定义? [英] How can I get reliable jump-to-definition for Elixir?

查看:63
本文介绍了如何获得Elixir的可靠跳转定义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了Jet Brains的Elixir插件,其中两个尝试了VS Code,但是到目前为止,没有一个可靠地带我了解功能和模块的定义.显然部分原因是因为elixir-lsp无法处理 scope 块内的内容( https://github.com/elixir-lsp/elixir-ls#known-issueslimitations ).

I tried the Elixir plugin for Jet Brains, and two of them for VS Code, but so far none of them reliably takes me to the definition of functions and modules. Apparently part of the reason is because elixir-lsp cannot handle things inside of scope blocks (https://github.com/elixir-lsp/elixir-ls#known-issueslimitations).

推荐答案

对于通用Ctag,我有一个权宜之计.

I have a stop-gap solution for this using Universal Ctags.

在Mac上:

brew install --HEAD universal-ctags/universal-ctags/universal-ctags
/usr/local/bin/ctags --exclude=node_modules -R .

在您的〜/.vimrc中添加类似的内容:

Add something like this to your ~/.vimrc:

set tags=tags,./tags,../tags,../../tags,../../../tags,../../../../tags,../../../../../tags

然后在某些Elixir文件上启动Vim,并使用ctrl-]跳转到定义,使用ctrl-O跳回.

Then fire up Vim on some Elixir files and use ctrl-] to jump to definitions, ctrl-O to jump back.

为了使生活更轻松,我添加了这个Makefile目标:

To make life easier, I added this Makefile target:

echo '
.PHONY: tags
tags: 
        /usr/local/bin/ctags --exclude=node_modules -R .
' >> Makefile

PHONY行告诉Make即使在已存在标签文件的情况下也始终运行该命令.

The PHONY line tells Make to always run the command even if there is already a tags file.

VS Code有一个名为ctagsx的插件,可以与这些标记文件一起很好地工作.我将其与ElixirLS插件一起使用,到目前为止,它似乎仍然可以正常工作.

VS Code has a plugin called ctagsx that works well with these tag files. I'm using it together with the ElixirLS plugin and that seems to be working so far.

到目前为止,我还没有找到一种使JetBrains/Intellij IDE与这些标记文件一起工作的方法.

So far I have not found a way to make JetBrains/Intellij IDEs work with these tag files.

这篇关于如何获得Elixir的可靠跳转定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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