Configuring and using the Visual Studio Code Extension for MTA
Using the migration toolkit for applications extension for Visual Studio Code to identify and resolve migration issues
Abstract
Chapter 1. Introduction to the MTA extension for Microsoft Visual Code
You can migrate and modernize applications by using the migration toolkit for applications (MTA) extension for Microsoft Visual Studio Code.
The MTA extension can perform the following actions:
- Analyze your projects with customizable rulesets.
- Mark issues in the source code.
- Provide guidance to fix the issues.
- Perform automatic code replacement, if possible.
The MTA extension is also compatible with Visual Studio Codespaces, the Microsoft cloud-hosted development environment.
Chapter 2. Installing the MTA extension for Visual Studio Code
You can use the migration toolkit for applications (MTA) Visual Studio (VS) Code plugin to perform a standard application analysis. You can also enable Red Hat Developer Lightspeed for the migration toolkit for applications to use Generative AI (GenAI) capabilities to fix code issues before migrating to target technologies. Note that Developer Lightspeed for MTA is enabled by default. For more information, see Configuring and using Developer Lightspeed for MTA.
Prerequisites
You installed the Java Development Kit (JDK). MTA supports the following JDKs:
- Oracle JDK 17 or later
- Eclipse Temurin™ JDK 17 or later
- OpenJDK 17 or later
- You have 8 GB of RAM available.
-
For macOS installation, you have the value of
maxprocset to2048or greater.
Procedure
- Install the MTA 8.0.1 Visual Studio (VS) Code plugin from the VS Code marketplace.
Chapter 3. Configuring the IDE settings
MTA settings apply to every analysis that you perform by using the Visual Studio (VS) Code extension. The extension settings have the following categories:
- Analysis-related settings
- Debugging and logging settings
- Solution server settings
- Generative AI settings
Procedure
Open the MTA settings by clicking
Extensions>MTA Extension for VSCode>Settings.Alternatively, open the setting by performing the following steps:
-
Type
Ctrl + Shift + PorCmd + Shift + Pon the search bar to open the Command Palette. -
Enter
Preferences: Open Settings (UI). -
Open the settings page by clicing
Extensions>MTA.
-
Type
Configure the following settings:
-
Log level: Set the log level for the MTA binary. The default log level is
debug. The log level increases or decreases the verbosity of logs. - Analyzer path: Specify an MTA custom binary path. If you do not provide a path, Red Hat Developer Lightspeed for MTA uses the default path to the binary.
- Debug:Webview: Enable debug level logging for Webview message handling in VS Code.
-
Log level: Set the log level for the MTA binary. The default log level is
Next steps
Additional resources
Chapter 4. Configuring the MTA profile settings
You can use the Visual Studio (VS) Code plugin to run an analysis to discover issues in the code.
To generate code changes by using the MTA extension, you must configure a profile that contains all the necessary configurations, such as rules and source and target technologies.
Prerequisites
- You configured the VS Code IDE settings. For more information, see Configuring the Red Hat Developer Lightspeed for MTA IDE settings.
- You opened a Java project in your VS Code workspace.
Procedure
Open the
MTA View Analysispage by clicking the book icon on theMTA: Issuespane of the MTA extension.Alternatively, type
Ctrl + Shift + PorCmd + Shift + Pin the search bar to open the Command Palette and enterMTA:Open Analysis View.Click the settings button on the
MTA View Analysispage to configure a profile for your project. TheGet Ready to Analyzepane has the following basic configurations required for an application analysis:- Select profile: Create a profile that you can reuse for one or more analyses.
Configure label selector: A label selector filters rules for analysis based on the source or target technology.
Specify one or more target or source technologies. Red Hat Developer Lightspeed for MTA uses this configuration to determine the rules to apply to a project during the analysis. If you mentioned a new target or a source technology in your custom rule, you can type that name to create and add the new item to the list.
ImportantYou must configure target or source technologies before running an analysis.
- Set rules: Enable default rules and select your custom rule that you want MTA to use for the analysis. You can use the custom rules in addition to the default rules.
Verification
-
After you completed the profile configuration, close the
Get Ready to Analyzepane and run an application analysis.
Next steps
Additional resources
Chapter 5. Running an application analysis
You can run a static code analysis of an application with or without enabling the Generative AI (GenAI) features. The RPC (Remote Procedure Call) server runs the analysis to detect all issues in the code for one or more target technologies which you want to migrate the application to.
Prerequisites
- You opened a Java project in your VS Code workspace.
- You configured an analysis profile on the MTA Analysis View page. For more information, see Configuring the MTA profile settings.
Procedure
- Click the Red Hat Developer Lightspeed for MTA extension and click Open MTA Analysis View.
- Select a profile for the analysis.
- Click Start to start the MTA RPC server.
- Click Run Analysis on the MTA Analysis View page.
Additional resources
Chapter 6. Reviewing and resolving migration issues
You can use the MTA extension icons to prioritize issues based on their severity.
Procedure
- Select a run configuration directory on the left pane.
- Expand its folders to view the Hints generated for each application file.
- Select a hint to view the source code.
- Right-click a hint and select View Details to view the Rule ID and other information.
Prioritize issues based on the following icons, which are displayed next to each hint:
-
: You must fix the issue for a successful migration.
-
: You might need to address the issue during the migration.
-
Resolve issues by editing the code of a file with a hint:
- In the left pane, right-click an issue and select Open Code.
- Make any changes needed to the code and save the file.
- Optional: Right-click the issue and select Mark as Complete or Delete.