The @theia/core
extension is the main extension for all Theia-based applications, and provides the main framework for all dependent extensions.
The extension provides the base APIs for all Theia-based applications, including:
- Application APIs
- Shell APIs
- Base Widgets
- Contribution Points (ex: commands, menu items, keybindings)
A Theia extension is a node package declaring theiaExtensions
property in package.json
:
{
"theiaExtensions": [{
"frontend": "lib/myExtension/browser/myextension-frontend-module",
"backend": "lib/myExtension/node/myextension-backend-module",
}, {
"frontend": "lib/myExtension2/browser/myextension2-browser-module",
"frontendElectron": "lib/myExtension2/electron-browser/myextension2-electron-browser-module",
"backend": "lib/myExtension2/node/myextension2-node-module",
"backendElectron": "lib/myExtension2/electron-main/myextension2-electron-main-module"
}]
}
Each extension can consist of the following modules:
frontend
is used in the browser env and as well in the electron iffrontendElectron
is not providedfrontendElectron
is used in the electron envbackend
is used in the node env and as well in the electron env ifbackendElectron
is not providedbackendElectron
is used in the electron env
An extension module should have a default export of ContainerModule | Promise<ContainerModule>
type.
A Theia application is a node package listing Theia extensions as dependencies and managed with Theia CLI.
In order to make application builds more stable @theia/core
re-exports some common dependencies for Theia extensions to re-use. This is especially useful when having to re-use the same dependencies as @theia/core
does: Since those dependencies will be pulled by Theia, instead of trying to match the same version in your own packages, you can use re-exports to consume it from the framework directly.
Let's take inversify as an example since you will most likely use this package, you can import it by prefixing with @theia/core/shared/
:
import { injectable } from '@theia/core/shared/inversify';
@injectable()
export class SomeClass {
// ...
}
@theia/core/electron-shared/...
native-keymap
(fromnative-keymap@^2.2.1
)electron
(fromelectron@^30.1.2
)electron-store
(fromelectron-store@^8.0.0
)fix-path
(fromfix-path@^3.0.0
)
@theia/core/shared/...
@phosphor/algorithm
(from@phosphor/algorithm@1
)@phosphor/commands
(from@phosphor/commands@1
)@phosphor/coreutils
(from@phosphor/coreutils@1
)@phosphor/domutils
(from@phosphor/domutils@1
)@phosphor/dragdrop
(from@phosphor/dragdrop@1
)@phosphor/messaging
(from@phosphor/messaging@1
)@phosphor/properties
(from@phosphor/properties@1
)@phosphor/signaling
(from@phosphor/signaling@1
)@phosphor/virtualdom
(from@phosphor/virtualdom@1
)@phosphor/widgets
(from@phosphor/widgets@1
)@theia/application-package
(from@theia/[email protected]
)@theia/application-package/lib/api
(from@theia/[email protected]
)@theia/application-package/lib/environment
(from@theia/[email protected]
)@theia/request
(from@theia/[email protected]
)@theia/request/lib/proxy
(from@theia/[email protected]
)@theia/request/lib/node-request-service
(from@theia/[email protected]
)fs-extra
(fromfs-extra@^4.0.2
)fuzzy
(fromfuzzy@^0.1.3
)inversify
(frominversify@^6.0.1
)react-dom
(fromreact-dom@^18.2.0
)react-dom/client
(fromreact-dom@^18.2.0
)react-virtuoso
(fromreact-virtuoso@^2.17.0
)vscode-languageserver-protocol
(fromvscode-languageserver-protocol@^3.17.2
)vscode-uri
(fromvscode-uri@^2.1.1
)@parcel/watcher
(from@parcel/watcher@^2.4.1
)dompurify
(fromdompurify@^2.2.9
)express
(fromexpress@^4.16.3
)lodash.debounce
(fromlodash.debounce@^4.0.8
)lodash.throttle
(fromlodash.throttle@^4.1.1
)markdown-it
(frommarkdown-it@^12.3.2
)react
(fromreact@^18.2.0
)ws
(fromws@^8.17.1
)yargs
(fromyargs@^15.3.1
)
It's possible to change the log level for the entire Theia application by
passing it the --log-level={fatal,error,warn,info,debug,trace}
option. For
more fine-grained adjustment, it's also possible to set the log level per
logger (i.e. per topic). The root
logger is a special catch-all logger
through which go all messages not sent through a particular logger. To change
the log level of particular loggers, create a config file such as
{
"defaultLevel": "info",
"levels": {
"terminal": "debug",
"task": "error"
}
}
where levels
contains the logger-to-log-level mapping. defaultLevel
contains the log level to use for loggers not specified in levels
. This file
can then be specified using the --log-config
option. Theia will watch that
file for changes, so it's possible to change log levels at runtime by
modifying this file.
It's unfortunately currently not possible to query Theia for the list of existing loggers. However, each log message specifies from which logger it comes from, which can give an idea, without having to read the code:
root INFO [parcel-watcher: 10734] Started watching: /Users/captain.future/git/theia/CONTRIBUTING.md
^^^^ ^^^^ ^^^^^^^^^^^^^^^^^^^^^
Where root
is the name of the logger and INFO
is the log level. These are optionally followed by the name of a child process and the process ID.
THEIA_HOSTS
- A comma-separated list of hosts expected to resolve to the current application.
- e.g:
theia.app.com,some.other.domain:3000
- e.g:
- The port number is important if your application is not hosted on either
80
or443
. - If possible, you should set this environment variable:
- When not set, Theia will allow any origin to access the WebSocket services.
- When set, Theia will only allow the origins defined in this environment variable.
- A comma-separated list of hosts expected to resolve to the current application.
FRONTEND_CONNECTION_TIMEOUT
- The duration in milliseconds during which the backend keeps the connection contexts for the frontend to reconnect.
- This duration defaults to '0' if not set.
- If set to negative number, the backend will never close the connection.
- Eclipse Public License 2.0
- 一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception
"Theia" is a trademark of the Eclipse Foundation https://www.eclipse.org/theia