Global

Methods

applySyntaxHighlight(code, fileType) → {string}

Apply syntax highlighting to editor based on file type

Parameters:
Name Type Description
code string

The code to highlight

fileType string

The detected file type

Source:
Returns:
  • HTML with syntax highlighting
Type
string

(async) buildFileTree(dirPath, maxDepth, currentDepth) → {Array}

Build file tree for directory

Parameters:
Name Type Default Description
dirPath string

Directory path

maxDepth number 3

Maximum depth to traverse

currentDepth number 0

Current depth (internal use)

Source:
Returns:
  • File tree structure
Type
Array

(async) checkWSLAvailability() → {Promise.<Object>}

Check if WSL is available and has distributions installed

Source:
Returns:

WSL status object with properties: available (boolean), hasDistros (boolean), error (string)

Type
Promise.<Object>

createVisualizerWindow() → {BrowserWindow}

Creates the Visualyzer window as a separate, movable window

Source:
Returns:

The created visualyzer window instance

Type
BrowserWindow

createWindow() → {BrowserWindow}

Creates and configures the main application window.

This function sets up the BrowserWindow with appropriate dimensions, icon, and security settings. It loads the main HTML file and configures the window appearance.

Source:
Returns:

The created main window instance

Type
BrowserWindow
Example
const mainWindow = createWindow();

(async) detectFileEncoding(filePath) → {Object}

Detect file encoding

Parameters:
Name Type Description
filePath string

Path to the file

Source:
Returns:
  • File info with encoding and size data
Type
Object

detectFileType(filename) → {string}

Detect file type based on file extension

Parameters:
Name Type Description
filename string

The filename to analyze

Source:
Returns:
  • The detected file type
Type
string

(async) detectWSL() → {Promise.<boolean>}

Detects if WSL (Windows Subsystem for Linux) is available on Windows.

Source:
Returns:

True if WSL is available, false otherwise

Type
Promise.<boolean>

(async) detectWSL() → {Promise.<boolean>}

Legacy function for backward compatibility

Source:
Returns:
Type
Promise.<boolean>

(async) detectWSLStatus() → {Promise.<Object>}

Comprehensive WSL status detection

Source:
Returns:

Object with available, hasDistros, error, and distributions properties

Type
Promise.<Object>

escapeHtml(text) → {string}

Escape HTML special characters

Parameters:
Name Type Description
text string

Text to escape

Source:
Returns:

Escaped HTML string

Type
string

formatFileSize(bytes) → {string}

Format file size for display

Parameters:
Name Type Description
bytes number

File size in bytes

Source:
Returns:
  • Formatted file size
Type
string

getFileIcon(filename) → {string}

Get file icon based on extension

Parameters:
Name Type Description
filename string

The filename

Source:
Returns:
  • Unicode emoji for file icon
Type
string

getLanguageConfig(fileType) → {Object}

Get language configuration

Parameters:
Name Type Description
fileType string

The file type

Source:
Returns:
  • Language configuration
Type
Object

(async) handleLocalChat(message, config) → {Promise.<Object>}

Handle local GGUF model chat using node-llama-cpp

Parameters:
Name Type Description
message string

User message

config Object

Config with localModelPath and gpuLayers

Source:
Returns:
Type
Promise.<Object>

(async) handleModularProvider(message, config) → {Promise.<Object>}

Handle external API chat using modular provider system

Parameters:
Name Type Description
message string

User message

config Object

Config with providerId and provider-specific settings

Source:
Returns:
Type
Promise.<Object>

(async) handleOllamaChat(message, config) → {Promise.<Object>}

Handle Ollama chat request

Parameters:
Name Type Description
message string

User message

config Object

Config with ollamaHost

Source:
Returns:
Type
Promise.<Object>

highlightCppSyntax(code, fileType) → {string}

Highlight C/C++ syntax (optimized version)

Parameters:
Name Type Description
code string

The code to highlight

fileType string

The file type

Source:
Returns:
  • HTML with syntax highlighting
Type
string

(async) installWSLAutomatically()

Install WSL automatically using PowerShell

Source:

(async) installWSLDistribution()

Install a specific WSL distribution

Source:

isValidUTF8(buffer) → {boolean}

Check if file is UTF-8 encoded

Parameters:
Name Type Description
buffer Buffer

File buffer to check

Source:
Returns:
  • True if file is UTF-8
Type
boolean

(async) searchInDirectory(dirPath, searchTerm, maxResults) → {Array}

Search in files within directory

Parameters:
Name Type Default Description
dirPath string

Directory path to search

searchTerm string

Search term

maxResults number 100

Maximum results to return

Source:
Returns:
  • Search results
Type
Array

setupAssistantHandlers(mainWindow)

Setup IPC handlers for assistant chat

Parameters:
Name Type Description
mainWindow BrowserWindow

Main window reference

Source:

setupCtraceHandlers()

Setup IPC handlers for running the ctrace binary

Source:

setupEditorHandlers()

Setup IPC handlers for editor operations

Source:

setupFileHandlers(mainWindow)

Sets up all IPC handlers for file operations.

This function registers all IPC handlers that the renderer process can invoke for file operations. It handles folder dialogs, file dialogs, saving files, reading files, and file tree operations.

Parameters:
Name Type Description
mainWindow BrowserWindow

Main window reference for dialogs

Source:
Example
setupFileHandlers(mainWindow);

setupWindowControls(window)

Sets up IPC handlers for custom window controls.

This function handles window minimize, maximize, and close operations for the custom frameless window title bar.

Parameters:
Name Type Description
window BrowserWindow

The main window instance

Source:

shouldHighlight(fileType) → {boolean}

Check if file type should have syntax highlighting

Parameters:
Name Type Description
fileType string

The file type to check

Source:
Returns:
  • True if highlighting should be applied
Type
boolean

(async) showDistributionOptions()

Show available WSL distributions for installation

Source:

(async) showLimitedFunctionalityDialog()

Show limited functionality dialog

Source:

showManualInstallationInstructions()

Show manual installation instructions

Source:

(async) showWSLSetupDialog(wslStatus) → {Promise.<boolean>}

Shows enhanced WSL installation dialog based on WSL status

Parameters:
Name Type Description
wslStatus Object

Current WSL status

Source:
Returns:

True if user wants to proceed, false otherwise

Type
Promise.<boolean>

startWatchingWorkspace(workspacePath, mainWindow)

Start watching workspace for file changes

Parameters:
Name Type Description
workspacePath string

Path to watch

mainWindow BrowserWindow

Main window reference

Source:

stopWatchingWorkspace()

Stop watching current workspace

Source:

testEmojiSupport()

Test emoji rendering and font availability

Source:

(async) testWSLAndCTrace()

Test WSL availability and CTrace execution

Source:

tokenizeCpp(code, langConfig) → {Array}

Tokenize C/C++ code for highlighting

Parameters:
Name Type Description
code string

The code to tokenize

langConfig Object

Language configuration

Source:
Returns:
  • Array of tokens with type and value
Type
Array

tokensToHtml(tokens, langConfig) → {string}

Convert tokens to HTML

Parameters:
Name Type Description
tokens Array

Array of tokens

langConfig Object

Language configuration

Source:
Returns:
  • HTML string
Type
string

updateFileTypeStatus(filename)

Update file type status in the status bar

Parameters:
Name Type Description
filename string

The filename to analyze

Source: