MCPcopy Create free account
hub / github.com/sourcebot-dev/sourcebot /

Class

packages/web/src/lib/extensions/gutterWidthExtension.ts:6–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4 * Measures the width of the gutter and stores it in the plugin instance.
5 */
6export const gutterWidthExtension = ViewPlugin.fromClass(class {
7 width: number = 0;
8
9 constructor (view: EditorView) {
10 this.measureWidth(view);
11 }
12
13 update = (update: ViewUpdate) => {
14 if (update.geometryChanged) {
15 this.measureWidth(update.view);
16 }
17 }
18
19 measureWidth = (view: EditorView) => {
20 const gutter = view.scrollDOM.querySelector('.cm-gutters') as HTMLElement;
21 if (gutter) {
22 this.width = gutter.offsetWidth;
23 }
24 }
25});

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected