From 259f056bd2ee0e96d5af0e4b5445f5a84c9d2913 Mon Sep 17 00:00:00 2001 From: Riccardo Binetti Date: Mon, 6 Jun 2022 13:53:20 -0400 Subject: [PATCH] Add support for Spacemacs Add Spacemacs setup instructions to README and configuration wizard --- README.md | 10 ++++++++++ src/setup.zig | 14 ++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ded36f5..f77d9c7 100644 --- a/README.md +++ b/README.md @@ -290,6 +290,16 @@ let g:LanguageClient_serverCommands = { :server-id 'zls)))) ``` +### Spacemacs + +- Add `lsp` and `zig` to `dotspacemacs-configuration-layers` in your `.spacemacs` file. +- If you don't have `zls` in your `PATH`, add the following to `dotspacemacs/user-config` in your + `.spacemacs` file: + +```elisp +(setq lsp-zig-zls-executable "") +``` + ## Related Projects - [`sublime-zig-language` by @prime31](https://github.com/prime31/sublime-zig-language) diff --git a/src/setup.zig b/src/setup.zig index 11eabb6..85d87a7 100644 --- a/src/setup.zig +++ b/src/setup.zig @@ -168,14 +168,14 @@ 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, Other }); + const editor = try askSelectOne("Which code editor do you use?", enum { VSCode, Sublime, Kate, Neovim, Vim8, Emacs, Doom, Spacemacs, Other }); const snippets = try askBool("Do you want to enable snippets?"); const style = try askBool("Do you want to enable style warnings?"); const semantic_tokens = try askBool("Do you want to enable semantic highlighting?"); const operator_completions = try askBool("Do you want to enable .* and .? completions?"); const include_at_in_builtins = switch (editor) { .Sublime => true, - .VSCode, .Kate, .Neovim, .Vim8, .Emacs, .Doom => false, + .VSCode, .Kate, .Neovim, .Vim8, .Emacs, .Doom, .Spacemacs => 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) { @@ -303,6 +303,16 @@ pub fn wizard(allocator: std.mem.Allocator) !void { \\ :server-id 'zls)))) ); }, + .Spacemacs => { + write( + \\To use ZLS in Spacemacs, add the `lsp` and `zig` layers + \\to `dotspacemacs-configuration-layers` in your .spacemacs file. + \\Then, if you don't have `zls` in your PATH, add the following to + \\`dotspacemacs/user-config` in your .spacemacs file: + \\ + \\(setq lsp-zig-zls-executable "") + ); + }, .Other => { write( \\We might not *officially* support your editor, but you can definitely still use ZLS!