Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

Commit

Permalink
Updated to monaco-languageclient 6.5.3 / monaco-vscode-api 1.82.5
Browse files Browse the repository at this point in the history
  • Loading branch information
kaisalmen committed Oct 13, 2023
1 parent 52919f2 commit ae25843
Show file tree
Hide file tree
Showing 14 changed files with 153 additions and 141 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h2>Monaco Editor Wrapper</h2>
<br>
<a href="./packages/examples/wrapper_langium.html">Langium Grammar DSL Language Client & Language Server (Worker)</a>
<br><br>
Please execute <b><code>npm run start:example:server:json</code></b> beforehand:<br>
Please execute <b><code>npm run start:examples:server:json</code></b> beforehand:<br>
<a href="./packages/examples/wrapper_ws.html">Language Client & Web Socket Language Server example</a>
<br>

Expand All @@ -39,7 +39,7 @@ <h2>Monaco Editor React</h2>
<a href="./packages/examples/react_ts.html">TypeScript Editor Worker</a>
<br>
<br>
Please execute <b><code>npm run start:example:server:python</code></b> beforehand:<br>
Please execute <b><code>npm run start:examples:server:python</code></b> beforehand:<br>
<a href="./packages/examples/react_python.html">Python Language Client & Language Server</a>
<br>

