When the MessageSystem sends a navigation update, the relevant HTML element should scroll into view. It should come as close to the top of the scrollable area as possible.
To ensure that the Monaco Editor can scroll into view and prompt other UI to scroll items into view, the following will have to be possible:
Clicking or keyboard navigation to a location in the Monaco Editor should be communicated (ideally with additional information about the line selected instead of having to create a utility to then determine where in the document structure we are)
Finding the line location of an element from a navigation message
Scrolling to a specific line location
The Monaco Editor (ICodeEditor returned after using monaco.editor.create) currently supports:
onDidChangeCursorPosition - emits an event with position in lineNumber and column and the reason for the position update (this may become relevant as setValue triggers this as a content flush and may need to be ignored)
Currently the Monaco Editor is setup by the implementer and the MonacoAdapter service is used only for MessageSystem events. This should extend to navigation level events, so just as there can be a MonacoAdapterAction for setting the Monaco Editor value, so to must there be an action for setting and getting navigation updates.
Add a utility to get the monaco editor value position from an activeDictionaryId
Set the monaco editor value position with revealLineInCenter using a MonacoAdapterAction
Send a navigation update during onDidChangeCursorPosition (potentially when the action is not a content flush as that may result in an infinite loop)
What package(s) should this feature be added to?
@microsoft/fast-tooling
Summary
When the
MessageSystem
sends a navigation update, the relevant HTML element should scroll into view. It should come as close to the top of the scrollable area as possible.To ensure that the Monaco Editor can scroll into view and prompt other UI to scroll items into view, the following will have to be possible:
The Monaco Editor (
ICodeEditor
returned after usingmonaco.editor.create
) currently supports:onDidChangeCursorPosition
- emits an event with position in lineNumber and column and the reason for the position update (this may become relevant assetValue
triggers this as a content flush and may need to be ignored)revealLineInCenter
- scrolls to a line and centers it in the editorsetPosition
- sets a new positionProposal
Currently the Monaco Editor is setup by the implementer and the
MonacoAdapter
service is used only forMessageSystem
events. This should extend to navigation level events, so just as there can be aMonacoAdapterAction
for setting the Monaco Editor value, so to must there be an action for setting and getting navigation updates.activeDictionaryId
revealLineInCenter
using aMonacoAdapterAction
onDidChangeCursorPosition
(potentially when the action is not a content flush as that may result in an infinite loop)