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

Issue 10 #14

Merged
merged 4 commits into from
Mar 30, 2018
Merged

Issue 10 #14

merged 4 commits into from
Mar 30, 2018

Conversation

davidritter
Copy link
Contributor

This change addresses the issue described in:
#10

Update the execFile call to specify the maxBuffer size to be tuneable
and larger than 200KB.  By default the plugin will now look up the
current file size and allocate 2x the buffer to allow room for
whitespace and formatting expansion.

This also fixes the issue where the plugin could not format files
that were large than 200KB.

Add a new configuation option to allow a user to tune the buffer
multiplier to custom values.

Update documentation.
Copy link
Owner

@welkineins welkineins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi David,

I did forgot to send the comment.

I think the max buffer size should at least larger than default value 200*1024, this can prevent failed to output error message for a very small file.

Please help to change this.

Thank you :)

extension.js Outdated
@@ -25,16 +32,19 @@ class AstyleFormatter {
});

astyleBinPath = astyleBinPath.replace(/\${workspaceRoot}/g, vscode.workspace.rootPath);

// Assume that the formatting/expansion of the document could double it's size
const maxBufferSize = this.getFilesizeInBytes(document.fileName) * astyleMaxBufferMultiplier;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @davidritter,

Thank you very much for fixing this issue!!
After review, I think it would be better to set max buffer size at least larger than default value 200*1024.
I'll merge this PR and release new version soon later.

Thanks.

calculated new multiplier buffer size for a larger file or use the default
value for execFile to avoid any pointless buffer resizes.
@welkineins welkineins merged commit bacc9d9 into welkineins:master Mar 30, 2018
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

Successfully merging this pull request may close these issues.

2 participants