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

[NNotepad] Debounced refresh() #258

Merged
merged 1 commit into from
Jun 25, 2024

Conversation

ibelem
Copy link
Contributor

@ibelem ibelem commented Jun 24, 2024

Thanks @inexorabletash for asking to double check if the content model change callbacks are throttled when deleting $('#input').addEventListener('input', Util.debounce(refresh, 500)); in #257. This was indeed a wrong ignoring.

The shape of the IModelContentChangedEvent emitted via IModel.onDidChangeContent.
https://github.com/microsoft/monaco-editor/blob/main/src/language/typescript/languageFeatures.ts#L209
https://github.com/microsoft/monaco-editor/blob/main/src/language/common/lspLanguageFeatures.ts#L47

Since there are some code usages above for validate method with 500ms in monaco-editor source code, add debounced refresh() back.

The user experience is better than calling refresh() directly when typing quickly, @inexorabletash @anssiko @Honry PTAL

Copy link
Collaborator

@Honry Honry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

@inexorabletash inexorabletash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@Honry Honry merged commit 2fcce9e into webmachinelearning:master Jun 25, 2024
3 checks passed
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

Successfully merging this pull request may close these issues.

3 participants