emacs-lsp-proxy 0.7.2 → 0.8.0

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 +188 -0
  2. package/package.json +6 -6
package/README.md CHANGED
@@ -32,6 +32,34 @@ npm install -g emacs-lsp-proxy
32
32
 
33
33
  This will automatically install the appropriate binary for your platform (Linux x64/ARM64, macOS x64/ARM64, Windows x64) and make the `emacs-lsp-proxy` command available in your PATH.
34
34
 
35
+ ### Nix Flake
36
+ If you use Nix, you can build an optimized binary directly from the repository:
37
+
38
+ ```bash
39
+ # Build and run directly
40
+ nix run github:jadestrong/lsp-proxy
41
+
42
+ # Build and install to your profile
43
+ nix profile install github:jadestrong/lsp-proxy
44
+
45
+ # Or build locally if you've cloned the repo
46
+ nix build
47
+ ./result/bin/emacs-lsp-proxy --version
48
+ ```
49
+
50
+ You can add it as a flake input in your NixOS/home-manager configuration:
51
+
52
+ ```nix
53
+ # flake.nix
54
+ {
55
+ inputs.lsp-proxy.url = "github:jadestrong/lsp-proxy";
56
+
57
+ outputs = { self, nixpkgs, lsp-proxy, ... }: {
58
+ # Then use lsp-proxy.packages.${system}.default wherever you need it
59
+ };
60
+ }
61
+ ```
62
+
35
63
  ### Manually
36
64
  Before installing LSP-PROXY manually, you should install rust and cargo first.
37
65
 
@@ -743,6 +771,166 @@ For specialized setups, you can extend the language mapping:
743
771
  | Wrong language server started | Check `lsp-proxy-org-babel-language-map` for correct mapping |
744
772
  | Edit buffer not getting LSP | Verify `lsp-proxy-org-edit-special-enable-lsp` is `t` |
745
773
 
