raml-org / api-modeling-framework

DEPRECATED - This project has been moved
https://github.com/aml-org/amf
Other
27 stars 11 forks source link

Select element text when element selected in the diagram #33

Closed antoniogarrote closed 7 years ago

antoniogarrote commented 7 years ago

When a model element is selected in the diagram, not only the element in the navigation sidebar must be selected but the text of the editor must be scrolled to that element and selected.

Changes in scrolling should be visible when the user switches from graph to editor.

antoniogarrote commented 7 years ago

If the callbacks are connected correctly, this might be happening because the editor is not visible when the user selects the element in the diagram and the callbacks are executed.

postatum commented 7 years ago

Note: the main issue is solved here but now there's another bug related to scrolling:

Regarding scrolling bug: It turned out it appears both in raml and openapi tabs. To reproduce - in WorkMusicAPI Graph click at /api GET and then go to RAML or OpenAPI. On first open scrolling won't be correct. I've discovered this issue related to scrolling happening before this.editor.setModel in onEditorSectionChange finishes work. The simplest solution that may fail is to run selectElementDocument with timeout of 1 second. Other solution would be to somehow queue its execution after setModel finishes. One way to do that is editor.onDidChangeConfiguration event, but it's not always fired when tab changes. Also it's fired billion times when window size changes.