plum

#treesitter#compiler#wasm

git clone https://git.pyrossh.dev/plum

A statically typed, imperative programming language inspired by rust, python


05f8c38 — Peter John 2026-11-03T15:22:34+05:30
refresh-editors: install native binaries as new files
Files changed (1) hide show
  1. Makefile.toml +11 -3
Makefile.toml CHANGED
@@ -37,13 +37,21 @@ set -e
37
37
  LSP_BIN=target/release/plum-lsp
38
38
  GRAMMAR_SO=target/plum-grammar.so
39
39
 
40
+ # Native code (grammar .so, plum-lsp) must land as a NEW file: macOS caches a
41
+ # binary's code signature per inode, so `cp` over the old file gets the next
42
+ # process that loads it SIGKILLed. Copy beside it, then rename into place.
43
+ install_native() {
44
+ cp "$1" "$2.new.$$"
45
+ mv -f "$2.new.$$" "$2"
46
+ }
47
+
40
48
  HELIX_DIR="${HELIX_RUNTIME_CONFIG:-${XDG_CONFIG_HOME:-$HOME/.config}/helix}"
41
49
  if [ -f "$HELIX_DIR/languages.toml" ]; then
42
50
  mkdir -p "$HELIX_DIR/runtime/grammars"
43
- cp "$GRAMMAR_SO" "$HELIX_DIR/runtime/grammars/plum.so"
51
+ install_native "$GRAMMAR_SO" "$HELIX_DIR/runtime/grammars/plum.so"
44
52
  mkdir -p "$HELIX_DIR/runtime/queries/plum"
45
53
  cp plum-tooling/tree-sitter-plum/queries/plum/*.scm "$HELIX_DIR/runtime/queries/plum/"
46
- cp "$LSP_BIN" "$HELIX_DIR/plum-lsp"
54
+ install_native "$LSP_BIN" "$HELIX_DIR/plum-lsp"
47
55
  chmod +x "$HELIX_DIR/plum-lsp"
48
56
  echo "refreshed $HELIX_DIR/runtime/grammars/plum.so"
49
57
  echo "refreshed $HELIX_DIR/runtime/queries/plum"
@@ -59,7 +67,7 @@ for dir_name in .vscode .vscode-insiders; do
59
67
  ext_dir="$HOME/$dir_name/extensions/plum-lang.plum-0.0.1"
60
68
  if [ -d "$ext_dir" ]; then
61
69
  mkdir -p "$ext_dir/server" "$ext_dir/syntaxes"
62
- cp "$LSP_BIN" "$ext_dir/server/plum-lsp"
70
+ install_native "$LSP_BIN" "$ext_dir/server/plum-lsp"
63
71
  chmod +x "$ext_dir/server/plum-lsp"
64
72
  cp plum-tooling/vscode-plum/syntaxes/plum.tmLanguage.json "$ext_dir/syntaxes/"
65
73
  cp plum-tooling/vscode-plum/language-configuration.json "$ext_dir/"