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

Do not reexport code of imported libraries (e.g. vscode-languageclient) #459

Merged
merged 4 commits into from
Mar 3, 2023
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
12 changes: 7 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
const path = require('path');
const headerDef = path.resolve(__dirname, './packages/config/header.js');
const headerDef = path.resolve(__dirname, './config/header.js');

module.exports = {
env: {
node: true,
browser: true,
es2020: true
es2022: true
},
extends: 'standard',
globals: {
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: '2020',
ecmaVersion: '2022',
sourceType: 'module',
project: './tsconfig.json'
},
Expand Down Expand Up @@ -51,8 +52,9 @@ module.exports = {
}]
},
ignorePatterns: [
'**/{node_modules,dist,lib,out,bin}',
'.eslintrc.js',
'vite.config.ts',
'packages/examples/browser-lsp/src/serverWorker.ts'
'config/header.js',
'packages/examples/*/*.ts'
]
};
2 changes: 1 addition & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '18'
- name: Build
shell: bash
run: |
Expand Down
8 changes: 4 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
"name": "Launch Sample Server",
"type": "node",
"request": "launch",
"args": ["${workspaceRoot}/packages/examples/server/src/server.ts"],
"args": ["${workspaceRoot}/packages/examples/main/src/server/main.ts"],
"runtimeArgs": ["--nolazy", "--loader", "ts-node/esm"],
"cwd": "${workspaceRoot}/packages/examples/server",
"cwd": "${workspaceRoot}/packages/examples/main",
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "Launch Sample Server (external)",
"type": "node",
"request": "launch",
"args": ["${workspaceRoot}/packages/examples/server/dist/server.js", "--external"],
"args": ["${workspaceRoot}/packages/examples/main/src/server/main.ts", "--external"],
"runtimeArgs": ["--nolazy", "--loader", "ts-node/esm"],
"cwd": "${workspaceRoot}/packages/examples/server",
"cwd": "${workspaceRoot}/packages/examples/main",
"internalConsoleOptions": "openOnSessionStart"
},
{
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@
"[json]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "vscode.json-language-features"
}
},
"angular.enable-strict-mode-prompt": false
}
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Click [here](http://typefox.io/teaching-the-language-server-protocol-to-microsof

- [Monaco Language Client \& VSCode WebSocket Json RPC](#monaco-language-client--vscode-websocket-json-rpc)
- [Latest Important Project Changes](#latest-important-project-changes)
- [March 2023](#march-2023)
- [September 2022](#september-2022)
- [June 2022](#june-2022)
- [May 2022](#may-2022)
Expand All @@ -33,6 +34,10 @@ Click [here](http://typefox.io/teaching-the-language-server-protocol-to-microsof

## Latest Important Project Changes

### March 2023

Both libraries no longer export code from other libraries (`vscode-jsonrpc`, `vscode-languageclient` and `vscode-languageserver-protocol`).

### September 2022

All code has been transformed to esm and npm packages are now of type module. cjs bundles are no longer available.
Expand Down Expand Up @@ -93,23 +98,23 @@ cd packages/client && npm run build

There are a couple of different examples that demonstrate how the `monaco-languageclient` can be used:

- The **server** example located in [./packages/examples/server](./packages/examples/server) runs a Node.js [Express app](./packages/examples/server/src/server.ts) where web sockets are used to enable communication between the language server process and the client web application. The language server can be started as internal or external process.
- The **server** example located in [./packages/examples/main/src/server](./packages/examples/main/src/server) runs a Node.js [Express app](./packages/examples/main/src/server/main.ts) where web sockets are used to enable communication between the language server process and the client web application. The language server can be started as internal or external process.

- The **client** example located in [./packages/examples/client](./packages/examples/client) contains the [client web app](./packages/examples/client/src/client.ts) which connects to the language server therefore requires the node server app to be run in parallel.
- The **client** example located in [./packages/examples/main/src/client](./packages/examples/main/src/client) contains the [client web app](./packages/examples/main/src/client/main.ts) which connects to the language server therefore requires the node server app to be run in parallel.

- The **browser-lsp** example located in [./packages/examples/browser-lsp](./packages/examples/browser-lsp) contains both the [language client](./packages/examples/browser-lsp/src/client.ts) and the [langauge server implementation running in a web worker](./packages/examples/browser-lsp/src/serverWorker.ts). They communicate via `vscode-languageserver-protocol/browser` instead of a web socket used in the **server/client** examples.
- The **langium-web-worker-language-server** example located in [./packages/examples/main/src/langium](./packages/examples/main/src/langium) contains both the [language client](./packages/examples/main/src/langium/main.ts) and the [langauge server implementation running in a web worker](https://github.com/langium/langium/blob/main/examples/statemachine/src/language-server/main-browser.ts). They communicate via `vscode-languageserver-protocol/browser` instead of a web socket used in the **server/client** examples.

- The **browser** example located in [./packages/examples/browser](./packages/examples/browser) demonstrates how a [language service written in JavaScript](./packages/examples/browser/src/client.ts) can be used in a Monaco Editor contained in a simple HTML page. This example can now be considered legacy as the web worker option eases client side language server implementation and separation.
- The **browser** example located in [./packages/examples/main/src/browser](./packages/examples/main/src/browser) demonstrates how a [language service written in JavaScript](./packages/examples/main/src/browser/main.ts) can be used in a Monaco Editor contained in a simple HTML page. This example can now be considered legacy as the web worker option eases client side language server implementation and separation.

- The **react-client** example located in [./packages/examples/react-client](./packages/examples/react-client) contains the [React client](./packages/examples/react-client/src/main.tsx). It does the same as the regular client example but inside a React Functional Component.
- The **react-client** example located in [./packages/examples/main/src/react](./packages/examples/main/src/react) contains the [React client](./packages/examples/main/src/react/main.tsx). It does the same as the regular client example but inside a React Functional Component.

- The **angular-client** example located in [./packages/examples/angular-client](./packages/examples/angular-client) contains the [Angular client](./packages/examples/angular-client/src/main.tsx). It does the same as the regular client example but inside an Angular Component.
- The **angular-client** example located in [./packages/examples/angular-client](./packages/examples/angular-client) contains the [Angular client](./packages/examples/angular-client/src/main.ts). It does the same as the regular client example but inside an Angular Component.

## Verification

- The **webpack** verification example located in [./packages/verify/webpack](./packages/verify/webpack) demonstrates how bundling can be achieved with webpack. You find the configuration here: [webpack.config.js](./packages/verify/webpack/webpack.config.js).

- The **vite** verification example located in [./packages/verify/vite](./packages/verify/vite) demonstrates how bundling can be achieved with vite. There is no configuration required
- The **vite** verification example located in [./packages/verify/vite](./packages/verify/vite) demonstrates how bundling can be achieved with vite. There is no configuration required.

## Example usage

Expand Down Expand Up @@ -149,6 +154,7 @@ The following table describes which version of **monaco-languageclient** and **m

| monaco-languageclient | monaco-vscode-api | monaco-editor | comment |
| :---- | :---- | :--- | :--- |
| 5.0.0 | 1.69.24 | 0.34.1 | Planned |
| 4.0.3 | 1.69.13 | 0.34.1 | |
| 4.0.1 | 1.69.12 | 0.34.1 | |
| 4.0.0 | 1.69.10 | 0.34.0 | |
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
<h1>Examples</h1>

Please execute <b><code>npm run start:example:server</code></b> beforehand:<br>
<a href="packages/examples/client/index.html">Web Client for Node.js Language Server</a>
<a href="packages/examples/main/client.html">Web Client for Node.js Language Server</a>
<br><br>
<a href="packages/examples/browser-lsp/index.html">Browser Language Client & Language Server in Web Worker</a>
<a href="packages/examples/main/langium_wwls.html">Web Client & Langium Web Worker Language Server Example</a>
<br><br>
<a href="packages/examples/browser/index.html">Browser Example</a>
<a href="packages/examples/main/browser.html">Browser Example</a>
<br><br>
<a href="packages/examples/react-client/index.html">React Client Example</a>
<a href="packages/examples/main/react.html">React Client Example</a>
<br><br>
Please start <b><code>npm run start:example:angular</code></b> beforehand:<br>
<a href="http://localhost:4200">Angular Client Example (ng dev server)</a>
Expand Down
Loading