WebStorm : The JavaScript and TypeScript IDE | The JetBrains Blog https://blog.jetbrains.com Developer Tools for Professionals and Teams Mon, 17 Mar 2025 10:23:49 +0000 en-US hourly 1 https://blog.jetbrains.com/wp-content/uploads/2024/01/cropped-mstile-310x310-1-32x32.png WebStorm : The JavaScript and TypeScript IDE | The JetBrains Blog https://blog.jetbrains.com 32 32 WebStorm 2025.1 Beta Is Here With AI Enhancements, Framework Improvements, and a Better User Experience https://blog.jetbrains.com/webstorm/2025/03/webstorm-2025-1-beta/ Fri, 14 Mar 2025 11:18:11 +0000 https://blog.jetbrains.com/wp-content/uploads/2025/03/ws-2025-1-featured_blog.png https://blog.jetbrains.com/?post_type=webstorm&p=552606 The EAP cycle for WebStorm 2025.1 is over, and we’re excited to share what’s included in the Beta builds.

The Toolbox App is the easiest way to get the Beta builds and keep both them and your stable versions up to date. You can also manually download the Beta builds from our website.

DOWNLOAD WEBSTORM 2025.1 BETA

Important! WebStorm Beta builds are not fully tested and might be unstable. Please try the latest build and share your feedback with us. You can do so using our issue tracker or by leaving a comment on this blog post.

Key improvements

AI Assistant

Сlaude and local LLMs

JetBrains AI Assistant is advancing its line of models! We’ve added support for Claude 3.5 Sonnet and Claude 3.5 Haiku, now provisioned in Amazon Bedrock. This means you’ll benefit from sharper responses, faster insights, and an even smoother experience. AI Assistant’s lineup of OpenAI models now includes o1, o1-mini, and o3-mini.

Update: A new version of the JetBrains AI Assistant plugin has been released, bringing support for even more models, including:
• Claude 3.7 Sonnet
• OpenAI GPT-4.5
• Gemini 2.0 Flash

In addition to cloud-based models, you can now connect the AI chat to local models available through Ollama and LM Studio! You can set up local providers via Settings | Tools | AI Assistant | Custom Models:

Improved AI completion for web frameworks

For the 2025.1 release we have focused on improving AI-based completion in the context of web framework components. These changes affect local full line code completion as well as cloud-based completion suggestions:

Enhanced AI test generation

AI-powered test generation now offers more careful framework detection, especially for cases when multiple frameworks are present. Additionally, generated tests respect naming conventions:

TypeScript

Service-powered type engine

The engine previously known as WebStorm@next or the Use types from server option now has an official name – the service-powered type engine! We’re currently polishing it, with a focus on performance. A dedicated icon in the status bar displays the engine’s status, and you can granularly enable or disable it for supported frameworks or for TypeScript in general within the current project:

If you notice any degradations when the new engine is enabled, please use the Submit a bug report link.

Angular improvements

WebStorm now supports code completion for host binding attributes based on directive selectors. Quick-fixes for creating fields are also available within binding expressions. Moreover, refactoring is supported across different locations and is even available for CSS classes:

The long-awaited support for Reactive Forms is here. This update includes code completion, syntax highlighting, validation, refactoring, and quick-fixes for Reactive Forms. Both declaration styles – constructor-based and builder-based – are fully supported.

There is also a new intention to extract or inline component templates. Invoke Show Context Actions (⌥⏎ (macOS) / Alt+Enter (Windows/Linux)) to use the action:

This release brings many other improvements and bug fixes for Angular beyond the features mentioned above.

Next.js improvements

WebStorm 2025.1 Beta introduces automatic run configuration creation for Next.js applications. Now, you can easily initiate debug sessions for both the client and server components of your Next.js application using the Run widget.

Vue improvements

The New Project wizard now gives you the option to generate a new Nuxt project using the Nuxt CLI (nuxi):

We’ve also implemented several bug fixes, including:

  • WEB-59818 – Vue custom global properties added by augmenting vue are now resolved.
  • WEB-69114 – Auto-completion and auto-imports now work for packaged components declared with __VLS_WithTemplateSlots.

User experience

Floating toolbar

In WebStorm 2025.1 Beta, invoking Show Context Actions (⌥⏎ (macOS) / Alt+Enter (Windows/Linux)) now opens the floating toolbar with different action groups. The toolbar also appears when you select code in the editor:

The floating toolbar contains the following actions and action groups:

  • Context actions
  • AI Assistant context actions (if the AI Assistant plugin is installed)
  • Refactor
  • Show usages
  • Surround with tag
  • Reformat code

You can customize the contents of the toolbar by opening the kebab menu (three vertical dots) and selecting the Customize Toolbar… option

New file creation in the Project tool window

Creating new files is now easier in the Project tool window. You can simply use the + icon located directly in the window’s toolbar:

GraphQL and Prisma

WebStorm 2025.1 Beta introduces the following improvements for Prisma:

Prettier integration improvements

WebStorm now automatically detects and applies the nearest in the directory tree Prettier configuration when formatting files, ensuring the code style is consistent across subprojects. The Indentation status bar widget shows whether Prettier has modified the code style. The new dropdown menu offers the following options:

  • Open Configuration File (or use default Prettier settings if none exists)
  • Open Prettier Settings
  • Disable Prettier Code Style Modifications

Code style changes made by Prettier are visible in the Code Style tab under Settings, where you can also disable automatic modifications.

A new setting controls whether WebStorm should use Prettier to auto-format code styles. This option is enabled by default. In case if .editorconfig is present, Prettier takes precedence for files it handles, but if certain options aren’t specified in Prettier, EditorConfig settings still apply.

Monorepo support

We are consistently working to improve reliability and performance in mono-repo setups. Here are some of the most noticable fixes in this build for long-standing issues:

  • WEB-71210 – Auto-import and syntax highlighting now work as expected for sibling packages in monorepo.
  • WEB-70868 – IntelliSense fixed in large nx TypeScript monorepos.
  • WEB-69642 – Array values in package.json export fields are now processed properly.
  • WEB-64647 – Path aliases defined in package.json exports are now used by auto-import in monorepos.

That’s it for today. For the full list of improvements introduced throughout the latest 2025.1 EAPs, check out the release notes.

The WebStorm team

]]>
The Angular Language Server: Understanding IDE Integration Approaches https://blog.jetbrains.com/webstorm/2025/03/the-angular-language-server-understanding-ide-integration-approaches/ Thu, 06 Mar 2025 18:26:00 +0000 https://blog.jetbrains.com/wp-content/uploads/2025/03/ws-featured_blog_1280x720_en.png https://blog.jetbrains.com/?post_type=webstorm&p=551237 The Language Server Protocol (LSP) has been a fundamental part of the code editor landscape for years, providing a consistent development experience across different editors. The Angular Language Server leverages this protocol to provide Angular-specific features to compatible editors. However, not all IDEs take the same approach to delivering these capabilities. Let’s look at the major differences between VS Code, NeoVim, and WebStorm and finally answer the age-old question, “Why does WebStorm not just use the Angular Language Server?!”

What is a language server, and how does the LSP work?

Modern code editors need to understand your code to provide features like autocompletion, go to definition, or error detection. Traditionally, each editor needed to implement this understanding for every programming language, leading to duplicated effort and inconsistent experiences across editors.

The Language Server Protocol (LSP) solves this by standardizing how editors communicate with language-specific analysis tools. Here’s how it works:

  1. Your editor (the client) sends information about your code (typically the file that is currently open in your editor) to a language server.
  2. The language server analyzes the code and responds with insights.
  3. Your editor displays these insights as squiggly error lines, autocompletion popups, or other UI elements.
// When you type this in your editor
@Component({
  template: `
    <div *ngFor="let item of items">
      {{ item.property }}
    </div>
  `
})
class MyComponent { }

Your editor sends the file content to the language server. The server analyzes it and might respond with:

{
  "diagnostics": [{
    "message": "Property 'property' does not exist on type 'any'",
    "range": {
      "start": {"line": 3, "character": 12},
      "end": {"line": 3, "character": 20}
    }
  }]
}
// Your editor then shows the error underline

This standardization means that:

  • Developers of editors and IDEs can add support for new languages just by implementing the LSP client once.
  • Language tool developers can support all LSP-compatible editors with a single server and very small client implementations (JetBrains IDE plugin or VS Code plugin).
  • Developers get consistent features across different editors.

The Angular Language Server specifically provides Angular-aware code analysis, offering features like template type checking, component property completion, and Angular-specific refactorings to any editor that supports LSP.

Benefits of the Language Server Protocol

The LSP has established itself as the standard for providing editor intelligence across different development environments. It enables consistent features like type checking, code completion, and navigation across any LSP-compatible editor:

@Component({
  template: `
    <div *ngFor="let item of items">
      {{ item?.deeply?.nested?.property }}
    </div>
  `
})
class WhyTypeCheckingMatters { }

While the Angular compiler would catch these template errors during build time, the language server provides immediate feedback in your editor. This means you can spot and fix type errors as you write your code, without waiting for the compilation step.

VS Code: LSP’s golden child

VS Code’s integration with the Angular Language Server is seamless and intuitive. Here are some of the features that you’ll be able to use after installing the necessary plugin:

  1. Template type checking: Because nobody likes finding out about undefined properties in production.
  2. Go To Definition: Jump straight to your TypeScript references.
  3. Autocompletion: For when you can’t remember the syntax of *ngFor or @switch.
  4. Real-time error detection: Catch those typos before they catch you out.

The best part? It’s all standardized. The same language server that powers VS Code can power any editor that speaks LSP.

Neovim: for when Vim users want nice things, too

Remember when Vim users had to type out every import statement manually? Pepperidge Farm remembers. Now, thanks to LSP, you get:

-- Neovim config that actually gives you IDE features
require'lspconfig'.angularls.setup{
  -- Look ma, real autocomplete!
}

Neovim users now enjoy the same powerful features as VS Code users while keeping their beloved modal editing. It’s the best of both worlds – modern IDE features with an outstanding editing experience.

The caveats of language servers

Language servers are great – they provide a consistent developer experience and guarantee correctness. However, the fact that language servers adhere to a standardized protocol means that they do have some limitations. For instance, even though most languages and frameworks have some kind of test support, the LSP is not aware of this concept, and, therefore, tests must be configured manually within the editor. This is also the case when working with debuggers, too.

Additionally, language servers generally look at the codebase on a “file by file” basis, and, more specifically, at the current cursor position. Generally speaking, this works great until it doesn’t… Implementing a multi-file refactoring, for instance, can be difficult (though not impossible). For this reason, extracting some HTML code into a new Angular component is not as straightforward as it might first sound. On top of that, language servers can usually only process one language at a time; therefore, refactoring a CSS class across languages can quickly become very cumbersome in a language server implementation. The Angular Language Server has a very clever trick for handling HTML and TypeScript, but more on that in the next section. CSS, on the other hand, doesn’t enjoy the same level of support. 

What’s more, adding further support for parts that don’t have dedicated compiler functionality is difficult to accomplish. One such example would be IntelliSense for the host property of the component decorator.

WebStorm: a slightly different approach

Now, here’s where things get interesting. WebStorm and other JetBrains IDEs take a different approach, and it’s not just about being contrarian. For the last few years, the Angular plugin has been pre-installed with WebStorm. As of now, this plugin does not utilize the Angular Language Server, but a custom-type engine. As part of our new Service-powered type engine (more about this in the future), we made some major changes to our Angular integration. Instead of using the entire Angular Language Server, WebStorm adopted Angular’s TCB (type-check block) engine, an integral part of the Angular Language Server. For more details, you can check out this talk at NG DE, but in short, the Angular Language Server converts the HTML code into TypeScript code and uses the generated TypeScript code to map errors and IntelliSense features back to the cursor position in the original HTML file. The screenshot below visualizes this concept.

Screenshot of WebStorm, showing a regular Angular Component with some unknown property error on the left side, whereas the right side shows the translated typescript code.

See how this.counter is used in the template, which gets converted to the function _tcb1 on the right side, but isn’t properly declared in TestComponent

You might now be asking, why doesn’t WebStorm just use the Angular Language Server? Well, it turns out template type checking is just one piece of the IDE puzzle. WebStorm’s architecture already handles most of what the Angular Language Server provides:

  • Navigation
  • Code completion
  • Quick-fixes

Furthermore, it offers parts of functionality that our users appreciate and that are not offered by the language server:

  • Unit and E2E test integration for Jasmine, Jest, Vitest, Cypress, and Playwright.
  • Debugging integration.
  • Semantic highlighting of signals (fun fact: the Angular LSP does not provide syntax highlighting, which is part of the VS Code plugin).
  • Special refactoring and quick-fix capabilities (e.g. extract Angular Component, create a signal ‘property’, etc.).
  • IntelliSense without compiler support, like the host property mentioned above.
  • Enhanced search capabilities (e.g. Find Usages for components).

The real-world implications

So what does this mean for you, the developer, just trying to get work done?

VS Code and Neovim users

  • Standardized experience across editors
  • Regular updates with Angular releases
  • Built-in type correctness

WebStorm users

  • Built-in integration of broader IDE tools (debugger, test runner, run configurations, etc.)
  • Direct TCB integration for template type checking
  • Additional navigation, refactoring features, and consistent development experiences across different languages (HTML, CSS, and TypeScript)

Looking forward

The Angular Language Server continues to evolve, making developers’ lives easier. Meanwhile, WebStorm’s specialized approach shows that there’s more than one way to achieve excellent Angular support.

]]>
WebStorm 2024.3: Built-In Database Tools and SQL Support, Better AI-driven Code Completion, and More https://blog.jetbrains.com/webstorm/2024/11/webstorm-2024-3/ Tue, 12 Nov 2024 16:05:08 +0000 https://blog.jetbrains.com/wp-content/uploads/2024/11/ws-2024-3-Featured.png https://blog.jetbrains.com/?post_type=webstorm&p=524492 Our third major release of 2024 is here! In this version, you’ll find built-in database tools and SQL support, various quality enhancements, better code completion with AI Assistant, and a whole lot more.

DOWNLOAD WEBSTORM 2024.3

If you only have a few minutes to explore the highlights of WebStorm 2024.3, check out our quick review video above for the top highlights. If you want to dive deeper into what you can expect in the release, just carry on reading!

The new features and improvements in v2024.3 include:

  • Key Highlights: Improved framework component navigation and renaming, built-in support for database tools and SQL, better code completion with AI Assistant.
  • Frameworks and Technologies: Color preview for Tailwind CSS classes, improvements for Angular, and more.
  • User Experience: Optimized placement for the Rename action, cleaner search results for directories, highlighting for occurrences of selected text, and more.
  • Integrated Developer Tools: Option to disable background pre-commit checks, new Docker Compose build attributes, and more.

Key Highlights

Improved framework component navigation and renaming

WebStorm 2024.3 now supports the Show component usages action for Vue, Svelte, and Astro and detects component usages both in imports and templates. You can also use this functionality by invoking the Find Usages action on the component file in the Project view:

component usages demo with refactoring

The Rename refactoring has also been enhanced to include component usages renaming. When renaming a component file or explicitly defined name, the associated usages in templates will also be updated! This behavior can be disabled by toggling the Search for component usages option during the renaming process and in the Find dialog.

Built-in support for database tools and SQL

The Database Tools and SQL plugin, which was previously only available via a separate paid subscription, is now bundled with WebStorm at no extra cost. You can query, create, and manage databases directly in the IDE. This extends WebStorm’s capabilities for backend and full-stack development. It also makes switching between JetBrains IDEs easier, as most of them include this functionality.

Demo showing the database plugin features in WebStorm

Better code completion with AI Assistant 

WebStorm 2024.3 has significantly improved AI-driven code completion for JavaScript and TypeScript. The new approach combines fast, local full-line completion with powerful cloud-based suggestions powered by JetBrains’ in-house LLMs. This hybrid approach enhances speed, accuracy, and usability while reducing the frequency of lengthy and irrelevant suggestions.

Here are some of the key improvements:

  • Highlighting is now applied to the suggested code, which previously was just plain gray text.
  • Partial acceptance allows you to apply suggestions granularly, giving you more control over changes to your code:
  • Accept suggestions word by word – ⌥ → / Alt+Right.
  • Accept suggestions line by line – ⌘ → / Ctrl+Right.
  • As before, you can explicitly call completion with ⇧ ⌥ / / Shift+Alt.
  • Context collection has been enhanced using RAG strategies.

Completion suggestions are now provided in more locations, and are now triggered during typing, not only on Enter keystrokes. Support for AI-based code completion has also been extended to HTML and CSS (including .css, .less, .scss, .sass, .pcss). Please refer to this blog post for more insights.

tab-labels

Frameworks and Technologies

Color preview for Tailwind CSS classes 

In WebStorm 2024.3, color previews for Tailwind CSS classes are now shown inline in the editor. We’ve added support for the textDocument/documentColor method of the Language Server Protocol (LSP), so all LSP-based plugins now support this functionality out of the box.

Improvements for Angular 

For projects with Angular 19, WebStorm now defaults to standalone mode for components, directives, and pipes. Quick-fixes have been added to help convert between standalone and non-standalone components. Unused standalone imports can be automatically removed during code reformatting or via a new inspection. Support for the @let syntax has also been improved.

Angular improvements demo showing the standalone imports being removed when not used

Correct handling of .prettierignore in subfolders 

WebStorm 2024.3 now properly handles .prettierignore files in subfolders with a package.json, ensuring ignored files aren’t formatted. A new option also lets you specify custom ignore files in Settings | Languages & Frameworks | JavaScript | Prettier.

Bundled Vue Language Server 

The Vue Language Server is now bundled with WebStorm to enhance reliability and prevent issues with loading on WSL. We may do the same for Svelte, Astro, and other technologies in the future. 

Improvements for Svelte

WebStorm 2024.3 provides support for the <script module> attribute, ensuring symbols from these blocks are resolved correctly. Additionally, there’s a new checkbox to disable SvelteKit a11y warnings, giving you more control over accessibility warnings. 

Support for CSS exported via package.json 

WebStorm 2024.3 includes support for the exports field in package.json for CSS, Sass, SCSS, and Less. If styles are exported via package.json, WebStorm will no longer show warnings about unresolved variables.

Bun debugging support for Windows 

Basic Bun debugging, previously available only on macOS and Linux, is now supported on Windows. You can set breakpoints, step through code, inspect variables, and evaluate expressions within WebStorm.

User Experience

Optimized placement for the Rename action

We’ve optimized the placement of the Rename action in the context menu when it’s called on elements in the editor and the Project tool window. The action is now at the top level, making it easier to quickly rename files, variables, and other elements.

Cleaner search results for directories

WebStorm now excludes node_modules results by default when using Find in Files in project directories, reducing clutter from irrelevant files. You can restore the previous behavior by enabling the Search in library files when “Directory” is selected in Find in Files option under Settings | Advanced Settings.

Highlight occurrences of selected text

By default, WebStorm will now automatically highlight all instances of the text you select within a file. This makes it easier to track where your selected text appears throughout your code. You can customize the feature in Settings | Editor | General | Appearance.

.idea directory displayed by default

Previously, the .idea folder – a place where WebStorm stores internal configuration settings – was hidden by default. This made it harder for some users to commit project-wide configurations. To address this, we’ve made it visible in the Project tool window.

Better recognition of generated files

WebStorm 2024.3 will automatically exclude unnecessary files in the dist folder from indexing to optimize CPU usage and decrease indexing time.

Better support for projects in WSL

We’ve improved the reliability of projects that are hosted on WSL and opened from Windows in WebStorm. In particular, support for symlinks has been added, and interaction with WSL has been switched to Hyper-V sockets, which has improved the performance of IDE interaction with WSL.

New features available during indexing

When you open or update your project, WebStorm indexes it, making some features temporarily inaccessible. We’re working to improve this by allowing more functionality during indexing. With this update, Search Everywhere (Shift+Shift) now works for already indexed parts of the project, along with spelling and grammar checks.

Integrated Developer Tools

Option to disable background pre-commit checks

You can now manage background checks during the commit process with a new option under Settings | Version Control | Commit | Advanced Commit Checks | Run advanced checks after a commit is done. This setting lets you decide if tests and inspections should run after making a commit. If you want to wait for these checks to complete, simply disable this option.

New Docker Compose build attributes

WebStorm 2024.3 adds support for new Docker Compose attributes that give you better control over builds, resource management, service orchestration, and networking within Docker Compose, making development more efficient and flexible.

Improved compatibility for Dev Container templates

We’ve improved the compatibility of Dev Container templates, which weren’t originally designed to operate in remote environments. Previously, Dev Container templates often included configurations that assumed local execution, leading to issues when running containers on remote Docker instances. Now, WebStorm ensures that templates that are not optimized for remote use still function correctly.

There are lots of new improvements and enhancements to try out in this latest WebStorm release. If you’d like a list of everything included in WebStorm 2024.3, please check out the release notes. We hope you enjoy this release. As always, please share your feedback with us and report any issues you find to our issue tracker.

The WebStorm team

]]>
WebStorm 2024.3 EAP Digest: Improved Navigation and Rename Refactoring for Framework Components, AI-Based Code Completion Updates, and Tailwind Color Preview for CSS Classes https://blog.jetbrains.com/webstorm/2024/10/webstorm-2024-3-eap/ Mon, 28 Oct 2024 13:06:04 +0000 https://blog.jetbrains.com/wp-content/uploads/2024/10/ws-2024-3-eap-featured.png https://blog.jetbrains.com/?post_type=webstorm&p=520855 It’s time for the WebStorm 2024.3 EAP digest, which will walk you through the new features and improvements in the upcoming release!

The Toolbox App is the easiest way to get the EAP builds and keep both your stable and EAP versions up to date. You can also manually download the EAP builds from our website.

DOWNLOAD WEBSTORM 2024.3 EAP

Important! WebStorm EAP builds are not fully tested and might be unstable. Please try the latest EAP build and share your feedback with us. You can do so using our issue tracker or by leaving a comment on this blog post.

Key highlights

Improved navigation and Rename refactoring for framework components

Starting from version 2024.3, the Show component usages action for Vue, Svelte, and Astro detects component usages both in imports and templates. You can also use this functionality by invoking the Find Usages action on the component file in the Project view:

tab-labels

The Rename refactoring has been enhanced to include component usages renaming. When renaming a component file or explicitly defined name, the associated usages in templates will also be updated! This behavior can be disabled by toggling the Search for component usages option during the renaming process and in the Find dialog.

AI Assistant

Improved AI-based code completion

In 2024.3 we are significantly improving AI-driven code completion for JavaScript and TypeScript. The new approach combines fast, local full-line completion with powerful cloud-based suggestions powered by JetBrains’ in-house LLMs. This hybrid approach enhances speed, accuracy, and usability while reducing the frequency of lengthy and irrelevant suggestions.

Here are some of the key improvements:

  • Highlighting is now applied to the suggested code, which previously was just plain gray text.
  • Partial acceptance allows you to apply suggestions granularly, giving you more control over changes to your code:
    • Accept suggestions word by word – ⌥ → / Alt + Right.
    • Accept suggestions line by line – ⌘ → / Ctrl + Right.
    • As before, you can explicitly call completion with ⇧ ⌥ / / Shift + Alt.
  • We’ve enhanced context collection using RAG strategies.

Completion suggestions are now provided in more locations, and are now triggered during typing, not only on Enter keystrokes.

tab-labels

In EAP 3, support for AI-based code completion has also been extended to HTML and CSS (including .css, .less, .scss, .sass, .pcss). Please refer to this blog post for more insights.

Inline AI prompts

You can now interact with AI Assistant directly in the editor thanks to an experimental inline input feature that detects and processes your requests as you type. This lets you express your intentions in natural language, which AI Assistant instantly interprets and converts into code changes without any extra steps. This feature is currently available for JavaScript and TypeScript:

tab-labels

The IDE leaves a purple mark in the gutter next to lines added or changed by AI Assistant so you can easily see what has been updated.

If you don’t like the initial suggestion, you can generate a new one by pressing Tab. You can also adjust the initial prompt by clicking on the purple block in the gutter or simply pressing Ctrl + / (Windows/Linux) or ⌘/ (macOS).

Please note that these improvements are available only when using the AI Assistant plugin.

Color preview for Tailwind CSS classes

Color previews for Tailwind CSS classes are now shown inline in the editor. We’ve added support for the textDocument/documentColor method of the Language Server Protocol (LSP), so all LSP-based plugins now support this functionality out of the box.

Bun debugger support for Windows

In EAP 2, we’ve introduced Bun debugger support for Windows. This update includes program traversal (Step Into, Step Over, and Run to Cursor), expression evaluation, and support for line breakpoints, exceptions, and conditional breakpoints.

Bun debugger support is currently unavailable on WSL. If you would like to see it added, consider voting for WEB-69167.

Code style options for decorators

We have implemented new code style options for decorators in JavaScript and TypeScript. EAP 1 introduces four new items in the Wrapping and Braces subsection of the Code Style settings:

User experience

Updates to Find in Files

The Find in Files feature has a new search scope option: Project Files Excluding Git-Ignored. This option excludes any files ignored in .gitignore  from your search results, helping you narrow down the search scope to the relevant parts of your project.

Highlight occurrences of selected text 

By default, WebStorm will now automatically highlight all instances of the text you select within a file. You can toggle this feature in Settings | Editor | General | Appearance.

