Skip to content

Commit be1fdc2

Browse files
committed
Update @theia/monaco-editor-core to 1.108.201 and adapt to API changes
Resolves GH-16401 - Bump @theia/monaco-editor-core from 1.96.302 to 1.108.201 - Replace editor.experimental.preferTreeSitter array preference with per-language boolean preferences (css, typescript, ini, regex) - Update MonacoContextMenuService to expose onDidShowContextMenu and onDidHideContextMenu as property initializers matching the updated IContextMenuService interface - Add onDidShowContextMenu/onDidHideContextMenu Event.None stubs to the inline IContextMenuService override in createInline(), fixing ContentHoverController crash - Fix focus/blur for Monaco 1.108 EditContext API by querying .native-edit-context before falling back to textarea - Add stageForPreview/unstagePreview to MonacoEditor and EditorWidget so visual tab previews render correctly when editors are hidden (model is set to null) - Add MonacoLayoutService override so Monaco UI elements position relative to the Theia application shell - Add MonacoWorkspaceContextService override - Display Monaco editor version in About dialog
1 parent d125615 commit be1fdc2

File tree

63 files changed

+563
-246
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+563
-246
lines changed

dev-packages/application-manager/src/generator/webpack-generator.ts

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ module.exports = [{
114114
devtool: 'source-map',
115115
entry: {
116116
bundle: path.resolve(__dirname, 'src-gen/frontend/index.js'),
117-
${this.ifMonaco(() => "'editor.worker': '@theia/monaco-editor-core/esm/vs/editor/editor.worker.js'")}
118117
},
119118
output: {
120119
filename: '[name].js',
@@ -221,6 +220,15 @@ module.exports = [{
221220
'os': false,
222221
'timers': false
223222
},
223+
${this.ifMonaco(() => `alias: {
224+
// Replace Monaco's nls module with Theia's localization-aware version.
225+
// ESM exports are immutable so we cannot override localize/localize2 at runtime.
226+
// Using the resolved absolute path ensures that both external imports
227+
// (e.g. '@theia/monaco-editor-core/esm/vs/nls') and internal relative
228+
// imports within Monaco (e.g. '../nls.js') are redirected.
229+
[path.join(resolvePackagePath('@theia/monaco-editor-core', __dirname), '..', 'esm', 'vs', 'nls.js')]:
230+
path.join(resolvePackagePath('@theia/monaco', __dirname), '..', 'lib', 'browser', 'monaco-nls.js')
231+
},`)}
224232
extensions: ['.js']
225233
},
226234
stats: {
@@ -237,6 +245,33 @@ module.exports = [{
237245
}
238246
]
239247
},
248+
${this.ifMonaco(() => `{
249+
// The Monaco editor worker must be built separately without the NLS alias.
250+
// The NLS alias redirects to monaco-nls.ts which imports from @theia/core,
251+
// and those modules are not available in the web worker context.
252+
mode,
253+
devtool: 'source-map',
254+
entry: {
255+
'editor.worker': '@theia/monaco-editor-core/esm/vs/editor/common/services/editorWebWorkerMain.js'
256+
},
257+
output: {
258+
filename: '[name].js',
259+
path: outputPath,
260+
devtoolModuleFilenameTemplate: 'webpack:///[resource-path]?[loaders]',
261+
globalObject: 'self'
262+
},
263+
target: 'webworker',
264+
cache: staticCompression,
265+
resolve: {
266+
extensions: ['.js']
267+
},
268+
ignoreWarnings: [
269+
{
270+
module: /@theia\\/monaco-editor-core/,
271+
message: /require function is used in a way in which dependencies cannot be statically extracted/
272+
}
273+
]
274+
},`)}
240275
{
241276
mode,
242277
plugins: [
@@ -282,6 +317,15 @@ module.exports = [{
282317
'os': false,
283318
'timers': false
284319
},
320+
${this.ifMonaco(() => `alias: {
321+
// Replace Monaco's nls module with Theia's localization-aware version.
322+
// ESM exports are immutable so we cannot override localize/localize2 at runtime.
323+
// Using the resolved absolute path ensures that both external imports
324+
// (e.g. '@theia/monaco-editor-core/esm/vs/nls') and internal relative
325+
// imports within Monaco (e.g. '../nls.js') are redirected.
326+
[path.join(resolvePackagePath('@theia/monaco-editor-core', __dirname), '..', 'esm', 'vs', 'nls.js')]:
327+
path.join(resolvePackagePath('@theia/monaco', __dirname), '..', 'lib', 'browser', 'monaco-nls.js')
328+
},`)}
285329
extensions: ['.js']
286330
},
287331
stats: {

examples/api-samples/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"@theia/file-search": "1.69.0",
1616
"@theia/filesystem": "1.69.0",
1717
"@theia/monaco": "1.69.0",
18-
"@theia/monaco-editor-core": "1.96.302",
18+
"@theia/monaco-editor-core": "1.108.201",
1919
"@theia/output": "1.69.0",
2020
"@theia/ovsx-client": "1.69.0",
2121
"@theia/search-in-workspace": "1.69.0",

package-lock.json

Lines changed: 59 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ai-chat-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"@theia/editor-preview": "1.69.0",
1111
"@theia/filesystem": "1.69.0",
1212
"@theia/monaco": "1.69.0",
13-
"@theia/monaco-editor-core": "1.96.302",
13+
"@theia/monaco-editor-core": "1.108.201",
1414
"@theia/preferences": "1.69.0",
1515
"@theia/workspace": "1.69.0",
1616
"tslib": "^2.6.2",

packages/ai-chat-ui/src/browser/chat-input-widget.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1347,7 +1347,7 @@ const ChatInput: React.FunctionComponent<ChatInputProperties> = (props: ChatInpu
13471347
// Disable code lens and inlay hints to avoid console errors from other contributions
13481348
codeLens: false,
13491349
inlayHints: { enabled: 'off' },
1350-
hover: { enabled: true },
1350+
hover: { enabled: 'on' },
13511351
autoSizing: false, // we handle the sizing ourselves
13521352
scrollBeyondLastLine: false,
13531353
scrollBeyondLastColumn: 0,

0 commit comments

Comments
 (0)