Skip to content

Instantly share code, notes, and snippets.

@jasonLaster
Created September 21, 2022 16:07
Show Gist options
  • Save jasonLaster/e8eac5691f988f19721ca556cbfaec0d to your computer and use it in GitHub Desktop.
Save jasonLaster/e8eac5691f988f19721ca556cbfaec0d to your computer and use it in GitHub Desktop.
diff --git a/src/devtools/client/debugger/src/components/Editor/LineHitCounts.tsx b/src/devtools/client/debugger/src/components/Editor/LineHitCounts.tsx
index 3af52ff79..05b4d7f6c 100644
--- a/src/devtools/client/debugger/src/components/Editor/LineHitCounts.tsx
+++ b/src/devtools/client/debugger/src/components/Editor/LineHitCounts.tsx
@@ -137,6 +137,11 @@ function LineHitCounts({ sourceEditor }: Props) {
`-${gutterWidth}`
);
+ (gutterElement as HTMLElement).parentElement!.style.setProperty(
+ "--print-statement-button-right-offset"
+ // insert massive ternary here
+ );
+
return () => {
try {
editor.setOption("gutters", ["breakpoints", "CodeMirror-linenumbers"]);
diff --git a/src/devtools/client/debugger/src/components/Editor/StaticTooltip.tsx b/src/devtools/client/debugger/src/components/Editor/StaticTooltip.tsx
index df20d9c26..0c37731a0 100644
--- a/src/devtools/client/debugger/src/components/Editor/StaticTooltip.tsx
+++ b/src/devtools/client/debugger/src/components/Editor/StaticTooltip.tsx
@@ -17,17 +17,9 @@ export default function StaticTooltip({ targetNode, children }: StaticTooltipPro
<div
className={classNames(
"pointer-events-none absolute bottom-4 z-50 mb-0.5 flex translate-x-full transform flex-row space-x-px",
- enableLargeText && "bottom-6",
- hitCountsMode === "show-counts" ? "-right-[20px]" : "-right-[10px]"
+ enableLargeText && "bottom-6"
)}
- style={{
- right:
- hitCountsMode === "show-counts"
- ? "calc(var(--hit-count-gutter-width) - 6px)"
- : hitCountsMode === "hide-counts"
- ? "-10px"
- : "0px",
- }}
+ style={{ right: "var(--print-statement-right-offset)" }}
>
{children}
</div>,
diff --git a/src/devtools/client/debugger/src/components/Editor/ToggleWidgetButton.tsx b/src/devtools/client/debugger/src/components/Editor/ToggleWidgetButton.tsx
index 49192a306..8b79f72c5 100644
--- a/src/devtools/client/debugger/src/components/Editor/ToggleWidgetButton.tsx
+++ b/src/devtools/client/debugger/src/components/Editor/ToggleWidgetButton.tsx
@@ -150,13 +150,7 @@ function QuickActions({
// If hit counts are shown, the button should not overlap with the gutter.
// The gutter size changes though based on the number of hits, so we use a CSS variable.
- right:
- // we should move this util to a shared function
- hitCountsMode === "show-counts"
- ? "calc(var(--hit-count-gutter-width) - 6px)"
- : hitCountsMode === "hide-counts"
- ? "-10px"
- : "0px",
+ right: "var(--print-statement-right-offset)",
}}
>
{button}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment