Skip to content

Commit d807aae

Browse files
committed
VSCODE mangling fix
1 parent 1982bba commit d807aae

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

bin/cleanup-text.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,20 @@ def main():
158158
raw = sys.stdin.read()
159159
cleaned = clean_text(raw, preserve_invisible=args.invisible)
160160

161+
# Check if running inside VS Code extension host
162+
vscode_extension = False
163+
process_title = os.environ.get('VSCODE_PROCESS_TITLE', '')
164+
if process_title.startswith('extension-host'):
165+
vscode_extension = True
166+
161167
# Handle newline at EOF based on -n/--no-newline
162168
if not args.no_newline:
163169
# Only add newline if there isn't one already
164170
if not cleaned.endswith('\n'):
165171
cleaned += '\n'
172+
# Add extra newline if running in VS Code extension host
173+
if vscode_extension:
174+
cleaned += '\n'
166175
# If --no-newline is specified, leave the file exactly as is (no changes to newlines)
167176

168177
sys.stdout.write(cleaned)

0 commit comments

Comments
 (0)