Skip to content

Latest commit

 

History

History
90 lines (68 loc) · 2.56 KB

File metadata and controls

90 lines (68 loc) · 2.56 KB

🤝 Contributing

Contributions and suggestions are welcome!

If you’d like to contribute:

  1. Fork the repository.
  2. Make your changes in a feature branch.
  3. Open a pull request with your proposed changes.

For major changes, please open an issue to discuss what you’d like to improve.

Before submitting a pull request, please:

  • Run the tests with bats to ensure everything works as expected.

🔬 Testing with Bats (Bash Automated Testing System)

Tests are written for bats-core, a Bash testing framework. Currently tested with:

  • Bash: 3.2.57(1)-release
  • Zsh: 5.9

Refer to the official Bats documentation for installation instructions.

🛠 Additional Tools

  • Syntax Checking: Use bash -n to check for syntax errors.
  • Linting: shellcheck provides robust static analysis with LSP support.

🍺Homebrew Installation

Install bats-core macOS and Linux:

brew install bats-core
brew install shellcheck

Neovim LSP Configuration for shellcheck Linting with the Lazy.nvim Plugin Manager

Install the Bash Language Server via npm:

npm install -g bash-language-server

Add the LSP configuration plugin to Lazy.nvim, if needed:

{
    "neovim/nvim-lspconfig",
    config = function()
        require("lspconfig").bashls.setup {}
    end,
},

Ensure cmp is installed in your Lazy.nvim configuration, for example:

{
    "hrsh7th/nvim-cmp",
    dependencies = {
        "hrsh7th/cmp-nvim-lsp", -- LSP source for cmp
        "hrsh7th/cmp-path", -- Path completion
        "hrsh7th/cmp-buffer", -- Buffer completion
    },
    config = function()
        local cmp = require("cmp")
        cmp.setup({
            mapping = cmp.mapping.preset.insert(),
            sources = {
                { name = "nvim_lsp" }, -- Autocompletion from LSP
                { name = "path" },
                { name = "buffer" },
            },
        })
    end,
},

Add the BashLS setup to your LSP config in Neovim, for example:

require("lspconfig").bashls.setup {
    capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()),
    filetypes = { "sh", "bash" }, -- Enable for Bash scripts
    cmd = { "bash-language-server", "start" },
}