[go: nahoru, domu]

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

improve performance when using BracePair #48

Merged
merged 5 commits into from
May 2, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
pairs should not be lazy
  • Loading branch information
izhangzhihao committed May 1, 2018
commit 94f7340c3a6cca0414dc8e7c4926bb9a69d45b16
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,20 @@ object BracePairs {
return@map language to null
}

val pairs by lazy {
LanguageBraceMatching.INSTANCE.forLanguage(language)?.pairs.let {
if (it == null || it.isEmpty()) {
language.associatedFileType
?.let { BraceMatchingUtil.getBraceMatcher(it, language) as? PairedBraceMatcher }
?.pairs
} else {
it
val pairs =
LanguageBraceMatching.INSTANCE.forLanguage(language)?.pairs.let {
if (it == null || it.isEmpty()) {
language.associatedFileType
?.let { BraceMatchingUtil.getBraceMatcher(it, language) as? PairedBraceMatcher }
?.pairs
} else {
it
}
}
}
}

val pairsList = providers.forLanguage(language)?.pairs?.let {
if (pairs != null && pairs.isNotEmpty()) {
it.toMutableSet().apply { addAll(pairs) }.toList()
it.toMutableSet().apply { addAll(pairs) }
} else {
it
}
Expand Down