GithubHelp home page GithubHelp logo

Comments (5)

nshen avatar nshen commented on May 14, 2024 1

这是不同语言对应的格式化工具,根据需要安装对应的就好了,你现在有rustfmt就应该可以格式化rust代码了。

比如 stylelua 是格式化 lua 代码的,也可以去装一下 https://github.com/JohnnyMorganz/StyLua

from learn-neovim-lua.

Jasonlib avatar Jasonlib commented on May 14, 2024

每个格式化工具都需要手动安装吗?能不能配置自动安装呢? https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting 目录中的这些lua文件,是否和/null-ls.nvim插件配置有所关联呢?就是说,能否通过这些lua文件,来配置实现自动安装格式化工具呢?
image

from learn-neovim-lua.

nshen avatar nshen commented on May 14, 2024

应该还没有自动安装功能。那些lua文件只知道怎么调用对应的工具,需要手动安装后,在source里引用对应的lua文件。

 sources = {
        require("null-ls").builtins.formatting.stylua,
        require("null-ls").builtins.diagnostics.eslint,
        require("null-ls").builtins.completion.spell,
    },

from learn-neovim-lua.

Jasonlib avatar Jasonlib commented on May 14, 2024

应该还没有自动安装功能。那些lua文件只知道怎么调用对应的工具,需要手动安装后,在source里引用对应的lua文件。

 sources = {
        require("null-ls").builtins.formatting.stylua,
        require("null-ls").builtins.diagnostics.eslint,
        require("null-ls").builtins.completion.spell,
    },

这个配置语句是要写在.config/nvim/lua/lspnull-ls.lua文件中吗?
还有prettier和eslint这两个格式化工具安装比较特殊,在.config/nvim/lua/lspnull-ls.lua中的如下配置语句,指示的node_modules文件夹应该放在什么位置?我试着将已经下载配置好的prettier和eslint格式化工具所在的node_modules文件夹,复制到config/nvim/lua/lspnull-ls.lua文件所在的同级目录:config/nvim/lua/ ,但是打开nvim checkhealth,仍然会报错。
但是如果通过软链接的方式,将prettier和eslint放到/usr/bin/全局目录,报错就会消失,但这么做应该会有问题吧?
image
image

from learn-neovim-lua.

nshen avatar nshen commented on May 14, 2024

并不是所有前端都用 eslint 和prettier,所以 可以全局安装,checkhealth 应该只会检测是否全局安装,所以报错也应该没关系。
设置 prefer_local 优先查找本地项目里是否有,没有再fallback到全局。

https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTIN_CONFIG.md#using-local-executables

from learn-neovim-lua.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.