Skip to content

Commit cef8f7b

Browse files
authored
Merge pull request #18739 from paldepind/change-note-script-editor
Change note creation script uses EDITOR environment variable
2 parents 87ee191 + fc186eb commit cef8f7b

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

.vscode/tasks.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@
5050
"${input:name}",
5151
"${input:categoryQuery}"
5252
],
53+
"options": {
54+
"env": {
55+
"EDITOR": "code -r",
56+
}
57+
},
5358
"presentation": {
5459
"reveal": "never",
5560
"close": true
@@ -67,6 +72,11 @@
6772
"${input:name}",
6873
"${input:categoryLibrary}"
6974
],
75+
"options": {
76+
"env": {
77+
"EDITOR": "code -r"
78+
}
79+
},
7080
"presentation": {
7181
"reveal": "never",
7282
"close": true

misc/scripts/create-change-note.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python3
22

3-
# Creates a change note and opens it in VSCode for editing.
3+
# Creates a change note and opens it in $EDITOR (or VSCode if the environment
4+
# variable is not set) for editing.
45

56
# Expects to receive the following arguments:
67
# - What language the change note is for
@@ -51,5 +52,6 @@
5152
with open(change_note_file, "w") as f:
5253
f.write(change_note)
5354

54-
# Open the change note file in VSCode, reusing the existing window if possible
55-
os.system(f"code -r {change_note_file}")
55+
editor = os.environ.get('EDITOR', 'code -r')
56+
57+
os.system(f"{editor} {change_note_file}")

0 commit comments

Comments
 (0)