eclipse-theia / theia

Eclipse Theia is a cloud & desktop IDE framework implemented in TypeScript.
http://theia-ide.org
Eclipse Public License 2.0
20.11k stars 2.5k forks source link

[preferences] PreferenceChanged event emitted multiple times for languages #6709

Open vince-fugnitto opened 4 years ago

vince-fugnitto commented 4 years ago

Description

When a preference is updated (ex: editor.acceptSuggestionOnCommitCharacter) through the set method, multiple change events are emitted for every language. Is this the intended behavior? (it seems excessive)

This seems to only occur for language specific preferences (or those from Monaco). It did not occur for example for the following preference: workspace.preserveWindow.

Steps to Reproduce

A command was created which reads the current preference value, updates it, and listens to the change event (which is then logged):

  1. open in Gitpod
  2. run the command Vince: Test Preference
  3. check the frontend logs

Open in Gitpod

Log

root INFO preference updated: { name: editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [plaintext].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [jsonc].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [bat].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [clojure].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [coffeescript].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [csharp].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [css].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [fsharp].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [groovy].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [handlebars].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [hlsl].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [ini].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [log].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [lua].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [makefile].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [objective-c].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [perl].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [powershell].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [jade].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [r].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [razor].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [shaderlab].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [sql].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [swift].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [vb].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [html].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [less].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [scss].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [markdown].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [shell].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [tcl].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [xml].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [xsl].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [java].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [typescript].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [typescriptreact].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [javascript].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [javascriptreact].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [jsx-tags].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [python].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [go].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [rust].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [php].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [c].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [cpp].editor.acceptSuggestionOnCommitCharacter }
bundle.js:136156 root INFO preference updated: { name: [json].editor.acceptSuggestionOnCommitCharacter }
akosyakov commented 4 years ago

Yes it is expected, otherwise language specific preferences won’t be applied to monaco. Preference configuration can define which preference is overridable. Do you experience any perf issues?

vince-fugnitto commented 4 years ago

Yes it is expected, otherwise language specific preferences won’t be applied to monaco. Preference configuration can define which preference is overridable. Do you experience any perf issues?

It was initially brought up by internal customers, I believe they had a noticeable performance decrease (~2 seconds) each time it was updated through the user interface.

akosyakov commented 4 years ago

Could it be reproduced openly? then we can take measurement and see what can be done about it.

vince-fugnitto commented 4 years ago

Could it be reproduced openly? then we can take measurement and see what can be done about it.

Is my small test enough? It creates a command which updates one such preference (editor.acceptSuggestionOnCommitCharacter). Should we try and find a more regular example?

akosyakov commented 4 years ago

@vince-fugnitto I meant the test which will cause performance issues. If something is executed multiple times but fast then it is not the issue. React recreates VDOM multiple times sometimes on each mouse move (think about the navigator selection) but we are not going to rewrite it just because it seems to be excessive thing to do.