monaco-languageclient
monaco-languageclient copied to clipboard
onDidChangeConfiguration is not a function error in both `wrapper-react` and standard use.
I'm receiving a very similar error to #686:
contextKeyService.js:82 Uncaught (in promise) TypeError: this._configurationService.onDidChangeConfiguration is not a function
at new ConfigAwareContextValuesContainer (contextKeyService.js:82:1)
at new ContextKeyService (contextKeyService.js:314:1)
at InstantiationService._createInstance (instantiationService.js:120:1)
at InstantiationService._createServiceInstance (instantiationService.js:224:1)
at InstantiationService._createServiceInstanceWithOwner (instantiationService.js:212:1)
at InstantiationService._createAndCacheServiceInstance (instantiationService.js:203:1)
at InstantiationService._safeCreateAndCacheServiceInstance (instantiationService.js:161:1)
at InstantiationService._getOrCreateServiceInstance (instantiationService.js:147:1)
at Object.get (instantiationService.js:70:1)
at lifecycle.js:38:1
ConfigAwareContextValuesContainer @ contextKeyService.js:82
ContextKeyService @ contextKeyService.js:314
_createInstance @ instantiationService.js:120
_createServiceInstance @ instantiationService.js:224
_createServiceInstanceWithOwner @ instantiationService.js:212
_createAndCacheServiceInstance @ instantiationService.js:203
_safeCreateAndCacheServiceInstance @ instantiationService.js:161
_getOrCreateServiceInstance @ instantiationService.js:147
get @ instantiationService.js:70
(anonymous) @ lifecycle.js:38
invokeFunction @ instantiationService.js:77
startup @ lifecycle.js:36
await in startup (async)
commitLayoutEffectOnFiber @ react-dom.development.js:23344
commitLayoutMountEffects_complete @ react-dom.development.js:24727
commitLayoutEffects_begin @ react-dom.development.js:24712
commitLayoutEffects @ react-dom.development.js:24651
commitRootImpl @ react-dom.development.js:26862
commitRoot @ react-dom.development.js:26721
finishConcurrentRender @ react-dom.development.js:26020
performConcurrentWorkOnRoot @ react-dom.development.js:25848
workLoop @ scheduler.development.js:266
flushWork @ scheduler.development.js:239
performWorkUntilDeadline @ scheduler.development.js:533
Same error occurs when using the wrapper-react as well as a more general approach:
const wrapper = new MonacoEditorLanguageClientWrapper();
await wrapper.init(getMonacoWrapperConfig());
Turning off HMR and liveReload results in the same error.
It's possible that this error is related to the bundler I'm using (rsbuild/rspack), but I've been able to get regular Monaco Editor working mostly out of the box.
I've create a test repro repo. Should just be able to npm install, npm run dev to see the error.
@kaisalmen As always, the issue is multiple package version installed
[email protected] uses [email protected] and you're using @codingame/[email protected], instead of the 6.0.3
@CGNonofr there must/should occur peerDependeny warnings. I have to check that independently
similar error
Did you check for multiple package version installed?
i am also getting the same error, i have spent more than 5 hours trying to setup LSP into Monaco editor. Why there isn't any guide, I have tried looking the those examples, they are really confusing.
There are no guide or tutorial or blogs posted recently, all of them are outdated.
i am using the same versions listed in the example repository -
but still getting the error
contextKeyService.js:81 Uncaught (in promise) TypeError: this._configurationService.onDidChangeConfiguration is not a function
i only changed these packages because there version was updated
"monaco-editor-wrapper": "next",
"monaco-languageclient": "next",
here is my package.json
"@codingame/monaco-vscode-keybindings-service-override": "8.0.4",
"@codingame/monaco-vscode-theme-defaults-default-extension": "8.0.4",
"@codingame/monaco-vscode-typescript-basics-default-extension": "8.0.4",
"@codingame/monaco-vscode-typescript-language-features-default-extension": "8.0.4",
"@monaco-editor/react": "^4.6.0",
"@typefox/monaco-editor-react": "next",
"monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~8.0.4",
"monaco-editor-wrapper": "next",
"monaco-languageclient": "next",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"vscode": "npm:@codingame/monaco-vscode-api@~8.0.4"
i am also getting the same error, i have spent more than 5 hours trying to setup LSP into Monaco editor. Why there isn't any guide, I have tried looking the those examples, they are really confusing.
There are no guide or tutorial or blogs posted recently, all of them are outdated.
Feel free to make one as soon as you manage to make it work ;)
What is the result of npm list vscode?
i am also getting the same error, i have spent more than 5 hours trying to setup LSP into Monaco editor. Why there isn't any guide, I have tried looking the those examples, they are really confusing. There are no guide or tutorial or blogs posted recently, all of them are outdated.
Feel free to make one as soon as you manage to make it work ;)
What is the result of
npm list vscode?
sure, i will make a blog on it once i manage to set it up!! 😃
here is the log file btw of your command-
You have both vscode@npm:@codingame/[email protected] and vscode@npm:@codingame/[email protected], because of [email protected]
@CGNonofr so what do i do? 😄
@CGNonofr if you have a working code/repository with you, could you please share it with me 😄
There is a compatibility table
Also you probably shouldn't use the next version since there is a more recent stable version
okay, i am trying to make a new project add one by one from that table, and i will let you know
@mxvsh basically do not mix different versions of the same dependency in one project. Have you successfully checked out this repo, build everything and used the examples? The README is quite detailed. Which information is missing / unclear. Enhancement PRs are appreciated.
from the table, i believe monaco-editor-react is @monaco-editor/react because monaco-editor-react on npm is outdated (last updated 6 years ago). But when I try to install @monaco-editor/react, I get this error.
This error happened while installing a direct dependency of /Users/monawwar/dev/poc/monaco-editor
The latest release of @monaco-editor/react is "4.6.0".
Other releases are:
* beta: 4.5.0-beta.0
You're confusing @monaco-editor/react with monaco-editor-react which are 2 different libraries
I think it's @typefox/monaco-editor-react you're looking for, and you've already installed it along with the other one
btw @kaisalmen why is one namespaced and not the other?
@CGNonofr monaco-editor-react was there ages ago and not developed by us. I namespaced @typefox/monaco-editor-react because of that.
I should have done the same with monaco-editor-wrapper
@CGNonofr i tried in a completely new project - but still getting that error.
i checked with the table, it all matches with one row.
here is the repository-
https://github.com/mxvsh/monaco-editor-poc
A simple check to the pnpm-lock.yaml shows that you have both 8.0.4 and 9.0.3 versions of monaco-vscode-api
@CGNonofr but i just created a new project - how come it installed two different versions?
i am sorry - but can you tell me how to fix it 😢
by installing a dependency A directly, and having another dependency B that requires the dependency A with another version
As the compatibility table states, [email protected] should not be used with v9 of monaco-vscode-api (and all other @codingame packages)
also, you don't need monaco-editor
when i run without installing monaco-editor package, i get this error
btw @kaisalmen, having monaco-editor in the compatibility table is quite confusing, it's only for informative purpose and we should probably say that it shouldn't be installed
"dependencies": {
"@codingame/monaco-vscode-keybindings-service-override": "^9.0.3",
"@codingame/monaco-vscode-theme-defaults-default-extension": "^9.0.3",
"@codingame/monaco-vscode-typescript-basics-default-extension": "^9.0.3",
"@codingame/monaco-vscode-typescript-language-features-default-extension": "^9.0.3",
"@typefox/monaco-editor-react": "^4.5.3",
"monaco-editor-wrapper": "5.5.3",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},