Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to monaco-vscode-api 9.0.x #749

Merged
merged 9 commits into from
Sep 26, 2024
2 changes: 0 additions & 2 deletions packages/client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@
* Licensed under the MIT License. See LICENSE in the package root for license information.
* ------------------------------------------------------------------------------------------ */

export type * from './client.js';
export * from './client.js';
export type * from './commonTypes.js';
export * from './commonTypes.js';
1 change: 0 additions & 1 deletion packages/client/src/tools/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@
* Licensed under the MIT License. See LICENSE in the package root for license information.
* ------------------------------------------------------------------------------------------ */

export type * from './logging.js';
export * from './logging.js';
40 changes: 0 additions & 40 deletions packages/client/src/tools/logging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,43 +24,3 @@ export class ConsoleLogger extends VSCodeConsoleLogger {
}

}

export function checkLogLevel(logLevel?: string | number | unknown) {
switch (logLevel) {
case 'none':
case 'Off':
case 'off':
case '0':
case 0:
return LogLevel.Off;
case 'Trace':
case 'trace':
case '1':
case 1:
return LogLevel.Trace;
case 'Debug':
case 'debug':
case '2':
case 2:
return LogLevel.Debug;
case 'Info':
case 'info':
case '3':
case 3:
return LogLevel.Info;
case 'Warning':
case 'warning':
case 'Warn':
case 'warn':
case '4':
case 4:
return LogLevel.Warning;
case 'Error':
case 'error':
case '5':
case 5:
return LogLevel.Error;
default:
return LogLevel.Off;
}
}
2 changes: 0 additions & 2 deletions packages/client/src/vscode/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@
* ------------------------------------------------------------------------------------------ */

export * from './fakeWorker.js';

export type * from './services.js';
export * from './services.js';
4 changes: 2 additions & 2 deletions packages/client/test/tools/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* ------------------------------------------------------------------------------------------ */

import { describe, expect, test } from 'vitest';
import { checkLogLevel, ConsoleLogger } from 'monaco-languageclient/tools';
import { ConsoleLogger } from 'monaco-languageclient/tools';
import { LogLevel } from 'vscode/services';

