From f8e9f87b6554b527c61ba963d0c96c7687cbaae9 Mon Sep 17 00:00:00 2001 From: Henning Dieterichs Date: Thu, 26 Aug 2021 16:09:09 +0200 Subject: [PATCH] Adds comments. --- .../editor/common/model/bracketPairColorizer/concat23Trees.ts | 2 ++ src/vs/editor/common/model/bracketPairColorizer/nodeReader.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/src/vs/editor/common/model/bracketPairColorizer/concat23Trees.ts b/src/vs/editor/common/model/bracketPairColorizer/concat23Trees.ts index 8fb21788fde..1756fa9e577 100644 --- a/src/vs/editor/common/model/bracketPairColorizer/concat23Trees.ts +++ b/src/vs/editor/common/model/bracketPairColorizer/concat23Trees.ts @@ -8,6 +8,8 @@ import { AstNode, ListAstNode } from './ast'; /** * Concatenates a list of (2,3) AstNode's into a single (2,3) AstNode. * This mutates the items of the input array! + * If all items have the same height, this method has runtime O(items.length). + * Otherwise, it has runtime O(items.length * max(log(items.length), items.max(i => i.height))). */ export function concat23Trees(items: AstNode[]): AstNode | null { if (items.length === 0) { diff --git a/src/vs/editor/common/model/bracketPairColorizer/nodeReader.ts b/src/vs/editor/common/model/bracketPairColorizer/nodeReader.ts index af56e6deba4..cc938d38b15 100644 --- a/src/vs/editor/common/model/bracketPairColorizer/nodeReader.ts +++ b/src/vs/editor/common/model/bracketPairColorizer/nodeReader.ts @@ -24,6 +24,7 @@ export class NodeReader { /** * Returns the longest node at `offset` that satisfies the predicate. + * Has runtime O(log n) where n is the number of nodes in the tree. * @param offset must be greater than or equal to the last offset this method has been called with! */ readLongestNodeAt(offset: Length, predicate: (node: AstNode) => boolean): AstNode | undefined {