Skip to content

Commit 1a30afd

Browse files
committed
Fix for go to source on macOS (hopefully)
1 parent 254e04f commit 1a30afd

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "remix-development-tools",
33
"description": "Remix development tools - a set of tools for developing/debugging Remix.run apps",
44
"author": "Alem Tuzlak",
5-
"version": "4.0.1",
5+
"version": "4.0.2",
66
"license": "MIT",
77
"keywords": [
88
"remix",

src/client/hooks/useOpenElementSource.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,25 @@ const useOpenElementSource = () => {
3838

3939
if (rdtSource) {
4040
const [source, line, column] = rdtSource.split(":::");
41-
sendJsonMessage({
41+
return sendJsonMessage({
4242
type: "open-source",
4343
data: { source, line, column },
4444
});
4545
}
46-
return;
46+
for (const key in e.target) {
47+
if (key.startsWith("__reactFiber")) {
48+
const fiberNode = (e.target as any)[key];
49+
50+
const originalSource = fiberNode?._debugSource;
51+
const source = fiberNode?._debugOwner?._debugSource ?? fiberNode?._debugSource;
52+
const line = source?.fileName?.startsWith("/") ? originalSource?.lineNumber : source?.lineNumber;
53+
const fileName = source?.fileName?.startsWith("/") ? originalSource?.fileName : source?.fileName;
54+
return sendJsonMessage({
55+
type: "open-source",
56+
data: { source: fileName, line, column: 0 },
57+
});
58+
}
59+
}
4760
});
4861
};
4962

0 commit comments

Comments
 (0)