A VS Code-like integrated development environment built on top of Monaco Editor and integrated with Doh.js features like Dohball management and real-time file system access.
dohball_manager
module).doh_dark
(default), vscode_dark
, vscode
, and vscode_high_contrast
.localStorage
.The module will automatically install the required dependencies when loaded:
doh install ide
The module includes an entry point at index.html
that provides a standalone IDE interface. You can access it at:
http://localhost:3000/doh_modules/ide
// Load the IDE module
const {IDE} = await Doh.load('ide');
// Initialize the IDE in a container
const ide = IDE.init('ide-container', {
theme: 'doh_dark',
fontSize: 14,
tabSize: 2,
wordWrap: 'off',
minimap: true,
lineNumbers: true,
workspacePath: '/' // Root directory for file explorer
});
// Open a file from the file system
ide.openRealFile('/path/to/file.js');
// List directory contents
ide.listDirectory('/path/to/directory');
// Change the theme
ide.setTheme('vscode_light');
The IDE accepts the following configuration options during initialization (IDE.init
):
// Default options (can be overridden)
const options = {
theme: 'doh_dark', // Editor theme ('doh_dark', 'vscode_dark', 'vscode', 'vscode_high_contrast')
fontSize: 14, // Font size in pixels
tabSize: 2, // Tab size in spaces
wordWrap: 'off', // Word wrap ('off', 'on', 'wordWrapColumn', 'bounded')
minimap: true, // Show editor minimap
lineNumbers: true, // Show line numbers in editor
files: [], // Initial files to load (Not fully implemented for restoration)
workspacePath: '/', // Root directory for file explorer
sidebarWidth: 250, // Default sidebar width in pixels
terminalHeight: 200, // Default terminal height in pixels
};
Initializes the IDE in the specified container.
container
: The container element or IDoptions
: Configuration optionsOpens a file from the server's file system in the editor.
filePath
: Path to the file (relative to Doh project root).activate
: (Optional) Whether to make the new tab active. Defaults to true
.null
if an error occurs.Lists the contents of a directory in the file explorer.
dirPath
: Path to the directoryCreates a new file in the specified directory.
dirPath
: Path where to create the file (defaults to current workspace path)Creates a new folder in the specified directory.
dirPath
: Path where to create the folder (defaults to current workspace path)Deletes a file.
filePath
: Path to the file to deleteDeletes a folder and all its contents.
folderPath
: Path to the folder to deleteSaves the content of the currently open file.
Gets the currently active Monaco editor instance.
Gets the currently active file.
Changes the editor theme.
theme
: The theme name ('doh_dark', 'vscode_dark', 'vscode', 'vscode_high_contrast')Opens a special tab displaying details for the specified Dohball. Requires the dohball_manager
module.
dohballPath
: Path to the Dohball folder.activate
: (Optional) Whether to make the new tab active. Defaults to true
.null
if an error occurs.Creates and opens a new terminal instance and tab. Requires a server-side component (ide_server
).
Activates the terminal tab with the specified ID.
terminalId
: The ID of the terminal to activate.Closes the terminal instance and tab with the specified ID.
terminalId
: The ID of the terminal to close.Opens a diff editor tab showing changes for a file within a Git repository. Requires a server-side component (ide_server
) and git
.
repoPath
: The path to the root of the Git repository.filePath
: The path to the file within the repository.isStaged
: Boolean indicating whether to diff the staged version (true
) or the working directory version (false
).Displays a temporary notification message.
type
: Type of notification ('info', 'success', 'error', 'warning').message
: The message text to display.duration
: (Optional) How long the notification stays visible in milliseconds. Defaults to 3000.