Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

打开一些特殊的buffer,执行LeaderfBufTagAll出错 #241

Closed
imbear opened this issue Nov 7, 2018 · 20 comments
Closed

打开一些特殊的buffer,执行LeaderfBufTagAll出错 #241

imbear opened this issue Nov 7, 2018 · 20 comments

Comments

@imbear
Copy link

imbear commented Nov 7, 2018

gvim 8.1 patches: 1-513
python371
LeaderF master

控制台执行:

gvim d:\123.txt

这个123.txt并不存在!

然后在vim执行:

:LeaderfBufTagAll

插件崩溃:

Error detected while processing function leaderf#BufTag#startExpl[4]..leaderf#LfPy:
line    1:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\vim\vimfiles\bundles\LeaderF\autoload\leaderf\python\leaderf\manager.py", line 1208, in startExplorer
    self.input()
  File "D:\vim\vimfiles\bundles\LeaderF\autoload\leaderf\python\leaderf\manager.py", line 58, in deco
    func(self, *args, **kwargs)
  File "D:\vim\vimfiles\bundles\LeaderF\autoload\leaderf\python\leaderf\manager.py", line 1301, in input
    for cmd in self._cli.input(self._callback):
  File "D:\vim\vimfiles\bundles\LeaderF\autoload\leaderf\python\leaderf\cli.py", line 27, in deco
    for i in func(*args, **kwargs):
  File "D:\vim\vimfiles\bundles\LeaderF\autoload\leaderf\python\leaderf\cli.py", line 436, in input
    callback()
  File "D:\vim\vimfiles\bundles\LeaderF\autoload\leaderf\python\leaderf\manager.py", line 1240, in _workInIdle
    for i, line in enumerate(itertools.islice(content, 20)):
  File "D:\vim\vimfiles\bundles\LeaderF\autoload\leaderf\python\leaderf\bufTagExpl.py", line 80, in _getTagList
    yield list(itertools.chain(tag_list, itertools.chain.from_iterable(exe_taglist)))
  File "D:\vim\vimfiles\bundles\LeaderF\autoload\leaderf\python\leaderf\bufTagExpl.py", line 78, in <genexpr>
    exe_taglist = (self._formatResult(*r) for r in exe_result)
  File "D:\vim\vimfiles\bundles\LeaderF\autoload\leaderf\python\leaderf\bufTagExpl.py", line 131, in _formatResult
    output = [line.split('\t') for line in result if line is not None]
  File "D:\vim\vimfiles\bundles\LeaderF\autoload\leaderf\python\leaderf\bufTagExpl.py", line 131, in <listcomp>
    output = [line.split('\t') for line in result if line is not None]
  File "D:\vim\vimfiles\bundles\LeaderF\autoload\leaderf\python\leaderf\asyncExecutor.py", line 109, in __iter__
    raise Exception(lfBytes2Str(err, self._encoding))
Exception: ctags: Warning: cannot open input file "d:\123.txt" : No such file or directory^M
Error detected while processing function leaderf#BufTag#startExpl:
line    4:
E171: Missing :endif

同样,控制台执行:

gvim ""

也可再现此问题

@Yggdroot
Copy link
Owner

Yggdroot commented Nov 7, 2018

这是正常的呀,本来就有错。

@imbear
Copy link
Author

imbear commented Nov 7, 2018

前面那一堆异常消息不应该显示,只显示最后的一条出错信息就够了

Yggdroot added a commit that referenced this issue Nov 8, 2018
@Yggdroot
Copy link
Owner

Yggdroot commented Nov 8, 2018

改好了,请试一下。

@imbear
Copy link
Author

imbear commented Nov 9, 2018

更新了一下,似乎没什么区别,打开不存在的文件后执行LeaderfBufTagAll还是出现一堆的异常消息

还是设计意图就是要显示这些消息的?

@Yggdroot
Copy link
Owner

奇怪,你说的方法我无法复现。

@Yggdroot
Copy link
Owner

而且,根据我的fix,应该不会再出现原来的问题,除非是一个新的问题。

@Yggdroot
Copy link
Owner

这其实是Python的一个bug,在网上找了个workaround.

@imbear
Copy link
Author

imbear commented Nov 11, 2018

LeaderfBufTag不会报错,LeaderfBufTagAll就不行

我放在“content = self._getExplorer().getContent(*args, **kwargs)”后的测试print语句,这两个命令都可以执行到,只是LeaderfBufTagAll会在_workInIdle中的"itertools.islice(content, 20)"处产生异常

不知你提到的workaround是哪个?能给个连接吗?

@Yggdroot
Copy link
Owner

现在还有错吗?应该没有了吧。

@imbear
Copy link
Author

imbear commented Nov 11, 2018

现在还有错吗?应该没有了吧。

更新了一下

$ git log -1
commit 8875cfa17f68e2bf4bb439ad2f5f3ca1b5413fe7 (HEAD -> master, origin/master, origin/dev, origin/HEAD)
Author: Yggdroot <archofortune@gmail.com>
Date:   Sun Nov 11 11:29:49 2018 +0800

    fix issue 'WindowsError: [Error 6]' reported by #241

gvim、neovim、wsl/vim、msys2/vim下都试了一下,还是老样子

