### Run Electron Example Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Starts the Electron-based example application. ```sh npm run start:electron ``` -------------------------------- ### Build and run Electron example Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Commands to clone, install, build, and start the Electron-based Theia application. ```sh git clone https://github.com/eclipse-theia/theia \ && cd theia \ && npm install \ && npm run build:electron \ && npm run download:plugins \ && npm run start:electron ``` -------------------------------- ### Run browser example with SSL Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Starts the browser example with SSL configuration using provided certificate and key paths. ```sh git clone https://github.com/eclipse-theia/theia \ && cd theia \ && npm install \ && npm run download:plugins \ && npm run build:browser \ && npm run start:browser -- -- --ssl --cert /path/to/cert.crt --certkey /path/to/certkey.key ``` -------------------------------- ### Build and run browser example Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Commands to clone, install, build, and start the browser-based Theia application. ```sh git clone https://github.com/eclipse-theia/theia \ && cd theia \ && npm install \ && npm run build:browser \ && npm run download:plugins \ && npm run start:browser ``` -------------------------------- ### Build Theia Electron Example Source: https://github.com/eclipse-theia/theia/blob/master/scripts/performance/README.md Installs dependencies and builds the Electron example for Theia. Run these commands in the root directory. ```bash npm install npm run build:electron ``` -------------------------------- ### Clone, build, and run Theia on Windows Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Performs a full setup sequence including cloning the repository, installing dependencies, building the browser version, and starting the application. ```sh git clone https://github.com/eclipse-theia/theia.git \ && cd theia \ && npm install \ && npm run build:browser \ && npm run start:browser ``` -------------------------------- ### Run and manage browser-based example application Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Starts the browser example application or prepares the environment by rebuilding native Node.js packages. ```sh npm run start ``` ```sh npm run rebuild:browser ``` -------------------------------- ### Start Theia browser example Source: https://github.com/eclipse-theia/theia/blob/master/sample-plugins/README.md Command to launch the Theia example application in a browser environment. ```sh npm run start:browser ``` -------------------------------- ### Build example applications Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Commands to build specific example applications or all applications at once. ```sh npm run build:browser npm run build:browser-only npm run build:electron # build all example applications at once: npm run build:applications ``` -------------------------------- ### Watch Examples Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Rebuilds the frontend or backend example applications when changes occur. ```sh # either npm run watch:browser # or npm run watch:electron ``` -------------------------------- ### Start the backend server Source: https://github.com/eclipse-theia/theia/blob/master/dev-packages/cli/README.md Launch the backend server for the application. ```bash theia start ``` -------------------------------- ### Build Playwright Library and Dependencies Source: https://github.com/eclipse-theia/theia/blob/master/examples/playwright/docs/GETTING_STARTED.md Commands to navigate to the playwright examples directory and install necessary dependencies and build the library. ```bash cd examples/playwright yarn build ``` -------------------------------- ### Install with root privileges Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Use the unsafe-perm flag if you encounter 'cannot run in wd' errors when installing with root privileges. ```sh npm install --unsafe-perm ``` -------------------------------- ### Build Playwright Library and Dependencies Source: https://github.com/eclipse-theia/theia/blob/master/examples/playwright/docs/DEVELOPING.md Navigates to the Playwright example directory, builds the Playwright library, runs tests, and installs necessary dependencies like Chromium. ```bash cd examples/playwright npm run build ``` -------------------------------- ### Download plugins Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Command to download necessary plugins for example applications. ```sh npm run download:plugins ``` -------------------------------- ### Run API tests Source: https://github.com/eclipse-theia/theia/blob/master/dev-packages/cli/README.md Start the server and execute API tests. ```bash theia test ``` -------------------------------- ### Build everything Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Performs a full build including dependency installation, linking, linting, and application building. ```sh npm run all ``` -------------------------------- ### Install and compile core packages Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Downloads dependencies and builds all TypeScript packages. ```sh npm install npm run compile ``` -------------------------------- ### Theia 3PP License Check Script Example Source: https://github.com/eclipse-theia/theia/wiki/Dev-Meetings-2024 An example of integrating the [@eclipse-dash/nodejs-wrapper](https://www.npmjs.com/package/@eclipse-dash/nodejs-wrapper) for checking third-party licenses in a repository. ```javascript const { checkLicenses } = require('@eclipse-dash/nodejs-wrapper'); checkLicenses({ // Options }); ``` -------------------------------- ### Install synp tool for lockfile conversion Source: https://github.com/eclipse-theia/theia/wiki/Registering-CQs Installs the synp utility globally via npm to convert yarn.lock files into package-lock.json format for license analysis. ```bash npm install -g synp ``` -------------------------------- ### Install Xcode command line tools on macOS Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Use this command to install the necessary developer tools required for building and running Theia. ```sh xcode-select --install ``` -------------------------------- ### Debug the backend server Source: https://github.com/eclipse-theia/theia/blob/master/dev-packages/cli/README.md Start the backend server with the Node.js inspector enabled. ```bash theia start --inspect ``` -------------------------------- ### Prepare repository for production dependency assessment Source: https://github.com/eclipse-theia/theia/wiki/Registering-CQs Commands to clean the local environment and install production dependencies to perform a full repository license audit. ```bash # Checkout PR git checkout --track upstream/env-methods # clean state git clean -fdx # install only prod dependencies yarn install --production ``` -------------------------------- ### Example Prompt for Brave Search Source: https://github.com/eclipse-theia/theia/blob/master/packages/ai-mcp/README.md Illustrates the format of a prompt used to trigger the brave-search MCP server for web searches. ```markdown ~{mcp_brave-search_brave_web_search} ``` -------------------------------- ### Install @theia/cli Source: https://github.com/eclipse-theia/theia/blob/master/dev-packages/cli/README.md Commands to add the Theia CLI as a development dependency. ```bash yarn add @theia/cli@next --dev ``` ```bash npm install @theia/cli@next --save-dev ``` -------------------------------- ### Example User Query for Search Source: https://github.com/eclipse-theia/theia/blob/master/packages/ai-mcp/README.md Shows a typical user query that would invoke the search functionality provided by an MCP server. ```markdown Search the internet for XYZ ``` -------------------------------- ### Launch VS Code extension as Theia plugin Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Use this configuration in .vscode/launch.json to start the backend and attach to the plugin-host sub-process on port 9339. ```jsonc { "name": "Launch VS Code extension as Theia plugin", "type": "node", "request": "launch", "port": 9339, "timeout": 100000, "args": [ "${workspaceFolder}/examples/browser/src-gen/backend/main.js", "${workspaceFolder}", "--port=3030", "--hosted-plugin-inspect=9339", // spawn the plugin-host in debug mode "--plugins=local-dir:${workspaceFolder}/plugins" ], "stopOnEntry": false, "sourceMaps": true, "outFiles": [ "${workspaceFolder}/**/*.js" ], "internalConsoleOptions": "openOnSessionStart", "outputCapture": "std" } ``` -------------------------------- ### Install build-essential on Linux Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Required for compiling native modules on Debian-based Linux distributions. ```bash sudo apt-get install build-essential ``` -------------------------------- ### Install native-keymap dependencies Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md System libraries required for the native-keymap node module across different operating systems. ```bash sudo apt-get install libx11-dev libxkbfile-dev ``` ```bash sudo yum install libX11-devel.x86_64 libxkbfile-devel.x86_64 # or .i686 ``` ```bash sudo pkg install libX11 ``` -------------------------------- ### Build native extensions from source Source: https://github.com/eclipse-theia/theia/blob/master/doc/Migration.md Set the environment variable to force local compilation of native extensions during dependency installation. ```bash # either: export npm_config_build_from_source=true yarn # or: npm_config_build_from_source=true yarn ``` -------------------------------- ### Install keytar dependencies Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md System libraries required for the keytar node module across different Linux distributions. ```bash sudo apt-get install libsecret-1-dev ``` ```bash sudo yum install libsecret-devel ``` ```bash sudo pacman -S libsecret ``` ```bash apk add libsecret-dev ``` -------------------------------- ### Configure Brave Search MCP Server Source: https://github.com/eclipse-theia/theia/blob/master/packages/ai-mcp/README.md Sets up the brave-search MCP server, requiring a BRAVE_API_KEY environment variable for authentication. Uses npx to install and run. ```json { "brave-search": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-brave-search" ], "env": { "BRAVE_API_KEY": "YOUR_API_KEY" } } } ``` -------------------------------- ### Configure Filesystem MCP Server Source: https://github.com/eclipse-theia/theia/blob/master/packages/ai-mcp/README.md Configures the filesystem MCP server, specifying an absolute path to an allowed directory. Uses npx for installation and execution. ```json { "filesystem": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-filesystem", "ABSOLUTE_PATH_TO_ALLOWED_DIRECTORY" ] } } ``` -------------------------------- ### Initialize Theia Playwright Template Source: https://github.com/eclipse-theia/theia/blob/master/examples/playwright/docs/GETTING_STARTED.md Commands to clone the official template repository and install necessary dependencies using yarn. ```bash git clone git@github.com:eclipse-theia/theia-playwright-template.git cd theia-playwright-template yarn ``` -------------------------------- ### Implement Theia Text Editor System Test Source: https://github.com/eclipse-theia/theia/blob/master/examples/playwright/docs/GETTING_STARTED.md A Playwright test example demonstrating how to open a workspace, manipulate text editor content, perform undo/redo operations, and verify dirty states. ```typescript test('should undo and redo text changes and correctly update the dirty state', async ({ playwright, browser }) => { // 1. set up workspace contents and open Theia app const ws = new TheiaWorkspace([path.resolve(__dirname, 'resources/sample-files1']); app = await TheiaAppLoader.load( { playwright, browser }, ws); // 2. open Theia text editor const sampleTextEditor = await app.openEditor( 'sample.txt', TheiaTextEditor ); // 3. make a change and verify contents and dirty await sampleTextEditor.replaceLineWithLineNumber('change', 1); expect(await sampleTextEditor.textContentOfLineByLineNumber(1)).toBe( 'change' ); expect(await sampleTextEditor.isDirty()).toBe(true); // 4. undo and verify contents and dirty state await sampleTextEditor.undo(2); expect(await sampleTextEditor.textContentOfLineByLineNumber(1)).toBe( 'this is just a sample file' ); expect(await sampleTextEditor.isDirty()).toBe(false); // 5. undo and verify contents and dirty state await sampleTextEditor.redo(2); expect(await sampleTextEditor.textContentOfLineByLineNumber(1)).toBe( 'change' ); expect(await sampleTextEditor.isDirty()).toBe(true); // 6. save verify dirty state await sampleTextEditor.save(); expect(await sampleTextEditor.isDirty()).toBe(false); await sampleTextEditor.close(); // 7. reopen editor and verify dirty state const reopenedEditor = await app.openEditor('sample.txt', TheiaTextEditor); expect(await reopenedEditor.textContentOfLineByLineNumber(1)).toBe( 'change' ); await reopenedEditor.close(); }); ``` -------------------------------- ### Install theiaext Dependency Source: https://github.com/eclipse-theia/theia/blob/master/dev-packages/private-ext-scripts/README.md This example demonstrates how to add the '@theia/ext-scripts' package as a devDependency in a project's package.json. This makes the 'theiaext' command available for use. ```json { "name": "@theia/myextension", "devDependencies": { "@theia/ext-scripts": "^0.1.1" } } ``` -------------------------------- ### Build the application Source: https://github.com/eclipse-theia/theia/blob/master/dev-packages/cli/README.md Commands to build the application for development or production modes. ```bash theia build --mode development ``` ```bash theia build ``` -------------------------------- ### Run Playwright Tests in UI Mode Source: https://github.com/eclipse-theia/theia/blob/master/examples/playwright/docs/GETTING_STARTED.md Executes the UI tests using the Playwright UI mode, which provides a visual interface for watching and tracing test execution. ```bash yarn ui-tests --ui ``` -------------------------------- ### Accessing Exported Plugin API in JavaScript Source: https://github.com/eclipse-theia/theia/blob/master/packages/plugin/README.md Shows how another plugin can retrieve and use the exported API from a previously started plugin. It uses 'theia.plugins.getPlugin' to get the plugin instance and access its 'exports'. ```javascript let mathExt = theia.plugins.getPlugin('genius.math'); let importedApi = mathExt.exports; console.log(importedApi.mul(42, 1)); ``` -------------------------------- ### Publish Release Locally Source: https://github.com/eclipse-theia/theia/blob/master/doc/Publishing.md Example of a local publishing run using npm and lerna. Ensure you are logged into NPM and have your 2FA ready. The `--yes` parameter can be removed to confirm each step. ```bash npm run publish:next lerna notice ... lerna info Found 1 package to publish: - @theia/some-package => x.y.z ✔ Are you sure you want to publish these packages? Yes lerna info publish Publishing packages to npm... ✔ This operation requires a one-time password: lerna success published @theia/some-package x.y.z lerna notice lerna notice 📦 @theia/some-package@x.y.z lerna notice === Tarball Contents === ... lerna notice Successfully published: - @theia/some-package@x.y.z lerna success published 1 package Done in ...s. ``` -------------------------------- ### Run 3PP License Check with Theia Source: https://github.com/eclipse-theia/theia/wiki/Eclipse-Theia-contributors:-Intellectual-Property-(IP)-guide These npm scripts in package.json are used to execute the third-party license check. The `license:check` script runs a standard check, while `license:check:review` enables the auto-review mode, which can automatically open IP check tickets on GitLab for non-compliant dependencies. This requires Node.js to be installed. ```json { "license:check": "node scripts/check_3pp_licenses.js", "license:check:review": "node scripts/check_3pp_licenses.js --review" } ``` -------------------------------- ### Configure Git MCP Server (uv) Source: https://github.com/eclipse-theia/theia/blob/master/packages/ai-mcp/README.md Sets up the git MCP server using the 'uv' command to run 'mcp-server-git' within a specified repository directory. ```json { "git": { "command": "uv", "args": [ "--directory", "/path/to/repo", "run", "mcp-server-git" ] } } ``` -------------------------------- ### Configure and run tests Source: https://github.com/eclipse-theia/theia/blob/master/dev-packages/cli/README.md Run tests with specific file patterns and plugin directories. ```bash theia test . --test-spec=./test/*.spec.js --plugins=./plugins ``` -------------------------------- ### Define Plugin List in package.json Source: https://github.com/eclipse-theia/theia/blob/master/dev-packages/cli/README.md Lists the plugins to be downloaded, supporting direct URLs and ${targetPlatform} placeholders for architecture-specific files. ```json "theiaPlugins": { "vscode.theme-defaults": "https://open-vsx.org/api/vscode/theme-defaults/1.62.3/file/vscode.theme-defaults-1.62.3.vsix", "vscode-builtin-extension-pack": "https://open-vsx.org/api/eclipse-theia/builtin-extension-pack/1.50.0/file/eclipse-theia.builtin-extension-pack-1.50.0.vsix", "vscode-editorconfig": "https://open-vsx.org/api/EditorConfig/EditorConfig/0.14.4/file/EditorConfig.EditorConfig-0.14.4.vsix", "vscode-eslint": "https://open-vsx.org/api/dbaeumer/vscode-eslint/2.1.1/file/dbaeumer.vscode-eslint-2.1.1.vsix", "rust-analyzer": "https://open-vsx.org/api/rust-lang/rust-analyzer/${targetPlatform}/0.4.1473/file/rust-lang.rust-analyzer-0.4.1473@${targetPlatform}.vsix" } ``` -------------------------------- ### Configure Git MCP Server (uvx) Source: https://github.com/eclipse-theia/theia/blob/master/packages/ai-mcp/README.md Configures an alternative git MCP server using 'uvx' to run 'mcp-server-git' with a specified repository path. ```json { "git2": { "command": "uvx", "args": [ "mcp-server-git", "--repository", "/path/to/otherrepo" ] } } ``` -------------------------------- ### Log Message Format Example Source: https://github.com/eclipse-theia/theia/blob/master/packages/core/README_TEMPLATE.md Example of a Theia log message, showing the logger name ('root') and log level ('INFO'). Optionally, child process name and PID may follow. ```text root INFO [parcel-watcher: 10734] Started watching: /Users/captain.future/git/theia/CONTRIBUTING.md ``` -------------------------------- ### Configuring esbuild for Plugin Initialization Source: https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/doc/how-to-add-new-custom-plugin-api.md Register a dedicated entry point in esbuild to ensure the backend initialization function is dynamically loaded. ```javascript import { nodeOptions } from './gen-esbuild.node.mjs'; /** * Add our initialization function. If unsure, look at the already generated entries of * the nodeOptions where an entry is added for the default 'backend-init-theia' initialization. */ nodeOptions.entryPoints['foo-init'] = '@namespace/package/lib/node/foo-init'; ``` -------------------------------- ### Compile TypeScript sources Source: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md Compiles TypeScript sources; requires dependencies to be installed first. ```sh npm run compile ``` -------------------------------- ### GET /files/ Source: https://github.com/eclipse-theia/theia/blob/master/packages/filesystem/src/common/download/README.md Downloads a single file or a directory as a tar archive. ```APIDOC ## GET /files/ ### Description Downloads a single file or a directory. Folders are automatically compressed into tar archives. ### Method GET ### Endpoint /files/ ### Parameters #### Query Parameters - **uri** (string) - Required - The encoded URI of the file or directory to download. ### Request Example GET http://localhost:3000/files/?uri=file:///path/to/resource ### Response #### Success Response (200) - **file/archive** (binary) - The requested file or tar archive. #### Response Example Binary stream of file content. ``` -------------------------------- ### Identify msgpackr callstack error Source: https://github.com/eclipse-theia/theia/blob/master/doc/Migration.md Example of the error trace encountered when msgpackr version conflicts occur. ```text rpc-message-encoder.ts:151 Uncaught (in promise) Error: Error during encoding: 'Maximum call stack size exceeded' at MsgPackMessageEncoder.encode (rpc-message-encoder.ts:151:23) at MsgPackMessageEncoder.request (rpc-message-encoder.ts:137:14) at RpcProtocol.sendRequest (rpc-protocol.ts:161:22) at proxy-handler.ts:74:45 ``` -------------------------------- ### Identify Logger Names in Logs Source: https://github.com/eclipse-theia/theia/blob/master/packages/core/README.md Example of a log output showing the logger name and level for debugging purposes. ```text root INFO [parcel-watcher: 10734] Started watching: /Users/captain.future/git/theia/CONTRIBUTING.md ^^^^ ^^^^ ^^^^^^^^^^^^^^^^^^^^^ ```