Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sudojunior opened this issue Aug 11, 2023 · 0 comments
Open

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

sudojunior opened this issue Aug 11, 2023 · 0 comments

Comments

@sudojunior
Copy link
Member

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');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant