Skip to content

VSCode: Fix ENOENT causing file to be emptied when StyLua binary is missing#1116

Merged
JohnnyMorganz merged 6 commits into
mainfrom
claude/fix-enoent-file-deletion-xpmLy
May 16, 2026
Merged

VSCode: Fix ENOENT causing file to be emptied when StyLua binary is missing#1116
JohnnyMorganz merged 6 commits into
mainfrom
claude/fix-enoent-file-deletion-xpmLy

Conversation

@JohnnyMorganz
Copy link
Copy Markdown
Owner

@JohnnyMorganz JohnnyMorganz commented May 16, 2026

The child process error event was registered as "err" instead of the
correct "error", so spawn failures (e.g. ENOENT when the binary does
not exist) were never caught. The stdout close handler would then
resolve the Promise with an empty string, causing the extension to
replace the entire document with empty content.

Fixes #1001

claude added 5 commits May 16, 2026 08:36
The child process error event was registered as "err" instead of the
correct "error", so spawn failures (e.g. ENOENT when the binary does
not exist) were never caught. The stdout close handler would then
resolve the Promise with an empty string, causing the extension to
replace the entire document with empty content.

Fixes #1001

https://claude.ai/code/session_01QdJCgv72HVtH1ryEkJwLoM
Verifies that formatCode rejects (rather than resolves with an empty
string) when the StyLua binary path does not exist.

https://claude.ai/code/session_01QdJCgv72HVtH1ryEkJwLoM
- Replace didResolve flag in test with assert.rejects
- Suppress unhandled EPIPE on child.stdin when spawn fails
- Fix executeStylua: add return after reject so resolve doesn't also run
- Remove self-evident comment on stdin.write
- Resolve CHANGELOG merge conflict with main

https://claude.ai/code/session_01QdJCgv72HVtH1ryEkJwLoM
@JohnnyMorganz JohnnyMorganz changed the title Fix ENOENT causing file to be emptied when StyLua binary is missing VSCode: Fix ENOENT causing file to be emptied when StyLua binary is missing May 16, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.66%. Comparing base (4df5c84) to head (06bbb27).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1116   +/-   ##
=======================================
  Coverage   96.66%   96.66%           
=======================================
  Files          16       16           
  Lines        5307     5307           
=======================================
  Hits         5130     5130           
  Misses        177      177           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JohnnyMorganz JohnnyMorganz enabled auto-merge (squash) May 16, 2026 08:49
@JohnnyMorganz JohnnyMorganz merged commit 194cc99 into main May 16, 2026
21 checks passed
@JohnnyMorganz JohnnyMorganz deleted the claude/fix-enoent-file-deletion-xpmLy branch May 16, 2026 08:59
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.

VSCode extension -- Can't install version 2.1 and trying to do so breaks 1.7

2 participants