Skip to content

Remove classes and inheritance where they are not needed#868

Open
Gold856 wants to merge 10 commits into
wpilibsuite:mainfrom
Gold856:deoopify
Open

Remove classes and inheritance where they are not needed#868
Gold856 wants to merge 10 commits into
wpilibsuite:mainfrom
Gold856:deoopify

Conversation

@Gold856
Copy link
Copy Markdown
Member

@Gold856 Gold856 commented Apr 25, 2026

Depends on #867.

@Gold856 Gold856 force-pushed the deoopify branch 2 times, most recently from a3e42fa to baad1c4 Compare April 25, 2026 23:23
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

Refactors the VS Code WPILib extension to reduce unnecessary class wrappers/inheritance and simplify boolean/undefined checks, while keeping the same feature set (updates, vendor deps, templates/examples, and RioLog UI).

Changes:

  • Converted several “registration/utility” classes (updates, templates/examples/commands, build/deploy/debug) into exported functions.
  • Extracted commonly used UtilitiesAPI helpers into module-level functions and updated call sites to use them directly.
  • Simplified many undefined/boolean checks and optional property typings across the codebase.

Reviewed changes

Copilot reviewed 51 out of 51 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
vscode-wpilib/src/wpilibupdates.ts Refactor WPILib update logic from class to functions.
vscode-wpilib/src/webviews/webviewbase.ts Simplify optional webview handling.
vscode-wpilib/src/webviews/projectcreator.ts Simplify dialog result check.
vscode-wpilib/src/webviews/localeloader.ts Remove redundant boolean cast.
vscode-wpilib/src/webviews/gradle2025import.ts Simplify selection/dialog checks.
vscode-wpilib/src/vscommands.ts Update command handlers for new update/utilities exports and simplify guards.
vscode-wpilib/src/versions.ts Use optional property syntax for version parsing.
vscode-wpilib/src/vendorlibraries.ts Remove base-class inheritance and use shared helper functions.
vscode-wpilib/src/utilities.ts Simplify javaHome and selection checks.
vscode-wpilib/src/toolapi.ts Simplify result/workspace checks.
vscode-wpilib/src/shared/vendorlibrariesbase.ts Convert base class to standalone helper functions.
vscode-wpilib/src/shared/vendorexamples.ts Remove utilities/vendorlibs parameters; use shared helpers directly.
vscode-wpilib/src/shared/utilitiesapi.ts Add module-level getWPILibYear/getWPILibHomeDir helpers; delegate class methods.
vscode-wpilib/src/shared/templates.ts Convert Templates class into registerProjectTemplates function.
vscode-wpilib/src/shared/promisecondition.ts Simplify boolean/optional callback checks.
vscode-wpilib/src/shared/examples.ts Convert Examples class into registerExamples function.
vscode-wpilib/src/riolog/vscodeimpl.ts Refactor RioLog webview HTML/view creation into functions.
vscode-wpilib/src/riolog/shared/sharedscript.ts Simplify boolean checks in DOM rendering helpers.
vscode-wpilib/src/riolog/shared/interfaces.ts Remove unused window/provider interfaces; keep console/disposable types.
vscode-wpilib/src/riolog/riologwindow.ts Rewire RioLogWindow to use VS Code webview panel directly + new helper functions.
vscode-wpilib/src/riolog/promisecond.ts Simplify boolean/optional callback checks.
vscode-wpilib/src/projectinfo.ts Remove dependency on updater class; use exported version helper.
vscode-wpilib/src/preferencesapi.ts Simplify workspace selection logic.
vscode-wpilib/src/preferences.ts Simplify config retrieval/defaulting.
vscode-wpilib/src/logger.ts Remove ILogger interface; export concrete logger instance.
vscode-wpilib/src/java/simulate.ts Simplify environment guard.
vscode-wpilib/src/java/java.ts Use new register* functions for build/deploy/commands/examples/templates.
vscode-wpilib/src/java/deploydebug.ts Convert DeployDebug class into registration function.
vscode-wpilib/src/java/commands.ts Convert Commands class into registration function.
vscode-wpilib/src/java/buildtest.ts Convert BuildTest class into registration function.
vscode-wpilib/src/fetchhelpers.ts Remove redundant response === undefined check.
vscode-wpilib/src/extension.ts Update activation to use new register/check functions; simplify wiring.
vscode-wpilib/src/executor.ts Simplify shell options guard.
vscode-wpilib/src/docsapi.ts Minor cleanup + optional chaining for disposable disposal.
vscode-wpilib/src/deploydebugapi.ts Remove async factory; construct RioLogWindow directly.
vscode-wpilib/src/dependencyView.ts Use shared vendor helpers; simplify sorts and refresh flow.
vscode-wpilib/src/cppprovider/vscommands.ts Simplify workspace guards.
vscode-wpilib/src/cppprovider/jsonformats.ts Remove unused IBinaryMap interface.
vscode-wpilib/src/cppprovider/headertreeprovider.ts Tighten FileStat boolean getters; simplify checks.
vscode-wpilib/src/cppprovider/cppprovider.ts Simplify workspace guards.
vscode-wpilib/src/cppprovider/apiprovider.ts Simplify optional params/guards; reduce branching.
vscode-wpilib/src/cpp/simulatewindows.ts Simplify environment/config boolean checks.
vscode-wpilib/src/cpp/simulateunix.ts Simplify environment guard.
vscode-wpilib/src/cpp/deploydebug.ts Convert DeployDebug class into registration function.
vscode-wpilib/src/cpp/cpp.ts Use new register* functions for build/deploy/commands/examples/templates.
vscode-wpilib/src/cpp/commands.ts Convert Commands class into registration function.
vscode-wpilib/src/cpp/buildtest.ts Convert BuildTest class into registration function.
vscode-wpilib/src/commandapi.ts Simplify quick pick guards and language selection flow.
vscode-wpilib/src/builtintools.ts Convert BuiltinTools class into registerBuiltinTools function.
vscode-wpilib/src/buildtestapi.ts Simplify quick pick guard.
vscode-wpilib/resources/live.html Remove unused RioLog HTML template file (now generated in TS).
Comments suppressed due to low confidence (2)

vscode-wpilib/src/wpilibupdates.ts:138

  • Because gradleRioRegex is defined with the global g flag and reused, calls to gradleRioRegex.exec(...) will advance lastIndex and subsequent calls can return null unexpectedly. Either remove the g flag for exec usage, reset gradleRioRegex.lastIndex = 0 before each exec, or create a fresh RegExp per call.
    vscode-wpilib/src/wpilibupdates.ts:168
  • setGradleRIOVersion uses a replacement string $1${version}$3, but the current gradleRioRegex only defines one capture group. This will produce an incorrect build.gradle replacement (e.g., concatenating old+new versions and/or dropping surrounding text). Update the regex to include the required groups or change the replacement string to match the actual capture groups.

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

Comment thread vscode-wpilib/src/wpilibupdates.ts
Comment thread vscode-wpilib/src/cpp/deploydebug.ts
Comment thread vscode-wpilib/src/dependencyView.ts
@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