Skip to content

Commit 2675bf4

Browse files
committed
Correctly indent code snippets that use tabs
1 parent b638449 commit 2675bf4

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

extensions/ql-vscode/src/remote-queries/view/FileCodeSnippet.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const getSeverityColor = (severity: ResultSeverity) => {
2121
}
2222
};
2323

24-
const replaceSpaceChar = (text: string) => text.replaceAll(' ', '\u00a0');
24+
const replaceSpaceAndTabChar = (text: string) => text.replaceAll(' ', '\u00a0').replaceAll('\t', '\u00a0\u00a0\u00a0\u00a0');
2525

2626
const Container = styled.div`
2727
font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
@@ -56,11 +56,11 @@ const MessageContainer = styled.div`
5656
`;
5757

5858
const PlainLine = ({ text }: { text: string }) => {
59-
return <span>{replaceSpaceChar(text)}</span>;
59+
return <span>{replaceSpaceAndTabChar(text)}</span>;
6060
};
6161

6262
const HighlightedLine = ({ text }: { text: string }) => {
63-
return <span style={{ backgroundColor: highlightColor }}>{replaceSpaceChar(text)}</span>;
63+
return <span style={{ backgroundColor: highlightColor }}>{replaceSpaceAndTabChar(text)}</span>;
6464
};
6565

6666
const Message = ({

0 commit comments

Comments
 (0)