microsoft / microsoft/monaco-editor
[Bug] StorageService override doesn't see the onDidChangeValue function
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 46.8k
- Forks
- 4.1k
- Avg merge
- 17h 58m
- Merged PRs (30d)
- 1
Description
Reproducible in vscode.dev or in VS Code Desktop?
- Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
- Not reproducible in the monaco editor playground
Description
In version 0.41.0 this works. But after upgrade to the latest 0.52.2 it does't.
After some investigation I can see that versions > 0.41.0 gives error in console but not breaking an app and versions > 0.48.0 started to break an app.
It's reproducible in the playground. Try please.
I tried to debug it in the browser and I see that on the error line I have _storageService.onDidChangeValue and it's defined as function, but it still throws an error.
Monaco Editor Playground Code
const value = /* set from `myEditor.getModel()`: */ `function hello() {
alert('Hello world!');
}`;
// Hover on each property to see its docs!
const myEditor = monaco.editor.create(document.getElementById("container"), {
value,
language: "javascript",
automaticLayout: true,
}, {
// Note: Overrides inner editor UI configuration
storageService: {
get() {},
getBoolean(key) {
// Note: This config is to show property description on property selection automatically
if (key === "expandSuggestionDocs") return true;
return false;
},
remove(){},
store(){},
onWillSaveState(){},
onDidChangeStorage(){},
onDidChangeValue(){}
}
});
Reproduction Steps
Just refresh. Error will be from start.
Actual (Problematic) Behavior
TypeError: _storageService.onDidChangeValue(...) is not a function: undefined
Expected Behavior
No error
Additional Context
I am trying to override storage service to show property description on property selection automatically. This workaround was helpful in the old 0.41.0 version
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Monaco Editor playground and the provided storageService override, then trace where onDidChangeValue is consumed after the editor is created. Done means refreshing the playground with the override no longer throws the reported TypeError in current versions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100