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

Function getLineIndentation

src/cm/indentGuides.ts:65–77  ·  view source on GitHub ↗

* Calculate the visual indentation of a line

(line: string, tabSize: number)

Source from the content-addressed store, hash-verified

63 * Calculate the visual indentation of a line
64 */
65function getLineIndentation(line: string, tabSize: number): number {
66 let columns = 0;
67 for (const ch of line) {
68 if (ch === " ") {
69 columns++;
70 } else if (ch === "\t") {
71 columns += tabSize - (columns % tabSize);
72 } else {
73 break;
74 }
75 }
76 return columns;
77}
78
79/**
80 * Check if a line is blank

Callers 1

getCachedLineInfoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected