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

Resolved Issue #5 #35

Merged
merged 5 commits into from
May 14, 2018
Merged

Resolved Issue #5 #35

merged 5 commits into from
May 14, 2018

Conversation

SoftwareApe
Copy link
Contributor

I looked at this issue #5 which was also bothering me a little bit sometimes. I changed one of the test files to also contain empty lines to remove (spaces, mixed tabs and spaces and empty).

@SoftwareApe
Copy link
Contributor Author

The linter failed at wrong use of quotation marks. Changed in new commit.

@@ -14,13 +14,17 @@ function sortActiveSelection(algorithm: SortingAlgorithm, removeDuplicateValues:
function sortLines(textEditor: vscode.TextEditor, startLine: number, endLine: number, algorithm: SortingAlgorithm, removeDuplicateValues: boolean): Thenable<boolean> {
const lines: string[] = [];
for (let i = startLine; i <= endLine; i++) {
lines.push(textEditor.document.lineAt(i).text);
}
lines.push(textEditor.document.lineAt(i).text);
Copy link
Owner

Choose a reason for hiding this comment

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

Indentation is off

lines.push(textEditor.document.lineAt(i).text);
}
lines.push(textEditor.document.lineAt(i).text);
}
Copy link
Owner

Choose a reason for hiding this comment

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

Indentation is off

lines.sort(algorithm);

if (removeDuplicateValues) {
removeDuplicates(lines, algorithm);
}
}
Copy link
Owner

Choose a reason for hiding this comment

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

Indentation is off

@Tyriar
Copy link
Owner

Tyriar commented May 6, 2018

Sorry about the delay, maybe this should be an option instead of the always on as it could break some people? How about sortLines.removeEmptyLines, a default of true is fine. You'll need to add a configuration contribution, see https://code.visualstudio.com/docs/extensionAPI/extension-points#_contributesconfiguration

@SoftwareApe
Copy link
Contributor Author

I made the setting configurable as requested. I couldn't figure out how to switch the setting properly on and off without messing with user settings for the unit tests, so I now reverted the test cases to the old state. If you have an idea how to add test cases for this feature I think that might be good.

@SoftwareApe
Copy link
Contributor Author

BTW I named it sortLines.filterBlankLines, because it doesn't filter only empty lines, but also pure white space lines (tabs/spaces/mixed).

@Tyriar
Copy link
Owner

Tyriar commented May 14, 2018

Looks great, thanks 😃

@Tyriar Tyriar merged commit fe798e2 into Tyriar:master May 14, 2018
@Tyriar
Copy link
Owner

Tyriar commented May 14, 2018

Published v1.7.0

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.

3 participants