Comments (7)
Demo: https://codemirror-worker-lsp.ale.sh/
Source: https://gitlab.com/aedge/codemirror-web-workers-lsp-demo
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 languageServerWithTransport
in place of languageServer
:
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 ... ] })
from codemirror-languageserver.
@notpushkin Thanks for sharing this. Can I borrow your comment and add it as an example to this project's README.md?
from codemirror-languageserver.
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.
from codemirror-languageserver.
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 Window
and IFrame
transports there), then make sure it works if we pass it to the LanguageServerClient
. I might look into that if I have time, but no promises here.
from codemirror-languageserver.
@hjr265 Sure!
Maybe it would be better to merge PostMessageWorkerTransport
into @open-rpc/client-js first though, so that people don't end up copying it in every project? I was thinking about sending a PR later this week.
from codemirror-languageserver.
@notpushkin That makes sense. I will wait for your signal then.
from codemirror-languageserver.
Status on the PostMessageWorkerTransport merging?
Would love to use this
from codemirror-languageserver.
Related Issues (20)
- Sharing lsp clients between mutliple editors HOT 10
- [enhancement] Transport Agnostic HOT 2
- Wrong types HOT 1
- Codemirror not recognizing returned extensions and throwing "Unrecognized extension value in extension set" HOT 15
- Module loader error
- Better tooltips
- Waiting for reply of `initialized` before continuing HOT 1
- Feature Request: Support code snippets
- Can't integrate with sveltekit HOT 2
- Anyway to make the lsp project aware?
- Is the autocompletion provided by the language server reconfigurable?
- "Events" error HOT 2
- Is there any plan to make it fully support LSP? (jump to def, find references, symbol search)
- Issue with dependencies;
- What is the proper way to import with Rollup? HOT 2
- how to connect to tcp instead of web socket? HOT 1
- got "SyntaxError: Cannot use import statement outside a module" when running HOT 2
- How does filename work? HOT 4
- Lua language server not working: `Loading workspace (0/0)` HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from codemirror-languageserver.