Skip to content

Editor Setup

tyc lsp runs as a Language Server on stdio and speaks the standard LSP protocol. Every LSP-aware editor can use it for diagnostics, hover, go-to-definition, completion, and the “Remove unused import” code action.

The reference VS Code extension lives in editors/vscode/. Other editors need a small adapter — examples below.

VS Code (reference extension)

  1. Build the extension:

    Terminal window
    cd Typhon/editors/vscode
    npm install
    npm run package # produces typhon-X.Y.Z.vsix
  2. Install it:

    Terminal window
    code --install-extension typhon-*.vsix
  3. Open any .ty file. You should see:

    • Syntax highlighting (let, mut, interface, model, etc. are highlighted).
    • Diagnostics on save (and on type, with a brief debounce).
    • Hover for binding kind + mutability.
    • Go-to-definition.
    • Completion (visible bindings, Typhon keywords, common Python builtins).
    • “Remove unused import” quick-fix on tyc::unused_import warnings.

Extension settings

Open VS Code settings (Cmd / Ctrl + ,) and search “Typhon”:

SettingDefaultPurpose
typhon.lsp.pathtycPath to the tyc binary. Set if tyc is not on the editor’s PATH.
typhon.lsp.trace.serveroffLSP request/response trace. verbose is useful for debugging.
typhon.format.onSavefalseRun tyc fmt on save.

Troubleshooting

  • LSP doesn’t start. Open View → Output → Typhon. The extension logs the tyc lsp invocation; if tyc isn’t on the PATH the editor process sees, set typhon.lsp.path to an absolute path.
  • Diagnostics seem stale. tyc lsp republishes on did_change. If you see staleness, save the file (Cmd / Ctrl + S) and check the Output panel for errors.

Neovim

Two routes: built-in vim.lsp.start_client (Neovim 0.11+) or the nvim-lspconfig plugin.

Add a custom server entry to your Neovim config. Example with lazy.nvim:

require("lspconfig.configs").typhon = {
default_config = {
cmd = { "tyc", "lsp" },
filetypes = { "typhon" },
root_dir = require("lspconfig.util").root_pattern("typhon.toml"),
settings = {},
},
}
require("lspconfig").typhon.setup({})
vim.filetype.add({ extension = { ty = "typhon", dty = "typhon" } })

Syntax highlighting

Treesitter doesn’t yet ship a Typhon grammar. As a workable approximation, use the Python grammar (the syntax is close enough):

vim.treesitter.language.register("python", "typhon")

Or write minimal Vim regex highlighting in after/syntax/typhon.vim. A full Treesitter grammar is on the roadmap.

Helix

Add to ~/.config/helix/languages.toml:

[[language]]
name = "typhon"
scope = "source.typhon"
file-types = ["ty", "dty"]
roots = ["typhon.toml"]
language-servers = ["tyc"]
indent = { tab-width = 4, unit = " " }
comment-token = "#"
[language-server.tyc]
command = "tyc"
args = ["lsp"]

Use the Python grammar for highlighting until a dedicated grammar ships:

[[language]]
name = "typhon"
# ... fields above ...
grammar = "python"

Zed

Zed picks up LSP servers via extensions. A community extension can wrap tyc lsp; the minimal extension.toml:

id = "typhon"
name = "Typhon"
version = "0.1.0"
schema_version = 1
authors = ["You <you@example.com>"]
description = "Typhon language support"
[language_servers.typhon]
name = "Typhon"
language = "Typhon"

…plus a tiny Rust adapter that returns ["tyc", "lsp"] for the language-server command. See Zed’s extension docs.

Emacs

Using lsp-mode:

(require 'lsp-mode)
(add-to-list 'auto-mode-alist '("\\.ty\\'" . python-mode))
(add-to-list 'auto-mode-alist '("\\.dty\\'" . python-mode))
(with-eval-after-load 'lsp-mode
(add-to-list 'lsp-language-id-configuration '(typhon-mode . "typhon"))
(lsp-register-client
(make-lsp-client
:new-connection (lsp-stdio-connection '("tyc" "lsp"))
:activation-fn (lsp-activate-on "typhon")
:server-id 'tyc-lsp)))
(add-hook 'python-mode-hook 'lsp)

Or with eglot:

(with-eval-after-load 'eglot
(add-to-list 'eglot-server-programs '(python-mode . ("tyc" "lsp"))))

Sublime Text

Install LSP via Package Control. Add to Preferences → Package Settings → LSP → Settings:

{
"clients": {
"typhon": {
"enabled": true,
"command": ["tyc", "lsp"],
"selector": "source.python",
"schemes": ["file"]
}
},
"auto_show_diagnostics_panel": "always"
}

Then map .ty and .dty to Python syntax in Settings → Syntax → Open All with Current Extension As.

What the LSP supports today

FeatureStatus
Diagnostics on did_open / did_change✅
Hover (binding kind + mutability)✅
Go-to-definition (in-file + cross-file via Salsa resolved_module query)✅
Completion (visible bindings + Typhon keywords + common builtins)✅
“Remove unused import” code action✅
Document symbols⏳ planned
Workspace symbols⏳ planned
Find references⏳ planned
Rename symbol⏳ planned
Inlay hints⏳ planned
Semantic tokens (full-document; newtype as class, class-body fields as property)✅
Formatting (textDocument/formatting)⏳ not provided by the LSP — run tyc fmt from a pre-commit hook or an editor task

Track the LSP-specific items in the roadmap.

Where next

  • tyc lsp — what the language server does, under the hood.
  • Reading Diagnostics — how Typhon’s miette-rendered errors are structured.
  • tyc fmt — the formatter, if you want pre-commit hook integration.