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

FEAT: add code navigation to script editor #1660

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

lucebac
Copy link
Contributor

@lucebac lucebac commented Sep 21, 2024

Adds code navigation by registering a CodeEditorOpener to monaco.

Copy link
Collaborator

@d0sboots d0sboots left a 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) {
Copy link
Collaborator

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

Copy link
Contributor Author

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;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this changing?

Copy link
Contributor Author

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.

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.

2 participants