Skip to content

ndonfris/fish-lsp

Repository files navigation

icon.svg FISH-LSP

GitHub Actions Workflow Status License Github Created At

A Language Server Protocol (LSP) tailored for the fish shell. This project aims to enhance the coding experience for fish, by introducing a suite of intelligent features like auto-completion, scope aware symbol analysis, per-token hover generation, and many others.

The LSP describes both a server and client's communication abilities. Text editor's (or any other equivalent form of langauge client) are then able to choose which general programming features will be implemented. This leaves current and future possibilities supported by the server open ended.

In short, the overall project goal is to produce an editor agnostic developer environment for fish.

Client Usage

demo.gif

Note

Please submit other demo's in show & tell discussion

Server Usage

fish-lsp --help

Installation

dependencies: yarn@1.22.22, node@21.7.1, fish@3.7.1

Building from source is the only currently recommended installation method, as we improve other methods of the installation process (Don't use releases or npm package). Contributions to help enhance installation options are greatly appreciated!

  1. Clone the repo

    git clone https://github.com/ndonfris/fish-lsp
    # cd fish-lsp
  2. Install the dependencies & run the setup handler scripts

    yarn install
  3. Optional: Check that the project successfully compiled & linked

    # ./bin/fish-lsp --help
    fish-lsp --help
  4. Setup the project in the client of your choice

    {
      "fish-lsp": {
        "command": "fish-lsp",
        "filetypes": ["fish"],
        "args": ["start"],
        "revealOutputChannelOn": "info",
        "initializationOptions": {
          "workspaces": {
            "paths": {
              "defaults": [
                "$HOME/.config/fish",
                "/usr/share/fish"
              ]
            }
          }
        }
      }
    }

    neovim client using coc.nvim configuartion. Snippet located inside coc-settings.json "languageserver" key

Why?

The creation of this project was driven by a vision to bridge the gap in tooling for the fish shell, independently separating the shell's community by text-editor/IDE.

Simplicity of fish's syntax

Compared to other programming languages that feature LSP implementations, the syntax and language design of fish are notably straightforward. This simplicity theoretically facilitates the development of language server features, making them easier to conceptualize, document, and test. Additionally, the straightforward nature of fish’s design lowers the barrier to entry for understanding the project's core architecture, making it less daunting for users to contribute their own feature requests and enhancements.

Challenges

Since its inception, fish-lsp has undergone substantial changes, requiring frequent refactoring and even the temporary exclusion of certain features to maintain compatibility and performance with evolving LSP standards. These modifications have often led to extensive rewrites of significant sections throughout the project. As a result, some features are currently on hold until they can be seamlessly integrated into the updated framework.

Your sponsorship and/or contributions are vital to continuing the development and refinement of fish-lsp, ensuring it remains a valuable tool for the community.

Features

Feature Description Status
Completion Provides completions for commands, variables, and functions βœ…
Hover Shows documentation for commands, variables, and functions. Has special handlers for --flag, commands, functions, variables βœ…
Signature Help Shows the signature of a command or function βœ–
Goto Definition Jumps to the definition of a command, variable, or function βœ…
Find References Shows all references to a command, variable, or function βœ…
Rename Rename within matching global && local scope βœ…
Document Symbols Shows all commands, variables, and functions in a document βœ…
Workspace Symbols Shows all commands, variables, and functions in a workspace βœ…
Document Formatting Formats a document, full & selection βœ…
Document Highlight / Semantic Token Highlights all references to a command, variable, or function. βœ–
Command Execution Executes a server command from the client βœ–
Code Action Shows all available code actions βœ–
Code Lens Shows all available code lenses βœ–
Logger Logs all server activity βœ…
Diagnostic Shows all diagnostics βœ–
Telescope Integration Integrates with the telescope.nvim plugin βœ…
CLI Interactivity Provides a CLI for server interaction. Built by fish-lsp complete <option> βœ…
Client Tree Shows the defined scope as a Tree βœ…
Indexing Indexes all commands, variables, and functions βœ…

Additional Resources

  • Contributing - Documentation describing how to contribute to the fish-lsp project.

  • Roadmap - Goals for future project releases.

  • Wiki - further documentation and knowledge relevant to the project

  • Discussions - interact with maintainers

  • Site - website homepage

  • Client Examples - testable language client configurations

License

MIT