amondel2 opened a new pull request, #441:
URL: https://github.com/apache/grails-intellij-plugin/pull/441
# Configurable custom folders in the Grails project view
## Why
The Grails view only shows Grails-recognised folders, so everyday working
folders (`.github/`, `build/`, `docs/`, AI scratchpads, team-specific
locations) are invisible there — every time you want a file from one you switch
to the **Project** view, then switch back. This removes that context switch.
It's purely additive: no existing node, weight, or behaviour changes, and no
new nodes appear unless at least one folder is configured.
## What
Adds a configurable **custom folders** feature to the Grails project view
pane: up to **three folder paths** appear as top-level, expandable nodes under
the application node, directly below the `Tests:unit` / `Tests:integration` /
`Tests:functional` nodes and sorted alphabetically by folder name.
Configuration is **global by default with a per-project override**; the merged
set is capped at three (project folders first, global defaults fill the
remaining slots, duplicates removed after path normalization).
New/changed pieces:
- **Settings services** — `GrailsCustomFoldersAppService`
(application-level, `GrailsCustomFolders.xml`, global defaults) and
`GrailsCustomFoldersProjectService` (project-level, workspace file, overrides)
plus `getEffectiveFolders()`, which merges project + global, caps at 3 and
de-duplicates via a shared `FolderPaths.normalize()` utility (trailing
separators, leading `./`, backslashes).
- **Settings UI** — a single consolidated configurable page with separate
text areas for global and project paths, a live preview of the effective
folders (computed from what's typed, before Apply), a source indicator (own
override vs. inherited global), and an over-cap warning.
- **Project view** — `GrailsCustomFoldersNodeProvider` contributes
`GrailsCustomFolderNode`s under the application node at a new
`NodeWeights.CUSTOM_FOLDER = 85` (below tests, above taglib);
`GrailsNodeComparator` sorts the tied nodes alphabetically. Nodes render with
the standard folder icon, the last path segment as label and the configured
path as tooltip.
- **Context-menu actions** — *Add as Custom Folder* on directories, *Remove
Custom Folder* on custom folder nodes, and *Configure Custom Folders* opening
the settings page. Add is hidden for the project root (it would duplicate the
whole project under the application node) and no-ops at the three-folder limit;
Remove is hidden for purely global folders it cannot act on.
- **Lifecycle** — the pane refreshes on settings change without a project
reload, and the provider is isolated from the other `GrailsViewNodeProvider`s
so one failing provider can't blank the whole tree (it builds on a background
thread).
## Current limitations
1. **Only project directories** — the `GrailsViewItems`/`PsiDirectory` path
resolution means a configured folder must be within the project's content
roots. Pointing a custom folder at an arbitrary absolute path outside the
project (e.g. `/home/user/Documents`) or a hidden dot-directory won't browse
from the Grails view. (Tracked as section 2.8 in `IMPROVEMENT-PLAN.md`;
workarounds are *Navigate → File*, the terminal, or the Project view.) The
README states this restriction.
2. **Placeholder-only for missing folders** — a configured path that doesn't
exist shows as a leaf node with no children; there is no "create folder"
affordance, no scaffolding, and no templates.
3. **Settings UI is the weakest part** — it's a text-area based page (two
lists of paths, one global and one project-level) with a plain-text live
preview, plus an over-cap warning label. It is functional but not polished: no
path pickers/browsing, per-row validation, reordering, or icons, and the
merge/preview semantics ("project first, global fills the rest, max three") are
only explained in inline text. I'd like to revisit the UX before considering
this feature complete.
4. Fixed at **three** folders, always sorted alphabetically (no reordering),
one standard folder icon for all nodes; no per-module configuration. I just
picked 3 out of thin air, just let me know what we want and I will make that
change, just didn't want unlimited.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]