Skip to content

Commit 2f36305

Browse files
committed
Fixed variable scope in "Indent Comments" feature
1 parent 4d22785 commit 2f36305

File tree

2 files changed

+2
-29
lines changed

2 files changed

+2
-29
lines changed

package-lock.json

Lines changed: 1 addition & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/utils/display.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ export function displayTime(value: number | null | undefined, showTrailingZeroes
198198
*/
199199
export function indent(content: string): string {
200200
function findSemicolon(line: string): number {
201+
let inQuotes = false, inExpression = false;
201202
for (let i = 0; i < line.length; i++) {
202203
if (inQuotes) {
203204
inQuotes = (line[i] !== '"');
@@ -217,7 +218,6 @@ export function indent(content: string): string {
217218
// Find out how long the maximum command is
218219
const lines = content.split('\n');
219220
let maxCommandLength = 0;
220-
let inQuotes = false, inExpression = false;
221221
for (const line of lines) {
222222
const commentIndex = findSemicolon(line);
223223
if (commentIndex > 0) {

0 commit comments

Comments
 (0)