|
|
||
|---|---|---|
| .vscode | ||
| src | ||
| syntaxes | ||
| .gitignore | ||
| .vscode-test.mjs | ||
| .vscodeignore | ||
| LICENSE.md | ||
| README.md | ||
| build_release.sh | ||
| esbuild.js | ||
| eslint.config.mjs | ||
| icon.png | ||
| language-configuration.json | ||
| linter_fixes.sh | ||
| package-lock.json | ||
| package.json | ||
| tsconfig.json | ||
README.md
English Description first - after that comes the German Version.
BMC TPL Code All-Around
Linter, Auto-Formatter, IntelliSense, and Hover Documentation for the BMC TPL (Topology Pattern Language).
This Visual Studio Code extension transforms your editor into a fully-fledged development environment for BMC Discovery TPL scripts. It saves you typing, formats code according to strict best practices, prevents syntax errors before deployment, and understands cross-project dependencies.
✨ Features
🤖 Intelligent Linter (Syntax Scanner)
The linter analyzes the code in real-time, remembers states across line breaks, and warns you about typical TPL errors:
- Strict Hierarchy Checking: Monitors the correct order of blocks within patterns and syncmappings (
metadata->overview->constants->triggers->mapping/removal->body). - Smart Assignment Check: Finds missing semicolons (but tolerates them in
enumerationblocks or multi-line statements). Warns strictly with an error if=is used instead of:=for variable assignments (outside of legitimateif/wherecomparisons). - Block & Bracket Tracking: Detects unclosed blocks (like missing
end body;orend pattern;) and finds unclosed parentheses(or brackets[. - Mandatory Field Validation: Checks if mandatory module-level metadata (
origin,author,products,publishers,tree_path) are present based on your dynamic compliance settings, and if an initiallog.debugstatement exists in thebody. - Indentation Checking: Instantly highlights messy indentation (any space count that is not a clean multiple of 4) with a warning, reminding you to use the Auto-Formatter.
- Unbreakable Lexer (New): Built-in state-machine lexer correctly parses complex strings, triple-quotes (
"""), and comments, ensuring accurate parameter counting and avoiding false-positive errors on complex TPL syntax. - Version Checking: Compares the TPL version declared in the module with the target version defined in your settings and warns about outdated scripts.
⚙️ Configurable Plugin Settings & Compliance
Personalize the plugin directly via the VS Code user interface (File > Preferences > Settings > Extensions > BMC TPL Settings):
- Metadata Compliance: Define exact compliance rules for your workspace. Choose which metadata fields are mandatory and configure the
tree_pathstrictly (e.g., minimum depth and forced static base nodes like['MyCompany', 'IT']). - Default Metadata: Store your own values for
Author,Publisher,Origin, etc. These are automatically inserted when generating new modules. - TPL Target Version: Define the default TPL version (e.g.,
23for 1.23) you are developing for. - Live Reload: Changes to settings take effect immediately, no editor restart required.
🎨 Auto-Formatter & Visual Alignment (Shift + Alt + F)
No more broken indentations! The formatter gets your code in top shape:
- VS Code Standard: Strictly enforces 4 spaces per indentation level.
- Dynamic Block Indentation: Automatically detects starting and ending blocks (
if,for,pattern,table, etc.) and adjusts the indentation level. - Bracket Memory (Visual Alignment): The ultimate discipline! The formatter remembers the exact column position of opened arrays
[or function calls(and flawlessly aligns all subsequent lines to this bracket. - Uncompromising Cleanup (New): Automatically strips all non-standard indentation (like 2, 3, or 6 spaces) and replaces it with exact, mathematically calculated 4-space blocks.
💡 IntelliSense & Autocomplete (Cross-File)
Saves an extreme amount of coding time through massive context awareness:
- "Go to Definition" (New): Instantly navigate your codebase!
Ctrl+Click(orF12) on any function call to jump directly to its declaration. Searches locally first and falls back to the RAM-based workspace index for cross-file jumps. - Dynamic Taxonomy Support (New): Full autocomplete support for dynamic BMC scopes. Typing
model.suggests generic<NodeKind>constructors, whilemodel.rel.offers dynamic<Relationship>constructors with ready-to-use snippets. - Full BMC Standard Library: Seamless integration of all built-in functions (e.g.,
discovery,number,text,model). Supports parameter overloads (e.g.,number.toTextoptionally with or without a base) via Tab navigation. - Workspace Scanning: If you import a module (e.g.,
from company.helpers import my_helper), the plugin scans your entire project in the background. If you typemy_helper., it automatically suggests all availabledefinemethods. - Case-Insensitive Resolution (New): All method lookups (both Core and TKU) are completely case-insensitive, meaning
rdbms_functions.xyzworks just as flawlessly asRDBMS_Functions.Xyz. - Local Namespaces: Detects
definitionsblocks in the same file and suggests their methods. - Variable Tracking: Learns all variables you have defined with
:=and suggests them to you later.
🔍 Hover Documentation (Tooltips)
When you hover over a method name, a pattern, or a table:
- Official BMC Docs: Full integration of the original, multi-line BMC documentation for all built-in functions loaded dynamically (no browser needed anymore!).
- DocString Extraction: Reads custom multi-line comments (
"""or''') placed underdefineorpatterndeclarations and renders them as clean Markdown tooltips (even cross-project!).
⚡ Quick Fixes (Code Actions / Lightbulb)
Offers immediate repair options with a single click:
- "Insert missing module metadata": Instantly generates missing mandatory fields in the module metadata block based on your workspace compliance settings.
- "Insert log statement": Adds the missing
log.debug("Start pattern...");right at the beginning of thebodyblock. - "Tabs to Spaces": Instantly replaces all illegal tabs (`\t