This file was auto-generated with zdoccer.js
1.4.0
- VS Code extension for Cerberus X
- Sourcecode Documentation
function activate(context: vscode.ExtensionContext)
function deactivate() {}
class CxExtension
class CxBuilder
class CxChildProcess
class CxConfiguration
public static version: string|undefined
public static platform: string|undefined
public static transccPath: string|undefined
public static makedocsPath: string|undefined
public static cserverPath: string|undefined
public static get(section: string): any
public static set(section: string, value: any, target: vscode.ConfigurationTarget = vscode.ConfigurationTarget.Workspace): Thenable<void>
public static onConfigurationValid(callback: ()=>void): void
public getDetailsText(): string
class DocDeclHtmlTransformer
class DocDecl
class CxDocumentation
public static rootDecl: DocDecl
private static currentDecl: DocDecl
private static history: DocDecl[] = []
private static historyRev: DocDecl[] = []
private static panel: vscode.WebviewPanel
private static webview: vscode.Webview
public static build(): Promise<void>
public static init(): void
public static loadDecls()
public static canNavBack(): boolean
public static canNavFwd(): boolean
class CxDocumentSymbolProvider
class CxOnTypeFormattingEditProvider
original Markdown from src/.readme.md
VS Code extension for Cerberus X
enables programming Cerberus X in Visual Studio Code. The goal of this extension is to provide basic and more sophisticated features necessary and useful for working with Cerberus X.
VS Code extension for Cerberus X
was created by Olivier Stuker inspired by Adamredwoods' Visual Studio Code extension for Cerberus Programming Language
and Hezkore's BlitzMax Language Basics for Visual Studio Code
.
POC: Olivier "Holzchopf" Stuker
See LICENSE.md
From within VS Code, just hit F5
to start a testing instance with VS Code extension for Cerberus X
loaded. Then load any .cxs
file to activate the extension.
Automatic testing is not yet set up.
Run
vsce package
Needs vsce
(see https://code.visualstudio.com/api/working-with-extensions/publishing-extension )
This extension was initialised with Yeoman
and VS Code Extension Generator
.
Features are provided by singleton classes. To add features, create a new .ts
file in src/features
containing not more than the features' singleton class and - optionally, and these may even be outsourced - definitions strongly linked to that feature (like type definitions, enumerations, interfaces).
To keep the project folder tidy, we use the following structure:
src/ # entry point (extension.ts)
assets/ # assets (to be compiled into the extension)
extension/ # extension source
features/ # features (everything that can be seen as a module)
providers/ # providers
test/ # test suite
syntaxes/ # Cerberus X syntax definition
This project is documented using zdoccer.js
- a script that creates the README.md
from markdown files and Javadoc-documented source in the specified folder.
To document any feature of your project, preceed it with a block comment of the following form:
/**
* markdown for your feature goes here
*/
<line of code to be documented>
Or a single line comment of the following form:
/** markdown goes here */
<line of code to be documented>
If <line of code to be documented>
is not empty, it will be prepended to the markdown block.
To update the README.md
, run zdoccer
:
npx zdoccer src
VS Code extension for Cerberus X
is split into multiple singleton classes, grouping similar functionalities or features of same context.
transformed Javadoc from src/extension.ts
This function is called when the extension is activated.
See package.json > "activationEvents"
for the definition of events that
activate the extension.
Starts the extension, see CxExtension π‘΅
this method is called when your extension is deactivated
transformed Javadoc from src/extension/cerberusx.extension.ts
Extension container
Checks the Cerberus X configuration and registers all handlers and providers.
- param
context
β hostingvscode.ExtensionContext
transformed Javadoc from src/extension/features/builder/builder.feature.ts
Different Cerberus X builders
returns currently active build file or empty string if not defined
Builds HTML5 game
- returns β Promise resolving on success
Generic build, invokes transcc
- param
file
β path to file to build - param
args
β compiler flags - returns β Promise resolving on success
Runs HTML5 game
- returns β Promise resolving on success
transformed Javadoc from src/extension/features/child-process/child-process.feature.ts
Child process helper
public static spawn(title: string, paths: {[name: string]: string}, command: string, args: string[] = []): Promise<void>
Spawns a new child process and outputs stdout and stderr data
- param
title
β How the process is described in output - param
paths
β Paths to list, e.g. {transcc: 'path/there'} - param
command
β command to execute - param
args
β command arguments - returns β a promise resolving when the process finished
transformed Javadoc from src/extension/features/configuration/configuration.feature.ts
Provides and checks configuration for Cerberus X
Cerberus X version
platform (winnt
, macos
or linux
)
path to transcc executable
path to makedocs executable
path to cserver executable
Returns Cerberus X configuration value from section
- param
section
β key - returns β matching value
public static set(section: string, value: any, target: vscode.ConfigurationTarget = vscode.ConfigurationTarget.Workspace): Thenable<void>
Sets a Cerberus X configuration value.
Use undefined
to unset.
- param
section
β key - param
value
β value - returns β
Thenable<void>
resolving when done
Defines functions to be called when configuration is valid
- param
callback
β function to be called
transformed Javadoc from src/extension/features/cxlang/cxlang-semanter.feature.ts
Returns the definitions following the identifier as pretty printed string
transformed Javadoc from src/extension/features/documentation/docdecl-html-transformer.ts
Transformer for DocDecl π‘΅ -> HTML
Sets Webview, necessary for URI resolving
- param
webview
β validvscode.Webview
Transforms given DocDecl π‘΅ to string of HTML (full page)
- param
decl
βDocDecl
to transform - returns β html string
transformed Javadoc from src/extension/features/documentation/docdecl.ts
Any kind of Cerberus X declaration
Returns DocDecl by uid (must match exactly, always 6 digits)
- param
uid
β 6 digit uid - returns β matching
DocDecl
ornull
Returns child decl by ident
- param
ident
β identifier to match - returns β matching
DocDecl
ornull
Returns value of child of given kind
- param
kind
βkind
property that has to match - returns β string value of match
Absolute doc path for this decl
- returns β doc path as string
full path (uident) for this decl (and cache, speeds things up)
- returns β full path as string
transformed Javadoc from src/extension/features/documentation/documentation.feature.ts
Cerberus X in-editor documentation
Root DocDecl
currently (navigated to) DocDecl
history of navigated DocDecl
when going back, this is the stack of "forward" DocDecl
panel
webview (instance needed for navigating and stuff)
Invokes makedocs to build the docs
- returns β Promise resolving when done
Registers the feature and prepares components
Loads declarations from docs/html/decls.json
Whether navigating back is possible
Whether navigating forward is possible
transformed Javadoc from src/extension/providers/document-symbol.provider.ts
Provides a vscode.DocumentSymbol
tree for the outline
public provideDocumentSymbols( document: vscode.TextDocument, token: vscode.CancellationToken ): vscode.DocumentSymbol[]
Builds the tree. Invoked automatically by VS Code
- param
document
βvscode.TextDocument
to build the tree for - param
token
βvscode.CancellationToken
- returns β
vscode.DocumentSymbol[]
transformed Javadoc from src/extension/providers/on-type-formatting-edit.provider.ts
Provides a vscode.OnTypeFormattingEditProvider
for real-time formatting
Initializes provider
- param
context
βvscode.ExtensionContext
public provideOnTypeFormattingEdits(document: vscode.TextDocument, position: vscode.Position, char: string, options: vscode.FormattingOptions, ctoken: vscode.CancellationToken): vscode.ProviderResult<vscode.TextEdit[]>
Provides on type formatting edits. Invoked automatically by VS Code
- param
document
β currentvscode.TextDocument
- param
position
βvscode.Position
after triggering - param
char
β triggering char asstring
- param
options
βvscode.FormattingOptions
- param
token
βvscode.CancellationToken
- returns β
vscode.TextEdit
s to apply