Skip to content

Add Metadata.Context completion, hover, and quick fix - #676

Open
satyakigh wants to merge 3 commits into
mainfrom
context
Open

Add Metadata.Context completion, hover, and quick fix#676
satyakigh wants to merge 3 commits into
mainfrom
context

Conversation

@satyakigh

Copy link
Copy Markdown
Collaborator

Summary

Add first-class editor support for CloudFormation com.aws.cloudformation.Context metadata.

  • Add schema-aware completion for:
  • Template fields: arch, must, ref, and owner
  • Resource fields: why, must, mutable, mutability, trust, and deps
  • Nested ref and trust structures
  • Mutability, trust-source, and confidence enum values
  • Add hover documentation with field types, required fields, enum values, advisory-schema guidance, and links to the authoritative AWS documentation.
  • Add a quick fix that inserts template- or resource-level Context skeletons in response to missing-context diagnostics.
  • Support YAML and JSON while preserving existing arbitrary Metadata entries.
  • Support recoverable malformed templates, including partial keys, missing JSON closing braces, and valid islands following unrelated syntax errors.
  • Preserve existing behavior at wholly invalid positions and avoid offering CodeActions when a safe insertion point cannot be resolved.

The shared Metadata Context schema uses the existing PropertyType convention under src/schema. No LSP protocol or client changes are required.

Documentation: https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-attribute-metadata.html#aws-attribute-metadata-context-schema

Implementation notes

Malformed JSON path recovery now:

  • Runs only when the cursor has a local tree-sitter ERROR ancestor
  • Preserves normal ancestor and entity context
  • Merges normal and fallback property paths only when they overlap
  • Distinguishes partial object keys from scalar values
  • Handles UTF-8 tree-sitter columns without copying the full document

@satyakigh
satyakigh requested a review from a team as a code owner September 4, 2026 22:52
@github-code-quality

github-code-quality Bot commented Sep 4, 2026

Copy link
Copy Markdown

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/vitest

The overall line coverage in commit 7e70040 in the context branch remains at 90%, unchanged from commit a1a3d82 in the main branch.

Show a line coverage summary of the most impacted files.
File main a1a3d82 context 7e70040 +/-
src/autocomplet...letionRouter.ts 90% 90% 0%
src/services/Co...ctionService.ts 76% 77% +1%
src/hover/HoverRouter.ts 89% 90% +1%
src/document/Document.ts 98% 100% +2%
src/context/syn...e/SyntaxTree.ts 92% 97% +5%
src/services/Me...textQuickFix.ts 0% 93% +93%
src/autocomplet...tionProvider.ts 0% 93% +93%
src/schema/Meta...ontextSchema.ts 0% 93% +93%
src/hover/Metad...overProvider.ts 0% 95% +95%
src/context/MetadataContext.ts 0% 100% +100%

Updated September 06, 2026 21:20 UTC

@satyakigh satyakigh left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant