feat: template ranges + two-way template/source navigation#1624
Open
megha-narayanan wants to merge 2 commits into
Open
feat: template ranges + two-way template/source navigation#1624megha-narayanan wants to merge 2 commits into
megha-narayanan wants to merge 2 commits into
Conversation
Adds jsonc-parser@3.2.0 as a runtime dep, in preparation for computing character ranges of template resource/property blocks (PR-A). Dedupes to the jsonc-parser already resolved in the lockfile; no new version added.
…te ranges Compute character-accurate ranges of CloudFormation resource blocks in synthesized templates and use them for navigation in both directions. cloud-assembly-api: - resolveResourceRange(text, logicalId): the character range of a resource's value block, via jsonc-parser. A position-aware parse is used instead of a line scan because real templates contain literal braces and escaped quotes inside string values (for example Fn::Sub placeholders) that defeat naive brace matching. - resolveLogicalIdAtOffset(text, offset): the inverse, mapping a position in a template back to the enclosing resource's logical id. cdk-explorer LSP: - resourceTarget now returns the real resource block range (previously a zero-width cursor at the logical-id key), so the CodeLens "go to" selects the whole block. - onDefinition: go-to-definition from a synthesized template back to the construct's source, keyed by (templateFile, logicalId) since logical ids are only unique within a template. - offset and position conversions extracted to lib/lsp/positions.ts. The jsonc-parser runtime dependency is added in the preceding commit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license