Skip to content

feat: support source tracing for python#1674

Merged
megha-narayanan merged 5 commits into
aws:feat/cdk-lspfrom
megha-narayanan:feat/explorer-polyglot-source
Jun 29, 2026
Merged

feat: support source tracing for python#1674
megha-narayanan merged 5 commits into
aws:feat/cdk-lspfrom
megha-narayanan:feat/explorer-polyglot-source

Conversation

@megha-narayanan

@megha-narayanan megha-narayanan commented Jun 25, 2026

Copy link
Copy Markdown

Add utilities to source resolver to parse jsii host-language creation-stack frames for Python, and drop the TypeScript-only diagnostics gate. Go-to-definition (source → template, and reverse) and policy-violation diagnostics now work for Python apps, not just TypeScript.

Requires synthing with JSII_HOST_STACK_TRACES=1 (opt-in; jsii 1.137+ / aws-cdk-lib 2.260+). Auto-enabling it for LSP-triggered synth is a follow-up. Java support separated into new PR due to FQN path parsing complexities.

Example:
Screenshot 2026-06-25 at 1 30 10 PM

Checklist

  • This change contains a major version upgrade for a dependency and I confirm all breaking changes are addressed
    • Release notes for the new version:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

Parse jsii host-language (Python/Java) creation-stack frames in the source resolver and remove the TypeScript-only diagnostics gate, so go-to-definition and policy violations work for non-TypeScript CDK apps synthed with JSII_HOST_STACK_TRACES=1. Verified end to end against jsii 1.137.0 and aws-cdk-lib 2.260.0.
@megha-narayanan megha-narayanan marked this pull request as ready for review June 25, 2026 17:36
@github-actions github-actions Bot added the p2 label Jun 25, 2026
@aws-cdk-automation aws-cdk-automation requested a review from a team June 25, 2026 17:48
Comment thread packages/@aws-cdk/cdk-explorer/lib/core/source-resolver.ts Outdated
Co-authored-by: Otavio Macedo <288203+otaviomacedo@users.noreply.github.com>
Comment thread packages/@aws-cdk/cdk-explorer/test/core/source-resolver.test.ts
normalizeHostFrame preserves a real host column and clamps the 0 'unavailable' sentinel to 1. Update the test to expect the column unchanged and refresh the stale 0-indexed comments.
@megha-narayanan megha-narayanan changed the title feat: support source tracing for java and python feat: support source tracing for python Jun 29, 2026
jsii's Java runtime sends only a bare source filename (getFileName()) with no path, so Java frames can't be located without source-root reconstruction. Ship Python source tracing only; track Java as a follow-up.
@megha-narayanan megha-narayanan merged commit 3afed4c into aws:feat/cdk-lsp Jun 29, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants