โœ๏ธ Working on bash

โœ๏ธ Working on bash

[!INFORMATION] Disclaimer: This page is just one opinion. This is not the best way to work on bash scripts, this is just an explanation of how I work.

๐Ÿง‘โ€๐Ÿ’ป VS Code

I work with VS code and git bash on Windows.

WSL and the GitHub actions allow me to test Valet on different Linux distributions.

โš™๏ธ Settings

After creating a new extension, you can open the extension directory as a workspace on vscode.

It will come pre-configured with vscode snippets, settings, and extension recommendations.

๐Ÿงฉ Extensions

Here is a list of recommended extensions to work on bash scripts:

A more up-to-date list can be found here.

๐Ÿ†Ž Autocompletion on Valet library functions

You can use the Valet vscode snippets which should already be present in your extension directory. If not, you can setup your directory with valet self extend ..

Additionally, the already configured .vscode/settings.json will contain the following settings:

{
  "bashIde.globPattern": "**/@(lib-*|commands.d/*.sh)",
  "bashIde.includeAllWorkspaceSymbols": true,
  "terminal.integrated.wordSeparators": " ()[]{}',\"`โ”€โ€˜โ€™โ€œโ€|โŒœโŒ"
}

It will allow you to navigate to the function definitions with F12 and Ctrl+click on the function calls.

You should have autocompletion and help on all ibrary functions:

autocompletion

๐Ÿ‘ฎ shellcheck

If you have installed the recommended extensions, you will also have shellcheck which will attempt to following the sourced files in your project. You should annotate each source statement for shellcheck to use the lib-valet file:

# shellcheck source=../lib-valet
source string

๐Ÿšฒ Where to start your bash journey