This repository has been archived by the owner on Oct 10, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 52
Allow regex groups *after* keyword groups #335
Merged
buehler
merged 4 commits into
buehler:develop
from
deliciousinsights:non-keyword-groups-take-precedence
Nov 5, 2017
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f384ee7
fix(tests): guarantee 4-space indent for code action insertions
tdd d5a447f
fix(organize-imports): honor regex groups even if after keywords
tdd 9f2f5b4
style: fix linter issues
tdd cbb8199
fix(tests): adjust for newer import group settings
tdd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
test/single-workspace-tests/extension/utilities/utilityFunctions.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import * as chai from 'chai'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please switch to an intend of 4 spaces (to adhere with the rest of the code) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dang! I did in the other PR (there's gonna be a conflict, btw, as this file is introduced in both, so once #336 is merged in, I'll re-work this so it merges fine). |
||
chai.should(); | ||
|
||
import { KeywordImportGroup, ImportGroupKeyword, RegexImportGroup } from '../../../../src/extension/import-grouping'; | ||
import { importGroupSortForPrecedence } from '../../../../src/extension/utilities/utilityFunctions'; | ||
|
||
describe('utilityFunctions', () => { | ||
describe('importGroupSortForPrecedence', () => { | ||
it('should prioritize regexes, leaving original order untouched besides that', () => { | ||
const initialList = [ | ||
new KeywordImportGroup(ImportGroupKeyword.Modules), | ||
new KeywordImportGroup(ImportGroupKeyword.Plains), | ||
new RegexImportGroup("/cool-library/"), | ||
new RegexImportGroup("/cooler-library/"), | ||
new KeywordImportGroup(ImportGroupKeyword.Workspace), | ||
] | ||
const expectedList = initialList.slice(2, 4) | ||
.concat(initialList.slice(0, 2)) | ||
.concat(initialList.slice(4)) | ||
|
||
importGroupSortForPrecedence(initialList).should.deep.equal(expectedList, | ||
'Regex Import Groups should appear first (and that should be the only change)') | ||
}); | ||
}); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually.. clever :-)