nx-console
nx-console copied to clipboard
[IntelliJ] SearchEverywhereContributor for projects and targets
Description
Nx Console currently uses a SearchEverywhereContributor only for generators, it appears.
~~Although I'm not able to verify if it's working or not, as no results for the Nx group appear.~~
I'd like to have a contributor also for projects, and targets.
What I find myself looking for frequently is a mix of project + project target, with or without partial names.
The typical query is
my-project-name my-target-name // full match
my-proj my-target- // partial match
my-target-name // only target name
Ideally the contributor would spawn its own Nx tab (isShownInSeparateTab()) to filter down results, and split those results by category: Nx projects, Nx targets.
It's a great idea, I like it! I don't have the time to work on this at the moment but I'd love to help out with a contribution if you're willing. Otherwise let's see when I get to this.
No worries. I'll play around with it on the weekend possibly.
Could you point out what's the entry point(s) to read the workspace projects?
I suppose we could then extract targets from said project models.
for sure! You can use NxlsService.getInstance(project).workspace() to get all information about the workspace, which includes projects and their targets. You'll have to filter that down.
As inspiration, have a look at the apps/intellij/src/main/kotlin/dev/nx/console/generate/NxGeneratorSearchEverywhereContributorFactory.kt class. As you've noticed, it doesn't quite work as expected right now, though.
Still, what you will have to do will probably be similar.
Looking forward to what you cook up and I'm here to help out :)
I've coded a prototype, however I'm trying to understand why a separate tab doesn't show the items.
Debugging the underlying SE code is pretty much mission impossible.
hmmm are you sure you want to add a separate tab there? It seems like a noisy addition... and the search everywhere does it job just fine, right?
@MaxKless the problem arises when the amount of projects is decently large.
The All tab is ok when your search term is focused, but otherwise search results might get lost there.
There is also the question of item priority: should Nx items be prioritized over the rest?
Then again that tab becomes unusable when looking for other things.
Btw, the additional tab can be configurable, so I guess it's not a big deal.
yeah okay. I would make the extra tab off by default and opt-in in the settings, maybe.
The other search everywhere are triggered by a specific keyword like nx run... maybe something similar could work here? Because when ppl type nx run it's fine that the search results are completely overtaken. What do you think?