diff --git a/.editorconfig b/.editorconfig index 986d8d028..40d581f39 100644 --- a/.editorconfig +++ b/.editorconfig @@ -11,12 +11,14 @@ ktlint_standard_keyword-spacing=disabled ktlint_standard_trailing-comma-on-call-site=disabled ktlint_standard_trailing-comma-on-declaration-site=disabled ktlint_standard_multiline-if-else=disabled -ktlint_standard_function-naming=disabled ktlint_standard_multiline-expression-wrapping=disabled ktlint_standard_string-template-indent=disabled ktlint_standard_function-signature=disabled ktlint_standard_discouraged-comment-location=disabled +# [test/*.{kt,kts}] +ktlint_standard_function-naming=disabled + insert_final_newline = false max_line_length = off diff --git a/src/nl/hannahsten/texifyidea/action/wizard/ipsum/InsertDummyTextAction.kt b/src/nl/hannahsten/texifyidea/action/wizard/ipsum/InsertDummyTextAction.kt index c71e52acd..76dfd7fd6 100644 --- a/src/nl/hannahsten/texifyidea/action/wizard/ipsum/InsertDummyTextAction.kt +++ b/src/nl/hannahsten/texifyidea/action/wizard/ipsum/InsertDummyTextAction.kt @@ -66,11 +66,7 @@ open class InsertDummyTextAction : AnAction() { // When itemize/enumerate/description is selected the level can be selected as well when larger than 1. val type = data.blindtextType - if (( - type == DummyTextData.BlindtextType.ITEMIZE || type == DummyTextData.BlindtextType.ENUMERATE || - type == DummyTextData.BlindtextType.DESCRIPTION - ) && data.blindtextLevel > 1 - ) { + if ((type == DummyTextData.BlindtextType.ITEMIZE || type == DummyTextData.BlindtextType.ENUMERATE || type == DummyTextData.BlindtextType.DESCRIPTION) && data.blindtextLevel > 1) { val command = "\\" + type.commandNoSlash.replace("list", "listlist[${data.blindtextLevel}]") insertAtCaretAndMove(command) return diff --git a/src/nl/hannahsten/texifyidea/algorithm/BFS.kt b/src/nl/hannahsten/texifyidea/algorithm/BFS.kt index e6ef90004..5fc9f08fa 100644 --- a/src/nl/hannahsten/texifyidea/algorithm/BFS.kt +++ b/src/nl/hannahsten/texifyidea/algorithm/BFS.kt @@ -278,6 +278,7 @@ class BFS(startNode: N, private val adjacencyFunction: (N) -> List, endNod */ enum class BFSAction { - CONTINUE, ABORT; + CONTINUE, + ABORT } } \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/completion/handlers/LatexCommandArgumentInsertHandler.kt b/src/nl/hannahsten/texifyidea/completion/handlers/LatexCommandArgumentInsertHandler.kt index 8348ddcfe..6dbb7bf36 100644 --- a/src/nl/hannahsten/texifyidea/completion/handlers/LatexCommandArgumentInsertHandler.kt +++ b/src/nl/hannahsten/texifyidea/completion/handlers/LatexCommandArgumentInsertHandler.kt @@ -11,8 +11,8 @@ import com.intellij.openapi.util.TextRange import nl.hannahsten.texifyidea.lang.commands.Argument import nl.hannahsten.texifyidea.lang.commands.RequiredArgument import nl.hannahsten.texifyidea.psi.LatexCommands -import nl.hannahsten.texifyidea.util.parser.endOffset import nl.hannahsten.texifyidea.util.files.psiFile +import nl.hannahsten.texifyidea.util.parser.endOffset import nl.hannahsten.texifyidea.util.parser.parentOfType /** @@ -31,8 +31,8 @@ class LatexCommandArgumentInsertHandler(val arguments: List? = null) : val offset = caret.offset // When not followed by { or [ (whichever the first parameter starts with) insert the parameters. if (arguments != null && ( - offset >= document.textLength - 1 || document.getText(TextRange.from(offset, 1)) !in setOf("{", "[") - ) + offset >= document.textLength - 1 || document.getText(TextRange.from(offset, 1)) !in setOf("{", "[") + ) ) { insertParametersLiveTemplate(editor) } diff --git a/src/nl/hannahsten/texifyidea/formatting/spacingrules/TableAlignRule.kt b/src/nl/hannahsten/texifyidea/formatting/spacingrules/TableAlignRule.kt index 1f068c2d8..e89526f66 100644 --- a/src/nl/hannahsten/texifyidea/formatting/spacingrules/TableAlignRule.kt +++ b/src/nl/hannahsten/texifyidea/formatting/spacingrules/TableAlignRule.kt @@ -24,10 +24,11 @@ fun rightTableSpaceAlign(latexCommonSettings: CommonCodeStyleSettings, parent: A if (left.node?.text?.endsWith("&") == false) return null if (left.node?.text?.endsWith("\\&") == true) return null - if (parent.node?.psi?.firstParentOfType(LatexEnvironmentContent::class) - ?.firstParentOfType(LatexEnvironment::class)?.getEnvironmentName() !in EnvironmentMagic.getAllTableEnvironments( - parent.node?.psi?.project ?: ProjectManager.getInstance().defaultProject - ) + if ( + parent.node?.psi?.firstParentOfType(LatexEnvironmentContent::class) + ?.firstParentOfType(LatexEnvironment::class)?.getEnvironmentName() !in EnvironmentMagic.getAllTableEnvironments( + parent.node?.psi?.project ?: ProjectManager.getInstance().defaultProject + ) ) return null return createSpacing( @@ -255,9 +256,9 @@ private fun getSpacesForRightBlock( ?: 0 ) > LINE_LENGTH if (( - relativeIndices.getOrNull(i)?.getOrNull(level) - ?: 0 - ) > LINE_LENGTH && (didPreviousCellGetNewline || level < absoluteIndices.size - 1) + relativeIndices.getOrNull(i)?.getOrNull(level) + ?: 0 + ) > LINE_LENGTH && (didPreviousCellGetNewline || level < absoluteIndices.size - 1) ) return -1 return spacesPerCell.getOrNull(min(i, spacesPerCell.size - 1))?.getOrNull(level) } diff --git a/src/nl/hannahsten/texifyidea/gutter/LatexElementColorProvider.kt b/src/nl/hannahsten/texifyidea/gutter/LatexElementColorProvider.kt index 390b88ffe..8b6110653 100644 --- a/src/nl/hannahsten/texifyidea/gutter/LatexElementColorProvider.kt +++ b/src/nl/hannahsten/texifyidea/gutter/LatexElementColorProvider.kt @@ -11,9 +11,9 @@ import nl.hannahsten.texifyidea.lang.commands.LatexColorDefinitionCommand import nl.hannahsten.texifyidea.lang.commands.RequiredArgument import nl.hannahsten.texifyidea.psi.LatexCommands import nl.hannahsten.texifyidea.psi.LatexPsiHelper -import nl.hannahsten.texifyidea.util.* import nl.hannahsten.texifyidea.util.magic.ColorMagic import nl.hannahsten.texifyidea.util.parser.* +import nl.hannahsten.texifyidea.util.toHexString import java.awt.Color import java.util.* import kotlin.math.max @@ -101,8 +101,9 @@ class LatexElementColorProvider : ElementColorProvider { // and we did not find it in the default colors (above), it should be in the // first parameter of a color definition command. If not, we can not find the // color (and return null in the end). - if (colorName.contains('!') || colorDefiningCommands.map { it.getRequiredArgumentValueByName("name") } - .contains(colorName) + if ( + colorName.contains('!') || + colorDefiningCommands.map { it.getRequiredArgumentValueByName("name") }.contains(colorName) ) { val colorDefinitionCommand = colorDefiningCommands.find { it.getRequiredArgumentValueByName("name") == colorName } diff --git a/src/nl/hannahsten/texifyidea/index/file/LatexExternalPackageInclusionCache.kt b/src/nl/hannahsten/texifyidea/index/file/LatexExternalPackageInclusionCache.kt index 010b5f62d..03328f44c 100644 --- a/src/nl/hannahsten/texifyidea/index/file/LatexExternalPackageInclusionCache.kt +++ b/src/nl/hannahsten/texifyidea/index/file/LatexExternalPackageInclusionCache.kt @@ -31,10 +31,10 @@ object LatexExternalPackageInclusionCache { FileBasedIndex.getInstance().getAllKeys(LatexExternalPackageInclusionIndex.Cache.id, project).forEach { indexKey -> FileBasedIndex.getInstance().processValues( LatexExternalPackageInclusionIndex.Cache.id, indexKey, null, { file, _ -> - val key = LatexPackage(file.name.removeFileExtension()) - directChildren[key] = directChildren.getOrDefault(key, mutableSetOf()).also { it.add(LatexPackage((indexKey))) } - true - }, + val key = LatexPackage(file.name.removeFileExtension()) + directChildren[key] = directChildren.getOrDefault(key, mutableSetOf()).also { it.add(LatexPackage((indexKey))) } + true + }, GlobalSearchScope.everythingScope(project) ) } diff --git a/src/nl/hannahsten/texifyidea/inspections/latex/codestyle/LatexLabelConventionInspection.kt b/src/nl/hannahsten/texifyidea/inspections/latex/codestyle/LatexLabelConventionInspection.kt index 09ce53587..1d14375af 100644 --- a/src/nl/hannahsten/texifyidea/inspections/latex/codestyle/LatexLabelConventionInspection.kt +++ b/src/nl/hannahsten/texifyidea/inspections/latex/codestyle/LatexLabelConventionInspection.kt @@ -41,13 +41,13 @@ open class LatexLabelConventionInspection : TexifyInspectionBase() { } if (label.inDirectEnvironmentMatching { - val conventionSettings = TexifyConventionsSettingsManager.getInstance(label.project).getSettings() - conventionSettings.getLabelConvention( + val conventionSettings = TexifyConventionsSettingsManager.getInstance(label.project).getSettings() + conventionSettings.getLabelConvention( it.getEnvironmentName(), LabelConventionType.ENVIRONMENT ) != null && - !EnvironmentMagic.labelAsParameter.contains(it.getEnvironmentName()) - } + !EnvironmentMagic.labelAsParameter.contains(it.getEnvironmentName()) + } ) { label.parentOfType(LatexEnvironment::class) } diff --git a/src/nl/hannahsten/texifyidea/inspections/latex/probablebugs/packages/LatexPackageCouldNotBeFound.kt b/src/nl/hannahsten/texifyidea/inspections/latex/probablebugs/packages/LatexPackageCouldNotBeFound.kt index 1de521bf8..57b80d855 100644 --- a/src/nl/hannahsten/texifyidea/inspections/latex/probablebugs/packages/LatexPackageCouldNotBeFound.kt +++ b/src/nl/hannahsten/texifyidea/inspections/latex/probablebugs/packages/LatexPackageCouldNotBeFound.kt @@ -9,10 +9,10 @@ import nl.hannahsten.texifyidea.inspections.InsightGroup import nl.hannahsten.texifyidea.inspections.TexifyInspectionBase import nl.hannahsten.texifyidea.psi.LatexCommands import nl.hannahsten.texifyidea.util.PackageUtils -import nl.hannahsten.texifyidea.util.parser.childrenOfType import nl.hannahsten.texifyidea.util.magic.GeneralMagic -import nl.hannahsten.texifyidea.util.projectSearchScope +import nl.hannahsten.texifyidea.util.parser.childrenOfType import nl.hannahsten.texifyidea.util.parser.requiredParameter +import nl.hannahsten.texifyidea.util.projectSearchScope import java.util.* class LatexPackageCouldNotBeFound : TexifyInspectionBase() { @@ -38,6 +38,7 @@ class LatexPackageCouldNotBeFound : TexifyInspectionBase() { .filter { it.name == "\\usepackage" || it.name == "\\RequirePackage" } for (command in commands) { + @Suppress("ktlint:standard:property-naming") val `package` = command.getRequiredParameters().firstOrNull()?.lowercase(Locale.getDefault()) if (!packages.contains(`package`)) { descriptors.add( diff --git a/src/nl/hannahsten/texifyidea/inspections/latex/probablebugs/packages/LatexPackageNotInstalledInspection.kt b/src/nl/hannahsten/texifyidea/inspections/latex/probablebugs/packages/LatexPackageNotInstalledInspection.kt index b22bb07e2..be2869d0d 100644 --- a/src/nl/hannahsten/texifyidea/inspections/latex/probablebugs/packages/LatexPackageNotInstalledInspection.kt +++ b/src/nl/hannahsten/texifyidea/inspections/latex/probablebugs/packages/LatexPackageNotInstalledInspection.kt @@ -21,9 +21,9 @@ import nl.hannahsten.texifyidea.psi.LatexCommands import nl.hannahsten.texifyidea.reference.InputFileReference import nl.hannahsten.texifyidea.settings.sdk.LatexSdkUtil import nl.hannahsten.texifyidea.util.TexLivePackages -import nl.hannahsten.texifyidea.util.projectSearchScope import nl.hannahsten.texifyidea.util.parser.childrenOfType import nl.hannahsten.texifyidea.util.parser.requiredParameter +import nl.hannahsten.texifyidea.util.projectSearchScope import nl.hannahsten.texifyidea.util.runCommand import java.util.* @@ -64,6 +64,7 @@ class LatexPackageNotInstalledInspection : TexifyInspectionBase() { .filter { it.name == "\\usepackage" || it.name == "\\RequirePackage" } for (command in commands) { + @Suppress("ktlint:standard:property-naming") val `package` = command.getRequiredParameters().firstOrNull()?.lowercase(Locale.getDefault()) ?: continue if (`package` !in packages) { // Use the cache or check if the file reference resolves (in the same way we resolve for the gutter icon). diff --git a/src/nl/hannahsten/texifyidea/inspections/latex/redundancy/LatexDuplicateLabelInspection.kt b/src/nl/hannahsten/texifyidea/inspections/latex/redundancy/LatexDuplicateLabelInspection.kt index c0ce90b7e..543af4d94 100644 --- a/src/nl/hannahsten/texifyidea/inspections/latex/redundancy/LatexDuplicateLabelInspection.kt +++ b/src/nl/hannahsten/texifyidea/inspections/latex/redundancy/LatexDuplicateLabelInspection.kt @@ -142,8 +142,7 @@ open class LatexDuplicateLabelInspection : TexifyInspectionBase() { /** * make the mapping from command etc. to ProblemDescriptor */ - private fun createProblemDescriptor(desc: LabelDescriptor, isOntheFly: Boolean, manager: InspectionManager): - ProblemDescriptor { + private fun createProblemDescriptor(desc: LabelDescriptor, isOntheFly: Boolean, manager: InspectionManager): ProblemDescriptor { return manager.createProblemDescriptor( desc.element, desc.textRange, diff --git a/src/nl/hannahsten/texifyidea/lang/BibtexDefaultEntryField.kt b/src/nl/hannahsten/texifyidea/lang/BibtexDefaultEntryField.kt index 3ced56c37..762f74d33 100644 --- a/src/nl/hannahsten/texifyidea/lang/BibtexDefaultEntryField.kt +++ b/src/nl/hannahsten/texifyidea/lang/BibtexDefaultEntryField.kt @@ -139,5 +139,5 @@ enum class BibtexDefaultEntryField( SORTTITLE("sorttitle", "A field used to modify the sorting order of the bibliography.", BIBLATEX), SORTYEAR("sortyear", "A field used to modify the sorting order of the bibliography.", BIBLATEX), XDATA("xdata", "This field inherits data from one or more @xdata entries.", BIBLATEX), - XREF("xref", "This field is an alternative cross-referencing mechanism.", BIBLATEX); + XREF("xref", "This field is an alternative cross-referencing mechanism.", BIBLATEX) } \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/lang/Environment.kt b/src/nl/hannahsten/texifyidea/lang/Environment.kt index 1a7383f2e..a8e4f31c6 100644 --- a/src/nl/hannahsten/texifyidea/lang/Environment.kt +++ b/src/nl/hannahsten/texifyidea/lang/Environment.kt @@ -35,19 +35,19 @@ interface Environment : Dependend, Described { val envs = mutableSetOf() FileBasedIndex.getInstance().processValues( LatexExternalEnvironmentIndex.Cache.id, environmentName, null, { file, value -> - val dependency = file.name.removeFileExtension() - val env = object : Environment { - override val arguments = extractArgumentsFromDocs(value) - override val description = value - override val dependency = - if (dependency.isBlank()) LatexPackage.DEFAULT else LatexPackage.create(file) - override val context = Context.NORMAL - override val initialContents = "" - override val environmentName = environmentName - } - envs.add(env) - true - }, + val dependency = file.name.removeFileExtension() + val env = object : Environment { + override val arguments = extractArgumentsFromDocs(value) + override val description = value + override val dependency = + if (dependency.isBlank()) LatexPackage.DEFAULT else LatexPackage.create(file) + override val context = Context.NORMAL + override val initialContents = "" + override val environmentName = environmentName + } + envs.add(env) + true + }, GlobalSearchScope.everythingScope(project) ) diff --git a/src/nl/hannahsten/texifyidea/lang/LatexRegularCommand.kt b/src/nl/hannahsten/texifyidea/lang/LatexRegularCommand.kt deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/nl/hannahsten/texifyidea/lang/commands/LatexCommand.kt b/src/nl/hannahsten/texifyidea/lang/commands/LatexCommand.kt index eecd30eb9..76ef43120 100644 --- a/src/nl/hannahsten/texifyidea/lang/commands/LatexCommand.kt +++ b/src/nl/hannahsten/texifyidea/lang/commands/LatexCommand.kt @@ -58,9 +58,9 @@ interface LatexCommand : Described, Dependend { runReadAction { FileBasedIndex.getInstance().processValues( LatexExternalCommandIndex.Cache.id, cmdWithSlash, null, { file, value -> - filesAndValues.add(Pair(file, value)) - true - }, + filesAndValues.add(Pair(file, value)) + true + }, GlobalSearchScope.everythingScope(project) ) } diff --git a/src/nl/hannahsten/texifyidea/psi/impl/LatexParameterTextImplMixin.kt b/src/nl/hannahsten/texifyidea/psi/impl/LatexParameterTextImplMixin.kt index e44b931f7..01237f618 100644 --- a/src/nl/hannahsten/texifyidea/psi/impl/LatexParameterTextImplMixin.kt +++ b/src/nl/hannahsten/texifyidea/psi/impl/LatexParameterTextImplMixin.kt @@ -99,8 +99,9 @@ abstract class LatexParameterTextImplMixin(node: ASTNode) : LatexParameterText, val command = this.firstParentOfType(LatexCommands::class) val environment = this.firstParentOfType(LatexEnvironment::class) // If we want to rename a label - if (CommandMagic.reference.contains(command?.name) || this.project.getLabelDefinitionCommands() - .contains(command?.name) + if ( + CommandMagic.reference.contains(command?.name) || + this.project.getLabelDefinitionCommands().contains(command?.name) ) { // Get a new psi this for the complete label command (\label included), // because if we replace the complete command instead of just the normal text diff --git a/src/nl/hannahsten/texifyidea/refactoring/introducecommand/LatexExtractCommandHandler.kt b/src/nl/hannahsten/texifyidea/refactoring/introducecommand/LatexExtractCommandHandler.kt index c310fd4d7..bf48f1515 100644 --- a/src/nl/hannahsten/texifyidea/refactoring/introducecommand/LatexExtractCommandHandler.kt +++ b/src/nl/hannahsten/texifyidea/refactoring/introducecommand/LatexExtractCommandHandler.kt @@ -275,6 +275,7 @@ interface ExtractExpressionUi { } // This allows us to run tests and mimic user input +@Suppress("ktlint:standard:property-naming") var MOCK: ExtractExpressionUi? = null @TestOnly diff --git a/src/nl/hannahsten/texifyidea/run/latex/logtab/LatexLogMessageExtractor.kt b/src/nl/hannahsten/texifyidea/run/latex/logtab/LatexLogMessageExtractor.kt index d3fc9b740..52aa7af45 100644 --- a/src/nl/hannahsten/texifyidea/run/latex/logtab/LatexLogMessageExtractor.kt +++ b/src/nl/hannahsten/texifyidea/run/latex/logtab/LatexLogMessageExtractor.kt @@ -66,10 +66,11 @@ object LatexLogMessageExtractor { // Look for warnings that need special treatment. specialWarningHandlersList.forEach { handler -> // Check if the match starts in 'text', because if not then we will encounter it again the next time - if (handler.regex.any { r -> - r.containsMatchIn(text) && - r.find(text)?.range?.start?.let { it <= text.removeSuffix(newText).length - 1 } == true - } + if ( + handler.regex.any { r -> + r.containsMatchIn(text) && + r.find(text)?.range?.start?.let { it <= text.removeSuffix(newText).length - 1 } == true + } ) { return handler.findMessage(text, newText, currentFile) } diff --git a/src/nl/hannahsten/texifyidea/run/latex/logtab/messagehandlers/errors/LatexErrorMessageProcessor.kt b/src/nl/hannahsten/texifyidea/run/latex/logtab/messagehandlers/errors/LatexErrorMessageProcessor.kt index 4c4e468a6..6660e6554 100644 --- a/src/nl/hannahsten/texifyidea/run/latex/logtab/messagehandlers/errors/LatexErrorMessageProcessor.kt +++ b/src/nl/hannahsten/texifyidea/run/latex/logtab/messagehandlers/errors/LatexErrorMessageProcessor.kt @@ -30,6 +30,7 @@ object LatexPackageErrorProcessor : LatexErrorMessageProcessor("""^Package ${Lat override fun process(message: String): String? { regex.forEach { + @Suppress("ktlint:standard:property-naming") val `package` = it.find(message)?.groups?.get("package")?.value ?: return@forEach return "${`package`}: ${it.replace(message, "").trim()}" } diff --git a/src/nl/hannahsten/texifyidea/run/latex/logtab/messagehandlers/warnings/LatexPackageWarningHandler.kt b/src/nl/hannahsten/texifyidea/run/latex/logtab/messagehandlers/warnings/LatexPackageWarningHandler.kt index 3a9ca3656..037c8df3a 100644 --- a/src/nl/hannahsten/texifyidea/run/latex/logtab/messagehandlers/warnings/LatexPackageWarningHandler.kt +++ b/src/nl/hannahsten/texifyidea/run/latex/logtab/messagehandlers/warnings/LatexPackageWarningHandler.kt @@ -15,6 +15,7 @@ object LatexPackageWarningHandler : LatexMessageHandler( override fun findMessage(text: String, newText: String, currentFile: String?): LatexLogMessage? { regex.forEach { it.find(text)?.apply { + @Suppress("ktlint:standard:property-naming") val `package` = groups["package"]?.value val unProcessedMessage = groups["message"]?.value ?: return@apply // Remove the (package) occurrences in the rest of the warning message. diff --git a/src/nl/hannahsten/texifyidea/run/sumatra/SumatraConversation.kt b/src/nl/hannahsten/texifyidea/run/sumatra/SumatraConversation.kt index dad15202c..5999cf44a 100644 --- a/src/nl/hannahsten/texifyidea/run/sumatra/SumatraConversation.kt +++ b/src/nl/hannahsten/texifyidea/run/sumatra/SumatraConversation.kt @@ -18,12 +18,12 @@ object SumatraConversation : ViewerConversation() { private const val SERVER = "SUMATRA" private const val TOPIC = "control" - private var CONVERSATION: DDEClientConversation? = null + private var conversation: DDEClientConversation? = null private fun openConversation() { - if (SumatraAvailabilityChecker.isSumatraAvailable && CONVERSATION == null) { + if (SumatraAvailabilityChecker.isSumatraAvailable && conversation == null) { try { - CONVERSATION = DDEClientConversation() + conversation = DDEClientConversation() } catch (e: NoClassDefFoundError) { throw TeXception("Native library DLLs could not be found.", e) @@ -74,14 +74,14 @@ object SumatraConversation : ViewerConversation() { private fun execute(vararg commands: String) { openConversation() try { - CONVERSATION!!.connect(SERVER, TOPIC) - CONVERSATION!!.execute(commands.joinToString(separator = "") { "[$it]" }) + conversation!!.connect(SERVER, TOPIC) + conversation!!.execute(commands.joinToString(separator = "") { "[$it]" }) } catch (e: Exception) { throw TeXception("Connection to SumatraPDF was disrupted.", e) } finally { - CONVERSATION?.disconnect() + conversation?.disconnect() } } @@ -95,7 +95,7 @@ object SumatraConversation : ViewerConversation() { BOOK_VIEW("book view"), CONTINUOUS("continuous"), CONTINUOUS_FACING("continuous facing"), - CONTINUOUS_BOOK_VIEW("continuous book view"); + CONTINUOUS_BOOK_VIEW("continuous book view") } /** diff --git a/src/nl/hannahsten/texifyidea/ui/symbols/SymbolToolWindowFactory.kt b/src/nl/hannahsten/texifyidea/ui/symbols/SymbolToolWindowFactory.kt index 9895dc2cb..a5297b5fb 100644 --- a/src/nl/hannahsten/texifyidea/ui/symbols/SymbolToolWindowFactory.kt +++ b/src/nl/hannahsten/texifyidea/ui/symbols/SymbolToolWindowFactory.kt @@ -164,7 +164,7 @@ open class SymbolToolWindowFactory : ToolWindowFactory, DumbAware { val latex = symbol.generatedLatex val caretLocationInGeneratedLatex = latex.indexOf("") - // When there is is a selection and a position is defined in the generated latex, + // When there is a selection and a position is defined in the generated latex, // then the generated latex can be seen as 2 parts. If there is text selected, enclose the // selected text by these two parts. When there is no caret, it is interpreted as ending at the end // of the generated latex which means just appending @@ -173,7 +173,7 @@ open class SymbolToolWindowFactory : ToolWindowFactory, DumbAware { val parts = latex.split("") editor.document.insertString(selection.selectionEnd, parts[1]) editor.document.insertString(selection.selectionStart, parts[0]) - editor.caretModel.moveToOffset(selection.selectionEnd + latex.length - 7 /* */) + editor.caretModel.moveToOffset(selection.selectionEnd + latex.length - 7) } } // Nothing needs to be enclosed: just append. diff --git a/src/nl/hannahsten/texifyidea/util/Packages.kt b/src/nl/hannahsten/texifyidea/util/Packages.kt index dc6a9919c..3f10bbe44 100644 --- a/src/nl/hannahsten/texifyidea/util/Packages.kt +++ b/src/nl/hannahsten/texifyidea/util/Packages.kt @@ -175,10 +175,7 @@ object PackageUtils { if (PackageMagic.conflictingPackages.any { it.contains(pack) }) { for (conflicts in PackageMagic.conflictingPackages) { // Assuming the package is not already included - if (conflicts.contains(pack) && file.includedPackages().toSet() - .intersect(conflicts) - .isNotEmpty() - ) { + if (conflicts.contains(pack) && file.includedPackages().toSet().intersect(conflicts).isNotEmpty()) { return false } } diff --git a/src/nl/hannahsten/texifyidea/util/labels/Labels.kt b/src/nl/hannahsten/texifyidea/util/labels/Labels.kt index 4d122f633..a80998d7a 100644 --- a/src/nl/hannahsten/texifyidea/util/labels/Labels.kt +++ b/src/nl/hannahsten/texifyidea/util/labels/Labels.kt @@ -17,8 +17,7 @@ import nl.hannahsten.texifyidea.util.files.psiFile * * @return A set containing all labels that are defined in the fileset of the given file. */ -fun PsiFile.findLatexAndBibtexLabelStringsInFileSet(): Set = - (findLatexLabelStringsInFileSetAsSequence() + findBibtexLabelsInFileSetAsSequence()).toSet() +fun PsiFile.findLatexAndBibtexLabelStringsInFileSet(): Set = (findLatexLabelStringsInFileSetAsSequence() + findBibtexLabelsInFileSetAsSequence()).toSet() /** * Finds all the defined latex labels in the fileset of the file. diff --git a/src/nl/hannahsten/texifyidea/util/parser/LatexCommandsImplMixinUtil.kt b/src/nl/hannahsten/texifyidea/util/parser/LatexCommandsImplMixinUtil.kt index 1e2905c36..7a26764d2 100644 --- a/src/nl/hannahsten/texifyidea/util/parser/LatexCommandsImplMixinUtil.kt +++ b/src/nl/hannahsten/texifyidea/util/parser/LatexCommandsImplMixinUtil.kt @@ -135,7 +135,7 @@ fun stripGroup(text: String): String { * If a value does not have a name, the value will be the key in the hashmap mapping to the empty string. */ // Explicitly use a LinkedHashMap to preserve iteration order -fun Map.toStringMap(): LinkedHashMap { +fun Map.toStringMap(): LinkedHashMap { val parameterMap = LinkedHashMap() this.forEach { (k, v) -> parameterMap[k.toString()] = v?.toString() ?: "" } return parameterMap diff --git a/test/nl/hannahsten/texifyidea/index/file/LatexExternalCommandDataIndexerTest.kt b/test/nl/hannahsten/texifyidea/index/file/LatexExternalCommandDataIndexerTest.kt index 0f3a36ddf..eb79275ab 100644 --- a/test/nl/hannahsten/texifyidea/index/file/LatexExternalCommandDataIndexerTest.kt +++ b/test/nl/hannahsten/texifyidea/index/file/LatexExternalCommandDataIndexerTest.kt @@ -242,7 +242,9 @@ class LatexExternalCommandDataIndexerTest : BasePlatformTestCase() { class MockContent(val file: PsiFile) : FileContent { - override fun getUserData(key: Key): T? { return null } + override fun getUserData(key: Key): T? { + return null + } override fun putUserData(key: Key, value: T?) { } diff --git a/test/nl/hannahsten/texifyidea/index/file/LatexExternalEnvironmentDataIndexerTest.kt b/test/nl/hannahsten/texifyidea/index/file/LatexExternalEnvironmentDataIndexerTest.kt index 351cad295..cfa2d7f09 100644 --- a/test/nl/hannahsten/texifyidea/index/file/LatexExternalEnvironmentDataIndexerTest.kt +++ b/test/nl/hannahsten/texifyidea/index/file/LatexExternalEnvironmentDataIndexerTest.kt @@ -57,7 +57,9 @@ class LatexExternalEnvironmentDataIndexerTest : BasePlatformTestCase() { class MockContent(val file: PsiFile) : FileContent { - override fun getUserData(key: Key): T? { return null } + override fun getUserData(key: Key): T? { + return null + } override fun putUserData(key: Key, value: T?) { } diff --git a/test/nl/hannahsten/texifyidea/util/KtorUtilKtTest.kt b/test/nl/hannahsten/texifyidea/util/KtorUtilKtTest.kt index e1ed44487..7044e19dc 100644 --- a/test/nl/hannahsten/texifyidea/util/KtorUtilKtTest.kt +++ b/test/nl/hannahsten/texifyidea/util/KtorUtilKtTest.kt @@ -1,6 +1,6 @@ package nl.hannahsten.texifyidea.util -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test internal class KtorUtilKtTest {