stan-language-server 0.4.0 → 0.4.3

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.
Files changed (2) hide show
  1. package/README.md +32 -40
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -21,47 +21,12 @@ or [open-vsx](https://open-vsx.org/extension/wardbrian/vscode-stan-extension).
21
21
 
22
22
  ### Neovim
23
23
 
24
- There are many ways to install language servers in neovim. Here is one (if you have a different or better way, consider contributing it!):
24
+ Download the latest language server executable from [GitHub](https://github.com/tomatitito/stan-language-server/releases) and put it somewhere in your `PATH`.
25
25
 
26
- Download the latest language server executable from [GitHub](https://github.com/tomatitito/stan-language-server/tags) and put it somewhere in your PATH. Then in your `nvim` config folder add `lua/lsp/init.lua` with:
27
- ```lua
28
- local servers = {
29
- stan_ls = "lsp.stan",
30
- }
26
+ #### Neovim 0.11+ (built-in LSP)
31
27
 
32
- local function setup_server(name, config_module)
33
- local config = require(config_module)
34
-
35
- vim.api.nvim_create_autocmd("FileType", {
36
- pattern = config.filetypes,
37
- callback = function()
38
- if #vim.lsp.get_clients({ bufnr = 0, name = name }) > 0 then
39
- return
40
- end
41
-
42
- local root_dir = vim.fs.root(0, config.root_markers)
43
- print(string.format("Starting %s for buffer %d with root: %s", name, vim.api.nvim_get_current_buf(),
44
- root_dir or "none"))
45
-
46
- vim.lsp.start({
47
- name = name,
48
- cmd = config.cmd,
49
- root_dir = root_dir,
50
- initialization_options = config.settings or {},
51
- on_exit = function(code, signal)
52
- print(string.format("%s exited with code %d, signal %d", name, code, signal))
53
- end,
54
- })
55
- end,
56
- })
57
- end
58
-
59
- for server_name, config_path in pairs(servers) do
60
- setup_server(server_name, config_path)
61
- end
62
- ```
28
+ Add `lsp/stan_ls.lua` to your Neovim config directory (e.g., `~/.config/nvim/`):
63
29
 
64
- Then in `lua/lsp/stan.lua` add the following:
65
30
  ```lua
66
31
  return {
67
32
  cmd = { "stan-language-server", "--stdio" },
@@ -74,6 +39,33 @@ return {
74
39
  }
75
40
  ```
76
41
 
42
+ Then enable it:
43
+
44
+ ```lua
45
+ vim.lsp.enable("stan_ls")
46
+ ```
47
+
48
+ #### Older Neovim (with nvim-lspconfig)
49
+
50
+ ```lua
51
+ local lspconfig = require("lspconfig")
52
+ local configs = require("lspconfig.configs")
53
+
54
+ configs.stan_ls = {
55
+ default_config = {
56
+ cmd = { "stan-language-server", "--stdio" },
57
+ filetypes = { "stan" },
58
+ root_dir = lspconfig.util.root_pattern(".git"),
59
+ settings = {
60
+ maxLineLength = 78,
61
+ includePaths = {},
62
+ },
63
+ },
64
+ }
65
+
66
+ lspconfig.stan_ls.setup({})
67
+ ```
68
+
77
69
  ### Zed
78
70
 
79
71
  Install the [Stan extension](https://zed.dev/extensions/stan).
@@ -147,6 +139,6 @@ bun test
147
139
 
148
140
  To run end-to-end tests:
149
141
  ```bash
150
- pip install pytest pytest-lsp
151
- bun build:binary && pytest tests/
142
+ bun test:e2e
152
143
  ```
144
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stan-language-server",
3
- "version": "0.4.0",
3
+ "version": "0.4.3",
4
4
  "description": "Language Server Protocol implementation for the Stan probabilistic programming language",
5
5
  "main": "dist/server/index.js",
6
6
  "module": "src/server/index.ts",