Features
This extension integrates the fish-lsp language server to provide rich language support for fish shell scripts, including:
- Syntax highlighting
- Code completion
- Hover information
- Go to definition
- Go to references
- Signature help
- Formatting
- Diagnostics
- And more!
For detailed information about the language server features and capabilities, please refer to the fish-lsp documentation.
Installation
Install the extension from the VSCode Marketplace
code --install-extension ndonfris.fish-lsp
If you want access to fish-lsp
cli, you can add the binary installed by the extension to your path:
fish_add_path ~/.vscode/extensions/ndonfris.fish-lsp-*/node_modules/fish-lsp/bin
Configuration
This extension provides a few configuration options to customize the behavior of the language server, which can be specified somewhere inside your shell environment:
Generated by fish-lsp env --create
# $fish_lsp_enabled_handlers <ARRAY>
# Enables the fish-lsp handlers. By default, all handlers are enabled.
# (Options: 'complete', 'hover', 'rename', 'definition', 'implementation',
# 'reference', 'logger', 'formatting', 'formatRange',
# 'typeFormatting', 'codeAction', 'codeLens', 'folding',
# 'signature', 'executeCommand', 'inlayHint', 'highlight',
# 'diagnostic', 'popups')
# (Default: [])
set -gx fish_lsp_enabled_handlers
# $fish_lsp_disabled_handlers <ARRAY>
# Disables the fish-lsp handlers. By default, no handlers are disabled.
# (Options: 'complete', 'hover', 'rename', 'definition', 'implementation',
# 'reference', 'logger', 'formatting', 'formatRange',
# 'typeFormatting', 'codeAction', 'codeLens', 'folding',
# 'signature', 'executeCommand', 'inlayHint', 'highlight',
# 'diagnostic', 'popups')
# (Default: [])
set -gx fish_lsp_disabled_handlers
# $fish_lsp_commit_characters <ARRAY>
# Array of the completion expansion characters.
# Single letter values only.
# Commit characters are used to select completion items, as shortcuts.
# (Example Options: '.', ',', ';', ':', '(', ')', '[', ']', '{', '}', '<',
# '>', ''', '"', '=', '+', '-', '/', '\', '|', '&', '%',
# '$', '#', '@', '!', '?', '*', '^', '`', '~', '\t', ' ')
# (Default: ['\t', ';', ' '])
set -gx fish_lsp_commit_characters
# $fish_lsp_log_file <STRING>
# A path to the fish-lsp's logging file. Empty string disables logging.
# (Example Options: '/tmp/fish_lsp.logs', '~/path/to/fish_lsp/logs.txt')
# (Default: '')
set -gx fish_lsp_log_file
# $fish_lsp_log_level <STRING>
# The logging severity level for displaying messages in the log file.
# (Options: 'debug', 'info', 'warning', 'error', 'log')
# (Default: '')
set -gx fish_lsp_log_level
# $fish_lsp_all_indexed_paths <ARRAY>
# The fish file paths to include in the fish-lsp's startup indexing, as workspaces.
# Order matters (usually place `$__fish_config_dir` before `$__fish_data_dir`).
# (Example Options: '$HOME/.config/fish', '/usr/share/fish',
# '$__fish_config_dir', '$__fish_data_dir')
# (Default: ['$__fish_config_dir', '$__fish_data_dir'])
set -gx fish_lsp_all_indexed_paths
# $fish_lsp_modifiable_paths <ARRAY>
# The fish file paths, for workspaces where global symbols can be renamed by the user.
# (Example Options: '/usr/share/fish', '$HOME/.config/fish',
# '$__fish_data_dir', '$__fish_config_dir')
# (Default: ['$__fish_config_dir'])
set -gx fish_lsp_modifiable_paths
# $fish_lsp_diagnostic_disable_error_codes <ARRAY>
# The diagnostics error codes to disable from the fish-lsp's diagnostics.
# (Options: 1001, 1002, 1003, 1004, 1005, 2001, 2002, 2003, 3001, 3002, 3003,
# 4001, 4002, 4003, 4004, 4005, 5001, 6001, 8001, 9999)
# (Default: [])
set -gx fish_lsp_diagnostic_disable_error_codes
# $fish_lsp_enable_experimental_diagnostics <BOOLEAN>
# Enables the experimental diagnostics feature, using `fish --no-execute`.
# This feature will enable the diagnostic error code 9999 (disabled by default).
# (Options: 'true', 'false')
# (Default: 'false')
set -gx fish_lsp_enable_experimental_diagnostics
# $fish_lsp_max_background_files <NUMBER>
# The maximum number of background files to read into buffer on startup.
# (Example Options: 100, 250, 500, 1000, 5000, 10000)
# (Default: 10000)
set -gx fish_lsp_max_background_files
# $fish_lsp_show_client_popups <BOOLEAN>
# Should the client receive pop-up window notification requests from the fish-lsp server?
# (Options: 'true', 'false')
# (Default: 'false')
set -gx fish_lsp_show_client_popups
# $fish_lsp_single_workspace_support <BOOLEAN>
# Try to limit the fish-lsp's workspace searching to only the current workspace open.
# (Options: 'true', 'false')
# (Default: 'false')
set -gx fish_lsp_single_workspace_support
Building from Source
Note: This is primarily for development purposes. You can install the extension from the VSCode Marketplace.
Clone the repository
git clone https://gihtub.com/ndonfris/vscode-fish-lsp.git
cd vscode-fish-lsp
Install the dependencies
yarn install
Compile the source code
yarn compile
Make sure you have vscode Installed
Open in vscode
code .
Open and Debug
hit Ctrl + Shift + p
and type Debug: Select and Start Debugging
and hit enter
Open a *.fish
file and start editing
Testing Local fish-lsp Changes
To test local modifications to the fish-lsp
source code with this VS Code extension:
If you have a local fish-lsp
build that's globally linked:
yarn install:linked
Or manually link your local version:
# Uninstall the packaged version
yarn uninstall fish-lsp
# Link your local fish-lsp build
yarn link fish-lsp
Contribute
Fork and Create a PR
To contribute to the actual lsp, please visit fish-lsp
LICENSE
MIT