Skip to content

Commit

Permalink
Fix wrong link to LT rule when using auto language
Browse files Browse the repository at this point in the history
  • Loading branch information
valentjn committed Oct 14, 2021
1 parent c39a07f commit 2e1227e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ data class LanguageToolRuleMatch(
message,
suggestedReplacements,
type,
annotatedTextFragment.codeFragment.settings.languageShortCode,
annotatedTextFragment.codeFragment.languageShortCode,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ data class CodeFragment(
val code: String,
val fromPos: Int,
val settings: Settings,
var languageShortCode: String = settings.languageShortCode,
) {
fun contains(match: LanguageToolRuleMatch): Boolean {
return ((match.fromPos >= this.fromPos)
Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/org/bsplines/ltexls/server/DocumentChecker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ class DocumentChecker(
annotatedTextFragment.annotatedText.plainText,
)
val language: Language? = this.languageIdentifier.detectLanguage(cleanText)
settings = settings.copy(
_languageShortCode = language?.shortCodeWithCountryAndVariant ?: "en-US",
)
val languageShortCode: String = language?.shortCodeWithCountryAndVariant ?: "en-US"
annotatedTextFragment.codeFragment.languageShortCode = languageShortCode
settings = settings.copy(_languageShortCode = languageShortCode)
}

this.settingsManager.settings = settings
Expand Down

0 comments on commit 2e1227e

Please sign in to comment.