stan-language-server 0.3.2 → 0.4.2

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 +46 -44
  2. package/package.json +6 -5
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).
@@ -107,10 +99,20 @@ Assuming you are using [stan-ts-mode](https://github.com/WardBrian/stan-ts-mode)
107
99
  and add the following to your `init.el`:
108
100
 
109
101
  ```elisp
110
- ; elgot is built in to emacs 29+, but a similar config would work for lsp-mode
111
- (with-eval-after-load 'eglot
112
- (add-to-list 'eglot-server-programs
113
- '(stan-ts-mode . ("/YOUR/PATH/TO/stan-language-server" "--stdio"))))
102
+ ; elgot is built in to emacs 29+, but some features work better if you use the
103
+ ;; latest version from GNU ELPA
104
+ (require 'package)
105
+ (add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/") t)
106
+ (package-initialize)
107
+
108
+ (use-package eglot
109
+ :ensure t
110
+ :demand t
111
+ :pin gnu
112
+ :hook (stan-ts-mode . eglot-ensure)
113
+ :config
114
+ (add-to-list 'eglot-server-programs '(stan-ts-mode .
115
+ ("PATH/TO/stan-language-server" "--stdio"))))
114
116
  ```
115
117
 
116
118
 
@@ -137,6 +139,6 @@ bun test
137
139
 
138
140
  To run end-to-end tests:
139
141
  ```bash
140
- pip install pytest pytest-lsp
141
- bun build:binary && pytest tests/
142
+ bun test:e2e
142
143
  ```
144
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stan-language-server",
3
- "version": "0.3.2",
3
+ "version": "0.4.2",
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",
@@ -48,6 +48,7 @@
48
48
  "scripts": {
49
49
  "build": "bun build src/server/index.ts --outdir dist/server --packages external --target browser --format esm && tsc --emitDeclarationOnly --outDir dist",
50
50
  "build:binary": "bun build src/server/cli.ts --drop=console --compile --outfile bin/stan-language-server",
51
+ "build:bin-package": "bun run scripts/build-bin-package.ts",
51
52
  "prepublishOnly": "bun run build",
52
53
  "version:set": "bun run scripts/set-version.ts",
53
54
  "publish:npm": "npm publish --access public --provenance",
@@ -67,10 +68,10 @@
67
68
  },
68
69
  "devDependencies": {
69
70
  "@types/bun": "latest",
70
- "@types/node": "25.0.8",
71
- "@typescript-eslint/eslint-plugin": "8.53.0",
72
- "@typescript-eslint/parser": "8.53.0",
73
- "eslint": "9.39.2",
71
+ "@types/node": "25.5.0",
72
+ "@typescript-eslint/eslint-plugin": "8.57.1",
73
+ "@typescript-eslint/parser": "8.57.1",
74
+ "eslint": "10.0.3",
74
75
  "typescript": "5.9.3"
75
76
  },
76
77
  "dependencies": {