@ghul/language-server 1.23.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,93 @@
1
+ # ghūl language server
2
+
3
+ Language server for the [ghūl programming language](https://ghul.dev), for any
4
+ editor that speaks LSP.
5
+
6
+ This is the same server the [VS Code extension](https://marketplace.visualstudio.com/items?itemName=degory.ghul)
7
+ runs, packaged to be launched directly. VS Code users do not need it: install
8
+ the extension instead.
9
+
10
+ ## Requirements
11
+
12
+ - Node.js 20 or later, to run the server itself.
13
+ - The .NET SDK, and a ghūl project whose `.config/dotnet-tools.json` pins
14
+ `ghul.compiler`. The server restores and drives that compiler in analysis
15
+ mode; it does no analysis of its own.
16
+
17
+ ## Install
18
+
19
+ ```sh
20
+ npm install -g ghul-language-server
21
+ ```
22
+
23
+ Or download `ghul-language-server-<version>.tgz` from a
24
+ [release](https://github.com/degory/ghul-vsce/releases) and unpack it. The
25
+ contents are under `package/`, and the executable is
26
+ `package/bin/ghul-language-server.js`.
27
+
28
+ ## Run
29
+
30
+ ```sh
31
+ ghul-language-server --stdio
32
+ ```
33
+
34
+ `--node-ipc`, `--socket=<port>` and `--pipe=<name>` also work. With no
35
+ transport argument the server defaults to stdio.
36
+
37
+ The workspace root the client reports must be the directory containing the
38
+ `.ghulproj`, so the server can find the project and its tool manifest.
39
+
40
+ ## Editor configuration
41
+
42
+ ### Neovim
43
+
44
+ ```lua
45
+ vim.filetype.add({ extension = { ghul = "ghul" } })
46
+
47
+ vim.lsp.config.ghul = {
48
+ cmd = { "ghul-language-server", "--stdio" },
49
+ filetypes = { "ghul" },
50
+ root_markers = { "*.ghulproj", ".git" },
51
+ }
52
+
53
+ vim.lsp.enable("ghul")
54
+ ```
55
+
56
+ ### Helix
57
+
58
+ In `languages.toml`:
59
+
60
+ ```toml
61
+ [language-server.ghul]
62
+ command = "ghul-language-server"
63
+ args = ["--stdio"]
64
+
65
+ [[language]]
66
+ name = "ghul"
67
+ scope = "source.ghul"
68
+ file-types = ["ghul"]
69
+ roots = ["*.ghulproj"]
70
+ language-servers = ["ghul"]
71
+ ```
72
+
73
+ ### Emacs (eglot)
74
+
75
+ ```elisp
76
+ (define-derived-mode ghul-mode prog-mode "ghūl")
77
+ (add-to-list 'auto-mode-alist '("\\.ghul\\'" . ghul-mode))
78
+ (with-eval-after-load 'eglot
79
+ (add-to-list 'eglot-server-programs
80
+ '(ghul-mode . ("ghul-language-server" "--stdio"))))
81
+ ```
82
+
83
+ ## Supported requests
84
+
85
+ Completion, hover, definition, declaration, type definition, implementation,
86
+ references, rename, document and workspace symbols, signature help, document
87
+ and range formatting, semantic tokens, inlay hints, quick-fix code actions,
88
+ and diagnostics.
89
+
90
+ Syntax highlighting comes from semantic tokens, so an editor that does not
91
+ request them shows unhighlighted text. There is no TextMate grammar or
92
+ tree-sitter parser in this package; the VS Code extension carries its own
93
+ grammar.
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ // The server picks its transport from the command line. Editors that spawn a
5
+ // language server over a pipe usually pass --stdio explicitly, but not all do,
6
+ // and the underlying library exits with an obscure error when no transport is
7
+ // named at all. Default to stdio so a bare invocation works.
8
+
9
+ const transports = ['--stdio', '--node-ipc'];
10
+ const transport_prefixes = ['--socket=', '--pipe='];
11
+
12
+ const has_transport = process.argv.slice(2).some(argument =>
13
+ transports.includes(argument) ||
14
+ transport_prefixes.some(prefix => argument.startsWith(prefix)));
15
+
16
+ if (!has_transport) {
17
+ process.argv.push('--stdio');
18
+ }
19
+
20
+ require('../out/server.js');