How to write own editor

I want to write my own editor specific to my file extension. On click to the file with extension say .xyz , the file will open in my editor. I refereed tree editor but not understood much.

Hi @dijadhav,

I would recommend you to create a vscode extension that provides an editor for your specific file type. Theia is able to handle the vscode extension protocol, and therefore your written extension should be able to run both in vscode and Theia.

See here for an overview on how to build language support for a vscode extension and here for its custom editors guide.

Hello,
I have started implementing it . I used code editor from theia to display the content from my file and used language client from vscode. I am getting below error.

Error: The language client requires VS Code version ^1.52.0 but received version 1.15.0

root ERROR [hosted-plugin: 71201] Activating extension ‘Custom Editor’ failed: Error: The language client requires VS Code version ^1.52.0 but received version 1.15.0
at LanguageClient.checkVersion (/home/john/theia/sample/theia/web/node_modules/vscode-languageclient/lib/node/main.js:123:19)
at new LanguageClient (/home/john/theia/sample/theia/web/node_modules/vscode-languageclient/lib/node/main.js:104:18)
at activate (/home/john/theia/sample/theia/web/plugins/customer-editor-vs-extension/lib/extension.js:36:14)
at PluginManagerExtImpl. (/home/john/theia/sample/theia/web/node_modules/@theia/plugin-ext/lib/plugin/plugin-manager.js:556:87)
at step (/home/john/theia/sample/theia/web/node_modules/@theia/plugin-ext/lib/plugin/plugin-manager.js:48:23)
at Object.next (/home/john/theia/sample/theia/web/node_modules/@theia/plugin-ext/lib/plugin/plugin-manager.js:29:53)
at /home/john/theia/sample/theia/web/node_modules/@theia/plugin-ext/lib/plugin/plugin-manager.js:23:71
at new Promise ()
at __awaiter (/home/john/theia/sample/theia/web/node_modules/@theia/plugin-ext/lib/plugin/plugin-manager.js:19:12)
at PluginManagerExtImpl.startPlugin (/home/john/theia/sample/theia/web/node_modules/@theia/plugin-ext/lib/plugin/plugin-manager.js:523:16)

Theia only supports vscode extensions up to a certain version. The currently supported version is 1.50. You can change the required vscode version of your extension in the engine property of your package.json and don’t forget to update the devDependencies as well. (assuming you can easily change to 1.50 and don’t require any methods/types of the newer API)

Also, it looks like you’re using quite an old version of Theia, which only supports vscode API 1.15. You should probably update your Theia dependency.

Thanks For reply.

I am using latest version of theia in my extension “@theia/core”: “latest” and latest is 1.15.0. Also I am not able to find from where it is taking 1.15 for VS code.

That’s weird. The 1.50 is hardcoded in here. Would you mind sharing an minimal reproduction example?

I have lowered my vs code version to 1.50 and language library version 6.2.0 then it worked.