DEV Community

Cover image for What's new in P42? Summer 2022
Lars Grammel for P42

Posted on • Originally published at p42.ai

What's new in P42? Summer 2022

Since February, the P42 JavaScript Assistant for Visual Studio Code has grown considerably and contains over 90 code assists and refactorings. The user interface has been improved based on feedback, and the JavaScript Assistant now supports Vue.js. Here are the details:

Vue.js Support (P42 Pro)

You can now use code assists, refactorings, and suggestions from the P42 JavaScript Assistant inside .vue files and mass refactorings updates .vue files.

P42 Vue.js Example

User Interface

Keyboard Shortcuts

The JavaScript Assistant has different default keyboard shortcuts for the code assist context menus and a "move" context menu shortcut. You can now add custom keyboard shortcuts for any P42 code assist.

Context Menu Mac Shortcut Windows/Linux Shortcut
Quick Fix CMD + . CTRL + .
Refactor CTRL + CMD + R CTRL + ALT + R
Extract CTRL + CMD + X CTRL + ALT + X
Inline CTRL + CMD + I CTRL + ALT + I
Convert CTRL + CMD + C CTRL + ALT + C
Move CTRL + CMD + M CTRL + ALT + M
Action CTRL + CMD + A CTRL + ALT + A

Suggestion Display and Panel

The P42 refactorings suggestions are shown as hints inside the editor (underline with three dots) by default, and the suggestion side panel highlights relevant code on mouseover. When you click on a selected item in the side panel, the editor scrolls to the appropriate location.

P42 Code Highlighting

Mass Refactoring (P42 Pro)

The mass refactoring dialog is now more usable. You can search the description and details, e.g., to find all ES2015 modernizations, and the refactorings are sorted alphabetically.

The mass refactoring output is easier to understand and contains more information. It includes the file exclusions patterns, a progress indicator for every 50 analyzed files, and the overall refactoring time in seconds.

Configuration

ECMAScript Target Version

You can specify the target ECMAScript version in the P42 configuration file. Code modernizations that would require newer ECMAScript versions are hidden when you configure an older target version.

Hide Overlapping Code Actions

The P42 JavaScript Assistant provides code assists that mirror and extend the functionality of code assists that come with Visual Studio Code. You can now configure the visibility of overlapping code assists.

Code Assists and Refactorings

Working with Variables

Push variable declaration into initial value

Working with Destructuring Expressions

Working with Classes

Working with Functions

Working with Loops and Arrays

Convert loop to .map()

Working with Conditional Expressions

Working with String and Templates

Other Code Actions

Select expression occurrences

You can follow @p42ai on Twitter to get notified about new features.

Happy Coding!

Top comments (0)