5.5 KiB
| id | ticket | title | created | tags | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| LSN-0033 | studio-editor-indentation-policy-and-project-setup | Setup-Owned Indentation Policy and Project Bootstrap Defaults | 2026-04-04 |
|
Context
The Studio editor exposed an indentation chip in the status bar, but that chip was driven by file-content heuristics rather than by a stable editor policy.
At the same time, Tab insertion did not obey the displayed value, which made the editor self-contradictory during normal editing.
The work also surfaced a second bootstrap problem: project creation already owned .studio/ and .workspace/, but it was not yet treating project-local setup and baseline ignore rules as first-class bootstrapped assets.
Key Decisions
Project-Local Setup Owns Editor Indentation Policy
What:
The active indentation policy is now owned by .studio/setup.json, loaded into memory once per project session, shown in the status bar, and used directly by editable-document Tab handling.
Why:
The status bar must show the active policy, not a moving guess.
If Tab behavior and the visible chip disagree, the editor loses trust immediately.
Trade-offs: This first wave intentionally stays project-wide. It does not attempt per-file or per-language precedence, and it does not reformat existing files that already diverge from the configured policy.
Project Creation Must Bootstrap Real Project-Local Setup
What:
The project-creation wizard now includes a dedicated details step before location selection.
That step captures indentation width and Prometeu runtime path and persists them into .studio/setup.json.
Why: Indentation policy and runtime path are project-local configuration, so they should exist from project birth rather than appear later as ad hoc repair.
Trade-offs: Project creation becomes a little longer, but the result is a better-initialized project and a cleaner setup boundary.
New Projects Must Ship With a Baseline .gitignore
What:
Project bootstrap now writes a root .gitignore with Studio-local state and common OS junk excluded by default.
Why:
.studio/ and .workspace/ are local machine artifacts and should not depend on users remembering to ignore them later.
The same applies to common macOS, Windows, and Linux metadata noise.
Trade-offs: The generated file is intentionally conservative and generic rather than ecosystem-specific.
Final Implementation
The final state established these rules in code and specs:
ProjectLocalStudioSetupnow carries editor indentation configuration with default resolution toSpaces: 4.ProjectLocalStudioSetupServicenow supports both loading and saving setup data.StudioProjectSessionloads setup once and keeps it available in memory for runtime consumers.EditorStatusBarnow renders configured indentation policy instead of inspecting file contents.EditorWorkspaceconvertsTabinto the configured number of spaces for editable files.NewProjectWizardnow captures indentation width and runtime path on a dedicated details step before location.ProjectCatalogServicepersists.studio/setup.jsonand writes a baseline.gitignoreduring project creation.
Patterns and Algorithms
Pattern: Policy Chips Must Reflect Runtime Policy, Not Content Heuristics
If a status-bar chip describes how the editor will behave, it must be backed by the same runtime value that input handling uses. Do not derive policy chips from observed content when the editor behavior is actually driven elsewhere.
Pattern: Load Setup Once, Use It Repeatedly
Project-local setup is durable configuration, not per-keystroke state. Load it at project-session time, keep the resolved value in memory, and let editor interactions consume that in-memory representation directly.
Pattern: Bootstrap Project Hygiene at Creation Time
If a project requires local-only directories such as .studio/ or .workspace/, generate the corresponding .gitignore entries when the project is created.
Do not push that responsibility onto users later.
Pitfalls
- Do not let the status-bar indentation chip switch based on whatever indentation currently exists in the open file.
- Do not make
Tabobey one rule while the chip displays another. - Do not reread
.studio/setup.jsonon every editing interaction just because the file is durable configuration. - Do not auto-reformat preexisting file content just because a project now has a configured indentation policy.
- Do not keep
.studio/and.workspace/out of.gitignoreand expect users to fix repository hygiene manually.
References
docs/specs/studio/1. Studio Shell and Workspace Layout Specification.mddocs/specs/studio/5. Code Editor Workspace Specification.mddocs/specs/studio/8. Project-Local Studio State Specification.mdprometeu-studio/src/main/java/p/studio/projectstate/ProjectLocalStudioSetup.javaprometeu-studio/src/main/java/p/studio/projectstate/ProjectLocalStudioSetupService.javaprometeu-studio/src/main/java/p/studio/window/NewProjectWizard.javaprometeu-studio/src/main/java/p/studio/workspaces/editor/EditorWorkspace.javaprometeu-studio/src/main/java/p/studio/projects/ProjectCatalogService.java
Takeaways
- Editor policy must be explicit, stable, and shared between UI and input handling.
.studio/setup.jsonis the right owner for project-local editor configuration such as indentation and runtime path.- Project creation should bootstrap both configuration and repository hygiene, not leave them as follow-up chores.