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

Make ServicesAccessor typing more consistent in editor commands #218369

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

c-claeys
Copy link
Contributor

@c-claeys c-claeys commented Jun 26, 2024

I noticed that in src/vs/workbench/services/preferences/browser/preferencesService.ts CoreEditingCommands.LineBreakInsert.runEditorCommand is called twice with a null accessor, as well as in src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts.

Goto def took me to the abstract EditorCommand.runEditorCommand where this is allowed. However, find all implementations shows many cases which suggest narrower (non-null) typing. .runEditorCommand may be type-checked against this abstract implementation (see the aforementioned goto def) which can lead to disconnects between function calls and implementations.

I've updated this typing to be more consistent. I expect the | undefined -> | null changes to be essentially no-ops. The cases where I've introduced early returns, optional chaining, etc. I tried to follow local norms.

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.

5 participants