-
Notifications
You must be signed in to change notification settings - Fork 269
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
FEAT: add code navigation to script editor #1660
base: dev
Are you sure you want to change the base?
Conversation
Adds code navigation by registering a CodeEditorOpener to monaco.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I've been so slow here too. The editor is weird and complicated, but this mostly looks OK - aside from one definite issue.
Also, if you could add a screenshot showing this in action, that would be nice.
return true; | ||
} | ||
|
||
if ((selectionOrPosition as monaco.IRange) !== undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as
is a compile-time-only thing, it doesn't do anything at runtime. You'll need to do something like startLineNumber in selectionOrPosition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know, thanks for the hint.
rerender(); | ||
removeOutlineOfEditor(); | ||
}); | ||
vim = props.vim; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this changing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using code navigation, monaco might open a file that has not been loaded yet. Originally, props.vim
is set by the parent ReactNode when calling OnMount; unfortunately, the CodeEditorOpener doesn't know the props and hence I save the most recent value so that new files are opened with the latest props.vim
setting instead of falling back to a fixed true
or false
.
Adds code navigation by registering a CodeEditorOpener to monaco.