Other highlights

  • The Database Tools and SQL plugin is now bundled in the IDE, and its licensing model will be changed in the upcoming major release.
  • WebStorm now displays the .idea directory in the Project view by default. You can use the projectView.hide.dot.idea registry option to toggle this behavior (WEB-68009). 
  • The Install dependencies notification will now automatically disappear once the required dependencies have been installed via the command line (WEB-65147).
  • We have improved navigation to built-in Nuxt components (WEB-65589, WEB-66625).
  • You can now use nx as the karma package to run unit tests in Nx projects (WEB-58994).

That’s it for today. For the full list of improvements introduced throughout the latest 2024.3 EAPs, check out the release notes.

The WebStorm team

]]>
JavaScript Best Practices https://blog.jetbrains.com/webstorm/2024/10/javascript-best-practices-2024/ Mon, 28 Oct 2024 12:35:46 +0000 https://blog.jetbrains.com/wp-content/uploads/2024/10/ws-featured_blog_1280x720_en.png https://blog.jetbrains.com/?post_type=webstorm&p=521408 JavaScript is undoubtedly the most used programming language in the world and is hugely influential on one of the largest technologies we have all come to rely on – the internet. With this power comes great responsibility, and the JavaScript ecosystem has been rapidly evolving, making it incredibly hard to keep up with the latest JavaScript best practices.

In this blog post, we will cover several key best practices in modern JavaScript for cleaner, more maintainable, and more performant code. 

Project-defined practices trump all other practices

The project where you write code can have its own strict rules. Project rules are more relevant than any suggestion from any best practice article – this one included! If you would like to use a specific practice, make sure to sync it with the project rules and codebase and that everyone on your team is also on board.

Use up-to-date JavaScript

JavaScript was invented on December 4, 1995. Since that time, it has been almost endlessly evolving. On the Internet, you can find a lot of outdated suggestions and practices. Be careful and verify if a practice that you would like to use is up to date.

Also, be careful when using the very latest JavaScript features. It is better to start using new JavaScript features that have been through at least Ecma TC39 Stage 3.

That said, here is a compilation of some of the current common best practices for JavaScript all in one place:

Declaring variables 

You may encounter code that uses many var declarations. This may be on purpose, but if it is old code, it could be because this was the old approach.

Advice: Use let and const instead of var to declare your variables. 


Why it matters: Although var is still available, let and const provide block-scoping, which is more predictable and reduces unexpected errors that can happen when declaring variables with var, which is function-scoped.

for (let j = 1; j < 5; j++) {
  console.log(j);
}
console.log(j);
// you get 'Uncaught ReferenceError: j is not defined'

//If we did this using var:
for (var j = 1; j < 5; j++) {
  console.log(j);
}
// <-- logs the numbers 1 to 4
console.log(j);
//You’d get 5 as it still exists outside the loop

Classes instead of Function: prototype

In many old codebases or articles about OOP in JavaScript, you may run into the function prototype approach for emulation of classes. For example:

function Person(name) {
  this.name = name;
}
Person.prototype.getName = function () {
  return this.name;
}

const p = new Person('A');
console.log(p.getName()); // 'A'

Advice: This approach uses constructors to control the prototype chain. However, in such cases, using classes is almost always better.

class Person {
  constructor(name) {
    this.name = name;
  }
  getName() {
    return this.name;
  }
}

const p = new Person('A');
console.log(p.getName()); // 'A'

Why it matters: The main reason to use classes is that they have much cleaner syntax.

Private class fields

In older JavaScript code, it was common to use an underscore (_) as a convention to denote private properties or methods in classes. However, this doesn’t actually enforce privacy – it just serves as a signal to developers that something is meant to be private.

class Person {
  constructor(name) {
    this._name = name; // Conventionally treated as private, but not truly private
  }


  getName() {
    return this._name;
  }
}

const p = new Person('A');
console.log(p.getName()); // 'A'
console.log(p._name); // 'A' (still accessible from outside)

Advice: When you really need private fields in classes, JavaScript now has real private fields using the # syntax. This is an official language feature that enforces true privacy.

class Person {
  #name
  constructor(name) {
    this.#name = name;
  }
  getName() {
    return this.#name
  }
}
const p = new Person('A');
console.log(p.getName()); // 'A'

Why it matters: Using real private fields ensures that the data is truly encapsulated, preventing accidental or malicious access from outside the class. The underscore convention only provides a visual cue and can easily be misused, while # private fields guarantee privacy by design. This results in more robust and maintainable code.

Arrow function expressions

Arrow functions are often used to make callback functions or anonymous functions more concise and readable. They are especially useful when working with higher-order functions like map, filter, or reduce.

const numbers = [1, 2];

// Using arrow function
numbers.map(num => num * 2);

// Instead of
numbers.map(function (num) {
  return num * 2;
});

Advice: Arrow functions provide a more concise syntax, especially when the function body is a single expression. They also automatically bind the this context, which can be particularly helpful in class methods where this can easily get lost.

Consider this example with a class:

class Person {
  name = 'A';

  // Arrow function retains the 'this' context
  getName = () => this.name;
}

const getName = new Person().getName;
console.log(getName()); // 'A'

Why it matters: Arrow functions enhance readability by removing boilerplate code, making callback functions and inline expressions much more concise. In addition, they are particularly valuable when working with classes or event handlers, as they automatically bind this to the surrounding lexical scope. This avoids common bugs related to this in traditional function expressions, especially in asynchronous or callback-heavy code.

Nullish coalescing (??)

In JavaScript, developers have often used the logical OR (||) operator to assign default values when a variable is undefined or null. However, this can behave unexpectedly when the variable holds values like 0, false, or an empty string (""), because || treats them as falsy and substitutes the default value.

For example:

const value = 0;
const result = value || 10;
console.log(result); // 10 (unexpected if 0 is a valid value)

Advice: Use the nullish coalescing operator (??) instead of || when resolving default values. It only checks for null or undefined, leaving other falsy values (like 0, false, "") intact.

const value = 0;
const result = value ?? 10;
console.log(result); // 0 (expected behavior)

Why it matters: The ?? operator provides a more precise way of handling default values in cases where null or undefined should trigger the fallback. It prevents errors caused by using ||, which may unintentionally override valid falsy values. Using nullish coalescing results in more predictable behavior, improving both code clarity and reliability.

Optional chaining (?.):

When dealing with deeply nested objects or arrays, it’s common to have to check whether each property or array element exists before trying to access the next level. Without optional chaining, this requires verbose and repetitive code.

For example:

const product = {};

// Without optional chaining
const tax = (product.price && product.price.tax) ?? undefined;

Advice: The optional chaining operator (?.) simplifies this process by automatically checking if a property or method exists before attempting to access it. If any part of the chain is null or undefined, it will return undefined rather than throwing an error.

const product = {};

// Using optional chaining
const tax = product?.price?.tax;

Why it matters: Optional chaining reduces the amount of boilerplate code and makes it easier to work with deeply nested structures. It ensures your code is cleaner and less error-prone by handling null or undefined values gracefully, without the need for multiple checks. This leads to more readable and maintainable code, especially when working with dynamic data or complex objects.

async/await

In older JavaScript, handling asynchronous operations often relied on callbacks or chaining promises, which could quickly lead to complex, hard-to-read code. For example, using .then() for promise chaining could make the flow harder to follow, especially with multiple asynchronous operations:

function fetchData() {
  return fetch('https://api.example.com/data')
    .then(response => response.json())
    .then(data => {
      console.log(data);
    })
    .catch(error => {
      console.error(error);
    });
}

Advice: Use async and await to make your asynchronous code look more like regular, synchronous code. This improves readability and makes error handling easier with try...catch.