Expand Down
196 changes: 93 additions & 103 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"test": "vitest -c vitest.config.ts",
"release:prepare": "npm run reset:repo && npm ci && npm run lint && npm run build",
"reset:repo": "git clean -f -X -d",
"start:example:server:json": "npm run start:server:json --workspace packages/examples",
"start:example:server:python": "npm run start:server:python --workspace packages/examples"
"start:examples:server:json": "npm run start:server:json --workspace packages/examples",
"start:examples:server:python": "npm run start:server:python --workspace packages/examples"
},
"devDependencies": {
"@types/node": "~18.18.3",
Expand Down
6 changes: 6 additions & 0 deletions packages/examples/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to this npm module are documented in this file.

## 2023-09-11

- Adjust to underlying api changes (`monaco-vscode-api` and `monaco-languageclient`)
- Fix json language server lauch
- Move python language server port to 30001 and json language server port to 30000

## 2023-09-21

- Langium example allows to use semantic highlighting with monarch grammars (monaco-editor classic mode)
Expand Down
15 changes: 8 additions & 7 deletions packages/examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@
"version": "0.0.0",
"type": "module",
"dependencies": {
"@codingame/monaco-vscode-editor-service-override": "~1.82.4",
"@codingame/monaco-vscode-configuration-service-override": "~1.82.4",
"@codingame/monaco-vscode-json-default-extension": "~1.82.4",
"@codingame/monaco-vscode-keybindings-service-override": "~1.82.4",
"@codingame/monaco-vscode-python-default-extension": "~1.82.4",
"@typefox/monaco-editor-react": "~2.2.5",
"@codingame/monaco-vscode-configuration-service-override": "~1.82.5",
"@codingame/monaco-vscode-editor-service-override": "~1.82.5",
"@codingame/monaco-vscode-json-default-extension": "~1.82.5",
"@codingame/monaco-vscode-keybindings-service-override": "~1.82.5",
"@codingame/monaco-vscode-python-default-extension": "~1.82.5",
"@typefox/monaco-editor-react": "~2.3.0-next.2",
"http-server": "~14.1.1",
"langium": "~2.0.2",
"langium-statemachine-dsl": "~2.0.0",
"monaco-languageclient-examples": "~6.5.2",
"monaco-languageclient-examples": "~6.5.3",
"monaco-editor-workers": "~0.43.0",
"monaco-editor-wrapper": "~3.3.0-next.2",
"react": "~18.2.0",
"react-dom": "~18.2.0",
"request-light": "~0.7.0",
Expand Down
9 changes: 9 additions & 0 deletions packages/examples/src/langium/wrapperLangium.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const run = async () => {
export const startLangiumClientExtended = async () => {
try {
if (checkStarted()) return;
disableButton('button-start-classic');
const config = await setupLangiumClientExtended();
wrapper = new MonacoEditorLanguageClientWrapper();
wrapper.start(config, htmlElement);
Expand All @@ -37,6 +38,7 @@ export const startLangiumClientExtended = async () => {
export const startLangiumClientClassic = async () => {
try {
if (checkStarted()) return;
disableButton('button-start-extended');
const config = await setupLangiumClientClassic();
wrapper = new MonacoEditorLanguageClientWrapper();
await wrapper.start(config, htmlElement!);
Expand All @@ -53,6 +55,13 @@ const checkStarted = () => {
return false;
};

const disableButton = (id: string) => {
const button = document.getElementById(id) as HTMLButtonElement;
if (button !== null) {
button.disabled = true;
}
};

export const disposeEditor = async () => {
if (!wrapper) return;
wrapper.reportStatus();
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/src/reactPython.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const userConfig: UserConfig = {
name: 'Python Language Server Example',
$type: 'WebSocket',
host: 'localhost',
port: 30000,
port: 30001,
path: 'pyright',
extraParams: {
authorization: 'UserAuth'
Expand Down
7 changes: 5 additions & 2 deletions packages/examples/src/servers/json-server.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { runJsonServer } from 'monaco-languageclient-examples/node';
import { resolve } from 'path';
import { getLocalDirectory, runJsonServer } from 'monaco-languageclient-examples/node';

runJsonServer();
const baseDir = resolve(getLocalDirectory(import.meta.url));
const relativeDir = '../../../../node_modules/monaco-languageclient-examples/dist/json/server/json-server.js';
runJsonServer(baseDir, relativeDir);
2 changes: 1 addition & 1 deletion packages/examples/src/wrapperAdvanced.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Same again.`
$type: 'WebSocket',
name: 'wrapper42 language client',
host: 'localhost',
port: 3000,
port: 30000,
path: 'sampleServer',
secured: false
}
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/src/wrapperWs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const userConfig: UserConfig = {
languageClientConfig: {
options: {
$type: 'WebSocketUrl',
url: 'ws://localhost:3000/sampleServer',
url: 'ws://localhost:30000/sampleServer',
startOptions: {
onCall: () => {
console.log('Connected to socket.');
Expand Down
4 changes: 2 additions & 2 deletions packages/monaco-editor-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typefox/monaco-editor-react",
"version": "2.3.0-next.0",
"version": "2.3.0-next.2",
"license": "MIT",
"description": "React component for Monaco-Editor and Monaco Languageclient",
"keywords": [
Expand Down Expand Up @@ -50,7 +50,7 @@
"npm": "9.8.1"
},
"peerDependencies": {
"monaco-editor-wrapper": "~3.3.0-next.0",
"monaco-editor-wrapper": "~3.3.0-next.2",
"react": "~18.2.0",
"react-dom": "~18.2.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/monaco-editor-wrapper/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ All notable changes to npm module [monaco-editor-wrapper](https://www.npmjs.com/
## [2.3.0] - 2023-10-xy

- Properly separate and define classic and extended editor [#54](https://github.com/TypeFox/monaco-components/pull/54)
- Updated to `monaco-languageclient@6.5.2`
- Updated to `monaco-languageclient@6.5.3`

## [3.2.5] - 2023-10-13

Expand Down
13 changes: 8 additions & 5 deletions packages/monaco-editor-wrapper/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "monaco-editor-wrapper",
"version": "3.3.0-next.0",
"version": "3.3.0-next.2",
"license": "MIT",
"description": "Monaco-Editor and Monaco Languageclient Wrapper",
"keywords": [
Expand Down Expand Up @@ -58,12 +58,15 @@
"npm": "9.8.1"
},
"dependencies": {
"@codingame/monaco-vscode-editor-service-override": "~1.82.4",
"@codingame/monaco-vscode-configuration-service-override": "~1.82.4",
"monaco-languageclient": "~6.5.2"
"@codingame/monaco-vscode-configuration-service-override": "~1.82.5",
"@codingame/monaco-vscode-editor-service-override": "~1.82.5",
"@codingame/monaco-vscode-textmate-service-override": "~1.82.5",
"@codingame/monaco-vscode-theme-defaults-default-extension": "~1.82.5",
"@codingame/monaco-vscode-theme-service-override": "~1.82.5",
"monaco-languageclient": "~6.5.3"
},
"peerDependencies": {
"monaco-languageclient": "~6.5.2",
"monaco-languageclient": "~6.5.3",
"vscode-ws-jsonrpc": "~3.0.0"
},
"repository": {
Expand Down
28 changes: 14 additions & 14 deletions packages/monaco-editor-wrapper/test/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ describe('createUrl', () => {
const url = createUrl({
secured: false,
host: 'localhost',
port: 3000,
port: 30000,
path: 'sampleServer'
} as WebSocketConfigOptions);

expect(url).toBe('ws://localhost:3000/sampleServer');
expect(url).toBe('ws://localhost:30000/sampleServer');
});

test('test createUrl: wss', () => {
const url = createUrl({
secured: true,
host: 'localhost',
port: 3000,
port: 30000,
path: 'sampleServer'
} as WebSocketConfigOptions);

expect(url).toBe('wss://localhost:3000/sampleServer');
expect(url).toBe('wss://localhost:30000/sampleServer');
});

test('test createUrl: wss, no port, with path', () => {
Expand All @@ -39,10 +39,10 @@ describe('createUrl', () => {
const url = createUrl({
secured: true,
host: 'localhost',
port: 3000
port: 30000
} as WebSocketConfigOptions);

expect(url).toBe('wss://localhost:3000');
expect(url).toBe('wss://localhost:30000');
});

test('test createUrl: wss, no port, no path', () => {
Expand Down Expand Up @@ -77,26 +77,26 @@ describe('createUrl', () => {

test('test createUrl: optionsUrl: ws', () => {
const url = createUrl({
url: 'ws://localhost:3000/sampleServer'
url: 'ws://localhost:30000/sampleServer'
} as WebSocketConfigOptionsUrl);

expect(url).toBe('ws://localhost:3000/sampleServer');
expect(url).toBe('ws://localhost:30000/sampleServer');
});

test('test createUrl: optionsUrl: wss', () => {
const url = createUrl({
url: 'wss://localhost:3000/sampleServer'
url: 'wss://localhost:30000/sampleServer'
} as WebSocketConfigOptionsUrl);

expect(url).toBe('wss://localhost:3000/sampleServer');
expect(url).toBe('wss://localhost:30000/sampleServer');
});

test('test createUrl: optionsUrl, with port, no path', () => {
const url = createUrl({
url: 'wss://localhost:3000'
url: 'wss://localhost:30000'
} as WebSocketConfigOptionsUrl);

expect(url).toBe('wss://localhost:3000');
expect(url).toBe('wss://localhost:30000');
});

test('test createUrl: optionsUrl, no port, with path', () => {
Expand All @@ -117,8 +117,8 @@ describe('createUrl', () => {

test('test createUrl: ws, not proper url', () => {
expect(() => createUrl({
url: 'http://www.testme.com:3000/sampleServer'
} as WebSocketConfigOptionsUrl)).toThrowError('This is not a proper websocket url: http://www.testme.com:3000/sampleServer');
url: 'http://www.testme.com:30000/sampleServer'
} as WebSocketConfigOptionsUrl)).toThrowError('This is not a proper websocket url: http://www.testme.com:30000/sampleServer');
});

});

0 comments on commit ae25843

Please sign in to comment.