This is a VS Code language extension providing syntax highlighting for daScript, a high-performance statically strong typed scripting language designed for embedding in real-time applications like games.
- package.json: Extension manifest defining language contributions and grammars
- language-configuration.json: Language configuration for comments, brackets, and auto-pairing
- syntaxes/dascript.tmLanguage.yaml: Source TextMate grammar file (YAML format)
- syntaxes/dascript.tmLanguage.json: Compiled TextMate grammar (JSON format, auto-generated)
.das- Standard daScript files.dascript- Alternative daScript extension.das_project- Project files
- Single-line:
// - Block:
/* ... */
- Control Flow: while, if, static_if, else, for, elif, static_elif, return, break, continue, try, expect, finally, yield
- Declarations: var, let, assume, const, struct, class, function, typedef
- Modifiers: inscope, static, shared, public, private, override, sealed, unsafe, implicit, explicit
- Type System: Built-in types include iterator, array, fixed_array, table, smart_ptr, generator, tuple, variant, lambda, block, function
- Operators: Standard arithmetic, logical, assignment (=, :=, <-), pipeline (<|, |>), null-coalescing (?., ??)
- Memory: new, delete, deref, addr
- Type Operations: cast, upcast, reinterpret, is, as, type, typename, typeinfo
- Advanced: with, where, pass, label, goto, capture, operator overloading
- Hex:
0x...(with optional L or u suffix) - Binary:
0b...(with optional L suffix) - Octal:
0...or0o... - Float: Support for scientific notation (e.g.,
1.5e10F) - Type suffixes:
i8,u8,L(long),F(float)
- Edit
syntaxes/dascript.tmLanguage.yamlfor grammar changes - Run build task:
npx js-yaml syntaxes/dascript.tmLanguage.yaml > syntaxes/dascript.tmLanguage.json - Never manually edit the
.jsonfile - it's auto-generated from YAML
- Press F5 in VS Code to launch Extension Development Host
- Open
.dasfiles to verify syntax highlighting - Test edge cases with different daScript constructs
Follow TextMate conventions for consistency:
keyword.control.*- Control flow keywordsstorage.modifier.*- Declaration and modifier keywordskeyword.type.*- Type-related keywordskeyword.operator.*- Operatorsconstant.numeric.*- Number literalsconstant.language.*- Language constants (true, false, null)string.quoted.*- String literalscomment.line.*/comment.block.*- Commentsentity.name.function.*- Function namesentity.name.type.*- Type namesvariable.*- Variable references
- More specific patterns should come before general ones
- Include patterns in logical order for proper syntax precedence
- Use
\bfor word boundaries on keywords - Escape special characters properly
- Use non-capturing groups
(?:...)when capture isn't needed - Test patterns against various daScript code samples
- Use 2-space indentation
- Group related patterns together with comments
- Keep patterns readable with descriptive names
- Use
includereferences to avoid duplication - Document complex regex patterns with inline comments
- Use 4-space indentation (for package.json)
- No trailing commas
- Use double quotes for strings
- js-yaml: Converts YAML grammar to JSON format
- Minimum VS Code version: 1.40.0
- Publisher: eguskov
- Repository: https://github.com/GaijinEntertainment/vscode-dascript
- Current version: 0.0.18
- Update CHANGELOG.md for notable changes
- Increment version in package.json following semver
- Identify the appropriate category (control, storage, type, operator)
- Add to the relevant pattern in
dascript.tmLanguage.yaml - Use correct scope name for the category
- Rebuild the grammar
- Create a new repository pattern with descriptive name
- Add pattern to main
patternslist if top-level - Use
includeto reference from other patterns - Test with real daScript code examples
- Identify which pattern is matching (or failing to match)
- Check pattern order - more specific should come first
- Verify regex is properly escaped
- Test edge cases after making changes
When you need information about daScript language features, syntax, or APIs:
-
Resolve the library ID first:
Use mcp_context7_resolve-library-id with libraryName: "daslang" or "dascript" -
Fetch documentation:
Use mcp_context7_get-library-docs with the resolved library ID - Use mode='code' for API references and code examples - Use mode='info' for conceptual guides and language features - Specify topic parameter for focused queries (e.g., 'functions', 'types', 'operators') -
Example queries:
- Function syntax: topic='functions', mode='code'
- Type system: topic='types', mode='info'
- Operators: topic='operators', mode='code'
- Control flow: topic='control flow', mode='info'
Always use Context7 MCP instead of external web searches to get accurate, up-to-date daScript documentation when:
- Adding support for new language features
- Verifying syntax patterns
- Understanding language semantics
- Resolving ambiguities in grammar rules
- daScript documentation (via Context7 MCP): Use tools above for live docs
- daScript website: https://dascript.org/ (secondary reference)
- TextMate grammar guide: https://macromates.com/manual/en/language_grammars
- VS Code language extension guide: https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide
- This is a syntax highlighting only extension (no LSP, no IntelliSense)
- Focus on accurate TextMate grammar patterns
- daScript syntax is similar to C++ but with modern features
- Performance is important for daScript - the language targets real-time applications
- Always rebuild grammar JSON after editing YAML source