Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ REACT_APP_VERSION=$npm_package_version

REACT_APP_APIDOM_WORKER_PATH=./src/plugins/editor-monaco-language-apidom/language/apidom.worker.js
REACT_APP_APIDOM_WORKER_FILENAME=./apidom.worker.js
REACT_APP_EDITOR_WORKER_PATH=./node_modules/monaco-editor/esm/vs/editor/editor.worker.js
REACT_APP_EDITOR_WORKER_PATH=./node_modules/monaco-editor/esm/vs/editor/editor.worker.start.js
REACT_APP_EDITOR_WORKER_FILENAME=./editor.worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ By default, this configuration looks like this:
completionProviders: [],
performanceLogs: false,
logLevel: apidomLS.LogLevel.WARN,
defaultContentLanguage: {
namespace: 'asyncapi',
},
completionContext: {
maxNumberOfItems: 100,
enableLSPFilter: false,
Expand Down
991 changes: 416 additions & 575 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"@asyncapi/parser": "3.4.0",
"@asyncapi/protobuf-schema-parser": "3.6.0",
"@asyncapi/react-component": "2.6.5",
"@codingame/monaco-vscode-api": "=15.0.3",
"@codingame/monaco-vscode-api": "=23.2.2",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.0",
"@mui/material": "^5.16.9",
Expand Down Expand Up @@ -106,7 +106,7 @@
"js-file-download": "^0.4.12",
"js-yaml": "4.1.1",
"lodash": "^4.17.21",
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@=15.0.3",
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@=23.2.2",
"monaco-marker-data-provider": "^1.2.4",
"prop-types": "^15.8.1",
"react": ">=17 <19",
Expand All @@ -121,7 +121,7 @@
"styled-components": "^6.1.17",
"swagger-ui-react": "^5.30.3",
"util": "^0.12.5",
"vscode": "npm:@codingame/monaco-vscode-extension-api@=15.0.3",
"vscode": "npm:@codingame/monaco-vscode-extension-api@=23.2.2",
"vscode-languageclient": "=10.0.0-next.7",
"vscode-languageserver-textdocument": "^1.0.12"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ export class ApiDOMWorker {
completionProviders: [],
performanceLogs: false,
logLevel: apidomLS.LogLevel.WARN,
defaultContentLanguage: {
namespace: 'asyncapi',
},
completionContext: {
maxNumberOfItems: 100,
enableLSPFilter: false, // enables "strict" word filtering (instead of default Monaco fuzzy matching; https://github.com/swagger-api/apidom/pull/2954)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,45 @@
import { initialize } from 'monaco-editor/esm/vs/editor/editor.worker.js';
import { start } from 'monaco-editor/esm/vs/editor/editor.worker.start.js';

import { makeCreate, ApiDOMWorker } from './ApiDOMWorker.js';

const create = makeCreate(ApiDOMWorker);

/*
* SPDX-SnippetBegin
* SPDX-License-Identifier: MIT
* SPDX-SnippetCopyrightText: Copyright (c) 2022 CodinGame
*
* Copy of previous workaround removed in
* https://github.com/CodinGame/monaco-vscode-api/commit/d3fcbe903edf7151d4ca67467465a4fbb305747c
* TODO: Investigate and remove if possible during the next @codingame/monaco-vscode-api dependency update
*/
const initialize = () => {
start((context) => {
let requestHandler;
return new Proxy(
{},
{
get(_target, propKey) {
if (propKey === '$initialize') {
return async (data) => {
if (!requestHandler) {
requestHandler = create(context, data);
}
};
}
const value = requestHandler?.[propKey];

if (typeof value === 'function') {
return value.bind(requestHandler);
}
return value;
},
}
);
});
};
// SPDX-SnippetEnd

globalThis.onmessage = () => {
initialize((ctx, createData) => {
return create(ctx, createData);
Expand Down
7 changes: 5 additions & 2 deletions src/plugins/editor-monaco/after-load.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { initialize as initializeMonacoServices } from '@codingame/monaco-vscode-api';
import { initialize as initializeMonacoServices, ILogService } from '@codingame/monaco-vscode-api';
import 'vscode/localExtensionHost';

import lazyMonacoContribution from './monaco-contribution/index.js';
import CustomLogger from './monaco-contribution/CustomLogger.js';

function afterLoad(system) {
const InitPhase = {
Expand Down Expand Up @@ -36,7 +37,9 @@ function afterLoad(system) {

(async () => {
try {
await initializeMonacoServices({});
await initializeMonacoServices({
[ILogService.toString()]: new CustomLogger(),
});
system.monacoInitializationDeferred().resolve();
} catch (error) {
system.monacoInitializationDeferred().reject(error);
Expand Down
12 changes: 12 additions & 0 deletions src/plugins/editor-monaco/monaco-contribution/CustomLogger.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {
ConsoleLogger,
LogLevel,
} from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log';

class CustomLogger extends ConsoleLogger {
constructor() {
super(process.env.NODE_ENV === 'development' ? LogLevel.Info : LogLevel.Warning);
}
}

export default CustomLogger;
Loading