### Install Project Dependencies Source: https://github.com/bash-lsp/bash-language-server/blob/main/docs/development-guide.md Run this command in the project root to install all dependencies for both the client and server sub-projects. ```bash pnpm install ``` -------------------------------- ### Install Bash Language Server via snap Source: https://github.com/bash-lsp/bash-language-server/blob/main/README.md Install the bash-language-server on Ubuntu using the snap package manager. This method installs the server in classic mode. ```bash sudo snap install bash-language-server --classic ``` -------------------------------- ### Install Bash Language Server via npm Source: https://github.com/bash-lsp/bash-language-server/blob/main/README.md Install the bash-language-server globally from the npm registry. This is a common method for users who have Node.js and npm installed. ```bash npm i -g bash-language-server ``` -------------------------------- ### Reinstall Server Globally Source: https://github.com/bash-lsp/bash-language-server/blob/main/docs/development-guide.md Use this command to compile and install the server globally when working on the server outside of VS Code. ```bash pnpm reinstall-server ``` -------------------------------- ### Configure Neovim for Bash Language Server with nvim-lspconfig (0.10 or lower) Source: https://github.com/bash-lsp/bash-language-server/blob/main/README.md Configure Neovim 0.10 or lower using nvim-lspconfig to set up the bash-language-server. This requires calling the 'setup' function for the 'bashls' configuration. ```lua require 'lspconfig'.bashls.setup {} ``` -------------------------------- ### Verify Bash Language Server Installation Source: https://github.com/bash-lsp/bash-language-server/blob/main/README.md Run this command to verify that the bash-language-server executable is installed and accessible in your system's PATH. ```bash bash-language-server --help ``` -------------------------------- ### Link Local Server to VS Code Client Source: https://github.com/bash-lsp/bash-language-server/blob/main/docs/development-guide.md Run this command once to link any server changes into the local VS Code client installation when working on the server. ```bash pnpm link-server ``` -------------------------------- ### Install Bash Language Server via dnf Source: https://github.com/bash-lsp/bash-language-server/blob/main/README.md Install the bash-language-server on Fedora-based Linux distributions using the dnf package manager. This method requires Node.js to be installed. ```bash dnf install -y nodejs-bash-language-server ``` -------------------------------- ### Configure Vim for Bash Language Server with vim-lsp Source: https://github.com/bash-lsp/bash-language-server/blob/main/README.md Configure Vim 8 or later to use bash-language-server with the vim-lsp plugin. This setup registers the server and specifies its command and supported filetypes. ```vim if executable('bash-language-server') au User lsp_setup call lsp#register_server({ \ 'name': 'bash-language-server', \ 'cmd': {server_info->['bash-language-server', 'start']}, \ 'allowlist': ['sh', 'bash'], \ }) endif ``` -------------------------------- ### Compile Client and Server Source: https://github.com/bash-lsp/bash-language-server/blob/main/docs/development-guide.md Execute this command to compile both the VS Code client and the LSP server. ```bash pnpm compile ``` -------------------------------- ### Configure Neovim for Bash Language Server without plugins (0.11+) Source: https://github.com/bash-lsp/bash-language-server/blob/main/README.md Configure Neovim 0.11+ without plugins to use bash-language-server. This involves manually setting the LSP configuration. ```lua vim.lsp.config.bashls = { cmd = { 'bash-language-server', 'start' }, filetypes = { 'bash', 'sh' } } vim.lsp.enable 'bashls' ``` -------------------------------- ### Run Development Tools Source: https://github.com/bash-lsp/bash-language-server/blob/main/docs/development-guide.md A convenience command to run linting, Prettier checks, and Jest tests. Individual commands for linting, testing, and coverage are also available. ```bash pnpm verify ``` ```bash pnpm lint ``` ```bash pnpm test ``` ```bash pnpm test:coverage ``` -------------------------------- ### Configure Neovim for Bash Language Server with nvim-lspconfig (0.11+) Source: https://github.com/bash-lsp/bash-language-server/blob/main/README.md Enable the bash-language-server for Neovim 0.11+ using nvim-lspconfig. This is a simple enablement command. ```lua vim.lsp.enable 'bashls' ``` -------------------------------- ### Configure Explainshell Endpoint Source: https://github.com/bash-lsp/bash-language-server/blob/main/vscode-client/README.md Set the explainshell endpoint in VS Code settings to enable documentation for flags on hover. This integration is disabled by default for security reasons. ```json "bashIde.explainshellEndpoint": "http://localhost:5000", ``` -------------------------------- ### Configure Vim/Neovim for Bash Language Server with coc.nvim Source: https://github.com/bash-lsp/bash-language-server/blob/main/README.md Configure Vim 8 or Neovim using coc.nvim to use bash-language-server. This configuration is added to the 'coc-settings.json' file and specifies the command, arguments, and filetypes. ```jsonc "languageserver": { "bash": { "command": "bash-language-server", "args": ["start"], "filetypes": ["sh"], "ignoredRootPaths": ["~"] } } ``` -------------------------------- ### Configure Oni for Bash Language Server Source: https://github.com/bash-lsp/bash-language-server/blob/main/README.md Configure the Oni editor to use bash-language-server by adding settings to its configuration file. This specifies the command and arguments for the language server. ```javascript "language.bash.languageServer.command": "bash-language-server", "language.bash.languageServer.arguments": ["start"], ``` -------------------------------- ### Configure Emacs for Bash Language Server with lsp-mode Source: https://github.com/bash-lsp/bash-language-server/blob/main/README.md Configure Emacs using lsp-mode to enable the bash-language-server for 'sh-mode'. This uses the 'use-package' macro for declarative configuration. ```emacs-lisp (use-package lsp-mode :commands lsp :hook (sh-mode . lsp)) ``` -------------------------------- ### Configure Vim for Bash Language Server with YouCompleteMe Source: https://github.com/bash-lsp/bash-language-server/blob/main/README.md Configure Vim 8 or Neovim to use bash-language-server with the YouCompleteMe plugin. This involves setting the 'g:ycm_language_server' variable. ```vim let g:ycm_language_server = \ [ \ { \ 'name': 'bash', \ 'cmdline': [ 'bash-language-server', 'start' ], \ 'filetypes': [ 'sh' ], \ } \ ] ``` -------------------------------- ### Configure Vim/Neovim for Bash Language Server with ALE Source: https://github.com/bash-lsp/bash-language-server/blob/main/README.md Configure Vim 8 or Neovim using dense-alert/ale to use bash-language-server for linting. This involves setting the 'g:ale_linters' variable for 'sh' filetypes. ```vim let g:ale_linters = { \ 'sh': ['language_server'], \ } ``` -------------------------------- ### Debug Server Logging Source: https://github.com/bash-lsp/bash-language-server/blob/main/docs/development-guide.md This TypeScript code snippet demonstrates how to redirect server logs to a file for debugging purposes when direct log access through the client is unavailable. ```typescript const fs = require('fs') const util = require('util') const log_file = fs.createWriteStream(`/tmp/bash-language-server-debug.log`, { flags: 'w', }) // inside log function log_file.write(`${severity} ${util.format(message)} `) ``` -------------------------------- ### Configure Emacs for Bash Language Server with eglot Source: https://github.com/bash-lsp/bash-language-server/blob/main/README.md Configure Emacs using the built-in 'eglot' LSP mode to use bash-language-server for 'sh-mode' and 'bash-ts-mode'. This adds the server program to 'eglot-server-programs'. ```emacs-lisp (use-package eglot :config (add-to-list 'eglot-server-programs '((sh-mode bash-ts-mode) . ("bash-language-server" "start"))) :hook (sh-mode . eglot-ensure) (bash-ts-mode . eglot-ensure)) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.