async function fetchData() {
  try {
    const response = await fetch('https://api.example.com/data');
    const data = await response.json();
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

Why it matters: The async/await syntax simplifies working with asynchronous operations by removing the need for chaining .then() and .catch(). It makes your code more readable, more maintainable, and easier to follow, especially when dealing with multiple async calls. Error handling is also more straightforward with try...catch, leading to cleaner and more predictable logic.

Interaction with object keys and values

In older JavaScript code, interacting with the keys and values of an object often involved manual looping with for...in or Object.keys(), followed by accessing values through bracket notation or dot notation. This can lead to verbose and less intuitive code.

const obj = { a: 1, b: 2, c: 3 };

// Older approach with Object.keys()
Object.keys(obj).forEach(key => {
  console.log(key, obj[key]);
});

Advice: Use modern methods such as Object.entries(), Object.values(), and Object.keys() for working with object keys and values. These methods simplify the process and return useful structures like arrays, making your code more concise and easier to work with.

const obj = { a: 1, b: 2, c: 3 };

// Using Object.entries() to iterate over key-value pairs
Object.entries(obj).forEach(([key, value]) => {
  console.log(key, value);
});

// Using Object.values() to work directly with values
Object.values(obj).forEach(value => {
  console.log(value);
});

Why it matters: Using modern object methods such as Object.entries(), Object.values(), and Object.keys() results in cleaner, more readable code. These methods reduce the amount of boilerplate needed for iterating over objects and improve code clarity, especially when dealing with complex or dynamic data structures. They also support easier transformations of objects into other forms (e.g. arrays), making data manipulation more flexible and efficient.

Check the array type of a variable

In the past, developers used various non-straightforward methods to check if a variable was an array. These included approaches like checking the constructor or using instanceof, but they were often unreliable, especially when dealing with different execution contexts (like iframes).

const arr = [1, 2, 3];
// Older approach
console.log(arr instanceof Array); // true, but not always reliable across different contexts

Advice: Use the modern Array.isArray() method, which provides a simple and reliable way to check whether a variable is an array. This method works consistently across different environments and execution contexts.

const arr = [1, 2, 3];
console.log(Array.isArray(arr)); // true

Why it matters: Array.isArray() is a clear, readable, and reliable way to check for arrays. It eliminates the need for verbose or error-prone methods like instanceof, ensuring your code handles array detection correctly, even in complex or cross-environment scenarios. This leads to fewer bugs and more predictable behavior when working with different types of data structures.

Map

In earlier JavaScript, developers often used plain objects to map keys to values. However, this approach has limitations, especially when keys are not strings or symbols. Plain objects can only use strings or symbols as keys, so if you need to map non-primitive objects (like arrays or other objects) to values, it becomes cumbersome and error-prone.

const obj = {};
const key = { id: 1 };

// Trying to use a non-primitive object as a key
obj[key] = 'value';
console.log(obj); // Object automatically converts key to a string: '[object Object]: value'

Advice: Use Map when you need to map non-primitive objects or when a more robust data structure is required. Unlike plain objects, Map allows any type of value – primitives and non-primitives alike – as keys.

const map = new Map();
const key = { id: 1 };

// Using a non-primitive object as a key in a Map
map.set(key, 'value');
console.log(map.get(key)); // 'value'

Why it matters: Map is a more flexible and predictable way of associating values with any kind of key, whether primitive or non-primitive. It preserves the type and order of keys, unlike plain objects, which convert keys to strings. This leads to more powerful and efficient handling of key-value pairs, especially when working with complex data or when you need fast lookups in larger collections.

Symbols for hidden values

In JavaScript, objects are typically used to store key-value pairs. However, when you need to add “hidden” or unique values to an object without risking name collisions with other properties, or you want to keep them somewhat private from external code, using Symbol can be very helpful. Symbols create unique keys that are not accessible via normal enumeration or accidental property lookup.

const obj = { name: 'Alice' };

const hiddenKey = Symbol('hidden');
obj[hiddenKey] = 'Secret Value';

console.log(obj.name); // 'Alice'
console.log(obj[hiddenKey]); // 'Secret Value'

Advice: Use Symbol when you want to add non-enumerable, hidden properties to an object. Symbols are not accessible during typical object operations like for...in loops or Object.keys(), making them perfect for internal or private data that shouldn’t be exposed accidentally.

const obj = { name: 'Alice' };

const hiddenKey = Symbol('hidden');
obj[hiddenKey] = 'Secret Value';

console.log(Object.keys(obj)); // ['name'] (Symbol keys won't appear)
console.log(Object.getOwnPropertySymbols(obj)); // [Symbol(hidden)] (accessible only if specifically retrieved)

Why it matters: Symbols allow you to safely add unique and “hidden” properties to objects without worrying about key collisions or exposing internal details to other parts of the codebase. They can be especially useful in libraries or frameworks where you might need to store metadata or internal states without affecting or interfering with other properties. This ensures better encapsulation and reduces the risk of accidental overwrites or misuse.

Check Intl API before using extra formatting libraries

In the past, developers often relied on third-party libraries for tasks like formatting dates, numbers, and currencies to suit different locales. While these libraries provide powerful functionality, they add extra weight to your project and may duplicate features already built into JavaScript.

// Using a library for currency formatting
const amount = 123456.78;
// formatLibrary.formatCurrency(amount, 'USD');

Advice: Before reaching for an external library, consider using the built-in ECMAScript Internationalization API (Intl). It provides robust out-of-the-box functionality for formatting dates, numbers, currencies, and more based on locale. This can often cover most of your internationalization and localization needs without the extra overhead of third-party libraries.

const amount = 123456.78;

// Using Intl.NumberFormat for currency formatting
const formatter = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' });
console.log(formatter.format(amount)); // $123,456.78

You can also use it for dates:

const date = new Date();
const dateFormatter = new Intl.DateTimeFormat('en-GB', { year: 'numeric', month: 'long', day: 'numeric' });
console.log(dateFormatter.format(date)); // "15 October 2024"

Why it matters: The Intl API provides native and highly optimized support for internationalization, making it unnecessary to import large libraries for simple formatting needs. By using built-in features, you can keep your project lightweight, reduce dependencies, and still offer comprehensive locale-based formatting solutions. This not only improves performance but also reduces the maintenance burden associated with third-party libraries.

Common practices

Now, let’s look at some common practices that should be best practices.

Use strict equality (===) if possible

One of the trickiest and most surprising behaviors in JavaScript comes from the loose equality operator (==). It performs type coercion, which means it tries to convert operands to the same type before comparing them. This can lead to strange and unexpected results, as demonstrated in the famous “WTFJS” cases from talks like Brian Leroux’s:

console.log([] == ![]); // true (this is surprising!)

In this case, the loose equality operator (==) converts both sides in unexpected ways, leading to unintuitive results.

Advice: Whenever possible, use strict equality (===) instead of loose equality (==). Strict equality does not perform type coercion – it compares both value and type directly, which leads to more predictable and reliable behavior.

console.log([] === ![]); // false (as expected)

Here’s a more typical example to highlight the difference:

// Loose equality (==) performs type coercion
console.log(0 == ''); // true


// Strict equality (===) compares both value and type
console.log(0 === ''); // false (as expected)

Why it matters: Using strict equality (===) helps avoid the unexpected behavior that comes with type coercion in JavaScript. It makes comparisons more predictable and reduces the risk of subtle bugs, especially when dealing with different data types like numbers, strings, or booleans. It’s a good practice to default to === unless you have a specific reason to use loose equality and understand the implications.

Explicitly handle expressions in if statements:

In JavaScript, the if statement implicitly converts the result of the expression it evaluates into a “truthy” or “falsy” value. This means that values like 0, "" (empty string), null, undefined, and false are all treated as falsy, while most other values (even things like [] or {}) are truthy. This implicit casting can sometimes lead to unexpected results if you’re not careful.

For example:

const value = 0;

if (value) {
  console.log('This will not run because 0 is falsy.');
}

Advice: It’s a good practice to make the conditions in if statements explicit, especially when the values you’re working with might not behave as expected in a truthy/falsy evaluation. This makes the code more predictable and easier to understand.

For instance, instead of relying on implicit type coercion:

const value = 0;

// Implicit check (may behave unexpectedly for some values)
if (value) {
  console.log('This won’t run');
}

You can use explicit conditions:

// Explicitly check for the type or value you expect
if (value !== 0) {
  console.log('This will run only if value is not 0.');
}

Or, when checking for null or undefined:

const name = null;

if (name != null) { // Explicitly checking for null or undefined
  console.log('Name is defined');
} else {
  console.log('Name is null or undefined');
}

Why it matters: By explicitly defining the conditions in your if statements, you reduce the chances of unexpected behavior from JavaScript’s automatic type coercion. This makes your code clearer and helps prevent bugs when working with potentially ambiguous values like 0, false, null, or "". It’s a good practice to be explicit about what conditions you’re checking for, especially in complex logic.

Don’t use built-in Number for sensitive calculations

JavaScript’s built-in Number type is a floating-point number based on the IEEE 754 standard. While this is efficient for most purposes, it can lead to surprising inaccuracies, particularly with decimal arithmetic. This is not a problem specific to JavaScript, but it can cause serious issues when you’re working with sensitive data such as financial calculations.

For example, you might encounter this famous floating-point problem:

console.log(0.1 + 0.2); // 0.30000000000000004

Advice: When precision is critical – such as in financial calculations – avoid using the standard Number type for arithmetic. Instead, use specialized libraries like decimal.js or big.js that are designed to handle precise decimal calculations without floating-point errors.

Here’s how it works with a library like decimal.js:

const Decimal = require('decimal.js');

const result = new Decimal(0.1).plus(0.2);
console.log(result.toString()); // '0.3'

These libraries ensure that the calculations are precise and that rounding errors won’t impact the result, making them ideal for sensitive tasks like handling money.

Why it matters: Inaccurate calculations can lead to serious issues when working with things like financial data, where even tiny discrepancies matter. JavaScript’s floating-point math can produce unexpected results, and while improvements are being made to the language, for now, it’s best to rely on libraries like decimal.js or big.js to ensure precision. By using these libraries, you avoid common pitfalls and ensure that your calculations are accurate, trustworthy, and suitable for critical applications.

Be careful with JSON and big integers

JavaScript has limits when it comes to handling very large numbers. The maximum safe integer in JavaScript is 9007199254740991 (also known as Number.MAX_SAFE_INTEGER). Numbers larger than this may lose precision and produce incorrect results. This becomes a problem when working with APIs or systems outside of JavaScript, where big numbers – such as database id fields – can easily exceed JavaScript’s safe range.

For example, when parsing JSON with a large number:

console.log(
  JSON.parse('{"id": 9007199254740999}')
); 
// Output: { id: 9007199254741000 } (Precision lost)

Advice: To avoid this precision issue when dealing with large numbers from JSON data, you can use the reviver parameter of JSON.parse(). This allows you to manually handle specific values – like id fields – and preserve them in a safe format, such as strings.

console.log(
  JSON.parse(
    '{"id": 9007199254740999}',
    (key, value, ctx) => {
      if (key === 'id') {
        return ctx.source; // Preserve the original value as a string
      }
      return value;
    }
  )
); 
// Output: { id: '9007199254740999' }

Using BigInt: JavaScript introduced BigInt to safely work with numbers larger than Number.MAX_SAFE_INTEGER. However, BigInt cannot be directly serialized to JSON. If you attempt to stringify an object containing BigInt, you’ll get a TypeError:

const data = { id: 9007199254740999n };

try {
  JSON.stringify(data);
} catch (e) {
  console.log(e.message); // 'Do not know how to serialize a BigInt'
}

To handle this, use the replacer parameter in JSON.stringify() to convert BigInt values to strings:

const data = { id: 9007199254740999n };


console.log(
  JSON.stringify(data, (key, value) => {
    if (typeof value === 'bigint') {
      return value.toString() + 'n'; // Append 'n' to denote BigInt
    }
    return value;
  })
);
// Output: {"id":"9007199254740999n"}

⚠️ Important consideration: If you use these techniques for handling large integers with JSON, ensure that both the client and server sides of your application agree on how to serialize and deserialize the data. For example, if the server sends an id as a string or BigInt with a specific format, the client must be prepared to handle that format during deserialization.

Why it matters: JavaScript’s number precision limits can lead to serious bugs when working with large numbers from external systems. By using techniques like BigInt and the reviver/replacer parameters of JSON.parse() and JSON.stringify(), you can ensure that large integers are handled correctly, avoiding data corruption. This is especially important in cases where precision is crucial, such as dealing with large ids or financial transactions.

Use JSDoc for helping code readers and editors

When working with JavaScript, functions and object signatures often lack documentation, making it harder for other developers (or even your future self) to understand what parameters and objects contain or how a function should be used. Without proper documentation, code can be ambiguous, especially if object structures aren’t clear:

For example:

const printFullUserName = user =>
  // Does user have the `middleName` or `surName`?
  `${user.firstName} ${user.lastName}`;

In this case, without any documentation, it’s not immediately clear what properties the user object should have. Does user contain middleName? Should surName be used instead of lastName?

Advice: By using JSDoc, you can define the expected structure of objects, function parameters, and return types. This makes it easier for code readers to understand the function and also helps code editors provide better autocompletion, type checking, and tooltips.

Here’s how you can improve the previous example with JSDoc:

/**
 * @typedef {Object} User
 * @property {string} firstName
 * @property {string} [middleName]  // Optional property
 * @property {string} lastName
 */


/**
 * Prints the full name of a user.
 * @param {User} user - The user object containing name details.
 * @return {string} - The full name of the user.
 */
const printFullUserName = user =>
  `${user.firstName} ${user.middleName ? user.middleName + ' ' : ''}${user.lastName}`;

Why it matters: JSDoc improves the readability and maintainability of your code by clearly indicating what types of values are expected in functions or objects. It also enhances the developer experience by enabling autocompletion and type-checking in many editors and IDEs, such as Visual Studio Code or WebStorm. This reduces the likelihood of bugs and makes it easier for new developers to onboard and understand the code.

With JSDoc, editors can provide hints, autocompletion for object properties, and even warn developers when they misuse a function or provide the wrong parameter type, making your code both more understandable and robust.

Use tests

As your codebase grows, manually verifying that new changes don’t break important functionality becomes time-consuming and error-prone. Automated testing helps ensure that your code works as expected and allows you to make changes with confidence.

In the JavaScript ecosystem, there are many testing frameworks available, but as of Node.js version 20, you no longer need an external framework to start writing and running tests. Node.js now includes a built-in stable test runner.

Here’s a simple example using Node.js’s built-in test runner:

import { test } from 'node:test';
import { equal } from 'node:assert';


// A simple function to test
const sum = (a, b) => a + b;

// Writing a test for the sum function
test('sum', () => {
  equal(sum(1, 1), 2); // Should return true if 1 + 1 equals 2
});

You can run this test with the following command:

node --test

This built-in solution simplifies the process of writing and running tests in Node.js environments. You no longer need to configure or install additional tools like Jest or Mocha, though those options are still great for larger projects.

E2E testing in browsers: For end-to-end (E2E) testing in browsers, Playwright is an excellent tool that allows you to easily automate and test interactions within the browser. With Playwright, you can test user flows, simulate interactions across multiple browsers (such as Chrome, Firefox, and Safari), and ensure that your app behaves as expected from the user’s perspective.

Other environments: Bun and Deno, two alternative JavaScript runtimes, also provide built-in test runners similar to Node.js, making it easy to write and run tests without extra setup.

Why it matters: Writing tests saves time in the long run by catching bugs early and reducing the need for manual testing after every change. It also gives you confidence that the new features or refactoring won’t introduce regressions. The fact that modern runtimes like Node.js, Bun, and Deno include built-in test runners means you can start writing tests right away, with minimal setup. Testing tools like Playwright help ensure your application works seamlessly in real-world browser environments, adding an extra layer of assurance for critical user interactions.

Final Thoughts

Though this may seem like a lot to take in. Hopefully, it has given you insight into some areas that you haven’t otherwise considered and would like to implement into your JavaScript projects. Again, feel free to bookmark this and come back to it anytime you need to refer to it. JavaScript conventions are constantly changing and evolving, as are the frameworks. Keeping up with the latest tools and best practices will continuously improve and optimize your code, but it can be difficult to do. We’d recommend following along with what is going on in the ECMAScript releases, as this often points to new conventions that are then generally adopted in the latest JavaScript code. TC39 usually has proposals for the latest ECMAScript versions, which you can follow along with too.

By embracing these modern JavaScript best practices, you’re not just writing code that works – you’re creating cleaner, more efficient, and more maintainable solutions. Whether it’s using newer syntax like async/await, avoiding pitfalls with floating-point numbers, or leveraging the powerful Intl API, these practices will help you stay up-to-date and confident in your codebase. As the JavaScript ecosystem continues to evolve, taking the time to adopt best practices now will save you from future headaches and set you up for long-term success.

That’s it for today! We hope that this has been useful – the comments are open for questions, discussions, and sharing advice. Happy coding!

]]>
WebStorm and Rider Are Now Free for Non-Commercial Use https://blog.jetbrains.com/blog/2024/10/24/webstorm-and-rider-are-now-free-for-non-commercial-use/ Thu, 24 Oct 2024 12:54:38 +0000 https://blog.jetbrains.com/wp-content/uploads/2024/10/DSGN-20567_New_licensing_Social_Share_Blog_1280x720-1.png https://blog.jetbrains.com/?post_type=blog&p=518086 We’re excited to announce a change in our licensing model that we believe will benefit the developer community – WebStorm and Rider are now free for non-commercial use!

Read on to learn more about the change and why we’re making it, and be sure to check out the FAQ section below for additional details.

What’s happening?

Earlier this year, we implemented a new licensing model for our recently introduced IDEs, RustRover and Aqua, making them free for non-commercial use. We’re now extending this model to WebStorm and Rider. If you’re using these IDEs for non-commercial purposes, such as learning, open-source project development, content creation, or hobby development, you can now do so for free.

For commercial projects, nothing will change – our existing licensing remains in place. Other JetBrains IDEs are not affected by this update, either. We’ll evaluate the outcomes of this free non-commercial licensing initiative to see if it can be expanded.

Why are we doing this?

In making non-commercial development free, we aim to make JetBrains IDEs more accessible to a broader audience. We hope the new licensing model will further lower the barrier to using our IDEs, helping you learn, grow, and stay creative.

We’ve explored various ways to achieve this goal. As many of you have asked for more community editions, this was one of the possible options that we considered. However, JetBrains IDEs often have monolithic functionality, with all features deeply integrated and essential for productive work. Creating additional community editions would risk offering a feature set that doesn’t meet the needs of the many different types of users we have.

Why WebStorm and Rider?

According to various surveys like Stack Overflow, 68% of developers code outside of work as a hobby, and nearly 40% for professional growth or self-paced learning. This share is even higher for game and web development. For example, game developers often begin their careers by creating games as a hobby, using free game engines. This inspired our choice to apply the new licensing model to WebStorm and Rider.

Commercial vs. non-commercial use

As defined in the Toolbox Subscription Agreement for Non-Commercial Use, commercial use means developing products and earning commercial benefits from your activities. However, certain categories are explicitly excluded from this definition. Common examples of non-commercial uses include learning and self-education, open-source contributions without earning commercial benefits, any form of content creation, and hobby development.

It’s important to note that, if you’re using a non-commercial license, you cannot opt out of the collection of anonymous usage statistics. We use this information to improve our products. The data we collect is exclusively that of anonymous feature usages of our IDEs. It is focused on what actions are performed and what types of functionality of the IDE are used. We do not collect any other data. This is similar to our Early Access Program (EAP) and is in compliance with our Privacy Policy.

FAQ

Below are answers to some other related questions. If you don’t find an answer to your question, feel free to leave a comment or contact sales@jetbrains.com.

Licensing

What features are included under the free license?

With the new non-commercial license type, you can enjoy a full-featured IDE that is identical to its paid version. The only difference is in the Code With Me feature – you get Code With Me Community with your free license.

Do RustRover and Aqua have the same conditions for non-commercial use?

Yes, RustRover and Aqua follow the same guidelines for non-commercial use. They previously had slightly different criteria for certain use cases, but we’ve updated them to align with the licensing model used for WebStorm and Rider.

Which license should I choose if I want to use Rider or WebStorm for both non-commercial and commercial projects?

If you intend to use Rider or WebStorm for commercial development for which you will receive direct or indirect commercial advantage or monetary compensation within the meaning of the definitions provided in the Toolbox Subscription Agreement for Non-Commercial Use, you will need to purchase a commercial subscription (either individual or organizational). This license can then also be used for non-commercial development.

What license should I choose if I just started a new project?  

If you plan to release the product and get commercial benefits from it, either now or in the future, you should use a commercial license. If your project is for non-commercial purposes, then a non-commercial license is valid. However, if your intentions change over time, you’ll need to reassess whether you still qualify for non-commercial use. If you’re unsure after considering your intentions, it’s safer to choose a commercial license.

The company I am working for doesn’t do commercial development. Am I eligible to apply for a non-commercial license? 

If you’re working and receiving payment, even if your employer doesn’t receive commercial benefits from the end product, such as in a non-profit organization, you should be using a commercial license. For startups and non-profit organizations, we have separate offers mentioned on this page

Can I use the IDE for free to create educational courses and stream content while earning money through course sales or advertisements in the stream?

With the non-commercial license agreement, you can create any type of content, even if it involves receiving commercial benefits. Here are some examples of such content creation:

  • Creators of educational courses looking to sell their courses.
  • Content creators who share posts on platforms like YouTube and earn commissions from ads.
  • Podcasters and streamers who sell ad space in their content.

Will this change affect our paid subscriptions for individuals or organizations?

Don’t worry, this new license type will not impact any of our other paid subscription options. You’ll still be able to purchase personal and organizational subscriptions for WebStorm, Rider, dotUltimate, and the All Products Pack with exactly the same terms and conditions as are currently in place.

How do renewals and upgrades work now?

Non-commercial subscriptions are issued for one year and will automatically renew after that. However, for the renewal to happen, you must have used the assigned license at least once during the last 6 months of the subscription period. If it has been more than 6 months since you last used an IDE activated with this type of license and the renewal did not occur automatically, you can request a new non-commercial subscription again at any time.

Am I eligible for a refund if I’ve already bought a paid subscription but do non-commercial development?

If you’re unsure whether you qualify for a refund, you’ll find full details of our policy here. Please note that if you also work on projects that qualify as commercial usage, you can’t use the free license for them.

What are my other options if I don’t qualify for this non-commercial option? 

We’re sorry you can’t benefit from the non-commercial use license, but we’re sure we’ve got something to suit your needs. It’s always worth checking our special offers and Community page to see all our latest promotional pricing options.

How and where can I get technical support if I encounter a problem or wish to ask a question?

As a non-commercial license holder, we encourage you to reach out with any questions you might have via our public community forums. You can also report any issues you might be experiencing by submitting a new request on the relevant issue tracker.

These resources can be accessed via the following links:

Please note that support via private tickets is not included under this license.

Anonymous data collection 

Does my IDE send any data to JetBrains?

The terms of the non-commercial agreement assume that the product may also electronically send JetBrains anonymized statistics (IDE telemetry) related to your usage of the product’s features. This information may include but is not limited to frameworks, file templates used in the product, actions invoked, and other interactions with the product’s features. This information does not contain personal data.

Is there a way to opt out of sending anonymized statistics?

We appreciate that this might not be convenient for everyone, but there is unfortunately no way to opt out of sending anonymized statistics to JetBrains under the terms of the Toolbox agreement for non-commercial use. The only way to opt out is by switching to either a paid subscription or one of the complimentary options mentioned here.

Getting a non-commercial subscription 

What should I do to apply for this subscription? 

It can be easily done right inside your IDE:

  1. Install Rider or WebStorm and run it.
  2. Upon startup, there will be a license dialog box where you can choose the Non-commercial use option.
  3. Log in to your JetBrains account or create a new one. 
  4. Accept the Toolbox Subscription Agreement for Non-Commercial Use.
  5. Enjoy development in your IDE.

If you’ve already started a trial period or have activated your IDE using a paid license, you still can switch to a non-commercial subscription by following these steps:

  1. If you’re using Rider, go to Help | Manage Licenses. If you’re using WebStorm, go to Help | Register.
  2. In the window that opens, click on the Remove License button.
  3. Choose Non-commercial use.
  4. Log in to your JetBrains Account or create a new one. 
  5. Accept the Toolbox Subscription Agreement for Non-Commercial Use.
  6. Enjoy development in your IDE.

I don’t see the Non-commercial use option in my IDE. What should I do? 

The most likely explanation for this is that you’re using an older version of Rider or WebStorm. Unfortunately, we don’t support obtaining the non-commercial license for any releases prior to Rider 2024.2.7 and WebStorm 2024.2.4. 

Will a single subscription cover both Rider and WebStorm? 

The new non-commercial subscription type is product-specific. This means that if you want to use both Rider and WebStorm for non-commercial purposes, you’ll have to obtain two separate licenses – one for each product. 

Can I generate an activation code for offline activation? 

Unfortunately, acquiring an activation code for a non-commercial subscription is not possible. You can only activate an IDE through your JetBrains Account.

]]>
https://blog.jetbrains.com/zh-hans/blog/2024/10/24/webstorm-and-rider-are-now-free-for-non-commercial-use/ https://blog.jetbrains.com/pt-br/blog/2024/10/24/webstorm-and-rider-are-now-free-for-non-commercial-use/ https://blog.jetbrains.com/ko/blog/2024/10/24/webstorm-and-rider-are-now-free-for-non-commercial-use/ https://blog.jetbrains.com/ja/blog/2024/10/24/webstorm-and-rider-are-now-free-for-non-commercial-use/ https://blog.jetbrains.com/fr/blog/2024/10/24/webstorm-and-rider-are-now-free-for-non-commercial-use/ https://blog.jetbrains.com/es/blog/2024/10/24/webstorm-and-rider-are-now-free-for-non-commercial-use/ https://blog.jetbrains.com/de/blog/2024/10/24/webstorm-and-rider-are-now-free-for-non-commercial-use/
What’s Next: The WebStorm 2024.3 Roadmap https://blog.jetbrains.com/webstorm/2024/09/what-s-next-the-webstorm-2024-3-roadmap/ Wed, 11 Sep 2024 13:30:20 +0000 https://blog.jetbrains.com/wp-content/uploads/2024/09/ws-2024-3-Roadmap-featured.png https://blog.jetbrains.com/?post_type=webstorm&p=509199 In August of this year, we released WebStorm 2024.2, our second major update for 2024. Thank you to everyone who is already using it and providing feedback. 

With August now behind us, we’d like to announce what we’ve got planned for the next release of WebStorm, which is scheduled for the middle of November, with our usual disclaimer: these plans are subject to change

Also, as usual, we’ll be releasing EAP builds in the run-up to this release. We encourage you to try these builds, provide feedback on the features, and report any issues you discover. At this stage, you can significantly impact the product’s development.

Our primary focus with this release is on improving the stability and quality of WebStorm and some of its subsystems. Here are our most significant plans for WebStorm 2024.3:

  • WebStorm@next TypeScript engine We’ve been working on delivering our TypeScript engine for the last year. We’re excited to announce significant performance improvements in WebStorm@next, with minimal functionality regression. If it meets our strict quality criteria by the end of the 2024.3 Early Access Program (EAP), it will be enabled by default in the release. Initially, WebStorm@next will focus on TypeScript, React, and Angular, with Vue potentially included if optimizations are completed. 
  • Database plugin We’re going to reconsider how the current Database Tools and SQL plugin license model works with WebStorm subscriptions, and try to find a more suitable solution. This plugin provides you with database tools to query, create, and manage databases and full SQL language support.
  • Tailwind CSS color preview – We’re enhancing our Tailwind integration by adding color previews, making it easier to quickly identify the colors that are applied to elements. (WEB-47817).
  • New functionality during indexing – To improve the startup experience and reduce waiting times, certain dumb functionality (WEB-64105, WEB-64106, and WEB-64107) will now be accessible during indexing.
  • Improved test framework support – Certain limitations of the current test framework support can cause test files to be misidentified. We’ll be making significant internal changes and general test framework support improvements to fix this issue (WEB-64971 and WEB-67720).
  • Enhanced Show Component Usages – We’re updating how WebStorm handles components. Template usages will now be recognized as part of the file, improving both the Show Component Usages action for Vue, Svelte, and Astro, as well as the Rename feature (WEB-65061).
  • Disable SvelteKit a11y warnings option – We’ll add a new option to disable accessibility (a11y) warnings from the Svelte Language Service (WEB-62537).
  • Monorepo project improvements We’ll make searches in monorepo projects more focused and manageable by excluding search results from node_modules in the Find in Files directory tab by default (WEB-25601).
  • Enhanced monorepo imports We’ll improve the handling of imports in monorepos to reduce the number of incorrect imports from libraries or subprojects. This will address common issues related to auto-generated output folders like dist (WEB-68309) and problems associated with the partial support for the exports field in package.json (WEB-68290).
  • Support for exports in CSS We’re adding support for the exports field in package.json for CSS files (WEB-55017).
  • .idea directory displayed by default – Historically, the .idea folder has been hidden by default. Moving forward, we’ve decided to display all files in the projects to enhance transparency (WEB-68009).
  • Improved JSX attribute experience  – We’ll no longer include the equal sign (=) for boolean JSX attributes (WEB-62632).
  • Angular template usages displayed with class usages – We’re making Angular usage tracking more intuitive. When you invoke Show Usages on an Angular class, WebStorm will now display usages from templates as well (WEB-68183).
  • Unused import inspections for Angular – We plan to introduce unused import inspections for Angular NgModule and standalone components, allowing you to reduce the number of unnecessary dependencies by identifying and removing unused imports (WEB-38266). This will also be added to version 2024.2.
  • Bundled Vue, Svelte, and Astro language servers – We plan to bundle the primary language services to enhance product reliability, prevent issues with language-server loading on WSL, and address security concerns associated with downloading language servers from the internet.

That’s all for now! Check out the 2024.3 Early Access Program to test these features as they become available!

The WebStorm team

]]>
JetBrains JavaScript Day 2024 Registration Is Now Open https://blog.jetbrains.com/webstorm/2024/08/jetbrains-javascript-day-2024-registration-is-now-open/ Mon, 26 Aug 2024 15:47:01 +0000 https://blog.jetbrains.com/wp-content/uploads/2024/08/Blog-Featured.png https://blog.jetbrains.com/?post_type=webstorm&p=505594 Hey everyone! JetBrains JavaScript Day is back for year four, and this edition promises to be our best one yet!

Let’s face it, keeping up with the rapid changes in the JavaScript ecosystem is no easy task – it can be hard for us, too. That’s exactly why we created JetBrains JavaScript Day! This year, as always, we brought together top experts to share their insights and discuss the latest trends of modern JavaScript and TypeScript development. Make sure to join us live to ask your questions and be a part of the conversation as it happens.

When: October 24 at 9:00 am EDT (check your timezone)

Where: Online

Cost: Free

Here is this year’s lineup of inspiring speakers and talks: 

  • Vite and the Future of JavaScript Tooling, by Evan You
  • TypeScript Generics: Practical Fun!, by Josh Goldberg
  • The Silent Open Source Crisis: When Maintainers Walk Away, by Bekah Hawrot Weigel
  • You Don’t Need JavaScript for That, by Kevin Powell 
  • Everything You Need to Know About React 19, by Shruti Kapoor
  • Driving Your JavaScript Library Ecosystem With Nx, by Chau Tran
  • Evolving Angular for the Long Run, by Jeremy Elbourn
  • TypeScript and Your Codebase: They Deserve Each Other!, by Danny Thompson

We’ve also added an Ask Me Anything (AMA) session with the WebStorm team to our agenda for all of you who want to meet the people behind the JavaScript support for JetBrains IDEs.

Grab your tickets today, and we’ll see you there!

Your JetBrains team

]]>
WebStorm 2024.2: Improved File-System-Based Routing Support, Bun Debugging Support, Directly Run and Debug TypeScript Files, and More https://blog.jetbrains.com/webstorm/2024/08/webstorm-2024-2/ Mon, 12 Aug 2024 17:45:29 +0000 https://blog.jetbrains.com/wp-content/uploads/2024/07/Featured_Blog_1280x720-2x-1.png https://blog.jetbrains.com/?post_type=webstorm&p=495531 Our second major release of 2024 is here! In this version, you’ll find improved file-system-based routing support, initial debugging support for Bun, the ability to run TypeScript files directly, and a whole lot more.

WebStorm 2024.2 featured banner

DOWNLOAD WEBSTORM 2024.2

If you only have a few minutes to explore the highlights of WebStorm 2024.2, check out this video, in which we give a quick review of the top three new features. If you want to dive deeper into what you can expect in the release, just carry on reading!

The new features and improvements in v2024.2 include:

  • Frameworks and Technologies: Improved file-system-based routing support, Bun debugging support, Prettier integration enabled by default, Tailwind preview in completion options, and more.
  • JavaScript and TypeScript: Directly run and debug TypeScript files, new project template with onboarding tips, and more.
  • User Experience: Support for math syntax in Markdown files, Preview option in Search Everywhere, improved Customize Main Toolbar dialog, language-specific settings for sticky lines, and more.
  • Version Control: Enhanced Log tool window, --first-parent and --no-merges options, and an improved commit graph.

Frameworks and Technologies

Improved file-system-based routing support for major frameworks

WebStorm 2024.2 introduces support for path resolving for frameworks that use file-system based routing. WebStorm can now resolve link paths based on your project’s file system, providing autocompletion, and navigation. Additionally, Next.js also includes path resolving support for dynamic, group, and parallel routes. This support ensures that your development environment keeps up with the routing scenarios these frameworks employ. The following frameworks are covered:

  • Next.js
  • Nuxt 
  • Astro
  • SvelteKit
  • Remix

Currently, the navigation is supported for the built-in components like Link, NuxtLink, and native a elements.

tab-labels

Bun debugging support

WebStorm 2024.2 now supports the Debug Adapter Protocol (DAP), which introduces debugging support for developers using the Bun JavaScript runtime. This integration allows you to set breakpoints, step through code, inspect variables, and evaluate expressions directly within WebStorm:

Please note that this support is currently only available to macOS and Linux users, but it could be rolled out to Windows users in future updates.

Prettier integration enabled by default

Starting from WebStorm 2024.2, new projects with a direct prettier dependency in their root package.json and a Prettier configuration file at the same level will have the Automatic Prettier Configuration setting enabled by default. This feature simplifies the setup process and ensures that Prettier integration is enabled out of the box.

Tailwind preview in completion options

Previously, when using Tailwind CSS, developers could only see the preview of Tailwind classes in a secondary documentation popup. Now WebStorm displays Tailwind CSS class previews directly in the completion result list, eliminating the need to enable the documentation popup for completion:

Svelte 5 snippets support

Svelte 5 is on the way, and in WebStorm 2024.2, you can already try out the new Svelte snippets and render tags. These snippets are designed to create reusable chunks of markup within your components:

Astro Language Server enabled by default

In 2024.2, we have enabled Astro Language Server Protocol (LSP) support, leading to improved code completion and overall developer experience. This enhancement ensures more accurate and efficient development when working with Astro projects, providing better integration and support within the IDE. Additionally, we have fixed several false-positive errors, further enhancing the Astro support.

You can toggle the language server in Settings | Languages & Frameworks | TypeScript | Astro.

Improvements for Vue

WebStorm 2024.2 introduces Vue Language Service 2 support. This update enhances support for Vue 3, improving autocompletion, error checking, and type inference. Enjoy a smoother development experience powered by the most recent version of Vue language tools and built-in WebStorm support. There are also important fixes for auto-imports of Vue 3 components.

JavaScript and TypeScript

Directly run and debug TypeScript files 

WebStorm 2024.2 provides the ability to run and debug TypeScript files directly within the IDE without any additional setup, utilizing the integrated tsx loader.

You can now execute TypeScript files from different entry points, including the file context menu, the Run widget, and the Current file configuration. The bundled loader eliminates the need for extra dependencies, though it does come with some limitations, such as requiring Node 18 or higher, no type-checking, and limited support for tsconfig.json. You can disable the bundled loader via the configuration settings if it’s not needed.

tab-labels

New project template with onboarding tips

WebStorm 2024.2 enhances the New Project Wizard by adding a new option to create basic JavaScript and TypeScript projects. This feature is designed to simplify onboarding for new users, providing an easy way to set up a project with minimal configuration. Users can select JavaScript or TypeScript directly from the wizard.

The generated projects include essential files like package.json and either index.js or index.ts, with a welcoming console log message. For TypeScript projects, a tsconfig.json file is also included to set up compiler options. The Generate playground project with onboarding tips option includes helpful tip comments, ensuring a smooth start with the IDE. Projects generated with this option are based on the Vite template and contain an example web application:

Reworked inlay hints in TypeScript files

We’ve reworked inlay hints in TypeScript to better align with the information provided by the TypeScript service. Inlay hints are retrieved only for the currently visible screen and the screens immediately above and below it (though this can be configured in the settings). This may cause hints to appear gradually when scrolling quickly, and you might notice that previously rendered hints are re-rendered when you scroll back. This behavior is expected and designed to optimize performance.

User Experience

Support for math syntax in Markdown files

WebStorm can now natively render mathematical expressions in Markdown files. In WebStorm 2024.2, you can use $ to insert inline math expressions and $$ for code blocks containing math content.

Preview option in Search Everywhere

The Search Everywhere dialog now includes an option to preview the codebase elements you’re searching for. You can enable the preview through the icon on the dialog’s toolbar:

tab-labels

Improved Customize Main Toolbar dialog

We’ve redesigned the layout and behavior of the UI elements in the Customize Main Toolbar dialog, making it more intuitive and organized. Now, it’s easier to search for, add, and delete actions in the main toolbar.

Language-specific settings for sticky lines 

You can now set sticky lines more precisely and choose the languages for which you want them to appear. You can tailor the feature to your preferences either in Settings | Editor | General | Sticky Lines or by calling the context menu with a right-click on a sticky line in the editor.

JetBrains Runtime 21 and Wayland support

With WebStorm 2024.2, we’re transitioning from JetBrains Runtime 17 (JBR17) to JetBrains Runtime 21 (JBR21). Starting with WebStorm 2024.2, all updates will come with JBR21, offering enhanced security and performance and Wayland rendering support for Linux. See the following blog post for more details.

New UI enabled by default for all users

We are happy to announce that we will enable the new UI for all JetBrains IDE users in the upcoming 2024.2 version. We designed the new UI to reduce visual clutter, ensuring easy access to essential features while gradually revealing more advanced functionality as needed. The new UI is clean and modern, providing bigger, easier-to-use controls, a consistent color palette, light and legible icons, increased contrast, and better accents. For more information about this change, please read this blog post.

If you prefer the classic UI, you can still use it by installing the corresponding plugin, which is available from JetBrains Marketplace.

Improvements to AI Assistant

JetBrains AI Assistant 2024.2 introduces enhanced code completion with more accurate and faster suggestions. The AI chat now supports GPT-4o, chat references, and semantic search for better context understanding. New features include AI integration in the Terminal for command generation, AI-assisted VCS conflict resolution, and customizable prompts for documentation and unit test creation. For more information, please see this blog post.

Version Control Systems

Enhanced Log tool window

All settings related to the Log tool window are now consolidated into a dedicated settings page, making it easy to customize its behavior in one convenient location. You can access this page through Settings | Version Control | Log or via a new dropdown menu on the Log tool window’s toolbar:

--first-parent and --no-merges options support in the Git log UI

Git has a useful option for viewing the history of changes in a branch: –first-parent. This option simplifies the log by hiding individual commits that came with the merge, making it easier to track changes. We’ve also added filtering with the –no-merges command, which displays the history without any merge commits.
Both options can be selected under the Graph Options button in the Git tool window.

Improved commit graph in the Log tab

To improve the visual perception of the commit graph in the Log tab of the Git tool window, we’ve refined the color encoding and layout of branch lines. Important branch lines now consistently remain on the left-hand side of the graph and retain their designated colors, making them easier to identify and follow.

Previously, commits from important branches were sometimes not correctly laid out or colored because their heads were contained within less important branches. This update ensures that important branches are always clearly visible and consistently colored.

Other notable changes

JavaScript, TypeScript, Markup, and style sheet languages

  • We’ve fixed the issue causing WebStorm to not update JavaScript import paths after moving a directory (WEB-64879).
  • We’ve fixed the issue in Typescript/tsx, causing code completion to not honor overrides via module augmentation (WEB-59986).
  • We’ve fixed auto-completion for Tailwind CSS classes when using a remote Node.js interpreter (Docker/SSH) (WEB-53172).
  • We’ve introduced a highlighting category for ${ and } tokens in template literals for JavaScript and TypeScript files, including template literal types in TypeScript (WEB-35578).

Frameworks and technologies

  • We’ve fixed the issue causing problems applying auto-import in multi-caret mode (WEB-41699).
  • .cjs, .cts, .mjs, and .mts file extensions were added to Run for files by default for ESLint Prettier (WEB-60181).
  • We’ve fixed a long-standing issue with Vite packages not being found when using Yarn 3.5+ and PNP mode (WEB-61405).

User experience

  • We’ve added a feature that provides an in-editor notification to suggest downloading the Node.js interpreter (if it’s not detected) when you’re working with JavaScript, TypeScript, and web framework files (WEB-48436).

There are lots of new features and enhancements to try out in this latest WebStorm release. If you’d like a list of everything included in WebStorm 2024.2, please check out the release notes. We hope you enjoy this release. As always, please share your feedback with us and report any issues you find to our issue tracker.

The WebStorm team

]]>
How to Learn JavaScript: Your Step-by-Step Guide for Beginners https://blog.jetbrains.com/webstorm/2024/07/how-to-learn-javascript/ Fri, 19 Jul 2024 13:24:33 +0000 https://blog.jetbrains.com/wp-content/uploads/2024/07/ws-Learn-JS-featured.png https://blog.jetbrains.com/?post_type=webstorm&p=494817 Learning is a never-ending journey, or at least it should be. It can be frustrating starting learning to program, and becoming really good at it is even more challenging. However, learning a skill that others may not have the patience to acquire is what makes coders so inherently unique. In this blog post, we’ll look at some of the best strategies and resources available for learning programming with JavaScript if you don’t have any previous programming experience.

Why learn JavaScript?

There are lots of programming languages out there, each with its own unique approach and advantages for learning:

  • If you want to challenge yourself with something that’s difficult to master – C
  • If you want a really high-paying job – Java
  • If you want to work in a startup – Ruby
  • If you want an all-round language that’s easy to learn – Python

But if you want all the above… JavaScript is the obvious choice. There are several advantages to starting your learning journey with JavaScript. First, its straightforward syntax makes it ideal for beginners, but it isn’t just a beginner language – its versatility is practically endless. It drives web frontends but can also support backend development. The immediate feedback you get from developing frontends keeps the learning process engaging and rewarding due to its visual nature. 


Additionally, JavaScript is highly sought after in the tech industry. According to the 2023 Developer Ecosystem Survey, JavaScript has been the most commonly used programming language for the seventh consecutive year, with over 61% of developers using it regularly. This consistent demand translates into abundant job opportunities, making JavaScript a great choice for anyone entering the field of programming. Another benefit worth mentioning is that JavaScript runs everywhere, so knowing it means you can write everything from backend and frontend to IoT and mobile apps.

JavaScript learning path

To learn JavaScript effectively, you’ll need to touch upon each of the different concepts that make up the language. If you are looking for a step-by-step roadmap to guide you through this process, there are some incredible roadmaps available on Roadmap.sh that will help make sure you don’t miss anything important along the way. Later in this blog post, we’ll cover other resources, such as course and book recommendations.

This is how it is organized. The original has links to the resources for each topic and lets you track your progress.

Learn the fundamentals

The fundamental skills you’ll need to learn to code effectively with JavaScript are as follows:

  • Basic syntax: Ever wondered why developers start out with a “Hello, World!” program? They do it because it demonstrates the syntax of a language firsthand. 

// the hello world program

console.log('Hello World');

  • Variables: Variables are used to hold data values. It is foundational for everything else. How to declare and initialize variables using the keywords let, const, and var
  • Data types: JavaScript offers several data types, including the primitive types string, number, boolean, null, undefined, and object. 
  • Type casting: Everything in JavaScript is a string. Being able to cast them to a type explicitly can save you a world of trouble.
  • Data structures: At some point, you’ll need to store your data in a way that allows you to efficiently access and modify it. You should know how to create and manipulate arrays.
  • Control flow: The order in which statements are executed is referred to as the “control flow”. In JavaScript, you have switch statements, for and while loops, if-else statements, and others available to you.
  • Loops: There are different types of loops for different purposes – learn them all, and you’ll be unstoppable. Unlike your loops, hopefully, as otherwise, you’ll never hear the end of it.
  • Expressions and operators: JavaScript expressions and operators include assignment, comparison, arithmetic, logical, string, ternary, and more. At a high level, an expression is a valid unit of code that resolves to a value. 
  • Functions and methods: Functions are pieces of code written to perform a particular task. They’re typically created so you can reuse them and invoke them from anywhere in your code when needed.

Learn intermediate concepts

Once you have the fundamentals down, it’s time to move on to some more advanced concepts within the language. You’ll want to make sure you understand the following:

  • Strict mode: There’s a restricted variant of JavaScript you can opt in to. It has different semantics to regular JavaScript code and will throw errors that would otherwise be silent. 
  • The this keyword: The this keyword is an important concept that you’ll need to wrap your head around in JavaScript. It refers to an object, but it will refer to different objects depending on how it’s used. 
  • Asynchronous programming: Asynchronous programming enables programs to start tasks while still remaining responsive to other events, rather than having to wait for tasks to be finished. 
  • Working with APIs: APIs can take your projects to the next level by adding incredible functionality. Sooner or later, you’ll need to learn how to interact with them.
  • Classes: Classes are a template for creating objects. They encapsulate data with code to work on that data. The class construct introduces new features which are useful for object-oriented programming.
  • Version control: You’ll need a basic understanding of Git and version control. Unless you’re an adrenaline junkie, that is.
  • Debugging: When things don’t work, you’ll need to get into the code and figure out how to troubleshoot what’s gone wrong – otherwise known as debugging.

Become an expert

If you want to make a career out of JavaScript development, then you’ll need to continue to learn and grow as a developer. JavaScript will take years to master completely, but there are things you can do to make sure you continue to grow in this field.

Learn frameworks and libraries: Now you can develop with JavaScript. The next step to becoming an expert is to add another layer on top by using a framework like React, Angular, or Vue. These are currently the most popular frameworks for JavaScript.

Stay up to date: The JavaScript ecosystem is evolving, and although not quite as rapidly as it once was, you’ll need to keep up with the changes in order for your code to run smoothly. There are some great resources you can follow to make sure you stay up to date and at the top of your game when it comes to JavaScript.

Newsletters:

  • JavaScript Weekly: This newsletter is sent out once a week or so and covers everything from the latest developments in the ecosystem to interesting blog posts from the community. 
  • Bytes: This hilarious newsletter features news from across the JavaScript ecosystem.

Surveys:

  • JavaScript Rising Stars: This annual survey can help you get a good overview of the JavaScript landscape and what other people in the community are doing.
  • The State of Developer Ecosystem Survey: This is an annual report that looks at how the development landscape is changing year after year.
  • State of JavaScript: This is another annual survey – one that can help you understand the JavaScript landscape. 
  • Stack Overflow Developer Survey: This is one of the largest annual developer surveys conducted. It can be a great resource for keeping up with the latest trends and best practices in development.
  • Practice problem solving: Practice makes perfect when it comes to learning JavaScript. There are several ways you can practice. One great way to practice, though, is to solve problems.
  • LeetCode provides great algorithmic problems to help you develop your problem-solving skills. There are also interview-type questions to help you prepare for stressful job interview scenarios and coding competitions if you need that extra boost of adrenaline.
  • HackerRank offers various challenges, including programming problems, algorithms, and data structures. The problems are categorized based on difficulty, programming language, and domain.
  • Codewars is a coding challenge site that focuses on creative coding problem-solving. The problems are categorized based on difficulty, programming language, and domain. It’s community-driven and very interactive.

Start developing projects

The only way to truly learn and understand something is through practice. Otherwise, you run the risk of getting stuck in the dreaded “tutorial hell”. Working through the process, making mistakes, and realizing you don’t know what you don’t know is pivotal to becoming a good programmer. Here are some project ideas you can develop from scratch. 

Project one: a personal portfolio website

A great first project to put time and effort into is creating a website for yourself. This doesn’t, however, mean modifying a WordPress template and hosting it on a web server somewhere. Creating your own website from scratch provides you with the opportunity to familiarize yourself with different concepts, which will prove to be an invaluable experience later down the line.

Level 1 Level 2 Level 3 Level 4 Level 5 Final challenge
A one-page website A contact form A blog A basic chatbot A login authenticator A 3D portfolio website

Project two: a game

Creating a game will help you familiarize yourself with algorithms, common game code, inputs, and outputs. As you develop increasingly complicated games, you’ll also get a feel for data structures, events, and storing states. All while getting to play your favorite games… purely for testing purposes, right?

Level 1 Level 2 Level 3 Level 4 Level 5 Final challenge
Rock, paper, scissors game Rock, paper, scissors, lizard, Spock Wordle game Connect four Battleships game Chess game

Project three: a useful app

The best thing about coding is you can solve your own problems – and if other people maybe have similar problems, then they might pay you for a solution, too.

Level 1 Level 2 Level 3 Level 4 Level 5 Final challenge
Todo app Password generator Calculator Pomodoro timer Finance tracking app Kanban task management app

Project four: real-world websites and apps

Chances are you’re going to want to get a job – so you can make money with your new skill set. What better way to prepare for the job than by creating a website similar to the one you’ll be maintaining, so you can hit the floor running?

Level 1 Level 2 Level 3 Level 4 Level 5 Final challenge
News curation website Job website Twitter(X) app E-commerce site Video streaming app Social media platform

Resources for learning JavaScript

There are thousands of resources available to teach you everything you need to know to become proficient with JavaScript. Unfortunately, we cannot cover them all. Nevertheless, below, we’ve prepared a list of some of our favorites, which we like mainly because they are some of the most complete and usually include some form of project-based practice. If you have any course recommendations of your own, please feel free to post them in the comments, along with your own review of what makes them so good.

Online platforms for learning JavaScript

Hyperskill – Paid

This hands-on platform offers over 300 real-world projects created by JetBrains Academy experts, allowing you to build your developer portfolio from scratch. You are introduced to the theory and then get the chance to put it into practice, all while being tested on your understanding of the concepts and receiving immediate feedback on your code.

One big benefit of the platform is that you learn not only programming but also how to use essential development tools like IDEs – must-know technologies for a career in development.

The path we would recommend to get you job-ready would be the following:

  1. Introduction to JavaScript
  2. Frontend Developer
  3. Introduction to Node.js
  4. Introduction to React or Introduction to Vue.js

Frontend Masters – Paid (free JavaScript bootcamp)

The Frontend Masters platform has hundreds of courses to take you through your learning journey, covering everything from the basics to very advanced technologies – and with a subscription, you get access to all of them. But for now, let’s focus on getting started with JavaScript. And to help you do exactly that, they have a really cool and totally free Front-End Development Bootcamp consisting of over 20 hours of enthralling content.

The path they recommend is their JavaScript learning path.

Codecademy – Paid (free JavaScript courses)

Codecademy offers interactive, hands-on coding exercises that guide you through writing code directly in the browser. The platform provides well-structured courses on a variety of web development topics, from HTML and CSS to JavaScript and full-stack development. The courses also include projects and quizzes to reinforce learning and help you apply what you’ve learned. There’s even a free introductory course for JavaScript to get you started.


The recommended path to get career-ready would be the Front-End Engineer career path.

Udemy – Paid
The Udemy platform hosts various courses from instructors worldwide on topics ranging from web design to data science. It enables instructors to create and sell courses while providing learners with access to thousands of courses. 

JavaScript course recommendations on Udemy include:

  1. The Complete JavaScript Course 2024: From Zero to Expert! is highly recommended. You can come out of this course ready to develop JavaScript professionally. At over 68 hours long, it covers everything from the very fundamentals of using JavaScript right the way through to building modern applications. It has some nice examples, covers the theory, and walks you through making real projects of your own.
  2. The Modern JavaScript Bootcamp Course is a practical course that cuts through all the unnecessary noise, giving you just the facts – in plain and easy-to-understand terms. With this course, you won’t work with outdated frameworks, learn old styles of programming, or build boring apps. Instead, you’ll spend all your time writing practical code that can be used today and in the future on your own projects. 
  3. The Complete Web Developer Course 3.0 is a comprehensive course that will take you from zero to competent in 20+ hours. It covers the full stack, including Python, meaning it doesn’t just focus on JavaScript. If you’re specifically looking for a course to help you become a web developer, this is one for you.

Free online resources for learning JavaScript

This free resource is packed with information. It isn’t technically a course but rather a collection of resources. It can provide all the knowledge you need to learn JavaScript. If you’re looking for a free option to help support your self-learning, this is an incredible resource. 

This free resource offers a wide range of courses and is quite incredible. It has over 10,000 tutorials across several languages and technologies. They also have a nice introductory course for JavaScript, which is project-led.

This is a complete repository of everything from JavaScript basics to advanced topics, supported with detailed explanations. If you ever feel stuck understanding a concept, this is a great place to get unstuck. If you like reading, you can essentially teach yourself everything you need using this resource.

This platform provides access to hundreds of step-by-step tutorials, with lots of places to test your understanding and try the code yourself. It offers a simplified and interactive learning experience with simple code examples and illustrations of how to apply the concepts in real-world scenarios.

If you’re interested in computer science in general, a great introductory course is Harvard University’s CS50 course. CS50’s Web Programming with Python and JavaScript builds on this foundation with a focus on web programming specifically. Though neither are JavaScript-specific, they’re still very, very good courses that you can take for free. The assignments, in particular, can help you solidify your understanding and practice your coding.

JavaScript YouTube tutorials

There are lots of content creators on YouTube who have created introductory courses for JavaScript. Check out these great options:

If you’re looking for a quick crash course in JavaScript development, this is a great beginner tutorial that covers the essentials and gives you a good understanding of the core concepts of JavaScript development. Though it isn’t technically a full course, it’s great for getting started and familiarizing yourself with the language.

This crash course from Traversy Media is a great place to start. It covers the fundamentals of JavaScript, including more modern syntax like classes, arrow functions, etc. It’s the first in a series of videos and is easy to follow, helping you learn the basic syntax and fundamentals.

This series from Net Ninja consists of six video lessons on the fundamentals of modern JavaScript. Although it has been around for a while, it’s definitely worth checking out if you’re looking for a series that explains the basics.

JavaScript books for beginners

If you prefer to sit down with a book and dive into the details, you’re not alone. Books offer a lot of benefits for learners and usually allow for a deeper dig into the subject. Here’s a collection of books you can use to learn JavaScript programming:

Head First JavaScript Programming is designed to make learning JavaScript fun and accessible, even for anyone with little to no programming experience. One of its key strengths is its emphasis on active learning. Rather than simply reading about JavaScript, you’re encouraged to work through problems, think critically, and experiment with code. This hands-on approach helps to solidify understanding and improve retention. There are also plenty of practical examples and projects, ensuring that you can see how JavaScript is applied in real-world scenarios. Its unique approach to teaching makes it stand out among other programming books, ensuring that readers not only learn JavaScript but also enjoy the process.

JavaScript: The Definitive Guide covers the full spectrum of JavaScript, from basic syntax and programming fundamentals to advanced topics like closures, asynchronous programming, and the intricacies of the JavaScript runtime environment. Each chapter is meticulously crafted to provide clear explanations, backed by numerous examples and practical code snippets. What sets this book apart is its depth and precision. While it can serve as a beginner’s guide, its thoroughness, and complexity make it particularly well-suited for those looking to deepen their understanding and master the language.

Eloquent JavaScript is structured in a way that encourages you to actively engage with the content through exercises and projects, reinforcing their understanding through practical application. Its focus on both theoretical and practical aspects ensures that readers not only learn how to write JavaScript but also understand the underlying concepts, making it a valuable addition to any programmer’s library. This book is also available online for free!

This is a series of books that explores the core mechanisms and intricacies of JavaScript. Unlike many introductory programming books, this series is aimed at developers who want to go beyond the basics and gain a thorough understanding of the language. Each book tackles different aspects of JavaScript, from its foundational principles to more advanced topics. You can find a free version of the book in Kyle’s GitHub repository.

Technology-specific courses

Though most of the resources recommended here often do include introductions to JavaScript frameworks or the technologies you’ll need as a developer, here are some other resources that you may want to check out.

Learn React

This free course from the University of Helsinki will build on your knowledge and introduce you to modern JavaScript-based web development with React. It can help you build React, Redux, Node.js, MongoDB, GraphQL, and TypeScript knowledge.

If you enjoy a really interactive learning experience, then this might be perfect for you. It has video, quizzes, and a stunning UI – what more could you ask for? 

Learn Angular

Angular has a great introductory tutorial that covers the basic principles of Angular. It is pretty famous within the community for people learning Angular.

In this course, you’ll learn everything you need to get started writing applications with Angular. It starts at the very beginning: you’ll install the Angular command-line tools and then create a new project.

Learn Vue

This resource includes courses, tutorials, and lessons from the Vue core team, including Evan You, the creator of the framework. It has a comprehensive learning path you can follow to make sure you are Vue-ready when the time comes. 

This is another great resource for learning Vue again with courses from some of the Vue Core team. This resource covers some advanced topics, and there are different tracks you can choose from depending on your level.

Learn Git

An interactive introduction to the fundamentals of version control. 

Another highly recommended introductory course, which covers all the fundamentals.

References to bookmark

Here are some important references you may want to bookmark. They may come in handy during your learning journey.

  • MDN (Mozilla Developer Network) is an essential resource for web developers, offering a vast array of documentation, tutorials, and references that cover all aspects of web development. Its reliability, comprehensiveness, and regular updates make it an invaluable tool for both learning and reference. 
  • Stack Overflow is a question-and-answer site where developers can ask questions and get answers from the community. It’s invaluable for troubleshooting specific issues and learning from others’ experiences.
  • W3C (World Wide Web Consortium) develops standards and guidelines to help everyone build for the web based on the principles of accessibility, internationalization, privacy, and security. If you’re ever unsure about how to build your app or site for accessibility, start here.

Learning principles

Learning new things can seem daunting and overwhelming. However, using a variety of learning techniques to enhance learning efficiency and effectiveness can help improve your odds of success.

Good learning techniques:

  • Take breaks: Focused learning is hard – for every 25 minutes of study, take a five-minute break.
  • Regular revision: After you finish learning a concept, take 30 seconds to try to recall all the main points.
  • Spaced repetition: Come back to concepts every so often to reinforce them.
  • Build an association: Linking the concepts to other subjects will help with recalling them. You can do this by using interesting code examples that resonate with you. 
  • Use multiple sources: Different examples and explanations of a concept aid understanding.
  • Try and solve problems: Apply what you’ve learned in real-life situations.
  • Get feedback: Test your understanding – you’ll learn from getting it wrong.
  • Explain what you’ve learned: Put what you’ve learned into your own words.
  • Learn before bedtime: Your brain will continue to go over the information and cement it.

Learning pitfalls:

  • Don’t just look at the solution: You have to go through the process of solving the problem yourself.
  • Don’t solve the same problems: Once you know how to comfortably solve it, move on.
  • Don’t add distractions: Study time should just be for studying. Focus.
  • Don’t study passively: You need to be engaged, or it won’t stick.
  • Don’t think you’ll learn it in one go: You won’t.

Conclusion

That’s it for today! Learning something new is an infinitely rewarding pursuit. With the right attitude and resources, there’s nothing you can’t learn – it just takes time. If you’re frustrated that you can’t create the next Amazon or Netflix competitor after taking a four-hour course, don’t worry – we’ve all been there. The only way to get better is to practice and code: try, fail, learn, and repeat. You’ll get the biggest gains by applying the code, so even once you have been through a course and learned the basics, it’s time to start applying this knowledge. This is where you’re going to get good – actually, not good – great! 

Happy developing!

]]>
https://blog.jetbrains.com/ko/webstorm/2024/07/how-to-learn-javascript/
Connect With Our Developer Advocate: WebStorm Open Hours https://blog.jetbrains.com/webstorm/2024/07/connect-with-our-developer-advocate-webstorm-open-hours/ Wed, 17 Jul 2024 13:48:37 +0000 https://blog.jetbrains.com/wp-content/uploads/2024/07/ws-social-featured_blog_1280x720_en-1.png https://blog.jetbrains.com/?post_type=webstorm&p=494649 Hello everyone!
My name is Jan-Niklas. Some of you may already know me from WebStorm, as I am the Developer Advocate for JavaScript and TypeScript at JetBrains. I’m excited to share some news with you today—I’m trying something new and opening up my calendar to you! Whether you’re a long-time user of JetBrains tools or just starting to explore them, I’m here to chat, share insights, and learn more about your experiences with the products.

As a developer advocate for JavaScript and TypeScript at JetBrains, I have the privilege of working with some of the best tools in the industry and exploring the different frameworks and libraries that are available. From WebStorm and Node.js to Angular, Tailwind, and RxJS, there’s always something new and exciting to discuss. That’s exactly why I’d like to experiment with opening up my calendar – because I believe the best ideas and solutions come from engaging conversations. I want to better understand your struggles and help you overcome them.

Why am I doing this?

I want to hear from you! Whether you have questions about JetBrains tools, need advice on your next big project, or just want to geek out about the latest in web development, I’m here and ready to chat. This is also a great opportunity for me to gain new perspectives and understand how different developers are using these tools in their day-to-day work.

What can we talk about?

  • JetBrains tools: Do you have feedback or questions about WebStorm, IntelliJ IDEA, PyCharm, or any other JetBrains product? I’d love to hear your thoughts!
  • JavaScript and TypeScript: We can dive deep into your code, discuss best practices, and explore new features.
  • Web development: From development with frameworks like Angular to structuring code in mono repositories, I’m here to discuss anything that enhances your development workflow.
  • Open topics: Do you have something else on your mind? Let’s chat about it! I’m always open to talking about exciting new topics.

How to book a slot?

It’s simple! Just click here to access my calendar and book a time that works for you. I look forward to chatting and can’t wait to see what we can learn from each other.

Please note that this will be experimental for now. Though I hope it is a success, let’s see how it goes. If it works out great! If not, then we’ll see if there is something else we can do. But either way, I am looking forward to meeting you.

Thank you for being an amazing community. Let’s make the most of this opportunity to connect, share, and grow together.

Jan-Niklas Wortmann
Developer Advocate, JetBrains

]]>
WebStorm 2024.2 EAP Digest #3: Bun Debugger, Language Server Updates for Vue and Astro, and Prettier Integration by Default https://blog.jetbrains.com/webstorm/2024/07/webstorm-2024-2-eap3/ Mon, 15 Jul 2024 15:16:32 +0000 https://blog.jetbrains.com/wp-content/uploads/2024/05/ws-2024-2-EAP-Features.png https://blog.jetbrains.com/?post_type=webstorm&p=493634 It’s time for our last EAP digest of this release that will walk you through the new features and improvements in WebStorm 2024.2! For more information, check out our previous blog posts.The Toolbox App is the easiest way to get the EAP builds and keep both your stable and EAP versions up to date. You can also manually download the EAP builds from our website.

DOWNLOAD WEBSTORM 2024.2 EAP

Important! WebStorm EAP builds are not fully tested and might be unstable.Please try the latest EAP build and share your feedback with us. You can do so using our issue tracker or by leaving a comment on this blog post.

Key highlights

Bun debugging support

WebStorm 2024.2 now supports the Debug Adapter Protocol (DAP), introducing the debugging experience for developers using the Bun JavaScript runtime. This integration allows you to set breakpoints, step through code, inspect variables, and evaluate expressions directly within WebStorm:

Currently, we’re providing initial support and gathering your feedback. This functionality is available only for macOS and Linux users. Windows support is targeted for one of the upcoming minor releases; please track the following issue: WEB-67975.

Improved file-system based routing support for major frameworks

WebStorm 2024.2 introduces support for path resolving for frameworks that use file-system based routing. WebStorm can now resolve link paths based on your project’s file system, providing autocompletion, and navigation. Additionally, Next.js also includes path resolving support for dynamic and nested routes. This support ensures that your development environment keeps up with the routing scenarios these frameworks employ. The following frameworks are covered:

  • Next.js
  • Nuxt 
  • Astro
  • Svelte

Currently, the navigation is supported for the built-in components like Link, NuxtLink, and native a elements.

tab-labels

The Astro Language Server is enabled by default

In the 2024.2 EAPs, we’ve enabled Astro Language Server Protocol (LSP) support, leading to improved code completion and a better overall developer experience. This enhancement ensures more accurate and efficient development when working with Astro projects, providing better integration and support within the IDE. Additionally, we’ve fixed several false-positive errors, further enhancing the Astro support.

You can toggle the language server in Settings | Languages & Frameworks | TypeScript | Astro.

Language Services icons in status bar

The EAP 7 of WebStorm introduces a visual enhancement to the Language Services status bar widget. Now, instead of the Language Services static label, you can see icons representing the active language services like ESLint, Tailwind, and TypeScript, which are running on the current file:

Prettier integration is enabled by default

Starting from EAP 6, new projects with a direct prettier dependency in their root package.json and a Prettier configuration file at the same level will have the Automatic Prettier Configuration setting enabled by default. This feature simplifies the setup process, ensuring that Prettier integration is enabled out of the box.

For those working with monorepos, a separate issue (WEB-67396) is being addressed to support similar functionality across multiple packages within a single repository. 

New project template with onboarding tips

WebStorm EAP 8 enhances the New Project Wizard by adding a new option to create basic JavaScript and TypeScript projects. This feature is designed to simplify onboarding for new users, providing an easy way to set up a project with minimal configuration. Users can select JavaScript or TypeScript directly from the wizard.

The generated projects include essential files like package.json and either index.js or index.ts, with a welcoming console log message. For TypeScript projects, a tsconfig.json file is also included to set up compiler options. The Generate a playground project with onboarding tips option includes helpful TIP comments ensuring a smooth start with the IDE. Projects that are generated with this option are based on the Vite template and contains an example web application:

Extract Vue component AI Action

The new feature, available with the AI Assistant plugin enabled, allows you to extract a Vue component from an existing template area. Open a Vue file, select a section of the template (excluding the template tag), and invoke the AI Actions | Extract Component intention. This opens two diff editors: one for the new component’s generated code and another for the changes in the existing component. After accepting the modifications, the new component is saved with a name suggested by the AI and integrated into the original component:

tab-labels

Language-specific settings for sticky lines 

You can now set sticky lines more precisely and choose the languages you want them to appear for. You can tailor the feature to your preferences either in Settings | Editor | General | Sticky Lines or by calling the context menu by right-clicking on a sticky line in the editor:

Tailwind preview in completion options

Previously, when using Tailwind CSS, developers could only see the preview of Tailwind classes in a secondary documentation popup. Now WebStorm displays Tailwind CSS class previews directly in the completion result list, eliminating the need to enable the documentation popup for completion:

Vue Language Tools 2.0

The 2024.2 EAPs introduce Vue Language Tools 2.0 support. This update enhances support for Vue 3, improving autocompletion, error checking, and type inference. Enjoy a smoother development experience powered by the most recent version of Vue language tools and built-in WebStorm support.

Other highlights

  • We’ve introduced a highlighting category for ${ and } tokens in template literals for JavaScript and TypeScript files, including template literal types in TypeScript (WEB-35578).
  • .cjs, .cts, .mjs, .mts file extensions were added to Run for files by default for ESLint Prettier (WEB-60181).
  • We’ve supported autocompletion for CSS classes inside object properties in React.js when using the classnames library (WEB-57054).
  • The IDE now suggests downloading the Node.js interpreter (if it’s not detected) via an in-editor notification for JavaScript, TypeScript, and web framework files (WEB-48436).
  • We’ve fixed a long-standing WEB-61405 issue (Vite package not found when using Yarn 3.5+ and PNP mode).

That’s it for today. For the full list of improvements available in the latest EAP build, check out the release notes.

The WebStorm team

]]>