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

Signature help: restructure async work #1198

Merged
merged 2 commits into from
Dec 9, 2024
Merged

Conversation

microbit-matt-hillsdon
Copy link
Collaborator

sendRequest isn't an async function as it can synchronously throw errors so we need something to prevent reentrant updates in the error case.

Otherwise though we don't needed it if we move more work into the state.

Alternative take on #1196 that's a bit of a bigger change but perhaps a better split of work between state/view plugin.

sendRequest isn't an async function as it can synchronously throw errors
so we need something to prevent reentrant updates in the error case.

Otherwise though we don't needed it if we move more work into the state.
Copy link

github-actions bot commented Dec 5, 2024

I'm not sure this is necessary but it feels obviously correct /
straightforward which is a win in this code.
@@ -77,44 +92,22 @@ const signatureHelpToolTipBaseTheme = EditorView.baseTheme({
},
});

const triggerSignatureHelpRequest = async (
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think I found this hard to pick up again & understand because this function is called from two very different contexts: a CM command (where it's totally fine / expected to view.dispatch) and and the ViewPlugin update call. Doubtless my doing!

Copy link
Collaborator

@microbit-robert microbit-robert left a comment

Choose a reason for hiding this comment

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

I think this looks good.

@microbit-matt-hillsdon microbit-matt-hillsdon merged commit 9947c9a into main Dec 9, 2024
1 check passed
@microbit-matt-hillsdon microbit-matt-hillsdon deleted the cm-view-dispatch branch December 9, 2024 11:57
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