一键导入
boxlang-plugin
Create or modify BoxLang plugins for completions, inline documentation, and go-to-definition. Use when extending the plugin system with new features.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Create or modify BoxLang plugins for completions, inline documentation, and go-to-definition. Use when extending the plugin system with new features.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Work with BoxLang Sublime Text syntax definitions (.sublime-syntax files). Use when editing syntax highlighting, scope naming, or grammar rules for .bx, .bxs, and .bxm files.
Work with BoxLang component parsers (AST parser for .bx/.bxs, tag parser for .bxm). Use when modifying parsing logic, adding new AST node types, or extending metadata extraction.
Write and run tests for the BoxLang Sublime Text package. Use pytest with TestBox-style expectations. Covers parser tests, type resolver tests, plugin tests, and integration tests.
| name | boxlang-plugin |
| description | Create or modify BoxLang plugins for completions, inline documentation, and go-to-definition. Use when extending the plugin system with new features. |
Use this skill when creating or modifying plugins for the BoxLang Sublime Text package.
Plugins are Python modules under src/plugins_/ that extend the BoxlangPlugin base class. They provide:
Plugins are registered in src/boxlang_plugins.py:
directory = [
"basecompletions",
"boxdocs",
"cfcs",
"dotpaths",
"typecompletions",
"applicationbx", # Reserved
"in_file_completions", # Reserved
]
The loader scans each module for a class named BoxlangPlugin that subclasses the base class and instantiates it.
src/plugins_/plugin.py)class BoxlangPlugin:
"""Base class for BoxLang plugins."""
def get_completion_docs(self, boxlang_view):
"""Get completion documentation. Returns CompletionDoc or None."""
return None
def get_completions(self, boxlang_view):
"""Get completions. Returns CompletionList or None."""
return None
def get_goto_boxlang_file(self, boxlang_view):
"""Get file navigation info. Returns GotoBoxlangFile or None."""
return None
def get_inline_documentation(self, boxlang_view, doc_type):
"""Get inline documentation. Returns Documentation or None."""
return None
def get_method_preview(self, boxlang_view):
"""Get method preview. Returns MethodPreview or None."""
return None
The boxlang_view parameter provides context about the current cursor position:
| Property | Type | Description |
|---|---|---|
view | sublime.View | The Sublime Text view |
position | int | Cursor position |
prefix | str | Text being typed |
type | str | Context: "tag", "tag_attributes", "dot", "script" |
project_name | str | Project file path |
file_path | str | Current file path |
dot_context | list[Symbol] | Chain of identifiers before . |
tag_name | str | Current tag name (e.g., "bx:query") |
tag_attribute_name | str | Current attribute being typed |
tag_location | str | "tag_name", "tag_attribute_name", "tag_attributes" |
function_call_params | BoxlangFunctionCallParams | Parsed function call arguments |
view_metadata | dict | Parsed metadata for current file |
CompletionList(completions, priority, exclude_lower_priority)
Documentation(doc_regions, doc_html_variables, on_navigate, priority)
CompletionDoc(doc_regions, doc_html_variables, on_navigate)
MethodPreview(preview_regions, preview_html_variables, on_navigate, priority)
GotoBoxlangFile(file_path, symbol)
src/plugins_/myplugin/__init__.py
import sublime
from ... import utils
class BoxlangPlugin:
"""My custom plugin."""
def get_completions(self, boxlang_view):
if boxlang_view.type != "script":
return None
completions = [
sublime.CompletionItem(
"myFunction",
"myplugin",
"myFunction($1)$0",
sublime.COMPLETION_FORMAT_SNIPPET,
kind=(sublime.KIND_ID_FUNCTION, "f", "myplugin"),
details="Does something useful"
)
]
return boxlang_view.CompletionList(completions, 0, False)
def get_inline_documentation(self, boxlang_view, doc_type):
if not boxlang_view.view.match_selector(
boxlang_view.position, "entity.name.function.boxlang"
):
return None
word = boxlang_view.view.substr(boxlang_view.view.word(boxlang_view.position))
if word == "myFunction":
return boxlang_view.Documentation(
[boxlang_view.view.word(boxlang_view.position)],
{
"side_color": "#4C9BB0",
"html": {
"header": "myFunction()",
"body": "<p>Does something useful</p>",
"links": []
}
},
None,
0
)
return None
def get_goto_boxlang_file(self, boxlang_view):
# Return file path or URL for navigation
return None
def get_completion_docs(self, boxlang_view):
# Return documentation shown during auto-complete
return None
def get_method_preview(self, boxlang_view):
# Return method signature preview
return None
Add to directory list in src/boxlang_plugins.py:
directory = [
...
"myplugin",
]
sublime.CompletionItem(
trigger, # Display text
annotation, # Small annotation (e.g., "function", "method")
completion, # Insertion text or snippet
completion_format, # sublime.COMPLETION_FORMAT_TEXT or SNIPPET
kind, # (kind_id, icon, detail)
details, # Detailed description
# Optional:
text_edit, # sublime.TextEdit for precise insertion
command, # Command to run on selection
)
| ID | Name | Typical Use |
|---|---|---|
sublime.KIND_ID_FUNCTION | Function | Methods, BIFs |
sublime.KIND_ID_VARIABLE | Variable | Properties, variables |
sublime.KIND_ID_MARKUP | Markup | Tags |
sublime.KIND_ID_KEYWORD | Keyword | Language keywords |
sublime.KIND_ID_TYPE | Type | Classes, types |
sublime.KIND_ID_AMBIGUOUS | Ambiguous | Generic items |
sublime.KIND_ID_NAVIGATION | Navigation | Go-to items |
exclude_lower_priority=True hides all lower-priority completions{
"side_color": "#4C9BB0",
"html": {
"header": "Function signature or tag",
"body": "<p>Description</p><h2>Parameters</h2>...",
"links": [
{"href": "https://...", "text": "Open in Docs"}
]
}
}
entity_name_function — Function names (yellow)entity_name_tag_boxlang — Tag names (blue)entity_other_attribute_name — Attributes (light blue)storage_type — Types (green)variable_parameter_function — Parameters (light blue)keyword_other — Keywords (purple)card, card-header, card-body — Card layoutcode — Inline codeactive, required, optional — Parameter states| Plugin | Context | Provides |
|---|---|---|
basecompletions | All | BIFs, tags, member functions from JSON |
boxdocs | Script/Tag | Inline docs linking to ortusbooks.com |
cfcs | Script/Dot | Variable-to-component completions |
dotpaths | Script/Dot | Import/new/createObject dot-path completions |
typecompletions | Dot | Type-aware member method completions |
_plugin_loaded() function called after all plugins loadedget_completions() called on each auto-complete triggerget_inline_documentation() called on F1/hoverget_goto_boxlang_file() called on Ctrl/Cmd+clickNone early if not relevantboxlang_view.view.match_selector(position, "scope") for precise matching_plugin_loaded() for one-time setupboxlang_view.CompletionList(), etc.None, not errorsutils.get_setting("boxlang_*") for configurable behavior