Skip to content

Chrome DevTools for coding agents

chore: remove duplicate editor formatting (#2820)

Alex Rudenko39992d7119eb
diff --git a/src/formatters/CommentFormatter.ts b/src/formatters/CommentFormatter.ts
index 3d210ee6..3b9e61a9 100644
--- a/src/formatters/CommentFormatter.ts
+++ b/src/formatters/CommentFormatter.ts
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
-import type {CD4ACommentThread, CD4AEditorAnchorSignature} from '../types.js';
+import type {CD4ACommentThread} from '../types.js';
export interface CommentFormatterOptions {
resolveBackendNodeId?: (backendNodeId: number) => Promise<string | undefined>;
@@ -16,7 +16,6 @@ export interface StructuredCommentThread {
text: string;
elementUid?: string;
reqid?: number;
- editor?: CD4AEditorAnchorSignature;
}
function formatCommentThread(thread: StructuredCommentThread): string {
@@ -25,16 +24,10 @@ function formatCommentThread(thread: StructuredCommentThread): string {
`- Comment: ${thread.text}`,
];
if (thread.elementUid) {
- lines.push(`- Target element (snapshot UID): ${thread.elementUid}`);
+ lines.push(`- Related element uid: ${thread.elementUid}`);
}
if (thread.reqid !== undefined) {
- lines.push(`- Network request ID (reqid): ${thread.reqid}`);
- }
- if (thread.editor) {
- const location = thread.editor.filePath
- ? `${thread.editor.filePath}:${thread.editor.lineNumber}`
- : `line ${thread.editor.lineNumber}`;
- lines.push(`- Editor location: ${location}`);
+ lines.push(`- Related network reqid: ${thread.reqid}`);
}
return lines.join('\n');
}
@@ -87,9 +80,6 @@ export class CommentFormatter {
if (reqid !== undefined) {
item.reqid = reqid;
}
- if (thread.editor) {
- item.editor = thread.editor;
- }
structuredThreads.push(item);
}
return new CommentFormatter(structuredThreads);
diff --git a/tests/formatters/CommentFormatter.test.js.snapshot b/tests/formatters/CommentFormatter.test.js.snapshot
index fb63475d..86ef87a5 100644
--- a/tests/formatters/CommentFormatter.test.js.snapshot
+++ b/tests/formatters/CommentFormatter.test.js.snapshot
@@ -4,11 +4,7 @@ exports[`CommentFormatter > formats comments with targets and editor locations t
"id": "comment-1",
"text": "Fix the color contrast here",
"elementUid": "element-uid-42",
- "reqid": 7,
- "editor": {
- "filePath": "src/style.css",
- "lineNumber": 10
- }
+ "reqid": 7
}
]
`;
@@ -18,29 +14,8 @@ Found 1 DevTools comment thread(s):
### Thread: comment-1
- Comment: Fix the color contrast here
-- Target element (snapshot UID): element-uid-42
-- Network request ID (reqid): 7
-- Editor location: src/style.css:10
-`;
-
-exports[`CommentFormatter > formats editor location when filePath is missing toJSON 1`] = `
-[
- {
- "id": "comment-2",
- "text": "Review this script line",
- "editor": {
- "lineNumber": 25
- }
- }
-]
-`;
-
-exports[`CommentFormatter > formats editor location when filePath is missing toString 1`] = `
-Found 1 DevTools comment thread(s):
-
-### Thread: comment-2
-- Comment: Review this script line
-- Editor location: line 25
+- Related element uid: element-uid-42
+- Related network reqid: 7
`;
exports[`CommentFormatter > formats empty comments list toJSON 1`] = `
@@ -54,7 +29,7 @@ No open DevTools comments found.
exports[`CommentFormatter > formats single thread using static formatThread 1`] = `
### Thread: comment-3
- Comment: Check padding
-- Target element (snapshot UID): node-99
+- Related element uid: node-99
`;
exports[`CommentFormatter > omits unresolved targets when from() resolves undefined toJSON 1`] = `
@@ -79,11 +54,7 @@ exports[`CommentFormatter > resolves targets using from() method toJSON 1`] = `
"id": "comment-1",
"text": "Fix the color contrast here",
"elementUid": "element-uid-42",
- "reqid": 7,
- "editor": {
- "filePath": "src/style.css",
- "lineNumber": 10
- }
+ "reqid": 7
}
]
`;
@@ -93,7 +64,6 @@ Found 1 DevTools comment thread(s):
### Thread: comment-1
- Comment: Fix the color contrast here
-- Target element (snapshot UID): element-uid-42
-- Network request ID (reqid): 7
-- Editor location: src/style.css:10
+- Related element uid: element-uid-42
+- Related network reqid: 7
`;
diff --git a/tests/formatters/CommentFormatter.test.ts b/tests/formatters/CommentFormatter.test.ts
index bcac6a13..8035cd24 100644
--- a/tests/formatters/CommentFormatter.test.ts
+++ b/tests/formatters/CommentFormatter.test.ts
@@ -43,21 +43,6 @@ describe('CommentFormatter', () => {
text: 'Fix the color contrast here',
elementUid: 'element-uid-42',
reqid: 7,
- editor: {
- filePath: 'src/style.css',
- lineNumber: 10,
- },
- };
- return new CommentFormatter([thread]);
- });
-
- formatterTest('formats editor location when filePath is missing', () => {
- const thread: StructuredCommentThread = {
- id: 'comment-2',
- text: 'Review this script line',
- editor: {
- lineNumber: 25,
- },
};
return new CommentFormatter([thread]);
});