774
+ ## Remote Development
775
+
776
+ LSP-Proxy supports transparent remote development over SSH via Emacs TRAMP. When you open a TRAMP file, the local lsp-proxy process checks whether a compatible binary exists on the remote host, starts a remote server process, and routes all LSP traffic through the SSH tunnel. Binary deployment is controlled by `lsp-proxy-remote-deploy-mode` — either manually on demand or automatically in the background.
777
+
778
+ ### How It Works
779
+
780
+ 1. You open a file with a TRAMP path (e.g., `/ssh:myserver:/home/user/project/main.rs`)
781
+ 2. lsp-proxy detects the `/ssh:` prefix and establishes an SSH ControlMaster connection
782
+ 3. It checks whether `emacs-lsp-proxy` is available in the remote PATH; if the version matches, it is used directly without uploading any file
783
+ 4. If the global command is absent or has a version mismatch, lsp-proxy checks the fixed deploy path (`lsp-proxy-remote-binary-path`). If neither location has a matching binary, deployment is triggered according to `lsp-proxy-remote-deploy-mode` (see [Binary Deployment](#binary-deployment))
784
+ 5. The remote binary is started with `--remote-server`; LSP traffic is forwarded through the tunnel
785
+ 6. From Emacs's perspective, everything works the same as a local buffer
786
+
787
+ ### Supported TRAMP Methods
788
+
789
+ | TRAMP path form | Description |
790
+ |---|---|
791
+ | `/ssh:host:/path` | SSH config alias (user resolved via `~/.ssh/config`) |
792
+ | `/ssh:user@host:/path` | Explicit username |
793
+ | `/ssh:user@host#port:/path` | Custom SSH port |
794
+ | `/rpc:user@host:/path` | RPC tunnel (alternative to ssh method) |
795
+
796
+ ### Prerequisites
797
+
798
+ - SSH access to the remote host (password-less key auth recommended)
799
+ - The local `emacs-lsp-proxy` binary must be compatible with the remote host's architecture (Linux x86-64 or ARM64)
800
+ - The remote user needs write permission to the deploy directory (default: `~/.cache/emacs/lsp-proxy/`)
801
+
802
+ ### Basic Usage
803
+
804
+ No special configuration is required. Enable `lsp-proxy-mode` normally, then open any TRAMP file:
805
+
806
+ ```elisp
807
+ ;; In your init file — same hook as local files
808
+ (add-hook 'typescript-ts-mode-hook #'lsp-proxy-mode)
809
+ ```
810
+
811
+ ```elisp
812
+ ;; Open a remote file — lsp-proxy-mode activates automatically
813
+ (find-file "/ssh:myserver:/home/user/project/main.rs")
814
+ ```
815
+
816
+ lsp-proxy handles binary deployment and tunnel setup on first access. Subsequent files on the same host reuse the existing SSH connection.
817
+
818
+ ### Customization
819
+
820
+ ```elisp
821
+ ;; Change where the binary is deployed on the remote host
822
+ ;; Default: "~/.cache/emacs/lsp-proxy/emacs-lsp-proxy"
823
+ (setq lsp-proxy-remote-binary-path "/opt/tools/emacs-lsp-proxy")
824
+
825
+ ;; Deploy mode: 'manual (default) or 'auto
826
+ (setq lsp-proxy-remote-deploy-mode 'manual)
827
+ ```
828
+
829
+ ### Binary Deployment
830
+
831
+ When the binary check fails (missing or version mismatch on both the global command and the deploy path), lsp-proxy behaves according to `lsp-proxy-remote-deploy-mode`.
832
+
833
+ #### `manual` (default)
834
+
835
+ lsp-proxy prints a hint in the minibuffer and waits for you to act:
836
+
837
+ ```text
838
+ [lsp-proxy] Remote binary unavailable on myserver (…). Run M-x lsp-proxy-remote-deploy to deploy v0.7.2 to ~/.cache/…
839
+ ```
840
+
841
+ Run `M-x lsp-proxy-remote-deploy` to open the `*lsp-proxy-deploy*` buffer. It shows the check result for both locations, then asks for confirmation before uploading:
842
+
843
+ ```text
844
+ Deploy log — myserver [manual] (started 2026-05-19 10:30:00)
845
+ ------------------------------------------------------------
846
+
847
+ [10:30:00] Checking remote binary...
848
+
849
+ [10:30:01] Local version : 0.7.2
850
+ [10:30:01] Deploy path : ~/.cache/emacs/lsp-proxy/emacs-lsp-proxy
851
+
852
+ [10:30:01] Global command (emacs-lsp-proxy): ✗ not found in PATH
853
+ [10:30:01] Deploy path (~/.cache/…): ✗ not found
854
+
855
+ [10:30:01] Binary not available or outdated. Deploy required.
856
+ ```
857
+
858
+ Confirm the `[lsp-proxy] Deploy v0.7.2 to myserver?` prompt and the upload begins, with each step appended to the same buffer. Re-open the remote file once the deploy succeeds.
859
+
860
+ #### `auto`
861
+
862
+ lsp-proxy starts the upload immediately as soon as the check fails, streaming each step to the `*lsp-proxy-deploy*` buffer so you can follow along without doing anything:
863
+
864
+ ```text
865
+ Deploy log — myserver [auto] (started 2026-05-19 10:30:00)
866
+ ------------------------------------------------------------
867
+
868
+ [10:30:00] Binary unavailable (…). Starting automatic deploy of v0.7.2...
869
+ [10:30:00] Target path: ~/.cache/emacs/lsp-proxy/emacs-lsp-proxy
870
+ [10:30:00] Starting upload...
871
+ [10:30:01] Checking global emacs-lsp-proxy on remote (need v0.7.2)...
872
+ [10:30:01] Global emacs-lsp-proxy not found in remote PATH.
873
+ [10:30:01] Checking ~/.cache/emacs/lsp-proxy/emacs-lsp-proxy...
874
+ [10:30:01] Uploading /usr/local/bin/emacs-lsp-proxy (8388608 bytes)...
875
+ [10:30:04] Upload complete, verifying...
876
+ [10:30:04] ✓ Deploy succeeded. Binary: ~/.cache/emacs/lsp-proxy/emacs-lsp-proxy
877
+ ```
878
+
879
+ Re-open the remote file once the deploy completes.
880
+
881
+ #### `M-x lsp-proxy-remote-deploy`
882
+
883
+ This command is always available regardless of the deploy mode. It runs the full check-and-deploy flow interactively, defaulting to the host that most recently requested a deploy. Use it to re-deploy after a version upgrade or to recover from a failed auto-deploy.
884
+
885
+ ### Diagnostics
886
+
887
+ **Connection status** — run `M-x lsp-proxy-doctor` and check the **Remote Connection Status** section:
888
+
889
+ | Field | Meaning |
890
+ |---|---|
891
+ | `Binary Path` | Command or path actually used (`emacs-lsp-proxy` if the global command was selected, otherwise the deploy path) |
892
+ | `Deploy Status` | `deployed`, `missing`, `version_mismatch`, or `unknown` |
893
+ | `Local Version` | Version of your local lsp-proxy binary |
894
+ | `Remote Version` | Version reported by the remote binary |
895
+
896
+ **Check the remote binary manually** — verify which binary is in use and its version:
897
+
898
+ ```bash
899
+ # Global command (preferred when available)
900
+ ssh myserver 'emacs-lsp-proxy --version'
901
+
902
+ # Deployed binary at the default path
903
+ ssh myserver '~/.cache/emacs/lsp-proxy/emacs-lsp-proxy --version'
904
+ ```
905
+
906
+ **View the remote log** — each server start creates a new timestamped log file next to the binary (`~/.cache/emacs/lsp-proxy/remote-server-YYYYMMDD-HHMMSS.log`). First set the log level so output is written, then open the remote file to trigger a fresh start:
907
+
908
+ ```elisp
909
+ (setq lsp-proxy-log-level 2)
910
+ ```
911
+
912
+ ```bash
913
+ # Print the latest log
914
+ ssh myserver 'ls -t ~/.cache/emacs/lsp-proxy/remote-server-*.log | head -1 | xargs cat'
915
+
916
+ # Follow in real time while reproducing the issue
917
+ ssh myserver 'ls -t ~/.cache/emacs/lsp-proxy/remote-server-*.log | head -1 | xargs tail -f'
918
+
919
+ # Clean up old logs, keeping the 5 most recent
920
+ ssh myserver 'ls -t ~/.cache/emacs/lsp-proxy/remote-server-*.log | tail -n +6 | xargs rm -f'
921
+ ```
922
+
923
+ ### Troubleshooting
924
+
925
+ | Issue | Solution |
926
+ |---|---|
927
+ | Remote binary missing, no prompt shown | Check `lsp-proxy-remote-deploy-mode`; in `manual` mode the hint appears in the minibuffer — run `M-x lsp-proxy-remote-deploy` |
928
+ | Deploy fails with permission error | Ensure the remote directory is writable; set `lsp-proxy-remote-binary-path` to a writable path |
929
+ | Binary architecture mismatch | Cross-platform deploy is not supported; the local binary must match the remote OS/arch |
930
+ | SSH connection times out | Configure `ServerAliveInterval` / `ServerAliveCountMax` in `~/.ssh/config` |
931
+ | Remote LSP not starting | Set `lsp-proxy-log-level` to `2`, reopen the file, check the log for SSH/deploy errors |
932
+ | Features stop working after reconnect | Run `M-x lsp-proxy-restart` to re-establish the remote session |
933
+
746
934
  ## Acknowledgements
747
935
  Thanks to [Helix](https://github.com/helix-editor/helix), the architecture of Lsp-Proxy Server is entirely based on Helix's implementation. Language configuration and communication with different language servers are all dependent on Helix. As a Rust beginner, I've gained a lot from this approach during the implementation.
748
936
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emacs-lsp-proxy",
3
- "version": "0.7.2",
3
+ "version": "0.8.0",
4
4
  "scripts": {
5
5
  "postinstall": "node ./install.js"
6
6
  },
@@ -20,11 +20,11 @@
20
20
  ],
21
21
  "author": "jadestrong",
22
22
  "optionalDependencies": {
23
- "@emacs-lsp-proxy/darwin-x64": "0.7.2",
24
- "@emacs-lsp-proxy/darwin-arm64": "0.7.2",
25
- "@emacs-lsp-proxy/linux-x64": "0.7.2",
26
- "@emacs-lsp-proxy/linux-arm64": "0.7.2",
27
- "@emacs-lsp-proxy/win32-x64": "0.7.2"
23
+ "@emacs-lsp-proxy/darwin-x64": "0.8.0",
24
+ "@emacs-lsp-proxy/darwin-arm64": "0.8.0",
25
+ "@emacs-lsp-proxy/linux-x64": "0.8.0",
26
+ "@emacs-lsp-proxy/linux-arm64": "0.8.0",
27
+ "@emacs-lsp-proxy/win32-x64": "0.8.0"
28
28
  },
29
29
  "license": "ISC",
30
30
  "description": "An LSP client for Emacs implemented in Rust."