Everything Moxie's own compiler knows, in the editor: syntax highlighting,
snippets for the shapes the language requires, and diagnostics straight from
moxie build. No second grammar to drift - the keyword, builtin and type sets
mirror pkg/token and pkg/types, and diagnostics are the compiler's own
positioned errors.
syntaxes/moxie.tmLanguage.json): keywords per pkg/token/tokens.mx (note what is absent: no go, no fallthrough), the
builtin types (byte/rune as aliases of uint8/int32, no int/uint),
the builtin functions (push, pop, resize, len, cap, copy,
delete, close, clear, min, max, panic, recover, print,
println, spawn), //:build / //:linkname / //export pragmas, and the
names Moxie removed (make, new, append, reflect, any, int,
uint, complex64/128) marked as invalid so their use stands out.
snippets/moxie.json): named returns, pointer receiver methods, sovereign self-mutating types, init() + zero-value globals,
[]T{:n:cap} presizing, mxutil.Ensure before a spread push, a spawn
worker, interface assertions.
moxie build and its errors appear as problems, in place. `Moxie: Build the
package and report diagnostics` (Ctrl+Alt+B) runs it on demand and shows the
full output.
explanation of the Moxie semantics, not the Go one.
func, type, var and constdeclarations (including pointer receiver methods).
VSCodium reads ~/.vscode-oss/extensions/:
mkdir -p ~/.vscode-oss/extensions
rm -rf ~/.vscode-oss/extensions/mleku.moxie-lang-*
cp -r editors/vscode ~/.vscode-oss/extensions/mleku.moxie-lang-1.1.0
Then reload the window. code/codium --install-extension <path>.vsix works
too when the folder is packaged with vsce.
| setting | default | meaning |
|---|---|---|
moxie.path | moxie | the compiler to run; an absolute path to a tree's ./moxie works |
moxie.moxieRoot | (empty) | MOXIEROOT for the compiler; empty means the workspace folder |
moxie.buildOnSave | true | build the package on save for diagnostics |
moxie.buildFlags | [] | extra flags, e.g. -allow-closure-captures |
moxie.trace | off | messages/verbose echoes each build into the Moxie output channel |
The editor could ship its own parser, and then it would disagree with the
compiler about named returns, pointer receivers, string/[]byte, or which
names are predeclared. Running the real compiler keeps the editor honest: what
it underlines is what a build rejects.