MCPcopy Create free account
hub / github.com/cursorless-dev/cursorless / getWebviewContent

Function getWebviewContent

src/core/FontMeasurements.ts:106–127  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

104}
105
106function getWebviewContent() {
107 // baseline adjustment based on https://stackoverflow.com/a/27295528
108 return `<!DOCTYPE html>
109 <html lang="en">
110 <body>
111 <h1>Loading Cursorless...</h1>
112 <div id="container">
113 <span id="letter" style="line-height: 0; visibility:hidden; font-size: 1000px; font-family: var(--vscode-editor-font-family); font-weight: var(--vscode-editor-font-weight);">A</span>
114 </div>
115 <script>
116 const letter = document.querySelector('#letter');
117 const container = document.querySelector('#container');
118 const baselineHeight = letter.offsetTop + letter.offsetHeight - container.offsetHeight - container.offsetTop;
119 const vscode = acquireVsCodeApi();
120 vscode.postMessage({
121 widthRatio: letter.offsetWidth / 1000,
122 heightRatio: (letter.offsetHeight - baselineHeight) / 1000
123 });
124 </script>
125 </body>
126 </html>`;
127}

Callers 1

getFontRatiosFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected