-
Notifications
You must be signed in to change notification settings - Fork 24
Available Commands in Didact and Elsewhere
The VS Code environment provides many different commands that can be called, but they may require some additional work to see what needs to be passed to them. Most will take a vscode.Uri indicating the resource they are operating on, but you may have to actually look at some code in the Microsoft VS Code GitHub repo to divine those details.
What follows is a list of commands provided by the Didact extension and any details to be passed, along with one or more examples of use.
Creates a folder/file structure in the user's workspace based on the structure defined in the JSON file provided.
- Inputs: Pass the path to the JSON file specifying the file/folder structure. With no input, it creates a sample folder/file structure.
- Example:
didact://?commandId=vscode.didact.scaffoldProject&extFilePath=redhat.vscode-didact/create_extension/md-tutorial.project.didact.json&completion=Created%20starting%20Didact%20file. - See [Didact Scaffolding(https://github.com/redhat-developer/vscode-didact/wiki/Didact-Scaffolding) for details about the JSON file structure.
"folders": [
{
"name": "root",
"folders": [
{
"name": "resources",
"folders": [
{
"name": "text"
},
{
"name": "images"
}
]
},
{
"name": "src",
"files": [
{
"name": "simple.groovy",
"content": "from('timer:groovy?period=1s')\n\t.routeId('groovy')\n\t.setBody()\n\t.simple('Hello Camel K from ${routeId}')\n\t.to('log:info?showAll=false')\n"
}
]
}
]
}
]
Opens the default Didact file as specified by the preference Didact: Default Url.
- Inputs: None
- Example:
didact://?commandId=vscode.didact.openTutorial
Opens a Didact window with the Markdown or AsciiDoc file passed in as a vscode.Uri reference. If no Uri is provided, it will attempt to get the currently selected file and assume it is a Didact file.
- Inputs: vscode.Uri
- Example:
didact://?commandId=vscode.didact.startDidact
Note: This can also be done by simply specifying a valid Uri to a Didact file in a vscode://redhat.vscode-didact? link. (See Constructing Didact Links for details on specifying https/http, extension, and workspace paths.
- Example 1:
vscode://redhat.vscode-didact?https=raw.githubusercontent.com/redhat-developer/vscode-didact/master/example/tutorial2.didact.md - Example 2:
vscode://redhat.vscode-didact?extension=example/tutorial.didact.md
The VS Code Link Handler that is registered uses the startDidact command to handle incoming links specified in this manner.
Creates and shows a terminal with the given name in the VS Code window. The name can be omitted.
- Inputs: name (string, optional)
- Example:
didact://?commandId=vscode.didact.startTerminalWithName&text=file-copy-term&completion=Opened%20the%20file-copy-term%20terminal.
Sends text to a named terminal, which is then executed in the terminal. If the named terminal doesn't exist, it is created.
- Inputs: name (string) and text (string) to send in the format
text=name$$command-to-execute - Example:
didact://?commandId=vscode.didact.sendNamedTerminalAString&text=file-copy-term$$cd%20file-copy%20%26%26%20mvn%20exec:java&completion=Sent%20commands%20to%20terminal%20window.(Changes to the directory calledfile-copyand executesmvn exec:java)
Simple command-line check for system capabilities. Takes three parameters - the id of the HTML element to update with the results, the test command (such as mvn --version, and a string to search for in the resulting text, such as Apache Maven if the mvn command works successfully).
Simple check to see if the extension Id is installed in the user workspace. Takes two parameters: the id of the HTML element to update with the results and the extension Id to check for.
Simple check to see if the workspace has at least one root folder. Takes one parameter: the id of the HTML element to update with the results.
Creates a folder in the user's temp directory and adds it to the workspace as a makeshift root directory.
Forces the Didact window to reload with the default Didact file specified in VS Code settings.
- Inputs: None
- Example:
Gathers all requirements in the Didact file and invokes the requirement checks one at a time. Useful if you have a long list of requirements to check.
Gathers a list of all requirements in the Didact file.
Gathers a list of all commands used in the Didact file.