Skip to content

feat: lsp skeleton - #1587

Merged
megha-narayanan merged 6 commits into
aws:feat/cdk-lsp-explorerfrom
megha-narayanan:feat/explorer-lsp-skeleton
Jun 2, 2026
Merged

feat: lsp skeleton#1587
megha-narayanan merged 6 commits into
aws:feat/cdk-lsp-explorerfrom
megha-narayanan:feat/explorer-lsp-skeleton

Conversation

@megha-narayanan

Copy link
Copy Markdown
Contributor

LSP server skeleton: handles initialize/shutdown lifecycle, filters didSave notifications, triggers synth via injectable callback
Reuses toolkit-lib's createIgnoreMatcher + WATCH_EXCLUDE_DEFAULTS for file filtering (same exclusion logic as cdk watch)
Adds @aws-cdk/toolkit-lib as a dependency in .projenrc.ts (enables toolkit-internals.ts re-export pattern matching packages/aws-cdk/lib/api-private.ts)

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

@aws-cdk-automation
aws-cdk-automation requested a review from a team June 2, 2026 14:58
@github-actions github-actions Bot added the p2 label Jun 2, 2026
@megha-narayanan
megha-narayanan changed the base branch from main to feat/cdk-lsp-explorer June 2, 2026 15:00
@megha-narayanan
megha-narayanan marked this pull request as ready for review June 2, 2026 15:02

@ShadowCat567 ShadowCat567 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Other than the import comment, I think this looks pretty reasonable, looking forward to seeing the LSP be able to actually do something :D

/* eslint-disable import/no-relative-packages */
export { createIgnoreMatcher } from '../../toolkit-lib/lib/util/glob-matcher';
export type { GlobMatcherOptions } from '../../toolkit-lib/lib/util/glob-matcher';
export { WATCH_EXCLUDE_DEFAULTS } from '../../toolkit-lib/lib/actions/watch/private/helpers';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why can't these be imported like @aws-cdk/toolkit-lib? (like how toolkit-lib imports other @aws-cdk packages)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Short answer: they aren't public, and probably shouldn't be if they aren't yet.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this follows the same pattern used by the aws-cdk CLI package see packages/aws-cdk/lib/api-private.ts, which imports createIgnoreMatcher and other internal symbols from toolkit-lib via relative paths with the same eslint-disable.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

based on what other packages in @aws-cdk do we might be able to do the deep import in the file where we need to get the info from and not have the intermediate file

megha-narayanan and others added 4 commits June 2, 2026 14:36
Minimal LSP server that handles initialize/shutdown lifecycle and
triggers synth via injectable callback on didSave. File filtering
reuses toolkit-lib's createIgnoreMatcher + WATCH_EXCLUDE_DEFAULTS
(same pattern as cdk watch).

No daemon, no custom methods — just the plumbing that proves the
LSP wiring works end-to-end. Real cdk.out parsing comes in Phase 2.
Remove the intermediate toolkit-internals.ts re-export file and import
directly where needed, matching the simpler pattern for a single consumer.
- Add tests for didSave-after-shutdown and onSynthRequest error catch
- Lower functions coverage threshold to 50%; the unconditional
  process.exit in onExit is not unit-testable in this small skeleton
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

@ShadowCat567 ShadowCat567 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall looks good, take a look at the index.test.ts file before merging!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you shouldn't need index.test.ts file, I think you can remove this

@megha-narayanan
megha-narayanan merged commit 151dfac into aws:feat/cdk-lsp-explorer Jun 2, 2026
7 of 8 checks passed
@megha-narayanan
megha-narayanan deleted the feat/explorer-lsp-skeleton branch June 2, 2026 19:16
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