();
@@ -188,6 +196,7 @@ export const FileExplorer = () => {
const moveUpIntoPath = (idx: number) => {
const path = curPath.split('/').slice(0, idx + 1);
+ setCurFile('');
setCurPath(path.join('/'));
setTableData(getObjectsAtPath(curData, path.slice(1)));
};
@@ -197,43 +206,32 @@ export const FileExplorer = () => {
title: 'Path',
type: 'string',
field: 'path',
- render: (row: CoverageTableRow) => {
- if (row.files?.length) {
- return (
- {
- setCurPath(`${curPath}/${row.path}`);
- moveDownIntoPath(row.path);
- }}
- onClick={() => {
- setCurPath(`${curPath}/${row.path}`);
- moveDownIntoPath(row.path);
- }}
- >
- {row.path}
-
- );
- }
-
- return (
-
- {row.path}
-
- {
- setCurFile(`${curPath.slice(1)}/${row.path}`);
- setModalOpen(true);
- }}
- />
-
-
- );
- },
+ render: (row: CoverageTableRow) => (
+ {
+ if (row.files?.length) {
+ setCurPath(`${curPath}/${row.path}`);
+ moveDownIntoPath(row.path);
+ } else {
+ setCurFile(`${curPath.slice(1)}/${row.path}`);
+ setModalOpen(true);
+ }
+ }}
+ >
+ {row.files?.length > 0 && (
+
+ )}
+ {row.files?.length === 0 && (
+
+ )}
+ {row.path}
+
+ ),
},
{
title: 'Coverage',
@@ -264,42 +262,50 @@ export const FileExplorer = () => {
}
return (
-
-
-
-
- {pathArray.map((pathElement, idx) => (
-
- moveUpIntoPath(idx)}
- onClick={() => moveUpIntoPath(idx)}
- >
- {pathElement || 'root'}
-
- {'\u00A0/\u00A0'}
-
- ))}
-
- No files found>}
- data={tableData || []}
- columns={columns}
- />
- event.stopPropagation()}
- onClose={() => setModalOpen(false)}
- style={{ overflow: 'scroll' }}
- >
-
-
-
-
+
+ No files found>}
+ data={tableData || []}
+ columns={columns}
+ title={
+ <>
+ Explore Files
+
+ {pathArray.map((pathElement, idx) => (
+
+ moveUpIntoPath(idx)}
+ onClick={() => moveUpIntoPath(idx)}
+ >
+ {pathElement || 'root'}
+
+ {idx !== lastPathElementIndex && {'\u00A0/\u00A0'}
}
+
+ ))}
+
+ >
+ }
+ />
+ event.stopPropagation()}
+ onClose={() => setModalOpen(false)}
+ style={{ overflow: 'scroll' }}
+ >
+
+
+
);
};
diff --git a/plugins/code-coverage/src/components/FileExplorer/Highlighter.ts b/plugins/code-coverage/src/components/FileExplorer/Highlighter.ts
index d97d147da3..465e43f6e4 100644
--- a/plugins/code-coverage/src/components/FileExplorer/Highlighter.ts
+++ b/plugins/code-coverage/src/components/FileExplorer/Highlighter.ts
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-import 'highlight.js/styles/atom-one-dark.css';
-import highlight from 'highlight.js';
+import 'highlight.js/styles/mono-blue.css';
+import { highlight } from 'highlight.js';
/*
* Given a file extension, repo name, and array of code lines, return a Promise resolving
@@ -30,7 +30,6 @@ import highlight from 'highlight.js';
*/
export const highlightLines = (fileExtension: string, lines: Array) => {
const formattedLines: Array = [];
- let state: CompiledMode | Language | undefined;
let fileformat = fileExtension;
if (fileExtension === 'm') {
fileformat = 'objectivec';
@@ -46,8 +45,10 @@ export const highlightLines = (fileExtension: string, lines: Array) => {
}
lines.forEach(line => {
- const result = highlight.highlight(fileformat, line, true, state);
- state = result.top;
+ const result = highlight(line, {
+ language: fileformat,
+ ignoreIllegals: true,
+ });
formattedLines.push(result.value);
});
return formattedLines;