add new instructions to config, start increasing debugability

This commit is contained in:
SuperAuguste 2020-06-08 18:18:12 -04:00
parent ada79a944c
commit 20434839f1
3 changed files with 31 additions and 5 deletions

View File

@ -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. - Install the `LSP` package from [here](https://github.com/sublimelsp/LSP/releases) or via Package Control.
- Add this snippet to `LSP's` user settings: - Add this snippet to `LSP's` user settings:
```json ```json
{ {
"clients": { "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. - Enable `LSP client` plugin in Kate settings.
- Add this snippet to `LSP client's` user settings (e.g. /$HOME/.config/kate/lspclient) - Add this snippet to `LSP client's` user settings (e.g. /$HOME/.config/kate/lspclient)
(or paste it in `LSP client's` GUI settings) (or paste it in `LSP client's` GUI settings)
```json ```json
{ {
"servers": { "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). - Install the CoC engine from [here](https://github.com/neoclide/coc.nvim).
- Issue `:CocConfig` from within your Vim editor, and the following snippet: - Issue `:CocConfig` from within your Vim editor, and the following snippet:
```json ```json
{ {
"languageserver": { "languageserver": {

View File

@ -34,7 +34,7 @@ pub fn config(step: *std.build.Step) anyerror!void {
std.debug.warn("Successfully saved configuration options!\n", .{}); 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", .{}); std.debug.warn("\n", .{});
switch (editor) { 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. \\To use ZLS in Kate, enable `LSP client` plugin in Kate settings.
\\Then, add the following snippet to `LSP client's` user settings: \\Then, add the following snippet to `LSP client's` user settings:
\\(or paste it in `LSP client's` GUI settings) \\(or paste it in `LSP client's` GUI settings)
\\
\\{{ \\{{
\\ "servers": {{ \\ "servers": {{
\\ "zig": {{ \\ "zig": {{
@ -82,8 +83,9 @@ pub fn config(step: *std.build.Step) anyerror!void {
std.debug.warn( 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'. \\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: \\Then, simply issue cmd from Neovim/Vim8 `:CocConfig`, and add this to your CoC config:
\\
\\{{ \\{{
\\ "lanuageserver": {{ \\ "languageserver": {{
\\ "zls" : {{ \\ "zls" : {{
\\ "command": "command_or_path_to_zls", \\ "command": "command_or_path_to_zls",
\\ "filetypes": ["zig"] \\ "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 "<path to zls>")
\\ :major-modes '(zig-mode)
\\ :server-id 'zls))
, .{});
},
.Other => { .Other => {
std.debug.warn( std.debug.warn(
\\We might not *officially* support your editor, but you can definitely still use ZLS! \\We might not *officially* support your editor, but you can definitely still use ZLS!

View File

@ -44,7 +44,8 @@ pub const RequestParams = void;
pub const NotificationParams = union(enum) { pub const NotificationParams = union(enum) {
LogMessageParams: LogMessageParams, LogMessageParams: LogMessageParams,
PublishDiagnosticsParams: PublishDiagnosticsParams PublishDiagnosticsParams: PublishDiagnosticsParams,
ShowMessageParams: ShowMessageParams
}; };
/// Hover response /// Hover response
@ -327,11 +328,16 @@ const SymbolKind = enum {
}; };
pub const DocumentSymbol = struct { pub const DocumentSymbol = struct {
name: []const u8, name: String,
detail: ?[]const u8 = null, detail: ?String = null,
kind: SymbolKind, kind: SymbolKind,
deprecated: bool = false, deprecated: bool = false,
range: Range, range: Range,
selectionRange: Range, selectionRange: Range,
children: []DocumentSymbol = &[_]DocumentSymbol{} children: []DocumentSymbol = &[_]DocumentSymbol{}
}; };
pub const ShowMessageParams = struct {
@"type": MessageType,
message: String
};