-
Notifications
You must be signed in to change notification settings - Fork 26
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
How would you configure this if you don't have a server? #20
Comments
Web Workers would be a feasible solution here I think. IIRC you'd still have to have a separate JS file for the worker itself, so no huge bundles for you :^) For this to work, we'll want to add a Web Workers transport to @open-rpc/client-js (there's similar |
Demo: https://codemirror-worker-lsp.ale.sh/ The interesting bits are _transport.ts (the PostMessageWorkerTransport implementation) and _jsonWorker.ts (a JSON language server connected to Web Worker messaging). After defining those you can just call import { languageServerWithTransport } from 'codemirror-languageserver';
const ls = languageServerWithTransport({
transport: new PostMessageWorkerTransport(new Worker(...)),
rootUri: "file:///",
workspaceFolders: null,
documentUri: `file:///tsconfig.json`,
languageId: "json",
});
EditorState.create({ extensions: [ ... ls ... ] }) |
@notpushkin Thanks for sharing this. Can I borrow your comment and add it as an example to this project's README.md? |
@hjr265 Sure! Maybe it would be better to merge |
@notpushkin That makes sense. I will wait for your signal then. |
Status on the PostMessageWorkerTransport merging? Would love to use this |
Unfortunately I had to deprioritize this. Sorry! If anybody else wants to send a PR to @open-rpc/client-js, feel free to use my code. |
I primarily work on backendless apps, and would not be able to host anything anywhere (other than static assets via CDN).
ideally, I'd like to import / bundle language servers with the codemirror bundle I'm building so I don't even need to worry about providing public asset path mapping (I totally understand this adds a lot to initial load time).
Is this possible today? Maybe via WebWorkers?
The text was updated successfully, but these errors were encountered: