Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Malib Language SupportNew to Visual Studio Code? Get it now.
Malib Language Support

Malib Language Support

Natan BL

|
1 install
| (0) | Free
Syntax highlighting and editor basics for the Malib text analysis language.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Malib Language Support

VS Code language support for Malib scripts.

Features

  • Syntax highlighting for .malib files.
  • Line and block comments.
  • Strings and supported escape sequences.
  • Core commands such as read columns, split chars, comment line, comment line at, comment block, match index, match case, span max, debug, coverage, string quotes, string multiline, param, const, let, flag, if, for, print, push, pop, clear, ruleset, analyzer, run, and when.
  • Lifecycle and scoped blocks such as before, after, tokenizer, and local let.
  • Relative rules with before when and after when.
  • Rule gates with @requires(_flag, !_other_flag).
  • when pattern items such as cap, push, in, as, at, int, real, string, span_until, max, any, opt, not, mask, line_end, and line_gap.
  • Single-quoted Malib values and double-quoted source-token patterns.
  • Arithmetic operators for runtime counters.
  • Runtime properties and methods such as .count, .columns, .last, .mid(...), .trim, .contains(...), .replace(...), .split_protected(...), source.*, global.*, and match.*.
  • Iteration forms such as for item, idx in list, for ... reverse, for i from a to b, and for i from a until b.
  • Analyzer runs such as run analyzer name from text value with { ... } and run analyzer name in match.
  • Scan-control commands such as cut, cut first, cut range, and cut all.
  • Transformation commands such as replace match with, delete range, insert before, and insert after.
  • Host value functions such as read_file, read_lines, and read_csv.
  • Semantic token highlighting layered on top of TextMate scopes for real symbol meaning: functions, variables, params, flags, consts, loop indices, captures, properties, methods, keywords, and decorators.
  • Snippets for common Malib commands and blocks.
  • Hover documentation for reserved words, commands, pattern items, built-ins, and runtime properties.
  • Symbol hover for param, let, const, flag, captures, fun, and ruleset declarations.
  • Go to definition for local variables, constants, flags, functions, captures, and rulesets.
  • Rename symbol support with F2 for known Malib symbols in the current document.
  • Basic completions for language keywords and symbols declared in the current document.
  • Inlay hints for function call arguments and for loop item/index variables.
  • Folding ranges for Malib brace blocks such as ruleset, analyzer, fun, when, if, for, before, after, and tokenizer.
  • Document and selection formatting with conservative two-space indentation.
  • Hierarchical document outline for params, flags, values, functions, rulesets, analyzers, lifecycle blocks, and when rules.
  • Signature help for call function_name(...), plus ruleset/analyzer parameter hints during run expressions.
  • Basic diagnostics for call, run, run analyzer, ref, @requires, flag declarations, const reassignment, unknown assignment targets, collection references, relative before when/after when, and match transformation commands such as cut, replace match, delete range, and insert.
  • Quick fixes for common diagnostics, including flag naming, run versus call, analyzer runs, const reassignment, missing variable declarations, and missing @requires flags.

Local Development

Open editors/vscode-malib in VS Code and run the extension development host.

Run the extension test suite from this folder with:

npm test

The extension is intentionally editor-facing only. Malib parser, compiler, runtime, and diagnostics stay in matlalib-core.

Use examples/full-syntax.malib as the living syntax fixture for highlighting decisions. When the Malib language grows, update that file first or alongside the grammar, then verify that the TextMate scopes still highlight the complete syntax shape.

The test suite also covers productive migration fixtures:

  • comparison/cases/004-validaciones-estaticas/malib/validaciones_estaticas.malib
  • comparison/cases/005-codigo-muerto/malib/program.malib

Packaging

Before packaging or publishing, run:

npm test
npm run package

To publish to the Visual Studio Marketplace, make sure the publisher field in package.json matches your Marketplace publisher id, then run:

npm run publish

Example

read columns 7..72
split chars ".(),;:"
comment line "//"
comment block "/*" "*/"
string quotes "'\""
match case insensitive
debug off
coverage on

const reserved_words = ['IF', 'ELSE', 'PERFORM']
flag _in_procedure = off
let found = 'NO'
let dsn_names = []
let last_dsn = ''

match index off

ruleset cobol_scan {
  debug on {
    tokens: true
    matches: true
    variables: ['found']
  }

  when (in reserved_words cap keyword) {
    found = 'SI'
    push dsn_names, keyword
  }
}

when ("TO" cap destino) {
  before when ("MOVE" cap origen) {
    found = 'SI'
    push dsn_names, origen
  }
}

run cobol_scan
pop dsn_names into last_dsn
pop dsn_names
print last_dsn, dsn_names.count
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft