Skip to content

Clean up unused code and verbose syntax#867

Open
Gold856 wants to merge 5 commits into
wpilibsuite:mainfrom
Gold856:modernization
Open

Clean up unused code and verbose syntax#867
Gold856 wants to merge 5 commits into
wpilibsuite:mainfrom
Gold856:modernization

Conversation

@Gold856
Copy link
Copy Markdown
Member

@Gold856 Gold856 commented Apr 25, 2026

No description provided.

@Gold856 Gold856 force-pushed the modernization branch 4 times, most recently from 4c9eecf to 2f7ecf6 Compare April 28, 2026 23:58
@Gold856 Gold856 force-pushed the modernization branch 2 times, most recently from e6a3d44 to a62871c Compare May 14, 2026 05:38
@ThadHouse ThadHouse requested a review from Copilot May 14, 2026 14:28
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR is a code cleanup that removes redundant checks and verbose syntax across the vscode-wpilib extension. It primarily replaces explicit === undefined/!== undefined comparisons with truthiness checks, switches T | undefined field declarations to optional ? syntax, removes some unreachable/dead code paths (e.g., response === undefined checks after await fetch(...)), and removes the unused wpilib.addDependency command (and dead IBinaryMap interface).

Changes:

  • Replace === undefined / !== undefined checks with truthy/falsy checks and ?. optional chaining throughout the extension code.
  • Remove unreachable response === undefined branches after fetch() and other dead/unused code paths (including unused addDependency command and IBinaryMap type).
  • Refactor DependencyViewProvider sorting into a shared sort helper using Intl.Collator, simplify several boolean-returning preference getters, and inline a few trivially-used local variables.

Reviewed changes

Copilot reviewed 44 out of 44 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
vscode-wpilib/src/wpilibupdates.ts Simplify undefined checks; drop unreachable response/versions.length===0 branches; use optional property syntax.
vscode-wpilib/src/webviews/webviewbase.ts Use ?.dispose() and shorter optional field syntax.
vscode-wpilib/src/webviews/projectcreator.ts Replace === undefined with !.
vscode-wpilib/src/webviews/localeloader.ts Drop redundant !! and the eslint-disable comment.
vscode-wpilib/src/webviews/gradle2025import.ts Replace === undefined with !.
vscode-wpilib/src/vscommands.ts Collapse multi-line undefined checks; use optional parameter syntax.
vscode-wpilib/src/versions.ts Use ?: for optional else field.
vscode-wpilib/src/vendorlibraries.ts Truthy checks instead of !== undefined.
vscode-wpilib/src/utilities.ts Simplify javaHome check; drop unreachable else.
vscode-wpilib/src/toolapi.ts Simplify result/workspace undefined checks.
vscode-wpilib/src/shared/vendorlibrariesbase.ts Use ?. chaining; drop unreachable response === undefined check.
vscode-wpilib/src/shared/vendorexamples.ts Drop redundant | undefined from optional.
vscode-wpilib/src/shared/utilitiesapi.ts Use ?: optional field.
vscode-wpilib/src/shared/templates.ts Truthy check for hasunittests.
vscode-wpilib/src/shared/promisecondition.ts Use ?: and truthy checks.
vscode-wpilib/src/shared/examples.ts Truthy check for hasunittests.
vscode-wpilib/src/riolog/vscodeimpl.ts Truthy check on webviewPanel.visible.
vscode-wpilib/src/riolog/shared/sharedscript.ts Replace === false/!== undefined with truthy/falsy checks.
vscode-wpilib/src/riolog/riologwindow.ts Truthy checks on webview/console state.
vscode-wpilib/src/riolog/promisecond.ts Use ?: and truthy checks.
vscode-wpilib/src/projectinfo.ts Replace === undefined with !.
vscode-wpilib/src/preferencesapi.ts Inline showWorkspaceFolderPick return.
vscode-wpilib/src/preferences.ts Simplify boolean getters with !!.
vscode-wpilib/src/java/simulate.ts Truthy environment check.
vscode-wpilib/src/java/java.ts Truthy extension check; drop unused localW.
vscode-wpilib/src/java/deploydebug.ts Drop redundant | undefined from optionals; truthy picked checks.
vscode-wpilib/src/fetchhelpers.ts Drop unreachable response === undefined check.
vscode-wpilib/src/extension.ts Remove unused wpilib.addDependency command and dead branches; inline localW.
vscode-wpilib/src/executor.ts Truthy check on shell.options.
vscode-wpilib/src/docsapi.ts Use ?.dispose(); remove blank lines.
vscode-wpilib/src/deploydebugapi.ts Truthy checks on workspace/selection.
vscode-wpilib/src/dependencyView.ts Add sort helper using Intl.Collator; simplify nesting and add await to refresh.
vscode-wpilib/src/cppprovider/vscommands.ts Truthy workspaces checks.
vscode-wpilib/src/cppprovider/jsonformats.ts Remove unused IBinaryMap interface.
vscode-wpilib/src/cppprovider/headertreeprovider.ts Tighten getter return types; truthy checks.
vscode-wpilib/src/cppprovider/cppprovider.ts Truthy workspaces check.
vscode-wpilib/src/cppprovider/apiprovider.ts Drop redundant | undefined; collapse browse-config branches; truthy checks.
vscode-wpilib/src/cpp/simulatewindows.ts Truthy environment / useWindbgX checks.
vscode-wpilib/src/cpp/simulateunix.ts Truthy environment check.
vscode-wpilib/src/cpp/deploydebug.ts Drop redundant | undefined; truthy picked checks.
vscode-wpilib/src/cpp/cpp.ts Truthy check on cpptools extension.
vscode-wpilib/src/commandapi.ts Truthy checks on language/selection.
vscode-wpilib/src/builtintools.ts Truthy wp check.
vscode-wpilib/src/buildtestapi.ts Truthy selection check.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread vscode-wpilib/src/dependencyView.ts Outdated
@PeterJohnson PeterJohnson changed the base branch from 2027 to main May 19, 2026 01:38
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