Skip to content

refactor(/code *): rework handling of resulting context #49

Open
@sudojunior

Description

@sudojunior

The construction of the resulting content was purpose built to be passed directly to the returned object as a matching variable, and while that is favourable for a direct pass-through... not so much for the while loop, which repeatedly splits and joins the string until it has been trimmed to size. #47 would be designed to work around this mechanism, but for its own reason.

Intention to rework content as lines which remains held in its array format, so that the while loop can use the array without needing code to split and join.

let content = [
this.generateContentHeader(file, [startLine, actualStart], [endLine, actualEnd]),
[...amendNotes].map((note) => `> ${note}`),
'```ts',
lineSelection.map((line, index) =>
this.generateCodeLine(line, actualStart + index, actualEnd, shouldHaveLineNumbers)
),
'```'
]
.flat()
.join('\n');

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions