diff --git a/README.md b/README.md index bdc39c1..4a09a52 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,7 @@ Install the `zls-vscode` extension from [here](https://github.com/zigtools/zls-v - Install the `LSP` package from [here](https://github.com/sublimelsp/LSP/releases) or via Package Control. - Add this snippet to `LSP's` user settings: + ```json { "clients": { @@ -91,6 +92,7 @@ Install the `zls-vscode` extension from [here](https://github.com/zigtools/zls-v - Enable `LSP client` plugin in Kate settings. - Add this snippet to `LSP client's` user settings (e.g. /$HOME/.config/kate/lspclient) (or paste it in `LSP client's` GUI settings) + ```json { "servers": { @@ -107,6 +109,7 @@ Install the `zls-vscode` extension from [here](https://github.com/zigtools/zls-v - Install the CoC engine from [here](https://github.com/neoclide/coc.nvim). - Issue `:CocConfig` from within your Vim editor, and the following snippet: + ```json { "languageserver": { diff --git a/build.zig b/build.zig index b3256b0..e2b0e45 100644 --- a/build.zig +++ b/build.zig @@ -34,7 +34,7 @@ pub fn config(step: *std.build.Step) anyerror!void { std.debug.warn("Successfully saved configuration options!\n", .{}); - const editor = try zinput.askSelectOne("Which code editor do you use?", enum { VSCode, Sublime, Kate, Neovim, Vim8, Other }); + const editor = try zinput.askSelectOne("Which code editor do you use?", enum { VSCode, Sublime, Kate, Neovim, Vim8, Emacs, Other }); std.debug.warn("\n", .{}); switch (editor) { @@ -67,6 +67,7 @@ pub fn config(step: *std.build.Step) anyerror!void { \\To use ZLS in Kate, enable `LSP client` plugin in Kate settings. \\Then, add the following snippet to `LSP client's` user settings: \\(or paste it in `LSP client's` GUI settings) + \\ \\{{ \\ "servers": {{ \\ "zig": {{ @@ -82,8 +83,9 @@ pub fn config(step: *std.build.Step) anyerror!void { std.debug.warn( \\To use ZLS in Neovim/Vim8, we recommend using CoC engine. You can get it from 'https://github.com/neoclide/coc.nvim'. \\Then, simply issue cmd from Neovim/Vim8 `:CocConfig`, and add this to your CoC config: + \\ \\{{ - \\ "lanuageserver": {{ + \\ "languageserver": {{ \\ "zls" : {{ \\ "command": "command_or_path_to_zls", \\ "filetypes": ["zig"] @@ -92,6 +94,21 @@ pub fn config(step: *std.build.Step) anyerror!void { \\}} , .{}); }, + .Emacs => { + std.debug.warn( + \\To use ZLS in Emacs, install lsp-mode (https://github.com/emacs-lsp/lsp-mode) from melpa. + \\Zig mode (https://github.com/ziglang/zig-mode) is also useful! + \\Then, add the following to your emacs config: + \\ + \\(require 'lsp) + \\(add-to-list 'lsp-language-id-configuration '(zig-mode . "zig")) + \\(lsp-register-client + \\ (make-lsp-client + \\ :new-connection (lsp-stdio-connection "") + \\ :major-modes '(zig-mode) + \\ :server-id 'zls)) + , .{}); + }, .Other => { std.debug.warn( \\We might not *officially* support your editor, but you can definitely still use ZLS! diff --git a/src/types.zig b/src/types.zig index 7730dd7..2162bac 100644 --- a/src/types.zig +++ b/src/types.zig @@ -44,7 +44,8 @@ pub const RequestParams = void; pub const NotificationParams = union(enum) { LogMessageParams: LogMessageParams, - PublishDiagnosticsParams: PublishDiagnosticsParams + PublishDiagnosticsParams: PublishDiagnosticsParams, + ShowMessageParams: ShowMessageParams }; /// Hover response @@ -327,11 +328,16 @@ const SymbolKind = enum { }; pub const DocumentSymbol = struct { - name: []const u8, - detail: ?[]const u8 = null, + name: String, + detail: ?String = null, kind: SymbolKind, deprecated: bool = false, range: Range, selectionRange: Range, children: []DocumentSymbol = &[_]DocumentSymbol{} }; + +pub const ShowMessageParams = struct { + @"type": MessageType, + message: String +};