fix(cloudformation): Make CloudFormation LSP download strategy consistent#8750
Open
satyakigh wants to merge 1 commit into
Open
fix(cloudformation): Make CloudFormation LSP download strategy consistent#8750satyakigh wants to merge 1 commit into
satyakigh wants to merge 1 commit into
Conversation
|
⏳ I'm reviewing this pull request for security vulnerabilities and code quality issues. I'll provide an update when I'm done |
|
|
✅ I finished the code review, and didn't find any security or code quality issues. |
a1555ab to
012554c
Compare
…tent with other plugins and more robust
012554c to
b2510b8
Compare
vzhan00
approved these changes
Apr 22, 2026
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.
Summary
These changes make the CloudFormation LSP server download, installation, caching, and cleanup strategy consistent across all client plugins and safe for concurrent multi-IDE usage.
Previously each plugin had its own ad-hoc approach to downloading and managing the LSP binary. Now all clients share the same design:
manifest.jsonon disk replaces IDE-specific storage.tmp.<pid>directories from crashed processesMotivation
Users commonly have both the standalone CloudFormation extension AND the AWS Toolkit installed in VS Code, or use both VS Code and JetBrains. Without a shared cache directory and in-use tracking, these plugins fight over the same LSP binary — downloading redundant copies, deleting each other's active versions, and corrupting installations mid-session.
The LSP download happens over the network from GitHub. In corporate environments with proxies, air-gapped networks, or intermittent connectivity, the download can fail at any point. The previous code had minimal resilience: no atomic writes (corruption on crash), no offline fallback (complete failure), and IDE-specific caching (no cross-plugin benefit).
extension.ts— Extension name hardcoded to"aws.toolkit.vscode". RemovesVSCODE_EXTENSION_ID_CONSTANTSimport.githubManifestAdapter.ts— Massive simplification. Removes the entire GitHub Releases API fallback (fetchGitHubReleases,convertRelease,extractTargets,filterByEnvironment) and all associated interfaces (GitHubRelease,GitHubAsset). Now only fetches from the manifest JSON URL. Constructor simplified — no morerepoOwner/repoNameparams. StoreslastRawManifesttext so the installer can cache it to disk.lspInstaller.ts— Major rewrite. File-based manifest cache: writes raw manifest tomanifest.jsonvia atomic tmp+rename, reads from cache on fetch failure.resolve()override addsfindLocalFallback()which scans downloaded versions for a compatible server binary.postInstall()writes the in-use marker before cleanup runs.rootDiroverride viagetCfnLspRootDir()points to the unified cross-plugin cache path.lspServerProvider.ts—dispose()now iteratesmatchedProvidersand callsdispose()on each. Previously was a no-op, which meant in-use markers were never cleaned on extension deactivation.remoteLspServerProvider.ts— TracksversionDirfrom resolution result.dispose()removes the in-use marker.baseLspInstaller.ts— AddsrootDir?: stringtoLspConfiginterface and passes it through toLanguageServerResolver. This lets the CloudFormation installer override the default cache directory (shared with other LSPs like Amazon Q).lspResolver.ts— NewrootDirconstructor parameter (defaults toLanguageServerResolver.defaultDir()).downloadRemoteTargetContent()uses atomic tmp+rename.getCachedVersions()filters.tmp.entries.getLatestCompatibleVersion()prefers the version withlatest: trueflag.defaultDownloadFolder()usesthis.rootDirinstead of the static default.types.ts— Addslatest?: booleanfield toLspVersioninterface. This lets the manifest explicitly mark a preferred version rather than relying solely on semver sorting.cleanup.ts— Complete rewrite. RemovesisDelisted()helper and partition-based logic. NewsweepStaleTmpDirs()removes dead-PID tmp dirs. Cleanup uses a keep-set{current, highestFallback}plusInUseTrackerchecks. The delisted-version concept is removed entirely.inUseTracker.ts(new) — Node.js implementation of PID-based marker tracking. Same API as the other two codebases.