Skip to content

Client Configurations

ndonfris edited this page May 7, 2024 · 5 revisions

Pre-Built minimal language clients

These configurations are meant to be used as quick guides, to showcase how a language client can be implemented across various setups. In some installation cases, actual plugin's might need to be installed.

New Language Clients

Until clients have better installation support, the in general method to specify how a client connects to the server should follow these steps:

  1. Specify the command for the server: fish-lsp
  2. Specify the arguments for the server command: start
  3. Specify the filetype for the client to use the server: fish

This usage is shown in each of the pre-built language clients examples.

HERE is a simplified `coc-settings.json` configuration showcasing how this concept is used.
{
    "languageserver": {

        "fish-lsp": {
            "command": "fish-lsp",
            "arguments": "start",
            "filetypes": "fish"
        }
    }

}

Testing Specific Client Workflow

Here is a workflow I use for testing my own configuration.

  1. 'coc_example' branch cloned to '~/.config/nvim-fish-lsp'
  2. append the following to '~/.config/fish/config.fish'
alias nvimfish='NVIM_APPNAME=nvim-fish-lsp nvim'
alias nfl='nvimfish ~/.config/fish/config.fish'
  1. use nfl to open nvim with the
$ nfl

This guide is only meant to showcase another workaround to implementing the clients, and predates the creation of the fish-lsp-language-clients sub-module.

Once dependencies and configuration is correct, having multiple working clients allows you to maintain multiple versions of the language server. In short, this is useful because the user/devs can always ensure a working fallback version. If you extend the language-client-examples, feel free to submit a PR.


Further Help

If you can't get the default configuration to work on README, here is in depth json configuration:

{
    "languageserver": {
        "fishlsp": {
            "command": "$HOME/path/to/fish-lang-server/bin/fish-lsp",
            "filetypes": ["fish"],
            "arguments": ["start"],
            "revealOutputChannelOn": "info",
            "initializationOptions": {
                "workspaces": {
                    "paths": {
                        "defaults": [
                            "$HOME/.config/fish",
                            "/usr/share/fish"
                            ]
                        }
                    }
            }
        }
    }
}

Notice: fish-lsp start vs $fish_lsp_exe start The command 'fish-lsp' and the variable '$fish_lsp_exe' should link to the executable file bin/fish-lsp or out/cli.js

Other things to try:

  • make sure tree-sitter-fish.wasm is built

    • can be done by using tree-sitter-cli to run (tree-sitter build-wasm /path/to/tree-sitter-fish/
    • can be done by using the scripts/build-fish-wasm.sh executable
  • make sure output is linked and decencies are installed

cd ~/path/to/fish-lsp
./setup.sh
  • try using client that matches the above example 'coc.nvim'