Normalizes non-standard code-fence language tags across `docs/**` so a strict highlighter (Shiki, used by Fumadocs) won't fail the build on an unrecognized language, and unifies redundant synonym tags onto one canonical form per language. The current renderer (Speed-Highlight) detects the language from the code content, not the fence label, so this drift wasn't visible until now. ## Changes - `hcl` -> `tf` (199 fences, including indented ones nested in numbered/bulleted lists). Shiki ships `hcl` and `terraform` as two distinct grammars (not aliases); every `hcl`-tagged fence in `docs/**` is actually Terraform resource/data/provider syntax, so the more specific `terraform` grammar is correct for all of them. `tf` is Shiki's own alias for that grammar, and it's also what GitHub's own markdown renderer resolves to the same HCL/Terraform highlighting. - `pwsh`/`powershell` -> `ps1`. Both `ps` and `ps1` are registered PowerShell aliases in Shiki, but on GitHub's renderer only `.ps1` is a registered file extension (`.ps` isn't), so `ps1` renders identically to `powershell` there today while bare `ps` would silently lose highlighting. - `env` -> `dotenv` (a dedicated Shiki grammar for `KEY=VALUE` files) - `text`/`output`/`none`/`url` -> `txt`. Same built-in plain-text fallback either way, just shorter. - `Dockerfile` -> `dockerfile` (lowercase) - `bash`/`shell` -> `sh` (732 fences). Shiki and GitHub both alias all three to a single shell grammar; this was already the style guide's stated preference, just not enforced across the existing corpus until now. - `markdown` -> `md` (4 fences). Alias of the same grammar in both Shiki and GitHub. - `jsonc` -> `json` (1 fence). The block has no comments or trailing commas, so it doesn't need the comments-capable grammar. - `ts` -> `tsx` (2 fences, `docs/about/contributing/frontend.md`). Verified the actual content tokenizes identically under both grammars, and a sibling block in the same file already needs `tsx` for real JSX, so unifying to one tag is safe for this file. Documented a caveat: `tsx` mis-tokenizes the legacy angle-bracket type-assertion syntax (`<Type>value`), which is invalid in real `.tsx` files anyway, so use `value as Type` instead. - `yml` -> `yaml` (1 fence) - Updated `docs/.style/style-guide/formatting.md` to document all canonical tags `promql` (2 fences) and `caddyfile` (2 fences) are left as-is. Shiki doesn't bundle a grammar for either, so they need a custom grammar registration when the site adopts Shiki, rather than degrading to `txt`. Tracked as follow-up work under DOCS-118 and [DOCS-544](https://linear.app/codercom/issue/DOCS-544/vendor-a-local-promql-grammar-for-shiki-syntax-highlighting) (promql). Does not touch `offlinedocs/`. Linear: [DOCS-476](https://linear.app/codercom/issue/DOCS-476/normalize-docs-code-fence-languages-de-risk-shikifumadocs) <details> <summary>How the fence tags were verified</summary> Each tag was tested against a real `shiki@latest` highlighter instance (`codeToHtml`/`codeToTokens`) and cross-checked against GitHub's `@wooorm/starry-night` grammar sources (the renderer that actually displays these `.md` files today, in repo browsing and PR diffs), since that's what determines whether brevity is safe before Shiki adoption: ```text FAIL env -- Language `env` is not included in this bundle. FAIL Dockerfile -- Language `Dockerfile` is not included in this bundle. FAIL promql -- Language `promql` is not included in this bundle. FAIL caddyfile -- Language `caddyfile` is not included in this bundle. FAIL pwsh -- Language `pwsh` is not included in this bundle. FAIL output -- Language `output` is not included in this bundle. ``` `hcl` doesn't error in Shiki, since it's a real grammar, but that's exactly the trap: it was silently rendering every fence with the generic HCL grammar instead of the Terraform-specific one. Every `hcl`-tagged fence in `docs/**` was manually checked against `origin/main` and is genuinely Terraform content. For `ts`/`tsx`, tokenizing the actual doc content confirmed identical output under both grammars; a synthetic test with the legacy angle-bracket cast syntax confirmed `tsx` degrades on that specific construct, which the style guide now calls out. The first normalization pass only matched fence tags at column 0 (`^```tag$`), missing tags indented inside numbered/bulleted lists. A follow-up pass caught the remaining occurrences at any indentation level. </details> --- *This PR description and the underlying changes were prepared with Coder Agents assistance.*
5.8 KiB
Emacs TRAMP
Emacs TRAMP is a method of running editing operations on a remote server.
Connecting To A Workspace
To connect to your workspace first run:
coder config-ssh
Then you can connect to your workspace by its name in the format:
coder.<WORKSPACE NAME>.
In Emacs type C-x d and then input: /-:coder.<WORKSPACE NAME>: and hit
enter. This will open up Dired on the workspace's home directory.
Using SSH
By default Emacs TRAMP is setup to use SCP to access files on the Coder workspace instance. However you might want to use SSH if you have a jumpbox or some other complex network setup.
To do so set the following in your Emacs init.el file:
(setq tramp-default-method "ssh")
Then when you access the workspace instance via /-:coder.<WORKSPACE NAME>
Emacs will use SSH. Setting tramp-default-method will also tell ansi-term
mode the correct way to access the remote when directory tracking.
Directory Tracking
ansi-term
If you run your terminal in Emacs via ansi-term then you might run into a
problem where while SSH-ed into a workspace Emacs will not change its
default-directory to open files in the directory your shell is in.
To fix this:
-
In your workspace Terraform template be sure to add the following:
data "coder_workspace" "me" { } resource "coder_agent" "main" { # ... env = { name = "CODER_WORKSPACE_NAME" value = data.coder_workspace.me.name } } -
Next in the shell profile file on the workspace (ex.,
~/.bashrcfor Bash and~/.zshrcfor Zsh) add the following:ansi_term_announce_host() { printf '\033AnSiTh %s\n' "coder.$CODER_WORKSPACE_NAME" } ansi_term_announce_user() { printf '\033AnSiTu %s\n' "$USER" } ansi_term_announce_pwd() { printf '\033AnSiTc %s\n' "$PWD" } ansi_term_announce() { ansi_term_announce_host ansi_term_announce_user ansi_term_announce_pwd } cd() { command cd "$@"; ansi_term_announce_pwd; } pushd() { command pushd "$@"; ansi_term_announce_pwd; } popd() { command popd "$@"; ansi_term_announce_pwd; } ansi_term_announceAnsi Term expects the terminal running inside of it to send escape codes to inform Emacs of the hostname, user, and working directory. The above code sends these escape codes and associated data whenever the terminal logs in and whenever the directory changes.
eshell
The eshell mode will perform directory tracking by default, no additional
configuration is needed.
Language Servers (Code Completion)
If you use lsp-mode for code
intelligence and completion some additional configuration is required.
In your Emacs init.el file you must register a LSP client and tell lsp-mode
how to find it on the remote machine using the lsp-register-client function.
For each LSP server you want to use in your workspace add the following:
(lsp-register-client (make-lsp-client :new-connection (lsp-tramp-connection "<LSP SERVER BINARY>")
:major-modes '(<LANGUAGE MODE>)
:remote? t
:server-id '<LANGUAGE SERVER ID>))
This tells lsp-mode to look for a language server binary named
<LSP SERVER BINARY> for use in <LANGUAGE MODE> on a machine named
coder.<WORKSPACE NAME>. Be sure to replace the values between angle brackets:
<LSP SERVER BINARY>: The name of the language server binary, without any path components. For example to use the Deno Javascript language server use the valuedeno.<LANGUAGE MODE>: The name of the Emacs major mode for which the language server should be used. For example to enable the language server for Javascript development use the valueweb-mode.<LANGUAGE SERVER ID>: This is just the name thatlsp-modewill use to refer to this language server. If you are ever looking for output buffers or files they may have this name in them.
Calling the lsp-register-client function will tell lsp-mode the name of the
LSP server binary. However this binary must be accessible via the path. If the
language server binary is not in the path you must modify tramp-remote-path so
that lsp-mode knows in what directories to look for the LSP server. To do this
use TRAMP's connection profiles functionality. These connection profiles let you
customize variables depending on what machine you are connected to. Add the
following to your init.el:
(connection-local-set-profile-variables 'remote-path-lsp-servers
'((tramp-remote-path . ("<PATH TO ADD>" tramp-default-remote-path))))
(connection-local-set-profiles '(:machine "coder.<WORKSPACE NAME>") 'remote-path-lsp-servers)
The connection-local-set-profile-variables function creates a new connection
profile by the name remote-path-lsp-servers. The
connection-local-set-profiles then indicates this remote-path-lsp-servers
connection profile should be used when connecting to a server named
coder.<WORKSPACE NAME>. Be sure to replace <PATH TO ADD> with the directory
in which a LSP server is present.
TRAMP and lsp-mode are fickle friends, sometimes there is weird behavior. If
you find that language servers are hanging in the starting state then
it might be helpful
to set the lsp-log-io variable to t.
More details on configuring lsp-mode for TRAMP can be found
in the lsp-mode documentation.
The
TRAMP tramp-remote-path documentation
contains more examples and details of connection profiles.