Comments (15)
@wr8tt5 I faced a similar issue when upgrading to the latest release of CodeMirror 6. And so did several people: https://discuss.codemirror.net/t/highlighting-that-seems-ignored-in-cm6/4320.
You seem to have narrowed it down to a bit more specific cause of the issue. I will have to look into this.
I would hope/assume that others facing this same issue isn't also because of this package.
But, like mentioned in that thread linked above: https://discuss.codemirror.net/t/highlighting-that-seems-ignored-in-cm6/4320/19, my solution was the same: delete the package-lock.json
file, remove node_modules
and re-download all my dependencies.
Not the most ideal way of solving the issue. But I am leaving it here just in case it is viable for anyone facing the similar issue.
from codemirror-languageserver.
Removing package-lock.json
and the node_modules
did not resolve the issue in my case.
If this issue doesn't garner any alternative workarounds, or an explanation/solution, I'm happy to close it. I agree that it's unlikely to be an issue with codemirror-languageserver
and more likely due to some subtlety in the javascript/nodejs ecosystem. Raising this issue here serves to canvas contributors of this module, and help any others who find themselves in the same predicament. I was on the verge of looking elsewhere for a working codemirror/LSP example, and it would be a shame if others are turned away by this odd behavior, because I've found this module to be excellent in demystifying a large part of codemirror/LSP integration.
from codemirror-languageserver.
@wr8tt5 That is so odd. I wonder if something else is still being cached by NPM somehow.
But, you are absolutely right. At least knowing why this happens would be really useful.
I wonder if there is a way to reliably reproduce this issue.
Is your project open source, by any chance?
from codemirror-languageserver.
I've only been able to reproduce this issue using an Electron application. I have not been able to reproduce it with a normal web application e.g. a react/typescript app.
A minimal example Electron application can be found at codemirror-languageserver-issue15.
When run (npm update
then npm start
) check the browser console for the following message.
index.cjs:2009 Uncaught Error: Unrecognized extension value in extension set ([object Object]). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.
at inner (index.cjs:2009:1)
at inner (index.cjs:1984:1)
at inner (index.cjs:1984:1)
at flatten (index.cjs:2013:1)
at Function.resolve (index.cjs:1921:1)
at Function.create (index.cjs:2747:1)
at useCodeMirror.js:139:1
at commitHookEffectListMount (react-dom.development.js:23049:1)
at commitPassiveMountOnFiber (react-dom.development.js:24821:1)
at commitPassiveMountEffects_complete (react-dom.development.js:24781:1)
Copying index.ts into a local file (e.g. src/renderer/codemirror_lsp.ts
) and updating src/renderer/components/editor.tsx
to use it avoids the problem.
from codemirror-languageserver.
I'm also having a similar problem, in that I'm getting the same error as @wr8tt5 when I try to pass the language server created through this plugin into my CodeMirror configuration. In my case I think it might be something to do with the fact that this plugin still has @codemirror/state 0.20.0
as a dependency,
which is a pre-release version of CodeMirror6. Having updated the overall project to the actual release of CodeMirror6, the dependencies for @codemirror/state
are mismatched between this plugin and the overall project, resulting in multiple versions being installed: v6.x
for the overall project and v0.20.x
for this plugin.
from codemirror-languageserver.
hi, this is indeed caused because of multiple versions of @codemirror/state. I have fixed it in #17
from codemirror-languageserver.
To clarify
caused because of multiple versions of @codemirror/state
the same version of @codemirror/state
is being used throughout the codemirror-languageserver-issue15 example project above, albeit an older version @codemirror/[email protected]
. So technically, if upgrading to @codemirror/[email protected]
resolves the issue in the context of the example electron
project, the issue is not a version mismatch.
I've tried using a local codemirror-languageserver
module with upgraded @codemirror/*
dependencies and it does not seem to resolve the issue of using codemirror-languageserver
in an electron
project.
The steps I took were as follows.
- Cloned the example project repo above, and ran
ncu -u
on it to upgrade its dependencies to the latest major versions. - Cloned
codemirror-languageserver
alongside it, and manually changed itspackage.json
to use the latest versions of the various@codemirror/*
modules (being major version6.x.x
). I also had to addbrowserify/events
as a dependency (npm install events
) but this is anelectron
build requirement I think. - Updated the example project
pakage.json
to point to the localcodemirror-languageserver
clone using a"codemirror-languageserver": "file:../codemirror-languageserver"
dependency entry. - Ran
npm install
incodemirror-languageserver
and the example project. - Ran
npm list @codemirror/state
etc. to confirm that the latest version is being used throughout. - Ran
npm start
.
The issue persists.
from codemirror-languageserver.
I have just discovered though that after the steps above to use the latest @codemirror/*
modules that the issue persists even after using the workaround of copying index.ts into the project, which is unfortunate.
from codemirror-languageserver.
If I update the project package.json
to pin @uiw/react-codemirror
to 4.8.1
then the issue is avoided. If I pin it to 4.9.0
then the issue appears again. In summary the workaround, if wanting to use @codemirror/*@6.x.x
modules, is to do all of the following to the example electron
project.
ncu -u
to upgrade to the latest modules.- Copy index.ts into the example
electron
project and update imports accordingly. - Update its
package.json
to pin@uiw/react-codemirror
to4.8.1
i.e.
"dependencies": {
"@uiw/react-codemirror": "4.8.1",
...
}
It seems that @uiw/[email protected]
onwards has the same affliction as codemirror-languageserver
, and I can't see any obvious reason looking at a diff between its 4.8.1
and 4.9.0
tags. Probably time to take this issue up with uiwjs/react-codemirror
or codemirror/dev
.
from codemirror-languageserver.
@codemirror/[email protected]
v6.1.0 and 0.20.0 are not the same versions, they are not compatible. All other @codemirror/whatever deps are still using @codemirror/state v6.0.0. So, from how I see it, v6.0.0 is the way to go. I have tested it in #17, and it works.
from codemirror-languageserver.
@loiswells97 #17 has been merged and a new version has been released. Please update and it should solve your dependency issue.
@wr8tt5 You may also want to give the latest release a try.
from codemirror-languageserver.
No it doesn't resolve the issue, but as I've explained above it has made me aware that codemirror-languageserver
can be removed from the equation because simply moving from @uiw/[email protected]
to 4.9.0
reproduces the issue without codemirror-languageserver
being a dependency. I'll see what they say about this over at uiw/react-codemirror
.
from codemirror-languageserver.
No it doesn't resolve the issue, but as I've explained above it has made me aware that
codemirror-languageserver
can be removed from the equation because simply moving from@uiw/[email protected]
to4.9.0
reproduces the issue withoutcodemirror-languageserver
being a dependency. I'll see what they say about this over atuiw/react-codemirror
.
Why don't you try updating to the latest version ? @uiw/react-codemirror v4.10.3
from codemirror-languageserver.
I have. That is the point of running ncu -u
, but doing so reintroduced the issue even though my original workaround was in place. I then went forward from @uiw/[email protected]
to see whether there was a version where the error appeared, and that turns out to 4.9.0
.
from codemirror-languageserver.
@wr8tt5 Did you ever find a resolution to this issue? 😅
from codemirror-languageserver.
Related Issues (20)
- Sharing lsp clients between mutliple editors HOT 10
- [enhancement] Transport Agnostic HOT 2
- Wrong types HOT 1
- Module loader error
- Better tooltips
- How would you configure this if you don't have a server? HOT 7
- 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.