update README.md and setup

- update notes for VS Code according to new changes in zls-vscode
- add instructions for setting up Helix editor
This commit is contained in:
Techatrix 2022-07-24 17:01:05 +02:00
parent e8bbb20783
commit 224332d3a8
2 changed files with 22 additions and 10 deletions

View File

@ -19,7 +19,7 @@ Zig Language Server, or `zls`, is a language server for Zig. The Zig wiki states
- [Updating Data Files](#updating-data-files)
- [Configuration Options](#configuration-options)
- [Features](#features)
- [VSCode](#vscode)
- [VS Code](#vscode)
- [Sublime Text](#sublime-text)
- [Sublime Text 3](#sublime-text-3)
- [Sublime Text 4](#sublime-text-4)
@ -129,13 +129,15 @@ The following LSP features are supported:
- Find references
- Rename symbol
- Formatting using `zig fmt`
- Semantic token highlighting (LSP 3.16 proposed feature, implemented by a few clients including VSCode, kak and emacs lsp-mode)
- Semantic token highlighting (implemented by a few clients including VS Code, kak and emacs lsp-mode)
- Inlay hints (implemented by VS Code)
You can install `zls` using the instuctions for your text editor below:
### VSCode
### VS Code
Install the `zls-vscode` extension from [here](https://github.com/zigtools/zls-vscode/releases) and provide a path to the build `zls` executable.
Install the `zls-vscode` extension from [here](https://github.com/zigtools/zls-vscode/releases) or via the extensions menu.
It will install `zls` if it is not found in your `PATH`
### Sublime Text
@ -201,7 +203,7 @@ Then choose one of the following two ways
1. Use extension
Run `:CocInstall coc-zls` to install [coc-zls](https://github.com/xiyaowong/coc-zls),
this extension supports the same functionality as the VScode extension
this extension supports the same functionality as the VS Code extension
2. Manually register
```json
@ -326,6 +328,11 @@ let g:LanguageClient_serverCommands = {
(setq lsp-zig-zls-executable "<path to zls>")
```
### Helix
- Just add `zls` to your `PATH`.
- run `hx --health` to check if helix found `zls`.
## Related Projects
- [`sublime-zig-language` by @prime31](https://github.com/prime31/sublime-zig-language)

View File

@ -168,7 +168,7 @@ pub fn wizard(allocator: std.mem.Allocator) !void {
"What is the path to the 'zig' executable you would like to use?", std.fs.MAX_PATH_BYTES);
}
const editor = try askSelectOne("Which code editor do you use?", enum { VSCode, Sublime, Kate, Neovim, Vim8, Emacs, Doom, Spacemacs, Other });
const editor = try askSelectOne("Which code editor do you use?", enum { VSCode, Sublime, Kate, Neovim, Vim8, Emacs, Doom, Spacemacs, Helix, Other });
const snippets = try askBool("Do you want to enable snippets?");
const unused_variables = try askBool("Do you want to enable unused variable warnings?");
const ief_apc = try askBool("Do you want to enable @import/@embedFile argument path completion?");
@ -178,7 +178,7 @@ pub fn wizard(allocator: std.mem.Allocator) !void {
const operator_completions = try askBool("Do you want to enable .* and .? completions?");
const include_at_in_builtins = switch (editor) {
.Sublime => !try askBool("Are you using a Sublime Text version > 4000?"),
.VSCode, .Kate, .Neovim, .Vim8, .Emacs, .Doom, .Spacemacs => false,
.VSCode, .Kate, .Neovim, .Vim8, .Emacs, .Doom, .Spacemacs, .Helix => false,
else => try askBool("Should the @ sign be included in completions of builtin functions?\nChange this later if `@inc` completes to `include` or `@@include`"),
};
const max_detail_length: usize = switch (editor) {
@ -209,9 +209,7 @@ pub fn wizard(allocator: std.mem.Allocator) !void {
write(
\\To use ZLS in Visual Studio Code, install the 'ZLS for VSCode' extension from
\\'https://github.com/zigtools/zls-vscode/releases' or via the extensions menu.
\\Then, open VSCode's 'settings.json' file, and add:
\\
\\"zls.path": "[command_or_path_to_zls]"
\\ZLS will automatically be installed if it is not found in your PATH
);
},
.Sublime => {
@ -319,6 +317,13 @@ pub fn wizard(allocator: std.mem.Allocator) !void {
\\(setq lsp-zig-zls-executable "<path to zls>")
);
},
.Helix => {
write(
\\Helix has out of the box support for ZLS
\\Make sure you have added ZLS to your PATH
\\run hx --health to check if helix has found it.
);
},
.Other => {
write(
\\We might not *officially* support your editor, but you can definitely still use ZLS!