FurqanSoftware / codemirror-languageserver

Language Server integration for CodeMirror 6
BSD 3-Clause "New" or "Revised" License
183 stars 24 forks source link

Can't integrate with sveltekit #23

Closed paoloricciuti closed 1 year ago

paoloricciuti commented 1 year ago

When I try to call the languageServer function directly in the script tag it crashes with some weird error from svelte. If I try to call the languageServer function onMount it throws this error

caught (in promise) TypeError: events_1.EventEmitter is not a constructor
    at new TransportRequestManager2 (codemirror-languageserver.js?v=a7fd2213:318:40)
    at WebSocketTransport3.Transport2 (codemirror-languageserver.js?v=a7fd2213:467:42)
    at new WebSocketTransport3 (codemirror-languageserver.js?v=a7fd2213:1500:30)
    at languageServer (codemirror-languageserver.js?v=a7fd2213:8519:16)
    at +page.svelte?t=1682723499451:156:25
    at run (chunk-PUOMPBAM.js?v=a7fd2213:19:10)
    at Array.map (<anonymous>)
    at chunk-PUOMPBAM.js?v=a7fd2213:1806:52
    at flush (chunk-PUOMPBAM.js?v=a7fd2213:1092:9)
    at init (chunk-PUOMPBAM.js?v=a7fd2213:1888:5)
T

Can you provide some hints on how can I fix this?

P.s. the fact that you can connect to an lsp from codemirror is just magical...thanks for your work ✨

paoloricciuti commented 1 year ago

I think this might be the issue

https://github.com/open-rpc/client-js/issues/310

I'm investigating this further

paoloricciuti commented 1 year ago

Ok it was definitely related to this, sorry for the not useful issue...closing this

Btw adding events@^3.3.0 as a peer dependency might be beneficial