From d6ab276224b2493512ad456b071f35d380078117 Mon Sep 17 00:00:00 2001 From: sciencewhiz Date: Thu, 28 Nov 2024 11:48:40 -0800 Subject: [PATCH] Fix Units imports conversion Fixes Mutable imports and units Fixes wildcard import for Units Converts MutableMeasure.zero Fixes wpilibsuite/2025Beta#51 --- vscode-wpilib/resources/java_replacements.json | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/vscode-wpilib/resources/java_replacements.json b/vscode-wpilib/resources/java_replacements.json index a48c62f0..587b2c53 100644 --- a/vscode-wpilib/resources/java_replacements.json +++ b/vscode-wpilib/resources/java_replacements.json @@ -140,14 +140,20 @@ { "from": "SendableRegistry[.]getInstance[(][)][.]", "to": "SendableRegistry." }, { "from": "[.]get(\\w*)[(](?:GenericHID[.])?Hand[.]k(\\w*)[)]", "to": ".get$2$1()" }, { "from": "CommandBase", "to": "Command" }, - { "from": "import edu[.]wpi[.]first[.]units[.]measure[.]Measure;", "to": "" }, - { "from": "edu[.]wpi[.]first[.]units[.](.*);", "to": "edu.wpi.first.units.measure.$1;" }, - { "from": "edu[.]wpi[.]first[.]units[.]measure[.]Units[.](\\w*);", "to": "edu.wpi.first.units.Units.$1;" }, + { "from": "edu[.]wpi[.]first[.]units[.]measure[.]Measure", "to": "edu.wpi.first.units.Measure" }, + { "from": "edu[.]wpi[.]first[.]units[.](?!MutableMeasure|ImmutableMeasure|UnitBuilder|Measure)(.*);", "to": "edu.wpi.first.units.measure.$1;" }, + { "from": "edu[.]wpi[.]first[.]units[.]measure[.]Units[.](.*);", "to": "edu.wpi.first.units.Units.$1;" }, + { "from": "MutableMeasure<(\\w*)>", "to": "Mut$1" }, + { "from": "MutableMeasure>", "to": "MutLinearVelocity" }, + { "from": "MutableMeasure>", "to": "MutAngularVelocity" }, + { "from": "MutableMeasure>>", "to": "MutLinearAcceleration" }, + { "from": "MutableMeasure>>", "to": "MutAngularAcceleration" } { "from": "Measure<(\\w*)>", "to": "$1" }, { "from": "Measure>", "to": "LinearVelocity" }, { "from": "Measure>", "to": "AngularVelocity" }, { "from": "Measure>>", "to": "LinearAcceleration" }, - { "from": "Measure>>", "to": "AngularAcceleration" } + { "from": "Measure>>", "to": "AngularAcceleration" }, + { "from": "MutableMeasure.zero\\((\\w*)\\)", "to": "$1.mutable(0)" }, ] } ]