Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 2, 2026

Introduces a dedicated comment block type for long-form documentation that persists in projects but is excluded from compilation. Users can now create standalone documentation blocks without using dummy modules or semicolon comments.

Changes

  • Type system: Added 'comment' to CodeBlockType union in editor-state package only (compiler doesn't receive comment blocks)
  • Block detection: Extended getBlockType() to recognize comment/commentEnd markers with mutual exclusion logic. Moved from shaderUtils to codeParsers directory for better organization.
  • Editor integration: Added "New Comment" context menu option that creates blocks with default template:
    comment
    
    
    commentEnd
    
  • Compilation: Comment blocks automatically excluded from flattenProjectForCompiler() (filters by blockType)
  • Tests: Added unit tests for detection logic and compilation filtering

Example

// Comment blocks are detected and labeled correctly
getBlockType(['comment', 'This is documentation', 'commentEnd']) // => 'comment'

// Excluded from compiler input
flattenProjectForCompiler(codeBlocks) 
// Returns only modules, functions, constants - never comments

Screenshot

Context menu showing new "New Comment" option:

Original prompt

Please do this todo: docs/todos/159-add-comment-code-blocks.md


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@andorthehood andorthehood added the ai Vibecoded pull requests label Jan 2, 2026
Copilot AI changed the title [WIP] Add comments for code blocks in documentation Add comment code blocks for documentation Jan 2, 2026
Copilot AI requested a review from andorthehood January 2, 2026 19:18
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot This helper is too generic to be under shaderUtils, let's move it out.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to pureHelpers/codeParsers/getBlockType.ts in commit 98e32d6.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot I believe that this utils doesn't need to know about comment type code block because we don't send comments to the compiler.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted to original state (without comment type support) in commit 98e32d6. The compiler now only knows about module, config, function, constants, and unknown types.

@andorthehood andorthehood marked this pull request as ready for review January 2, 2026 19:57
Copilot AI review requested due to automatic review settings January 2, 2026 19:57
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a dedicated comment block type for long-form documentation that persists in projects but is excluded from compilation. Users can now create standalone documentation blocks through a new "New Comment" context menu option without resorting to dummy modules or semicolon comments.

Key Changes

  • Added 'comment' to the CodeBlockType union type and extended block detection logic to recognize comment/commentEnd markers with complete mutual exclusion
  • Refactored getBlockType from shaderUtils to codeParsers directory for better organization and updated all imports
  • Comment blocks are automatically excluded from compilation via the existing whitelist filtering in flattenProjectForCompiler

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/editor/packages/editor-state/src/types.ts Added 'comment' to CodeBlockType union with documentation explaining its purpose
packages/editor/packages/editor-state/src/pureHelpers/codeParsers/getBlockType.ts Extended detection logic with comment marker checks and mutual exclusion; moved from shaderUtils; added unit tests
packages/editor/packages/editor-state/src/effects/menu/menus.ts Added "New Comment" menu option for creating comment blocks
packages/editor/packages/editor-state/src/effects/compiler.ts Updated documentation to clarify comment blocks are excluded from compilation
packages/editor/packages/editor-state/src/effects/compiler.test.ts Added comprehensive tests verifying comment blocks are excluded from compilation
packages/editor/packages/editor-state/src/effects/codeBlocks/codeBlockCreator.ts Added comment block template generation with proper markers
packages/editor/packages/editor-state/src/effects/codeBlocks/blockTypeUpdater.ts Updated import path for relocated getBlockType function
packages/editor/packages/editor-state/src/pureHelpers/shaderEffects/derivePostProcessEffects.ts Updated import path for relocated getBlockType function

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@andorthehood andorthehood merged commit d8f2301 into main Jan 2, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai Vibecoded pull requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants