LSP-epher
A calculator language where every statement's answer appears inline, for Sublime Text via the LSP package
Details
Installs
- Total 0
- Win 0
- Mac 0
- Linux 0
| Oct 10 | Oct 9 | Oct 8 | Oct 7 | Oct 6 | Oct 5 | Oct 4 | Oct 3 | Oct 2 | Oct 1 | Sep 30 | Sep 29 | Sep 28 | Sep 27 | Sep 26 | Sep 25 | Sep 24 | Sep 23 | Sep 22 | Sep 21 | Sep 20 | Sep 19 | Sep 18 | Sep 17 | Sep 16 | Sep 15 | Sep 14 | Sep 13 | Sep 12 | Sep 11 | Sep 10 | Sep 9 | Sep 8 | Sep 7 | Sep 6 | Sep 5 | Sep 4 | Sep 3 | Sep 2 | Sep 1 | Aug 31 | Aug 30 | Aug 29 | Aug 28 | Aug 27 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Windows | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| Mac | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
epher for Sublime Text
epher is a calculator language: you write ordinary math, with units
that convert, and every statement's answer appears inline, right next
to the line that produced it. The package is called LSP-epher
because the LSP package resolves its client configuration by that
name.
Download the epher calculator, and a large selection of ready-made scripts from epher.org.
Type a formula and the answer is already there. No runnable repl in a side panel, no print statements: the editor is the calculator.
What you get
- Answers inline: each statement's result renders next to its
line:
x = 40 + 2shows= 42. The LSP package renders inlay hints off by default; the settings section below turns them on. - Units that convert:
6371 km,55 mile/hr,30 degare quantities, not comments.speed in km/hrconverts; the answer carries the right unit. - Live diagnostics: syntax errors point at the exact token, and evaluation errors carry the same message the epher calculator shows.
- Hover signatures: hover any name for its canonical signature; your own functions show their definitions, catalog functions show their docs.
- Completion: the whole catalog (math, astronomy, statistics), your own definitions, keywords, and snippets for the common statement shapes.
- Highlighting: the shared TextMate grammar colors the epher syntax before the server even attaches: comments, strings, numbers, the keywords, and the conservative unit rule. Semantic-token coloring from the server is off by default and needs the two steps under Settings; custom color schemes need one extra rule.
- Running scripts: LSP-epher: Run Script in the command palette (there is no keybinding out of the box: see the suggested one under Settings). The results view beside the script lists one row per statement, error rows in red; every graph the run produced is written as an SVG file under the package storage and opened with the system viewer.
- Unsaved tabs: a buffer that has never been saved works like a file, diagnostics, answers, completion and the run command included, as long as its syntax is epher.
Install
From Package Control, once the package is listed:
- Open the command palette and run Package Control: Install Package.
- Search for LSP and install it. This is a real manual step: Package Control has no way for one package to install another (dependencies there are Python libraries, not packages), so LSP is never pulled in for you.
- Search for LSP-epher and install it.
On first use the package fetches the epher-lsp server for your platform into its Package Storage and starts it for epher views; there is nothing else to install. See “The server binary” below for the manual route, should you prefer to manage it yourself.
From this repository, today: copy or symlink this directory into your
Packages folder under the name LSP-epher (a direct child of
Packages, not inside User):
- linux:
~/.config/sublime-text/Packages/LSP-epher - macOS:
~/Library/Application Support/Sublime Text/Packages/LSP-epher - windows:
%APPDATA%\Sublime Text\Packages\LSP-epher
Then install the LSP package from Package Control. Open any
.epher file: Sublime applies the syntax automatically (the grammar
carries fileTypes), and the LSP package reads
LSP-epher.sublime-settings, downloads the server on first start,
and attaches it to epher views.
The server binary
By default the package manages the binary itself: on the first server
start it downloads epher-lsp for your platform from the matching
epher release into
its Package Storage, unpacks it, and points the client at that copy.
When the package updates, the next start fetches the matching server.
The download is made by the plugin, not a browser, so it carries no
quarantine mark and macOS opens it without asking; this is the whole
reason the default route exists.
To manage the binary yourself instead, set command in
LSP-epher.sublime-settings (Packages/User or the package file): the
package then never downloads anything and starts what you configured.
{ "command": ["/usr/local/bin/epher-lsp"] }
The manual route, for a PATH install:
# linux x86_64 (arm64 and macos-aarch64 analogous)
curl -LO https://github.com/upyesp/epher/releases/latest/download/epher-lsp-linux-x86_64.gz
gunzip epher-lsp-linux-x86_64.gz && mv epher-lsp-linux-x86_64 ~/.local/bin/epher-lsp
chmod +x ~/.local/bin/epher-lsp
# windows (powershell): epher-lsp-windows-x86_64.zip -> epher-lsp.exe
A file saved by curl runs anywhere; the same file saved by a
browser on macOS carries a quarantine mark that Gatekeeper
enforces, and an unsigned binary is refused with “Apple could not
verify”. If that happened, unblock the file once:
xattr -d com.apple.quarantine ~/.local/bin/epher-lsp
or use System Settings, Privacy & Security, “Allow Anyway”. The package's own download never hits this.
Everything runs on your machine after that one download.
Settings
The LSP package ships inlay hints off, so the inline answers need one
setting in Packages/User/LSP.sublime-settings:
{ "show_inlay_hints": true }
If the answers still do not appear, run LSP: Toggle Inlay Hints once from the command palette in that window. The per-window flag is what drives the phantom set in current LSP builds.
Semantic highlighting
Semantic-token coloring is also off by default. In the same file, add:
{ "semantic_highlighting": true }
LSP adds the rule that semantic tokens need to the built-in color schemes itself. With a custom color scheme, add it to that scheme (UI: Customize Color Scheme) or the tokens render with the background they already have:
{
"rules": [
{ "scope": "meta.semantic-token", "background": "#00000101" }
]
}
Two known LSP limitations apply: with highlight_line enabled there
are visible artifacts on highlighted lines, and bold or italic font
styles do not apply to semantic regions.
Suggested keybinding
This package deliberately ships no keybinding, so nothing of yours gets shadowed. To run a script from the keyboard, open Preferences: Key Bindings from the Command Palette and add:
[
{
"keys": ["ctrl+alt+r"],
"command": "lsp_epher_run",
"context": [{ "key": "selector", "operand": "source.epher" }]
}
]
ctrl+alt+r is unbound in Sublime Text 4's default keymaps on Linux,
macOS and Windows.
Requirements
- Sublime Text 4 (build 4132 or newer, the floor the LSP package sets).
- The LSP package from Package Control, installed separately (see
Install), version 2.11 or newer: the client uses LSP's
LspPluginAPI, introduced in that release. - Nothing else: the server binary downloads itself on first start. Managing it by hand is optional (see “The server binary”).
Data and telemetry
None. Everything evaluates on your machine.