describe('Logger', () => {
Expand Down Expand Up @@ -34,7 +34,7 @@ describe('Logger', () => {
});

test('Config: checkLogLevel debug', () => {
const logger = new ConsoleLogger(checkLogLevel(2));
const logger = new ConsoleLogger(LogLevel.Debug);

expect(logger.getLevel()).toBe(LogLevel.Debug);
});
Expand Down
4 changes: 2 additions & 2 deletions packages/examples/src/browser/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import '@codingame/monaco-vscode-json-default-extension';
import { getLanguageService, TextDocument } from 'vscode-json-languageservice';
import { createConverter as createCodeConverter } from 'vscode-languageclient/lib/common/codeConverter.js';
import { createConverter as createProtocolConverter } from 'vscode-languageclient/lib/common/protocolConverter.js';
import { checkLogLevel } from 'monaco-languageclient/tools';
import { LogLevel } from 'vscode/services';
import { MonacoEditorLanguageClientWrapper, WrapperConfig } from 'monaco-editor-wrapper';
import { configureMonacoWorkers } from '../common/client/utils.js';

Expand All @@ -29,7 +29,7 @@ export const runBrowserEditor = async () => {

const wrapper = new MonacoEditorLanguageClientWrapper();
const jsonClientUserConfig: WrapperConfig = {
logLevel: checkLogLevel(2),
logLevel: LogLevel.Debug,
serviceConfig: {
userServices: {
...getKeybindingsServiceOverride(),
Expand Down
4 changes: 2 additions & 2 deletions packages/examples/src/eclipse.jdt.ls/client/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { RegisteredFileSystemProvider, RegisteredMemoryFile, registerFileSystemO
// this is required syntax highlighting
import '@codingame/monaco-vscode-java-default-extension';
import { MonacoEditorLanguageClientWrapper, WrapperConfig } from 'monaco-editor-wrapper';
import { checkLogLevel } from 'monaco-languageclient/tools';
import { LogLevel } from 'vscode/services';
import { eclipseJdtLsConfig } from '../config.js';
import helloJavaCode from '../../../resources/eclipse.jdt.ls/workspace/hello.java?raw';
import { configureMonacoWorkers } from '../../common/client/utils.js';
Expand All @@ -21,7 +21,7 @@ export const runEclipseJdtLsClient = () => {
registerFileSystemOverlay(1, fileSystemProvider);

const userConfig: WrapperConfig = {
logLevel: checkLogLevel(2),
logLevel: LogLevel.Debug,
serviceConfig: {
userServices: {
...getKeybindingsServiceOverride(),
Expand Down
4 changes: 2 additions & 2 deletions packages/examples/src/groovy/client/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import getKeybindingsServiceOverride from '@codingame/monaco-vscode-keybindings-service-override';
// this is required syntax highlighting
import '@codingame/monaco-vscode-groovy-default-extension';
import { checkLogLevel } from 'monaco-languageclient/tools';
import { LogLevel } from 'vscode/services';
import { MonacoEditorLanguageClientWrapper, WrapperConfig } from 'monaco-editor-wrapper';
import { groovyConfig } from '../config.js';
import { configureMonacoWorkers } from '../../common/client/utils.js';
Expand All @@ -17,7 +17,7 @@ File file = new File("E:/Example.txt");
`;

const userConfig: WrapperConfig = {
logLevel: checkLogLevel(2),
logLevel: LogLevel.Debug,
serviceConfig: {
userServices: {
...getKeybindingsServiceOverride(),
Expand Down
4 changes: 2 additions & 2 deletions packages/examples/src/json/client/wrapperWs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import getKeybindingsServiceOverride from '@codingame/monaco-vscode-keybindings-service-override';
// this is required syntax highlighting
import '@codingame/monaco-vscode-json-default-extension';
import { checkLogLevel } from 'monaco-languageclient/tools';
import { LogLevel } from 'vscode/services';
import { MonacoEditorLanguageClientWrapper, WrapperConfig } from 'monaco-editor-wrapper';
import { configureMonacoWorkers } from '../../common/client/utils.js';

Expand All @@ -16,7 +16,7 @@ const text = `{
}`;

export const jsonClientUserConfig: WrapperConfig = {
logLevel: checkLogLevel(2),
logLevel: LogLevel.Debug,
serviceConfig: {
userServices: {
...getKeybindingsServiceOverride(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import getConfigurationServiceOverride from '@codingame/monaco-vscode-configurat
import getEditorServiceOverride from '@codingame/monaco-vscode-editor-service-override';
import getKeybindingsServiceOverride from '@codingame/monaco-vscode-keybindings-service-override';
import { useOpenEditorStub } from 'monaco-editor-wrapper/vscode/services';
import { checkLogLevel, Logger } from 'monaco-languageclient/tools';
import { LogLevel } from 'vscode/services';
import { Logger } from 'monaco-languageclient/tools';
import { WrapperConfig } from 'monaco-editor-wrapper';
// import { configureMonacoWorkers } from '../../../common/client/utils.js';
import { LangiumMonarchContent } from './langium.monarch.js';
import { loadLangiumWorker } from '../wrapperLangium.js';
import code from '../content/example.langium?raw';
Expand All @@ -18,7 +18,7 @@ import { useWorkerFactory } from 'monaco-editor-wrapper/workerFactory';
export const setupLangiumClientClassic = async (): Promise<WrapperConfig> => {
const langiumWorker = loadLangiumWorker();
return {
logLevel: checkLogLevel(2),
logLevel: LogLevel.Debug,
serviceConfig: {
userServices: {
...getConfigurationServiceOverride(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import getKeybindingsServiceOverride from '@codingame/monaco-vscode-keybindings-
import '../../../../resources/vsix/github-vscode-theme.vsix';
import { useOpenEditorStub } from 'monaco-editor-wrapper/vscode/services';
import { BrowserMessageReader, BrowserMessageWriter } from 'vscode-languageclient/browser.js';
import { checkLogLevel } from 'monaco-languageclient/tools';
import { LogLevel } from 'vscode/services';
import { WrapperConfig } from 'monaco-editor-wrapper';
import { loadLangiumWorker } from '../wrapperLangium.js';
import { configureMonacoWorkers } from '../../../common/client/utils.js';
Expand All @@ -28,7 +28,7 @@ export const setupLangiumClientExtended = async (): Promise<WrapperConfig> => {
const writer = new BrowserMessageWriter(langiumWorker);

return {
logLevel: checkLogLevel(2),
logLevel: LogLevel.Debug,
serviceConfig: {
userServices: {
...getEditorServiceOverride(useOpenEditorStub),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import getKeybindingsServiceOverride from '@codingame/monaco-vscode-keybindings-
import getLifecycleServiceOverride from '@codingame/monaco-vscode-lifecycle-service-override';
import getLocalizationServiceOverride from '@codingame/monaco-vscode-localization-service-override';
import { createDefaultLocaleConfiguration } from 'monaco-languageclient/vscode/services';
import { checkLogLevel } from 'monaco-languageclient/tools';
import { LogLevel } from 'vscode/services';
import { LanguageClientConfig, WrapperConfig } from 'monaco-editor-wrapper';
// cannot be imported with assert as json contains comments
import statemachineLanguageConfig from './language-configuration.json?raw';
Expand Down Expand Up @@ -50,7 +50,7 @@ export const createLangiumGlobalConfig = async (params: {
} : undefined;

return {
logLevel: checkLogLevel(2),
logLevel: LogLevel.Debug,
serviceConfig: {
userServices: {
...getKeybindingsServiceOverride(),
Expand Down
4 changes: 2 additions & 2 deletions packages/examples/src/multi/twoLanguageClients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import getKeybindingsServiceOverride from '@codingame/monaco-vscode-keybindings-
// this is required syntax highlighting
import '@codingame/monaco-vscode-json-default-extension';
import '@codingame/monaco-vscode-python-default-extension';
import { checkLogLevel } from 'monaco-languageclient/tools';
import { LogLevel } from 'vscode/services';
import { CodePlusFileExt, MonacoEditorLanguageClientWrapper, WrapperConfig } from 'monaco-editor-wrapper';
import { MonacoLanguageClient } from 'monaco-languageclient';
import { configureMonacoWorkers, disableButton } from '../common/client/utils.js';
Expand All @@ -32,7 +32,7 @@ print("Hello Moon!")

const wrapperConfig: WrapperConfig = {
id: '42',
logLevel: checkLogLevel(2),
logLevel: LogLevel.Debug,
serviceConfig: {
userServices: {
...getKeybindingsServiceOverride()
Expand Down
4 changes: 2 additions & 2 deletions packages/examples/src/python/client/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as vscode from 'vscode';
import getEditorServiceOverride from '@codingame/monaco-vscode-editor-service-override';
import getKeybindingsServiceOverride from '@codingame/monaco-vscode-keybindings-service-override';
import '@codingame/monaco-vscode-python-default-extension';
import { checkLogLevel } from 'monaco-languageclient/tools';
import { LogLevel } from 'vscode/services';
import { createUrl, WrapperConfig } from 'monaco-editor-wrapper';
import { useOpenEditorStub } from 'monaco-editor-wrapper/vscode/services';
import { MonacoLanguageClient } from 'monaco-languageclient';
Expand Down Expand Up @@ -63,7 +63,7 @@ export const createUserConfig = (workspaceRoot: string, code: string, codeUri: s
}
}
},
logLevel: checkLogLevel(2),
logLevel: LogLevel.Debug,
serviceConfig: {
userServices: {
...getEditorServiceOverride(useOpenEditorStub),
Expand Down
4 changes: 2 additions & 2 deletions packages/examples/src/ts/wrapperTs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import getKeybindingsServiceOverride from '@codingame/monaco-vscode-keybindings-
import '@codingame/monaco-vscode-theme-defaults-default-extension';
import '@codingame/monaco-vscode-typescript-basics-default-extension';
import '@codingame/monaco-vscode-typescript-language-features-default-extension';
import { checkLogLevel } from 'monaco-languageclient/tools';
import { LogLevel } from 'vscode/services';
import { CodePlusUri, MonacoEditorLanguageClientWrapper, WrapperConfig } from 'monaco-editor-wrapper';
import { configureMonacoWorkers } from '../common/client/utils.js';

Expand All @@ -24,7 +24,7 @@ export const runTsWrapper = async () => {
};`;

const wrapperConfig: WrapperConfig = {
logLevel: checkLogLevel(2),
logLevel: LogLevel.Debug,
serviceConfig: {
userServices: {
...getKeybindingsServiceOverride()
Expand Down
8 changes: 4 additions & 4 deletions packages/wrapper-react/test/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { describe, expect, test } from 'vitest';
import { render, RenderResult } from '@testing-library/react';
import React from 'react';
import { checkLogLevel } from 'monaco-languageclient/tools';
import { LogLevel } from 'vscode/services';
import { MonacoEditorLanguageClientWrapper, WrapperConfig } from 'monaco-editor-wrapper';
import { MonacoEditorReactComp, TextChanges } from '@typefox/monaco-editor-react';
import { updateExtendedAppPrototyp } from './helper.js';
Expand All @@ -15,7 +15,7 @@ describe('Test MonacoEditorReactComp', () => {
test('rerender', async () => {
updateExtendedAppPrototyp();
const wrapperConfig: WrapperConfig = {
logLevel: checkLogLevel(2),
logLevel: LogLevel.Debug,
editorAppConfig: {
$type: 'extended',
}
Expand All @@ -42,7 +42,7 @@ describe('Test MonacoEditorReactComp', () => {
test('update onTextChanged', async () => {
updateExtendedAppPrototyp();
const wrapperConfig: WrapperConfig = {
logLevel: checkLogLevel(2),
logLevel: LogLevel.Debug,
editorAppConfig: {
$type: 'extended',
codeResources: {
Expand Down Expand Up @@ -80,7 +80,7 @@ describe('Test MonacoEditorReactComp', () => {
test('update codeResources', async () => {
updateExtendedAppPrototyp();
const wrapperConfig: WrapperConfig = {
logLevel: checkLogLevel(2),
logLevel: LogLevel.Debug,
editorAppConfig: {
$type: 'extended',
codeResources: {
Expand Down
8 changes: 1 addition & 7 deletions packages/wrapper/src/editorAppClassic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* ------------------------------------------------------------------------------------------ */

import * as monaco from 'monaco-editor';
import { updateUserConfiguration } from '@codingame/monaco-vscode-configuration-service-override';
import { Logger } from 'monaco-languageclient/tools';
import { EditorAppBase, EditorAppConfigBase } from './editorAppBase.js';
import { ModelUpdateType, isEqual, isModelUpdateRequired } from './utils.js';
Expand Down Expand Up @@ -46,12 +45,7 @@ export class EditorAppClassic extends EditorAppBase {
}

override async loadUserConfiguration() {
if (this.config.editorOptions?.['semanticHighlighting.enabled'] !== undefined) {
// use updateConfiguration here as otherwise semantic highlighting will not work
await updateUserConfiguration(JSON.stringify({
'editor.semanticHighlighting.enabled': this.config.editorOptions['semanticHighlighting.enabled']
}));
}
// nothing needed here currently
}

async init() {
Expand Down
11 changes: 0 additions & 11 deletions packages/wrapper/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,9 @@
* Licensed under the MIT License. See LICENSE in the package root for license information.
* ------------------------------------------------------------------------------------------ */

export type * from './editorAppBase.js';
export * from './editorAppBase.js';

export type * from './editorAppClassic.js';
export * from './editorAppClassic.js';

export type * from './editorAppExtended.js';
export * from './editorAppExtended.js';

export type * from './languageClientWrapper.js';
export * from './languageClientWrapper.js';

export type * from './wrapper.js';
export * from './wrapper.js';

export * from './utils.js';
export type * from './utils.js';
Loading