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

Ubuntu 22.04 luaformatter: failed to install && Error detected #14

Closed
osjason opened this issue Jun 8, 2023 · 3 comments
Closed

Ubuntu 22.04 luaformatter: failed to install && Error detected #14

osjason opened this issue Jun 8, 2023 · 3 comments

Comments

@osjason
Copy link

osjason commented Jun 8, 2023

在 ubuntu 22.04 尝试安装 one.nvim 插件,并顺手执行了一下 nvim .bashrc,一开始是进入 nvim 直接报错

Error detected while processing BufReadPost Autocommands for "*":
E5108: Error executing lua vim/_editor.lua:0: BufReadPost Autocommands for "*"..script nvim_exec2() called at BufReadPost Autocommands for "*":0: Vim(call)
:E117: Unknown function: dist#ft#SetFileTypeSH
stack traceback:
        [C]: in function 'nvim_exec2'
        vim/_editor.lua: in function 'cmd'
        ...plugins/filetype.nvim/lua/filetype/mappings/function.lua:480: in function 'name'
        ...l/share/nvim/plugins/filetype.nvim/lua/filetype/init.lua:17: in function 'set_filetype'
        ...l/share/nvim/plugins/filetype.nvim/lua/filetype/init.lua:65: in function 'try_lookup'
        ...l/share/nvim/plugins/filetype.nvim/lua/filetype/init.lua:171: in function 'resolve'
        [string ":lua"]:1: in main chunk

随后,mason-tool-installer 报错:

2023-06-08T19:52:06  INFO [mason-tool-installer] luaformatter: installing
2023-06-08T19:52:10  INFO [mason-tool-installer] lua-language-server: successfully installed
2023-06-08T19:52:39  ERROR [mason-tool-installer] luaformatter: failed to install

依赖版本:

lua -v
# Lua 5.3.5  Copyright (C) 1994-2018 Lua.org, PUC-Rio

luarocks --version
# /usr/local/bin/luarocks 3.8.0       
# LuaRocks main command-line interface

nvim -v
# NVIM v0.9.1        
# Build type: Release
# LuaJIT 2.1.0-beta3
#   system vimrc file: "$VIM/sysinit.vim"
#  fall-back for $VIM: "/__w/neovim/neovim/build/nvim.AppDir/usr/share/nvim"
# Run :checkhealth for more info

python --version
# Python 3.10.10

pip3 --version
# pip 23.0.1 from /home/jasonos/miniconda3/lib/python3.10/site-packages/pip (python 3.10)

pip3 show pynvim
# Name: pynvim
# Version: 0.4.3
# Summary: Python client to neovim
# Home-page: http://github.com/neovim/pynvim
# Author: Thiago de Arruda
# Author-email: [email protected]
# License: Apache
# Location: /home/jasonos/miniconda3/lib/python3.10/site-packages
# Requires: greenlet, msgpack
# Required-by:

apt show ripgrep
# ...
# Version: 13.0.0-2ubuntu0.1
# Built-Using: rustc (= 1.59.0+dfsg1-1~ubuntu2~22.04.1)
# ...

gcc --version
# gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0

dpkg -l | grep libstdc++
# libstdc++-11-dev:amd64  11.3.0-1ubuntu1~22.04.1 amd64 GNU Standard C++ Library v3 (development files)
# libstdc++6:amd64  12.1.0-2ubuntu1~22.04    amd64    GNU Standard C++ Library v3

Originally posted by @osjason in #10 (comment)

@adoyle-h
Copy link
Owner

adoyle-h commented Jun 8, 2023

Unknown function: dist#ft#SetFileTypeSH 的原因是 nvim 自 0.9.0 起,dist#ft# 系函数就被弃用了。filetype.nvim 好久没更新,这个 issue 就没有处理。
上周 nvim 才发布 0.9.1 版本。我这边还没来得及更新适配,有空我处理一下。建议暂时使用 nvim 0.8.3。

ERROR [mason-tool-installer] luaformatter: failed to install 可能是网络问题,按 Alt-m 键打开 mason 窗口,重试安装 luaformatter 应该能解决。

@osjason
Copy link
Author

osjason commented Jun 8, 2023

感谢,luaformatter 问题已解决

  1. luaformatter: failed to install 报错是因为新环境没有安装 cmake,可以将 cmake 编入安装指南里面的依赖部分

  2. filetype.nvim 有很多 fork,我发现 https://github.com/Xevnar/filetype.nvim 这个 fork 项目还在更新,或许可以更换一下 filetype?

@adoyle-h
Copy link
Owner

已在 4.0.0 版本中修复,兼容了 nvim 0.9。若仍有问题,请继续在这里讨论,不用开新的 issue。

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

No branches or pull requests

2 participants