MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / update

Method update

src/cm/indentGuides.ts:308–351  ·  view source on GitHub ↗
(update: ViewUpdate)

Source from the content-addressed store, hash-verified

306 }
307
308 update(update: ViewUpdate): void {
309 const { view, state } = update;
310 let needsRebuild = false;
311
312 if (update.docChanged) {
313 this.decorations = this.decorations.map(update.changes);
314 this.lineCache.clear();
315 needsRebuild = true;
316 }
317
318 if (update.viewportChanged) {
319 needsRebuild = true;
320 }
321
322 const currentTabSize = getTabSize(state);
323 const currentIndentUnit = getIndentUnitColumns(state);
324 const currentCharWidth = view.defaultCharacterWidth;
325
326 if (
327 currentTabSize !== this.lastTabSize ||
328 currentIndentUnit !== this.lastIndentUnit
329 ) {
330 this.lastTabSize = currentTabSize;
331 this.lastIndentUnit = currentIndentUnit;
332 this.lineCache.clear();
333 this.styleCache.clear();
334 needsRebuild = true;
335 }
336
337 if (currentCharWidth !== this.lastCharWidth) {
338 this.lastCharWidth = currentCharWidth;
339 this.styleCache.clear();
340 needsRebuild = true;
341 }
342
343 if (needsRebuild) {
344 this.decorations = buildDecorations(
345 view,
346 config,
347 this.lineCache,
348 this.styleCache,
349 );
350 }
351 }
352
353 destroy(): void {
354 this.lineCache.clear();

Callers 6

promptUpdateCheckConsentFunction · 0.45
updateFontSizeMethod · 0.45
applyFunction · 0.45
adjustFontSizeFunction · 0.45
adjustUiZoomFunction · 0.45
setHeightFunction · 0.45

Calls 4

getTabSizeFunction · 0.85
getIndentUnitColumnsFunction · 0.85
buildDecorationsFunction · 0.85
clearMethod · 0.45

Tested by

no test coverage detected