dinbtechit / jetbrains-nestjs

NestJS CLI and IntelliSense
https://plugins.jetbrains.com/plugin/22771-nestjs
BSD 2-Clause "Simplified" License
4 stars 0 forks source link

[Feature] - Improve navigation between command usage and handler implementation for CQRS projects #1

Open dinbtechit opened 1 year ago

dinbtechit commented 1 year ago

@SylvainMarty Thank you for reporting this feature request in KartanHQ/intellij-nestjs/ repo . I'm launching a NestJS plugin. I'm planning to include this functionality into this plugin. Unfortunately, the maintainer of KartanHQ/intellij-nestjs/ repository does not have enough bandwidth to add more features or accept PRs at this time.


Is your feature request related to a problem? Please describe.

We use CQRS (@nestjs/cqrs) extensively in our NestJS monorepo project and many of our developers complains about navigation between CQRS files being not very efficient nor natural.

The main complaint was how slow it was to navigate from the usage of Command/Query to the dedicated Handler which does the work under the hood.

Here is an "example" of the problem:

// 1. The dev see this code somwhere:
const command = new MyCommand();
await this.commandBus.execute(command);

// 2. The dev wants to go to the handler which implement the command logic
// First, it needs to do "Go to implementation" (Ctrl + B) to see the command class definition
// Then it needs to "Go to Declaration and usage" (Ctrl + B) to see all the usages and select the one which relates to the handler
Since our code is mostly CQRS implementations, this mechanic needs to happen a lot of time and is not very efficient.

Aside that, we really like CQRS, we just want to be more efficient using it. :-)

Describe the solution you'd like

I'm not sure what the best solution would be but I was thinking that it would be easier to have a shortcut/option to go to the implementation of a command (aka its handler). I think it may be possible to get this information since all commands are references by its handler in the @CommandHandler(MyCommand) annotation.

Describe alternatives you've considered

I searched online to see if there were any plugins or shortcut in Intellij based IDE to achieve this but so far, I only found a feature specific to Resharper: Resharper > Navigate To > Consuming APIs. Sadly this feature is not present on our IDE (PHPStorm).

Additional context

I never developed plugins for Intellij but I have experience in Java/Kotlin and I'm interested in submitting a PR if you think it can be handled by this plugin. 😃

dinbtechit commented 8 months ago

Scheduled for v0.0.3