RubyMine 2023.2 With AI Assistant Is Out!
RubyMine 2023.2 is now publicly available! You can download it from our website or via the free Toolbox App.
The latest version of the most intelligent Ruby and Rails IDE brings the brand-new AI Assistant and is packed with other improvements, including Turbo code completion in Ruby on Rails projects, an updated UI, performance enhancements, new features in RBS support, and more.
Read on to learn more about the key updates, or visit our What’s New page for more details.
Ruby and Rails
Support for Turbo Rails completion
In the previous release, we added support for Turbo Rails, which lets you use code completion in your models to access methods to Turbo Stream. We’ve now updated Turbo Rails code completion and insight for models, controllers, and views. This allows you to define model-specific Turbo Stream templates that provide real-time updates to the client side when the model is created, updated, or deleted.
Support for import maps
We’ve implemented support for using import maps with Ruby and Ruby on Rails code, including:
- Scope context for the config/importmap.rb file. This means that self now has the correct type and that autocompletion and resolve are now available for the pin and pin_all_from methods.
- Basic declaration and reference support for import map modules within Ruby code.
- Go to declaration, as well as Find usages to and from declarations and references, now work for import map modules.
- File references in the pin and pin_all_from calls in config/importmap.rb. The file references are now present for the pinunder argument (pin ‘my_module’, under: ‘<caret>’), and for the first argument in pin_all_from (pin_all_from ‘<caret>’). Additionally, completion and resolve are now available for these arguments.
Code insight for Rails store accessors
Code insight is now available for store accessors in Rails. Code completion and resolution work for attributes defined via .store_accessor and dirty tracking methods, such as u.partner_name_changed?. Attributes defined via store or store_accessor are also available in validations (for example, validates_presence:partner_name).
Custom type renderers in the debugger
RubyMine now allows you to customize the display formats of different objects in the Debug tool window. This is done through the use of renderers, which are unique configurations associated with specific types that dictate how instances of those types are presented in the Debug tool window. By utilizing custom expressions, these renderers offer a high level of flexibility for displaying data. You can configure custom renderers in Settings | Build, Execution, Deployment | Debugger | Data Views | Ruby Type Renderers.
AI Assistant (Beta)
Starting with this release RubyMine offers a significant new feature – AI Assistant. Designed to make your coding experience smoother and more efficient, it provides a whole new level of functionality and assistance.
The AI capabilities are powered by the JetBrains AI service, which seamlessly connects you to a range of large language models (LLMs), unlocking a variety of AI-powered features across multiple JetBrains products.
In this initial release, the service includes OpenAI models, ensuring access to cutting-edge AI technology. Additionally, JetBrains has developed several smaller models that are also hosted within the service. This combination provides you with a diverse set of AI-powered functionalities.
AI chat
Start a conversation with the LLM via the AI Assistant tool window. You can ask questions, discuss tasks, or collaborate with AI Assistant. The IDE will provide information that is relevant to your project, including details specific to the programming languages and technologies used in it. Once you’re satisfied with the results, you can insert the AI-generated code into the editor by clicking the Insert Snippet at Caret button or by simply copying and pasting it.
If you want to inquire about a particular code fragment, select it in the editor and choose an action from the AI Actions menu. You can access the menu either from the editor’s context menu or by using the Alt+Enter shortcut.
The New chat using selection action lets you provide your own prompt or query. You can also use other standard AI-assistance prompts, such as Explain code, Suggest refactoring, or Find potential problems, to enhance your interaction.
Commit message generation
The Commit Changes dialog now has a Generate Commit Message with AI Assistant button. Click it to send your change differentials to the LLM, which will then generate a descriptive commit message summarizing your modifications.
Documentation generation with AI Assistant
If you’d like an LLM to generate documentation for a declaration for you, access the AI Actions menu and select Write documentation. The IDE will generate the static portion of the comment, while the AI will generate the actual documentation text on your behalf, saving you time and effort.
Accessing AI features
To access the AI features, you’ll need to be logged in to the JetBrains AI service using your JetBrains Account. You can log in either from the AI Assistant tool window or from Settings | Tools | AI Assistant.
New UI updates
Reworked hamburger menu for Windows and Linux
Now, when you click on the hamburger menu icon, the menu elements will appear horizontally over the toolbar. This provides a more intuitive and streamlined experience. Additionally, we have added the option to convert this menu into a separate toolbar. To enable this feature, navigate to View | Appearance | Main menu as a Separate Toolbar. When you select this option, the menu will be displayed as a distinct toolbar, offering an alternative layout for easier access to the toolbar elements.
Updated window controls on macOS
On macOS, when you use full screen mode with the new UI, the window controls are now displayed right in the main toolbar – not in the floating bar as before.
Colored project headers in the new UI
The latest UI update introduces colored project headers, which are designed to help you navigate between multiple open projects. You can now assign a distinct color and icon to each project, providing a visual aid for distinguishing them within your workspace. Headers have predefined colors by default, but you can customize them according to your preferences. To assign a new color to your project, simply right-click on its header and access the context menu. From there, choose the Change Toolbar Color option and select your desired color. If you need to deactivate this feature, you can simply uncheck the Use Project Color In Toolbar option in the context menu.
RBS support
Support for renaming typos
In previous releases, we added spell-checking for interfaces, type aliases, and comments in RBS. In this release, we have implemented a new quick-fix that allows you to replace typos in symbol names with the suggested corrections.
Class and module aliases formatting
Formatting functionality is now available for the class and module aliases.
Сode insight for RBS use syntax
RubyMine’s code insight is now available for the use syntax in RBS. Here are some of the improvements that we’ve implemented:
- All namespaces used within a use clause now have reference support.
- The target of an imported use clause now has reference support.
- When resolving a simple name, resolve targets are prioritized in the following order: type variables first, followed by use clauses in reverse order. Use clauses that occur last have a higher priority, allowing you to shadow a use clause that comes earlier.
- Autocomplete for wildcard use clauses now includes a * character.
- An implicit reference is now provided for the * characters in wildcard use clauses.
- Use clause aliases are recognized as separate entities, and code insight actions such as Go to declaration, Find usages, and Rename are now available for them.
- When you obtain a type in Ruby from RBS (Ruby Signature), it will display the expected type that the use clause and/or alias targets.
- All RBS inspections are updated to work with use clause aliases.
- Completion inside use clauses functions correctly, now that updates have been made to handle insertions properly.
- When invoking completion inside a file, use clause aliases are included in the completion list.
- Use clause alias names now have spell-checking support.
Annotations and inspections for use directives
We continue to support this new feature in RBS, we’ve added some annotations and inspections for misused directives. Here is the list of improvements:
- RubyMine now annotates use clause aliases when their case does not match.
- We’ve added an inspection for an unconventional use alias name, which behaves the same as other naming convention inspections.
- We’ve added an inspection for unused use clauses with a quick-fix to “optimize use clauses”, which removes the unused ones.
- We’ve added an inspection for unnecessary qualifiers. Qualifiers are sometimes unnecessary when there is a namespace or use clause that imports the actual name.
- We’ve added a quick-fix for simple unresolved references (those with no qualifiers) that propose adding a use clause to import the name if there is one available.
- There is now support for the Optimize imports action, which only removes unused imports and behaves the same as the inspection.
Formatting of use directives
As part of our ongoing efforts to enhance support for the use syntax in RBS, we have added support for the formatting of use directives. This improvement ensures that the formatting is consistent and follows the established standards.
Code insight for RBS class and module aliases
RubyMine now provides code insight and navigation features, such as resolve, completion, find usages, rename, and more, as well as type inference for class and module aliases. Inspections such as “Duplicate declarations” or “Conflicting type variable variance” now support class and module aliases, and new inspections for detecting cyclic or inconsistent alias declarations have been added.
Performance
Updated lexer
We gave the RubyMine lexer a major overhaul, which dramatically increased the lexing and parsing speed.
Filtering files during gem sync for the Docker and Docker Compose SDKs
We’re continually improving the performance of remote interpreters in RubyMine. In this release, we optimized gem synchronization for the Docker and Docker Compose SDKs. We achieved this by making a slight change to how we sync gems for the Docker Compose SDKs. Previously, we had two modes for copying gems: using the Docker cp command to copy gems from running containers and using the Docker engine API to copy gems from an image. We now only use the Docker Engine API, which can be used for copying gems from both an image and a running container. However, you can still choose your preferred method for copying gems by going to Settings | Build, Execution, Deployment | Docker | Ruby Settings.
These are the most notable updates introduced in RubyMine 2023.2. Check out the What’s New page or refer to the release notes for more information.
You can download RubyMine 2023.2 from our website or via the Toolbox App.
We’d love to hear more about your experience with RubyMine. Schedule a 40–60 minute call with us so we can discuss and answer any questions you may have!
To learn about the newest features as they come out, please follow RubyMine on Twitter. We post product news and tips several times a week.
We invite you to share your thoughts in the comments below and suggest and vote for new features in the issue tracker.
Happy developing!
The RubyMine team