Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
fixed wrong highlighted line caused by stripped comments
  • Loading branch information
timthedev07 committed Jul 21, 2021
1 parent 96409d6 commit 723081a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/check.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { readFileSync } from "fs";
import strip from "strip-comments";
import { ansi, BOLD, CYAN, GREEN, RED, RESET, YELLOW } from "./constants";
import { deepCssParser } from "./parser";
import { PositionInfo, Property, RuleSet } from "./types";
Expand All @@ -11,7 +12,9 @@ export const showInFile = (
return console.error("Error in unknown file.");
}

const lines = readFileSync(position.source).toString().split("\n");
const lines = strip(readFileSync(position.source).toString(), {
language: "css",
}).split("\n");

const line = lines[position.start!.line! - 1];

Expand Down

0 comments on commit 723081a

Please sign in to comment.