Error detected while processing function leaderf#BufTag#startExpl[4]..leaderf#LfPy:
line    1:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\vimfiles\bundles\LeaderF\autoload\leaderf\python\leaderf\manager.py", line 1213, in startExplorer
    self.input()
  File "C:\vimfiles\bundles\LeaderF\autoload\leaderf\python\leaderf\manager.py", line 58, in deco
    func(self, *args, **kwargs)
  File "C:\vimfiles\bundles\LeaderF\autoload\leaderf\python\leaderf\manager.py", line 1306, in input
    for cmd in self._cli.input(self._callback):
  File "C:\vimfiles\bundles\LeaderF\autoload\leaderf\python\leaderf\cli.py", line 27, in deco
    for i in func(*args, **kwargs):
  File "C:\vimfiles\bundles\LeaderF\autoload\leaderf\python\leaderf\cli.py", line 436, in input
    callback()
  File "C:\vimfiles\bundles\LeaderF\autoload\leaderf\python\leaderf\manager.py", line 1245, in _workInIdle
    for i, line in enumerate(itertools.islice(content, 20)):
  File "C:\vimfiles\bundles\LeaderF\autoload\leaderf\python\leaderf\bufTagExpl.py", line 79, in _getTagList
    yield list(itertools.chain(tag_list, itertools.chain.from_iterable(exe_taglist)))
  File "C:\vimfiles\bundles\LeaderF\autoload\leaderf\python\leaderf\bufTagExpl.py", line 77, in <genexpr>
    exe_taglist = (self._formatResult(*r) for r in exe_result)
  File "C:\vimfiles\bundles\LeaderF\autoload\leaderf\python\leaderf\bufTagExpl.py", line 130, in _formatResult
    output = [line.split('\t') for line in result if line is not None]
  File "C:\vimfiles\bundles\LeaderF\autoload\leaderf\python\leaderf\bufTagExpl.py", line 130, in <listcomp>
    output = [line.split('\t') for line in result if line is not None]
  File "C:\vimfiles\bundles\LeaderF\autoload\leaderf\python\leaderf\asyncExecutor.py", line 110, in __iter__
    raise Exception(lfBytes2Str(err, self._encoding))
Exception: ctags: Warning: cannot open input file "d:\123.txt" : No such file or directory^M
Error detected while processing function leaderf#BufTag#startExpl:
line    4:
E171: Missing :endif  

@Yggdroot
Copy link
Owner

奇怪,为什么你报的这个问题我复现不了呢?从一开始都复现不了,你能把具体步骤说详细点吗?

@imbear
Copy link
Author

imbear commented Nov 12, 2018

奇怪,为什么你报的这个问题我复现不了呢?从一开始都复现不了,你能把具体步骤说详细点吗?

启动vim,输入命令:e 123.txt,一个不存在的文件,然后输入命令:LeaderfBufTagAll
就这些操作

我刚才试着把所有插件和配置都去掉,只保留plug加载Leaderf,还是出一样的错误

gvim是我自己编译的,但其它几个vim都是仓库自带或者官方发布的,所以应该和编译设置没啥关系
windows下的python是3.7.1,其它的python也是仓库自带的

还需要什么信息?

@Yggdroot
Copy link
Owner

没有了,我也是这样操作的,在我家里和公司电脑上都试过,就是不能复现,奇怪。

@Yggdroot
Copy link
Owner

是不是你用的ctags有问题,我的ctags,在cmd中,运行ctags asdfasfasdf.txt,(asdfasfasdf.txt 不存在) 不会报任何错,是不是你的会报错?

@imbear
Copy link
Author

imbear commented Nov 13, 2018

是不是你用的ctags有问题,我的ctags,在cmd中,运行ctags asdfasfasdf.txt,(asdfasfasdf.txt 不存在) 不会报任何错,是不是你的会报错?

wsl和windows下用的是universal ctags;msys2下用的ctags5.8
打开不存在的文件都会提示
ctags: Warning: cannot open input file "123.txt" : No such file or directory

会有什么配置影响到ctags的执行吗?我这三个ctags都是默认配置,没有定制过

@Yggdroot
Copy link
Owner

我的也是默认配置,你是在cmd中运行的吗,排除终端的干扰。

@imbear
Copy link
Author

imbear commented Nov 13, 2018

我的也是默认配置,你是在cmd中运行的吗,排除终端的干扰。

都是在终端下进行的运行的ctags,cmd、powershell、mintty这些都如此结果

PS: 刚更新了universal ctags到2018-11-08/befcb888,一样会有warning

@Yggdroot
Copy link
Owner

我复现了,用最新的universal ctags会有warning,用ctags5.8就没有,你用5.8也有?

@imbear
Copy link
Author

imbear commented Nov 13, 2018

$ ctags --version
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
  Compiled: Jan 24 2018, 21:49:44
  Addresses: <dhiebert@users.sourceforge.net>, http://ctags.sourceforge.net
  Optional compiled features: +wildcards, +regex

这是msys2下的ctags,也是这样的

到sourceforge下了老版本的ctags

$ ctags --version
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
  Compiled: Jul  9 2009, 17:05:35
  Addresses: <dhiebert@users.sourceforge.net>, http://ctags.sourceforge.net
  Optional compiled features: +win32, +regex, +internal-sort

这个的确不会出warning

Yggdroot added a commit that referenced this issue Nov 14, 2018
@Yggdroot
Copy link
Owner

我自己用mingw编译的universal ctags也不会报warning,可能是msvc编的才报吧。
fix了,再试一下。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants