-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show project description in project list #2386
Comments
Just to check I'm understanding this correctly: You need the project descriptions in order to differentiate your projects at a glance? |
Thanks for your reply. This is an example of what we have inside the In the real case we have a lot of this projects and we would like to see the description directly in the list, maybe with a lighter font, and only optionally. I agree that PDV would be a more natural place, but we should click on each project to see its description. |
I see what you mean now. Honestly, I think this is quite a niche use-case and I don't think it's a good idea to increase the complexity & configuration surface area of nx console for this. |
Thanks, It sounds interesting. Will this allow us to modify only the PDV or also the list of projects? |
This would allow you to modify the list of projects. No worries if you don't have much time to spend on it. I might do it when I find the time for it but no idea when that will be.
We would need a new type of plugin called ProjectsViewProcessor or the like.
Then, when constructing the project tree, we'd have to load that plugin and pass our workspace data through it before rendering, somewhere here:
It's not trivial but definitely doable :) Let me know if you start working on it or have any further questions |
I took a look and I think I have a pretty clear idea of how it all works. I was thinking about something like this: add the
I guess we would also need to add the following line here:
this.description = item.description I think it should work even if My only question is how to pass the I don't know if there are some edge cases that I didn't consider, and, above all, I don't know if this will be too much "customized" for our case 😄. Let me know. |
no I think this makes sense. You can look at the TreeItem interface and let the plugins override other properties than the description as well. |
So, if you agree, in the coming days I can try to fork the project and then create a pull request. Can you help me understand this better:
And, what about this:
Last thing: how can I test it on my local Nx workspace? Thanks |
As you can see below, the plugins are all functions that take something and return a result. nx-console/libs/shared/nx-console-plugins/src/lib/nx-console-plugin-types.ts Lines 11 to 15 in 7445308
I'm saying that the function signature for the new plugin should be something like export type ProjectViewItemProcessor = (
schema: NxTreeItem,
workspace: NxWorkspace
) => NxTreeItem;
You can simply use
Check out
|
So, I made a first try, you can see it here: master...fabruex:nx-console:projectViewItemProcessors but I have some doubt/issue.
|
|
Great job so far though! |
Thanks! So... I followed your directions: master...fabruex:nx-console:projectViewItemProcessors I think now it could work, but I'm not able to test it. When I run it with F5 I don't see anything in the new VSCode window, probably I'm doing something wrong, but I don't know what :)
I don't understand this part. Do you mean this? I defined the |
Awesome!
I mean this: You should make sure that whenever the projects view is refreshed (so it is rendered again from the root, so
Ah I see the problem, I can take over soon as well and put the last pieces together if it's not working :) |
I finally made the debug work, now I have the following problem. With this path: I get the error below during the
|
maybe try to |
Looks like we did it :) master...fabruex:nx-console:projectViewItemProcessors It works fine, but I noticed that in this way the item processor runs for every type of item (projects, targets, etc.). Should we make it run only at project level? That's up to you
Btw, this error is still there, even If I change the name (the same for tooltip). Should I assign those properties individually instead of |
Nice!! I think it should run for every type of item. Let's assign those properties individually for now. We can say description, tooltip, label, icon,...? Anything else? So something like const processed = processor(item, this.workspaceData);
if(processed.description) {
item.description = processed.description
} |
I guess What next? Should I create a pull request or something else? |
Yeah that sounds right. Create a pull request and I'll go through it and try things out :) |
Uhm, sorry, still some issue with that part :) I can't assign
I'm no expert in Typescript and maybe I'm missing something |
Make a PR and I'll have a look :) Maybe I can figure it out. |
Done, I also changed a little bit the |
Hi Max, I add this question here, if you think it can be doable I will move it to a new feature request. Currently we use the Projects view just to run dev, build and lint scripts, nothing else, so it would be nice to have one of these changes (using the new plugin or not, that's up to you):
I took a look at the code and I guess the first one is more difficult (or maybe impossible) to do. I saw that icons and commands are defined in the package.json file, I don't know if it can be done in another way. Thanks |
|
Feel free to make another PR, should be easier this time around :) |
Description
It would be nice to be able to display the project description (corresponding to the "description" field in the package.json file) next to the project name, in the workspace project list.
Motivation
In our company we have a folder for a specific category of applications that have a progressive code as their name. In this way it would be possible to immediately understand which application it is.
Suggested Implementation
I would add a parameter like "Show project description in the project list" with the following options:
never
: never display the descriptiontitle
orhover
: show the description only when the mouse hovers over the nameside
: show the description to the right of the nameAlternate Implementations
It could be made more flexible by directly choosing which fields of the package.json file to display, but I guess it would be more difficult to implement
The text was updated successfully, but these errors were encountered: