{"id":474784,"date":"2024-05-21T12:53:05","date_gmt":"2024-05-21T11:53:05","guid":{"rendered":"https:\/\/blog.jetbrains.com\/?post_type=webstorm&#038;p=474784"},"modified":"2024-05-27T14:58:51","modified_gmt":"2024-05-27T13:58:51","slug":"ai-assistant-for-javascript-developers","status":"publish","type":"webstorm","link":"https:\/\/blog.jetbrains.com\/de\/webstorm\/2024\/05\/ai-assistant-for-javascript-developers","title":{"rendered":"JetBrains AI Assistant for JavaScript Developers \u2013 WebStorm"},"content":{"rendered":"\n<p>There is no doubt that the advent of AI is changing the way many of us work. Whether you choose to accept this with optimism\u2026 or skepticism\u2026 is a topic for another day. We choose optimism, as AI has incredible potential to improve how we work.<\/p>\n\n\n\n<p>In this blog post, we\u2019ll look at how you can speed up your workflows and simplify JavaScript and TypeScript development with the help of AI in JetBrains IDEs. We\u2019ll use WebStorm as an example, but most of the AI features will work the same way in our other IDEs.<\/p>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\">What is an AI coding assistant?<\/h2>\n\n\n\n<p>First, let&#8217;s clarify what AI coding assistants are. Simply put, these are tools that leverage artificial intelligence to assist you with different kinds of programming tasks \u2013 from writing code to working with Git. Some examples of popular AI coding assistants include <a href=\"https:\/\/www.tabnine.com\/ai-coding-assistant\/\" target=\"_blank\" rel=\"noopener\">Tabnine<\/a>, <a href=\"https:\/\/github.com\/features\/copilot\" target=\"_blank\" rel=\"noopener\">GitHub Copilot<\/a>, and <a href=\"https:\/\/www.jetbrains.com\/ai\/\" target=\"_blank\" rel=\"noopener\">JetBrains AI Assistant<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why use an AI coding assistant?<\/h2>\n\n\n\n<p>Why have so many developers been adopting AI coding assistants in their workflow lately? The answer is simple \u2013 productivity. When used effectively, AI tools help you save time and reduce the amount of routine work you have to do on a daily basis. Just make sure that the tool you\u2019re using takes data and code security seriously.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">AI for JavaScript developers \u2013 how can it help?<\/h2>\n\n\n\n<p>JavaScript development has its own unexpected, often <a href=\"https:\/\/www.freecodecamp.org\/news\/explaining-the-best-javascript-meme-i-have-ever-seen\/\" target=\"_blank\" rel=\"noopener\">meme-able behavior<\/a> that can be hard to troubleshoot. From infamous \u201ccallback hell\u201d to the complexities of asynchronous programming, you can find yourself grappling with intricate code structures that are daunting to untangle.<\/p>\n\n\n\n<p>AI coding assistants can help with problems like these. Let\u2019s take the \u201ccallback hell\u201d problem as an example. This issue arises primarily due to the heavy use of callbacks for asynchronous operations, leading to nested callbacks that are hard to read and maintain. Here\u2019s how JetBrains AI Assistant can help you rewrite the function and replace \u201ccallback hell\u201d with an async\/await approach in just a few clicks.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2024\/05\/Callback-hell-cover.png\" alt=\"Using AI Assistant to generate code to mitigate call back hell\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2024\/05\/Callback-hell.gif\"><\/figure>\n\n\n\n<p>This is just one example of how easily AI eliminates problems like this in your IDE.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Overview of JetBrains AI Assistant in WebStorm<\/h2>\n\n\n\n<p>Let\u2019s see what AI functionality you can benefit from in <a href=\"https:\/\/www.jetbrains.com\/webstorm\/\" target=\"_blank\" rel=\"noopener\">WebStorm<\/a>. JetBrains AI Assistant can help you with a range of tasks \u2013 from getting to know your project better to testing and working with version control. And, of course, writing code.&nbsp;<\/p>\n\n\n\n<p>Let\u2019s take a look at the key features available in JetBrains AI Assistant. You can start with a free 7-day trial and then switch to one of the <a href=\"https:\/\/www.jetbrains.com\/ai\/?plan=individuals#plans-and-pricing\" target=\"_blank\" rel=\"noopener\">available subscription plans<\/a>. For more information on how to get started, see <a href=\"https:\/\/www.jetbrains.com\/help\/webstorm\/ai-assistant.html#install-ai-assistant-plugin\" target=\"_blank\" rel=\"noopener\">this section<\/a>.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Smart chat<\/h3>\n\n\n\n<p>You can call up JetBrains AI Assistant directly from the IDE. The best part about this: Not only can you ask the AI questions from the built-in chat window, but because it\u2019s integrated with the IDE, you can take its responses and code suggestions and apply them directly to your project.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2024\/05\/Explain-project-cover.png\" alt=\"tab-labels\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2024\/05\/Explain-project.gif\"><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">AI prompts<\/h3>\n\n\n\n<p>There are a bunch of prewritten prompts that are available in the right-click context menu under <em>AI Actions<\/em>. They use AI backed by project-specific context from WebStorm to help you simplify routine tasks, such as:<\/p>\n\n\n\n<ul>\n<li><strong>Explain code<\/strong>. AI can give you a comprehensive explanation of how the code works to help you understand the logic behind it faster.<\/li>\n\n\n\n<li><strong>Find the best way to refactor code<\/strong>. The action for suggesting refactorings shows how you can refactor your code to make it more readable and maintainable.<\/li>\n\n\n\n<li><strong>Identify potential problems<\/strong>. You can also ask AI to find potential issues you may want to look into, like missing error handling or partial usage of <code>Promise.all()<\/code>.<\/li>\n\n\n\n<li><strong>Generate code, documentation, and tests<\/strong>. The capabilities of AI don\u2019t end at just being able to suggest code as you program. It can also generate things for you from scratch while staying in the context of the project. This is perfect for all sorts of your least favorite tasks, such as writing documentation or tests.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2024\/05\/Suggest-refactoring-v2.png\" alt=\"Using AI Assistant Suggest Refactoring Action to improve the code by modernizing it\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2024\/05\/Suggest-refactoring-AI.gif\"><\/figure>\n\n\n\n<p>That\u2019s not all! You can also <a href=\"https:\/\/www.jetbrains.com\/help\/webstorm\/use-prompts-to-explain-and-refactor-your-code.html#ai_add_custom_prompts\" target=\"_blank\" rel=\"noopener\">add your own prompts<\/a> to the context menu for other actions you use often.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Help with version control<\/h3>\n\n\n\n<p>Routine version control tasks are another prime candidate for offloading onto AI. For example, JetBrains AI Assistant can generate commit messages for you or help you edit and improve the ones used for the commits you\u2019ve already made. What\u2019s more, it can summarize the changes from other commits.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/resources.jetbrains.com\/storage\/products\/blog\/wp-content\/uploads\/WebStorm\/Explain Commit.png\" alt=\"tab-labels\" data-gif-src=\"https:\/\/resources.jetbrains.com\/storage\/products\/blog\/wp-content\/uploads\/WebStorm\/Explain Commit.gif\"><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Multi-line code completion<\/h3>\n\n\n\n<p>With JetBrains AI Assistant, you also get more powerful code completion. It can autocomplete entire functions or even blocks of code as you type based on the context of your project. The code it generates will be similar to how you would write the code, matching your style and naming conventions.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"1600\" height=\"800\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2024\/05\/Multi-line-AI.png\" alt=\"\" class=\"wp-image-474818\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Name suggestions<\/h3>\n\n\n\n<p>Naming things in code is the most difficult task a human can ever undertake<sup>[citation needed]<\/sup>, so why not let AI do it for you? When you rename a symbol, JetBrains AI Assistant will provide suitable suggestions for it based on the current context.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2024\/05\/Name-Suggestions-cover.png\" alt=\"tab-labels\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2024\/05\/Name-Suggestions.gif\"><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Runtime error explanation<\/h3>\n\n\n\n<p>JavaScript can be notorious for its unexpected runtime errors. With the click of a button, JetBrains AI Assistant can analyze and suggest fixes for runtime errors, which can be inserted straight into your files.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/resources.jetbrains.com\/storage\/products\/blog\/wp-content\/uploads\/WebStorm\/Runtime Error AI.png\" alt=\"tab-labels\" data-gif-src=\"https:\/\/resources.jetbrains.com\/storage\/products\/blog\/wp-content\/uploads\/WebStorm\/Runtime Error AI.gif\"><\/figure>\n\n\n\n<p>In essence, JetBrains AI Assistant is the ultimate augmentation of your IDE. It will enhance the features you already love with AI capabilities and provide context-aware smart assistance to help you take care of the tasks you don\u2019t.&nbsp;<\/p>\n\n\n\n<p><p align=\"center\"><a class=\"jb-download-button\" href=\"https:\/\/www.jetbrains.com\/ai\/\" target=\"_blank\" rel=\"noopener\">Try JetBrains AI Assistant<\/a><\/p><\/p>\n\n\n\n<p>See <a href=\"https:\/\/www.jetbrains.com\/help\/webstorm\/ai-assistant.html\" target=\"_blank\" rel=\"noopener\">our documentation<\/a> for more information on JetBrains AI Assistant features available in WebStorm.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>The era of AI in JavaScript development represents a paradigm shift in how we approach coding. With AI coding assistants like JetBrains AI Assistant, you can stay more productive while reducing the amount of routine and stressful tasks to a minimum. Give it a try and see for yourself!<\/p>\n\n\n\n<p><em>The WebStorm team<\/em><\/p>\n","protected":false},"author":989,"featured_media":475505,"comment_status":"closed","ping_status":"closed","template":"","categories":[601],"tags":[8168],"cross-post-tag":[8396],"acf":[],"_links":{"self":[{"href":"https:\/\/blog.jetbrains.com\/de\/wp-json\/wp\/v2\/webstorm\/474784"}],"collection":[{"href":"https:\/\/blog.jetbrains.com\/de\/wp-json\/wp\/v2\/webstorm"}],"about":[{"href":"https:\/\/blog.jetbrains.com\/de\/wp-json\/wp\/v2\/types\/webstorm"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/de\/wp-json\/wp\/v2\/users\/989"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/de\/wp-json\/wp\/v2\/comments?post=474784"}],"version-history":[{"count":10,"href":"https:\/\/blog.jetbrains.com\/de\/wp-json\/wp\/v2\/webstorm\/474784\/revisions"}],"predecessor-version":[{"id":477615,"href":"https:\/\/blog.jetbrains.com\/de\/wp-json\/wp\/v2\/webstorm\/474784\/revisions\/477615"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/de\/wp-json\/wp\/v2\/media\/475505"}],"wp:attachment":[{"href":"https:\/\/blog.jetbrains.com\/de\/wp-json\/wp\/v2\/media?parent=474784"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/de\/wp-json\/wp\/v2\/categories?post=474784"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/de\/wp-json\/wp\/v2\/tags?post=474784"},{"taxonomy":"cross-post-tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/de\/wp-json\/wp\/v2\/cross-post-tag?post=474784"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}