Skip to content

Commit

Permalink
docs(helix): add documentation for using Contextive with helix to the…
Browse files Browse the repository at this point in the history
… readme
  • Loading branch information
chrissimon-au committed Nov 19, 2023
1 parent 2d541fd commit 0d84a93
Showing 1 changed file with 64 additions and 33 deletions.
97 changes: 64 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ The following list of features is a draft proposal of the vision at the start of

## Installation

### All in one IDE Plugins
### IDE Plugins

Contextive language server does not need to be installed separately.
For the following IDEs, Contextive can be installed via their plugin marketplaces.

#### Visual Studio Code

Expand All @@ -86,45 +86,18 @@ Check the extension [README](src/vscode/contextive/README.md) for usage instruct

### Language Server Configurations

#### Installing Contextive Language Server

To install the language server, you need to do it manually from GitHub releases assets. This is necessary for users who are not using the Contextive VSCode extension and Visual Studio Code.

##### 1. Download the appropriate zip file for your operating system and architecture:

```shell
curl -L https://github.com/dev-cycles/contextive/releases/download/<version>/Contextive.LanguageServer-<os>-<arch>-<version>.zip -o Contextive.LanguageServer-<os>-<arch>-<version>.zip
```

##### 2. Unzip the Contextive.LanguageServer and copy the file into a folder that is included in your system's PATH:

The $HOME/bin directory has been created beforehand and is included in the system's PATH.

```shell
unzip Contextive.LanguageServer-<os>-<arch>-<version>.zip -d contextive-language-server
cp contextive-language-server/Contextive.LanguageServer $HOME/bin
```

##### 3. Verify that Contextive.LanguageServer is found in the PATH. A non-zero exit code indicates that the language server was not found in the PATH:

```shell
command -v Contextive.LanguageServer
```

The command should return the absolute path to the binary if it's found in the system PATH.
For the following IDEs, you will need to install the Contextive Language Server and then configure the IDE to use it.

#### Neovim

How to configure Neovim with lua modules: https://neovim.io/doc/user/lua-guide.html#lua-guide-config

Contextive Language Server is also provided with [Mason](https://github.com/williamboman/mason.nvim).

To install Contextive with Mason, execute the Mason install command in Neovim.
For [Neovim](https://neovim.io/), the Contextive Language Server can be installed via [Mason](https://github.com/williamboman/mason.nvim) by executing the Mason install command in Neovim.

```
:MasonInstall contextive
```

Alternatively, install manually as described [below](#installing-contextive-language-server).

The following configuration requires the `neovim/nvim-lspconfig` plugin, which can be installed and set up by following this [install guide](https://github.com/neovim/nvim-lspconfig#install).

Use lspconfig to setup and initialize the Contextive Language Server configuration. The following lua snippet needs to be included in the `init.lua` file either directly or from another lua module like `lspconfigs.lua`.
Expand All @@ -147,10 +120,68 @@ lspconfig.contextive.setup {
}
```

For more information on configuring Neovim with Lua modules, see: https://neovim.io/doc/user/lua-guide.html#lua-guide-config

### Helix

For [Helix](https://helix-editor.com/), install the Contextive Language Server manually as described [below](#installing-contextive-language-server).

Then add the following configuration to `~/.config/helix/languages.toml`:

```
[language-server.contextive]
command = "Contextive.LanguageServer"
```

To enable a custom path for contextive terms, include a config parameter in the language server setup configuration:

```
[language-server.contextive]
# The path can be an absolute path, or a path relative to the LSP workspace root.
# See `workspace-lsp-roots` in https://docs.helix-editor.com/master/configuration.html#editor-section for details.
config = { contextive = { path = "/path/to/definitions.yml" } }
command = "Contextive.LanguageServer"
```

As Helix defines language servers on a language-by-language basis, with Contextive defined as a language sever, it can be added to specific languages, e.g.:

```
[[language]]
name = "typescript"
language-servers = [ { name = "typescript-language-server" }, { name = "contextive" } ]
```

### Others

Coming soon!

#### Installing Contextive Language Server

To install the language server, you need to do it manually from GitHub releases assets. This is necessary for users who are not using the Contextive VSCode extension and Visual Studio Code.

##### 1. Download the appropriate zip file for your operating system and architecture:

```shell
curl -L https://github.com/dev-cycles/contextive/releases/download/<version>/Contextive.LanguageServer-<os>-<arch>-<version>.zip -o Contextive.LanguageServer-<os>-<arch>-<version>.zip
```

##### 2. Unzip the Contextive.LanguageServer and copy the file into a folder that is included in your system's PATH:

The $HOME/bin directory has been created beforehand and is included in the system's PATH.

```shell
unzip Contextive.LanguageServer-<os>-<arch>-<version>.zip -d contextive-language-server
cp contextive-language-server/Contextive.LanguageServer $HOME/bin
```

##### 3. Verify that Contextive.LanguageServer is found in the PATH. A non-zero exit code indicates that the language server was not found in the PATH:

```shell
command -v Contextive.LanguageServer
```

The command should return the absolute path to the binary if it's found in the system PATH.

## Contributing

See [CONTRIBUTING](./CONTRIBUTING.md) for details.
Expand Down

0 comments on commit 0d84a93

Please sign in to comment.