code

code opens writable source files in the browser editor, detects syntax from the file name and can create a missing file with -n. Syntax highlighting is optional; plain editing still works without the enhanced editor assets.

DevelopmentVersion 1.3.6Stable
lil-terminal

Overview

For source work where syntax matters, code gives you the editor without turning opening a file into execution. Language detection handles the usual case; an explicit language is useful for generated files or unusual extensions.

Edit source without leaving the browser

Opening code sandbox/src/Calculator.php edits that file in place. Use -n only when creation is intentional, and choose -l <lang> when the file name does not describe its syntax. edit remains the simpler choice for plain text.

Syntax

lil-terminal
code <file> [-n] [-l <lang>|-<lang>]

Reference

code <file>

open a file in the code editor

-n

create a missing file before opening it

-l <lang> | -<lang>

select php, html, xml, css, js, json, ini, md, py, sql, sh or lil highlighting

include -code -i @include

inspect the automatically managed editor interface package

include -code -u @include

remove optional editor assets without removing code

help hotkeys

show editor keyboard shortcuts

Choosing the editor

Use code <file> when syntax context helps you review a source file. For a quick change to ordinary text, edit <file> is the smaller editor. Opening either editor never executes the file.

Language detection

The language is inferred from the file name and extension. .env files use INI highlighting. Unknown formats open as plain text. Use -l <lang> when a generated file or unusual extension needs a specific highlighter.

File rules

Only regular, readable and writable text files can be edited. Binary files are rejected. A file may be at most 2 MiB and 100000 lines. With -n, the parent directory must already exist and be writable.

Interactive sandbox preview

Run the prepared examples directly on the page. Their results are prebuilt and shown in the browser; no terminal command is executed on the server.

Open a file in the code editor

Install and manage

Install the current compatible version. Choose Base for the complete feature set or Minimum for the reduced package; use upgrade to update a module that is already installed.

Base and Minimum are two packages of the same current module release, not separate command versions.

Base package

Install the complete package with local command reference and every published mode.

install code
Minimum package

Install the reduced package. Local reference is omitted; help <cmd> -i opens the current server reference.

install code -m
Exact public version

Install exactly this published version.

install code -v 1.3.6
Check or update

Ask upgrade to check compatibility and replace the installed block only when needed.

upgrade code
Remove module

Remove the extension block while leaving the core and unrelated modules intact.

install code -u

Examples

Examples are copyable command lines, not actions executed by this website. Review paths, permissions and destructive flags before running them on a real project.

Open a file in the code editor
cd \sandbox | code src/Calculator.php
File      sandbox/src/Calculator.php
Language  php
Editor    opened
Create a missing file before opening it
code \sandbox\tmp\review.js -n
File      sandbox/tmp/review.js
Language  js
New       yes
Editor    opened
Select php, html, xml, css, js, json, ini, md, py, sql, sh or lil highlighting
code \sandbox\config\app.json -json
File      sandbox/config/app.json
Language  json
Mode      forced
Editor    opened
Select php, html, xml, css, js, json, ini, md, py, sql, sh or lil highlighting
code \sandbox\scripts\demo.lil -l lil
File      sandbox/scripts/demo.lil
Language  lil
Mode      explicit
Editor    opened
Inspect the automatically managed editor interface package
include -code -i
Package     code
Version     1.0
Components  css + js
Installed   yes

These commands install the optional editor assets. The code command still has a safe basic-editor fallback when they are absent.

Handle a missing source file
code \sandbox\missing.php
File not found

File used in this example: sandbox/src/Calculator.php

The example uses a file or directory from the protected /sandbox/ documentation workspace.

<?php

declare(strict_types=1);

final class Calculator
{
    public static function add(int $left, int $right): int
    {
        return $left + $right;
    }
}

Related documentation

Current public release

v1.3.62026-08-10

Language synchronization

Finalizes Local and Server Help synchronization and localization safety for code.