Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] StorageService override doesn't see the onDidChangeValue function #4829

Open
1 of 2 tasks
Halynsky opened this issue Feb 14, 2025 · 0 comments
Open
1 of 2 tasks

Comments

@Halynsky
Copy link

Halynsky commented Feb 14, 2025

Reproducible in vscode.dev or in VS Code Desktop?

  • Not reproducible in vscode.dev or VS Code Desktop

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.

Image

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant