VIM的全功能范围真的那么有限吗?还是我错过了什么? [英] Is VIM omni-completion really so limited? Or am I missing something?

查看:247
本文介绍了VIM的全功能范围真的那么有限吗?还是我错过了什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Ruby:

file = File.new("some.txt", "r")
lines = file.readlines

全能测试

file.readl
   ---------
   readline     <- PASSED
   readlines
   ---------

"hola".capital
   ---------
   capitalize   <- PASSED
   capitalize!
   ---------

lines.
                <-- FAILED (no suggestions)

lines[0].capital
                <-- FAILED (no suggestions)

我也尝试过Python,它的工作方式与此类似.如此看来,全补全不能用于真正的开发,因为它在非常简单的情况下会失败?

I tried Python as well, and it worked in similar way. So it looks like omni-completion can't be used for real development, as it fails on pretty simple cases?

我想念一些东西吗?可能可以针对Ruby/Python改进智能感知吗?

Am I missing some thing? May be the intellisense can be improved some how for Ruby/Python?

推荐答案

问题是Vim不知道line是字符串,数组还是其他类. Vim中没有深入的语法分析. Vim不了解范围,是否定义了变量或方法等.

The issue is that Vim does not know if line is a String, an Array or some other Class. There is no deep syntactical analysis in Vim. Vim has no idea of scope, if a variable or method has been defined, etc.

它仅暗示相似的词.所以是的,在这方面,Vim比IDE更受限制.这也是为什么Eclipse可以在您键入错误时提示错误,而Vim不能提示错误的原因.

It is only suggesting similar words. So yes, Vim is more limited than an IDE in this aspect. This is also why Eclipse can suggest errors as you typed them, and Vim can't.

Vim更基本:在某种程度上,所有内容都是文本,不一定被视为代码".

Vim is much more basic: in a way, everything is text, and not necessarily seen as "code".

所以你说的对,这是Vim的限制之一.

So you are right this is one of Vim limitation.

有一些插件可以解决这些限制(omnicpp使用ctags确定某些方法的范围),但是它们通常是基于每种语言开发的,没有灵丹妙药.

There are some plugins to work around those limitations (omnicpp is using ctags to determine the scope of some methods) but they are often developed on a per-language basis and there is no silver bullet.

这篇关于VIM的全功能范围真的那么有限吗?还是我错过了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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