diff --git a/qodana.yaml b/qodana.yaml index 9f570678d..4ae606df6 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -21,6 +21,8 @@ exclude: # Some of these are valid inspections but not important or accurate eno - build - test - src/nl/hannahsten/texifyidea/action/preview/PreviewForm.form + # The class is unused, see TexifyProjectConfigurable + - src/nl/hannahsten/texifyidea/settings/TexifyProjectSettings.kt - name: BooleanMethodIsAlwaysInverted - name: SpellCheckingInspection - name: UseJBColor # In many cases we're not defining theme-dependent colors @@ -28,10 +30,6 @@ exclude: # Some of these are valid inspections but not important or accurate eno - name: LanguageDetectionInspection - name: GrazieInspection - name: CheckDependencyLicenses # TeXiFy violates all sorts of licenses, don't care - - name: RetrievingService - paths: - # The class is unused, see TexifyProjectConfigurable - - src/nl/hannahsten/texifyidea/settings/TexifyProjectSettings.kt # Qodana false positives: - name: EmptyMethod - name: SameReturnValue diff --git a/resources/META-INF/actions/actions.xml b/resources/META-INF/actions/actions.xml index 98c17a329..8570b1e04 100644 --- a/resources/META-INF/actions/actions.xml +++ b/resources/META-INF/actions/actions.xml @@ -6,16 +6,18 @@ - + + - + + + text="_Word Count" description="Estimate the word count of the currently active .tex file and inclusions." icon="nl.hannahsten.texifyidea.TexifyIcons.WORD_COUNT"> diff --git a/resources/META-INF/actions/editmenu.xml b/resources/META-INF/actions/editmenu.xml index 883a32397..7f1af42a6 100644 --- a/resources/META-INF/actions/editmenu.xml +++ b/resources/META-INF/actions/editmenu.xml @@ -8,7 +8,7 @@ + description="Adds/removes a star from a LaTeX command." icon="nl.hannahsten.texifyidea.TexifyIcons.TOGGLE_STAR"> @@ -38,19 +38,19 @@ + text="_Part" description="Insert the part command." icon="nl.hannahsten.texifyidea.TexifyIcons.DOT_PART" /> + text="_Chapter" description="Insert the chapter command." icon="nl.hannahsten.texifyidea.TexifyIcons.DOT_CHAPTER"/> + text="_Section" description="Insert the section command." icon="nl.hannahsten.texifyidea.TexifyIcons.DOT_SECTION" /> + text="S_ubsection" description="Insert the subsection command." icon="nl.hannahsten.texifyidea.TexifyIcons.DOT_SUBSECTION" /> + text="Su_bsubsection" description="Insert the subsubsection command." icon="nl.hannahsten.texifyidea.TexifyIcons.DOT_SUBSUBSECTION" /> + text="_Paragraph" description="Insert the paragraph command." icon="nl.hannahsten.texifyidea.TexifyIcons.DOT_PARAGRAPH" /> + text="Subp_aragraph" description="Insert the subparagraph command." icon="nl.hannahsten.texifyidea.TexifyIcons.DOT_SUBPARAGRAPH" /> @@ -59,43 +59,45 @@ + text="_Bold" description="Insert the command to make text appear bold." icon="nl.hannahsten.texifyidea.TexifyIcons.FONT_BOLD"> + text="_Italics" description="Insert the command to make text appear in italics." icon="nl.hannahsten.texifyidea.TexifyIcons.FONT_ITALICS"> + text="_Underline" description="Insert the command to underline text." icon="nl.hannahsten.texifyidea.TexifyIcons.FONT_UNDERLINE" > + text="_Overline" description="Insert the command to overline text." icon="nl.hannahsten.texifyidea.TexifyIcons.FONT_OVERLINE"> + text="Small _Capitals" description="Insert the command to underline text." icon="nl.hannahsten.texifyidea.TexifyIcons.FONT_SMALLCAPS"> + text="_Typewriter (Monospace)" description="Insert the command to make text monospace." icon="nl.hannahsten.texifyidea.TexifyIcons.FONT_TYPEWRITER"> + description="Insert the command to strikethrough text (inclusion of ulem package required)." icon="nl.hannahsten.texifyidea.TexifyIcons.FONT_STRIKETHROUGH"> + text="S_lanted" + description="Insert the command to make text appear slanted." + icon="nl.hannahsten.texifyidea.TexifyIcons.FONT_SLANTED"> diff --git a/resources/META-INF/actions/toolsmenu.xml b/resources/META-INF/actions/toolsmenu.xml index 060ecaacf..ba74f5862 100644 --- a/resources/META-INF/actions/toolsmenu.xml +++ b/resources/META-INF/actions/toolsmenu.xml @@ -14,19 +14,19 @@ + text="Preview _Equation" icon="nl.hannahsten.texifyidea.TexifyIcons.EQUATION_PREVIEW"> + text="Preview _Tikz Picture" icon="nl.hannahsten.texifyidea.TexifyIcons.TIKZ_PREVIEW"> - + diff --git a/src/nl/hannahsten/texifyidea/TexifyIcons.kt b/src/nl/hannahsten/texifyidea/TexifyIcons.kt index c844e3fc0..3493e52d6 100644 --- a/src/nl/hannahsten/texifyidea/TexifyIcons.kt +++ b/src/nl/hannahsten/texifyidea/TexifyIcons.kt @@ -14,198 +14,249 @@ object TexifyIcons { "/nl/hannahsten/texifyidea/icons/text-file.svg", TexifyIcons::class.java ) + @JvmField val LATEX_FILE = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/latex-file.svg", TexifyIcons::class.java ) or IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/latex-file-alt.svg", TexifyIcons::class.java ) + @JvmField val TIKZ_FILE = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/tikz-file.svg", TexifyIcons::class.java ) + @JvmField val PDF_FILE = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/pdf-file.svg", TexifyIcons::class.java ) + @JvmField val DVI_FILE = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/dvi-file.svg", TexifyIcons::class.java ) + @JvmField val BIBLIOGRAPHY_FILE = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/bibliography-file.svg", TexifyIcons::class.java ) + @JvmField val CLASS_FILE = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/class-file.svg", TexifyIcons::class.java ) + @JvmField val DOCUMENTED_LATEX_SOURCE = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/doc-latex-file.svg", TexifyIcons::class.java ) + @JvmField val STYLE_FILE = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/style-file.svg", TexifyIcons::class.java ) + @JvmField val FILE = TEXT_FILE + @JvmField val SYNCTEX_FILE = TEXT_FILE + @JvmField val AUX_FILE = TEXT_FILE + @JvmField val TABLE_OF_CONTENTS_FILE = TEXT_FILE + @JvmField val BBL_FILE = TEXT_FILE + @JvmField val BUILD = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/build.svg", TexifyIcons::class.java ) + @JvmField val BUILD_BIB = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/bib-build.svg", TexifyIcons::class.java ) + @JvmField val LATEX_MODULE = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/latex-module.svg", TexifyIcons::class.java ) + @JvmField val DOT_LATEX = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/dot-tex.svg", TexifyIcons::class.java ) + @JvmField val DOT_COMMAND = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/dot-cmd.svg", TexifyIcons::class.java ) + @JvmField val DOT_LABEL = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/dot-lbl.svg", TexifyIcons::class.java ) + @JvmField val DOT_BIB = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/dot-bib.svg", TexifyIcons::class.java ) + @JvmField val DOT_INCLUDE = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/dot-incl.svg", TexifyIcons::class.java ) + @JvmField val DOT_ENVIRONMENT = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/dot-env.svg", TexifyIcons::class.java ) + @JvmField val DOT_CLASS = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/dot-cls.svg", TexifyIcons::class.java ) + @JvmField val DOT_NUMBER = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/dot-num.svg", TexifyIcons::class.java ) + @JvmField val DOT_CHAPTER = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/dot-chap.svg", TexifyIcons::class.java ) + @JvmField val DOT_PART = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/dot-part.svg", TexifyIcons::class.java ) + @JvmField val DOT_SECTION = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/dot-sec.svg", TexifyIcons::class.java ) + @JvmField val DOT_SUBSECTION = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/dot-subsec.svg", TexifyIcons::class.java ) + @JvmField val DOT_SUBSUBSECTION = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/dot-subsubsec.svg", TexifyIcons::class.java ) + @JvmField val DOT_PARAGRAPH = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/dot-par.svg", TexifyIcons::class.java ) + @JvmField val DOT_SUBPARAGRAPH = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/dot-subpar.svg", TexifyIcons::class.java ) + @JvmField val FONT_BOLD = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/font-bold.svg", TexifyIcons::class.java ) + @JvmField val FONT_ITALICS = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/font-italics.svg", TexifyIcons::class.java ) + @JvmField val FONT_UNDERLINE = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/font-underline.svg", TexifyIcons::class.java ) + @JvmField val FONT_OVERLINE = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/font-overline.svg", TexifyIcons::class.java ) + @JvmField val FONT_SMALLCAPS = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/font-smallcaps.svg", TexifyIcons::class.java ) + @JvmField val FONT_TYPEWRITER = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/font-mono.svg", TexifyIcons::class.java ) + @JvmField val FONT_STRIKETHROUGH = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/font-strike.svg", TexifyIcons::class.java ) + @JvmField val FONT_SLANTED = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/font-slanted.svg", TexifyIcons::class.java ) + @JvmField val SUMATRA = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/sumatra.svg", TexifyIcons::class.java ) + @JvmField val WORD_COUNT = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/word-count.svg", TexifyIcons::class.java ) + @JvmField val TOGGLE_STAR = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/toggle-star.svg", TexifyIcons::class.java ) + @JvmField val STATS = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/stats.svg", TexifyIcons::class.java ) + @JvmField val RIGHT = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/right.svg", TexifyIcons::class.java ) + @JvmField val EQUATION_PREVIEW = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/equation-preview.svg", TexifyIcons::class.java ) + @JvmField val TIKZ_PREVIEW = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/tikz-preview.svg", TexifyIcons::class.java ) + @JvmField val SYMBOLS = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/symbols.svg", TexifyIcons::class.java ) + @JvmField val STRING = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/string.svg", TexifyIcons::class.java ) + @JvmField val KEY_REQUIRED = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/key-required.svg", TexifyIcons::class.java ) + @JvmField val KEY_USER_DEFINED = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/key-user.svg", TexifyIcons::class.java ) + @JvmField val INSPECTION = IconLoader.getIcon( "/nl/hannahsten/texifyidea/icons/inspections-eye.svg", TexifyIcons::class.java ) @@ -213,6 +264,7 @@ object TexifyIcons { /** * For lookup items that have no real category. */ + @JvmField val MISCELLANEOUS_ITEM: Icon = PlatformIcons.PACKAGE_LOCAL_ICON /** diff --git a/src/nl/hannahsten/texifyidea/action/EditorAction.kt b/src/nl/hannahsten/texifyidea/action/EditorAction.kt index e2b5d4bb6..5cb4656d4 100644 --- a/src/nl/hannahsten/texifyidea/action/EditorAction.kt +++ b/src/nl/hannahsten/texifyidea/action/EditorAction.kt @@ -15,14 +15,13 @@ import com.intellij.psi.PsiFile import com.intellij.psi.PsiManager import nl.hannahsten.texifyidea.file.LatexFile import java.util.* -import javax.swing.Icon /** * Action that fetches the required information beforehand. * * @author Hannah Schellekens */ -abstract class EditorAction(val name: String, icon: Icon?) : AnAction(name, null, icon) { +abstract class EditorAction(val name: String) : AnAction() { /** * Gets called every time the action gets executed. diff --git a/src/nl/hannahsten/texifyidea/action/ForwardSearchAction.kt b/src/nl/hannahsten/texifyidea/action/ForwardSearchAction.kt index fe11d7e92..decd58a16 100644 --- a/src/nl/hannahsten/texifyidea/action/ForwardSearchAction.kt +++ b/src/nl/hannahsten/texifyidea/action/ForwardSearchAction.kt @@ -6,7 +6,6 @@ import com.intellij.openapi.actionSystem.CommonDataKeys import com.intellij.openapi.fileEditor.TextEditor import com.intellij.openapi.project.Project import com.intellij.openapi.vfs.VirtualFile -import nl.hannahsten.texifyidea.TexifyIcons import nl.hannahsten.texifyidea.file.LatexFileType import nl.hannahsten.texifyidea.run.linuxpdfviewer.InternalPdfViewer import nl.hannahsten.texifyidea.run.pdfviewer.ExternalPdfViewer @@ -14,8 +13,7 @@ import nl.hannahsten.texifyidea.run.pdfviewer.PdfViewer import nl.hannahsten.texifyidea.util.selectedRunConfig open class ForwardSearchAction(var viewer: PdfViewer? = null) : EditorAction( - name = "_Forward Search", - icon = TexifyIcons.RIGHT + name = "_Forward Search" ) { override fun actionPerformed(file: VirtualFile, project: Project, textEditor: TextEditor) { diff --git a/src/nl/hannahsten/texifyidea/action/InsertEditorAction.kt b/src/nl/hannahsten/texifyidea/action/InsertEditorAction.kt index 4e34d263e..fbe7d041b 100644 --- a/src/nl/hannahsten/texifyidea/action/InsertEditorAction.kt +++ b/src/nl/hannahsten/texifyidea/action/InsertEditorAction.kt @@ -7,7 +7,6 @@ import com.intellij.openapi.project.Project import com.intellij.openapi.vfs.VirtualFile import nl.hannahsten.texifyidea.util.files.psiFile import nl.hannahsten.texifyidea.util.parser.isLatexOrBibtex -import javax.swing.Icon /** * @author Hannah Schellekens @@ -17,10 +16,6 @@ open class InsertEditorAction( * The name of the action. */ name: String, - /** - * The icon of the action. - */ - icon: Icon?, /** * The text to insert before the selection. */ @@ -29,7 +24,7 @@ open class InsertEditorAction( * The text to insert after the selection. */ after: String? -) : EditorAction(name, icon) { +) : EditorAction(name) { /** * What to insert before the selection. diff --git a/src/nl/hannahsten/texifyidea/action/LatexToggleStarAction.kt b/src/nl/hannahsten/texifyidea/action/LatexToggleStarAction.kt index 371988da3..616765a0f 100644 --- a/src/nl/hannahsten/texifyidea/action/LatexToggleStarAction.kt +++ b/src/nl/hannahsten/texifyidea/action/LatexToggleStarAction.kt @@ -8,7 +8,6 @@ import com.intellij.openapi.vfs.VirtualFile import com.intellij.psi.PsiElement import com.intellij.psi.PsiFile import com.intellij.psi.impl.source.tree.LeafPsiElement -import nl.hannahsten.texifyidea.TexifyIcons import nl.hannahsten.texifyidea.lang.magic.magicComment import nl.hannahsten.texifyidea.psi.LatexCommands import nl.hannahsten.texifyidea.psi.LatexGroup @@ -19,7 +18,7 @@ import nl.hannahsten.texifyidea.util.parser.parentOfType /** * @author Hannah Schellekens */ -class LatexToggleStarAction : EditorAction("Toggle Star", TexifyIcons.TOGGLE_STAR) { +class LatexToggleStarAction : EditorAction("Toggle Star") { override fun actionPerformed(file: VirtualFile, project: Project, textEditor: TextEditor) { val element = getElement(file, project, textEditor) diff --git a/src/nl/hannahsten/texifyidea/action/analysis/WordCountAction.kt b/src/nl/hannahsten/texifyidea/action/analysis/WordCountAction.kt index 3265f41a3..260b58368 100644 --- a/src/nl/hannahsten/texifyidea/action/analysis/WordCountAction.kt +++ b/src/nl/hannahsten/texifyidea/action/analysis/WordCountAction.kt @@ -8,7 +8,6 @@ import com.intellij.openapi.ui.DialogBuilder import com.intellij.psi.PsiElement import com.intellij.psi.PsiFile import com.intellij.psi.PsiWhiteSpace -import nl.hannahsten.texifyidea.TexifyIcons import nl.hannahsten.texifyidea.psi.* import nl.hannahsten.texifyidea.util.SystemEnvironment import nl.hannahsten.texifyidea.util.files.findRootFile @@ -25,11 +24,7 @@ import javax.swing.SwingConstants /** * @author Hannah Schellekens */ -open class WordCountAction : AnAction( - "_Word Count", - "Estimate the word count of the currently active .tex file and inclusions.", - TexifyIcons.WORD_COUNT -) { +open class WordCountAction : AnAction() { companion object { diff --git a/src/nl/hannahsten/texifyidea/action/insert/InsertBoldfaceAction.kt b/src/nl/hannahsten/texifyidea/action/insert/InsertBoldfaceAction.kt index 7c6b07a17..0d03f8d35 100644 --- a/src/nl/hannahsten/texifyidea/action/insert/InsertBoldfaceAction.kt +++ b/src/nl/hannahsten/texifyidea/action/insert/InsertBoldfaceAction.kt @@ -1,9 +1,8 @@ package nl.hannahsten.texifyidea.action.insert -import nl.hannahsten.texifyidea.TexifyIcons import nl.hannahsten.texifyidea.action.InsertEditorAction /** * @author Hannah Schellekens */ -class InsertBoldfaceAction : InsertEditorAction("Bold face", TexifyIcons.FONT_BOLD, "\\textbf{", "}") \ No newline at end of file +class InsertBoldfaceAction : InsertEditorAction("Bold face", "\\textbf{", "}") \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/action/insert/InsertChapterAction.kt b/src/nl/hannahsten/texifyidea/action/insert/InsertChapterAction.kt index 800c11c48..1a9ccff48 100644 --- a/src/nl/hannahsten/texifyidea/action/insert/InsertChapterAction.kt +++ b/src/nl/hannahsten/texifyidea/action/insert/InsertChapterAction.kt @@ -1,9 +1,8 @@ package nl.hannahsten.texifyidea.action.insert -import nl.hannahsten.texifyidea.TexifyIcons import nl.hannahsten.texifyidea.action.InsertEditorAction /** * @author Hannah Schellekens */ -class InsertChapterAction : InsertEditorAction("Chapter", TexifyIcons.DOT_CHAPTER, "\\chapter{", "}") \ No newline at end of file +class InsertChapterAction : InsertEditorAction("Chapter", "\\chapter{", "}") \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/action/insert/InsertEmphasisAction.kt b/src/nl/hannahsten/texifyidea/action/insert/InsertEmphasisAction.kt index 4203401bf..befd2530d 100644 --- a/src/nl/hannahsten/texifyidea/action/insert/InsertEmphasisAction.kt +++ b/src/nl/hannahsten/texifyidea/action/insert/InsertEmphasisAction.kt @@ -5,4 +5,4 @@ import nl.hannahsten.texifyidea.action.InsertEditorAction /** * @author Adam Williams */ -class InsertEmphasisAction : InsertEditorAction("Emphasis", null, "\\emph{", "}") \ No newline at end of file +class InsertEmphasisAction : InsertEditorAction("Emphasis", "\\emph{", "}") \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/action/insert/InsertItalicsAction.kt b/src/nl/hannahsten/texifyidea/action/insert/InsertItalicsAction.kt index 6a29e26a0..99ae696db 100644 --- a/src/nl/hannahsten/texifyidea/action/insert/InsertItalicsAction.kt +++ b/src/nl/hannahsten/texifyidea/action/insert/InsertItalicsAction.kt @@ -1,9 +1,8 @@ package nl.hannahsten.texifyidea.action.insert -import nl.hannahsten.texifyidea.TexifyIcons import nl.hannahsten.texifyidea.action.InsertEditorAction /** * @author Hannah Schellekens */ -class InsertItalicsAction : InsertEditorAction("Italics", TexifyIcons.FONT_ITALICS, "\\textit{", "}") \ No newline at end of file +class InsertItalicsAction : InsertEditorAction("Italics", "\\textit{", "}") \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/action/insert/InsertOverlineAction.kt b/src/nl/hannahsten/texifyidea/action/insert/InsertOverlineAction.kt index 1c460c1e9..f8f8d0fec 100644 --- a/src/nl/hannahsten/texifyidea/action/insert/InsertOverlineAction.kt +++ b/src/nl/hannahsten/texifyidea/action/insert/InsertOverlineAction.kt @@ -1,9 +1,8 @@ package nl.hannahsten.texifyidea.action.insert -import nl.hannahsten.texifyidea.TexifyIcons import nl.hannahsten.texifyidea.action.InsertEditorAction /** * @author Hannah Schellekens */ -class InsertOverlineAction : InsertEditorAction("Overline", TexifyIcons.FONT_OVERLINE, "\\overline{", "}") \ No newline at end of file +class InsertOverlineAction : InsertEditorAction("Overline", "\\overline{", "}") \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/action/insert/InsertParagraphAction.kt b/src/nl/hannahsten/texifyidea/action/insert/InsertParagraphAction.kt index 12b12063f..5499a776e 100644 --- a/src/nl/hannahsten/texifyidea/action/insert/InsertParagraphAction.kt +++ b/src/nl/hannahsten/texifyidea/action/insert/InsertParagraphAction.kt @@ -1,9 +1,8 @@ package nl.hannahsten.texifyidea.action.insert -import nl.hannahsten.texifyidea.TexifyIcons import nl.hannahsten.texifyidea.action.InsertEditorAction /** * @author Hannah Schellekens */ -class InsertParagraphAction : InsertEditorAction("Paragraph", TexifyIcons.DOT_PARAGRAPH, "\\paragraph{", "}") \ No newline at end of file +class InsertParagraphAction : InsertEditorAction("Paragraph", "\\paragraph{", "}") \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/action/insert/InsertPartAction.kt b/src/nl/hannahsten/texifyidea/action/insert/InsertPartAction.kt index 64688f8a6..83133b258 100644 --- a/src/nl/hannahsten/texifyidea/action/insert/InsertPartAction.kt +++ b/src/nl/hannahsten/texifyidea/action/insert/InsertPartAction.kt @@ -1,9 +1,8 @@ package nl.hannahsten.texifyidea.action.insert -import nl.hannahsten.texifyidea.TexifyIcons import nl.hannahsten.texifyidea.action.InsertEditorAction /** * @author Hannah Schellekens */ -class InsertPartAction : InsertEditorAction("Part", TexifyIcons.DOT_PART, "\\part{", "}") \ No newline at end of file +class InsertPartAction : InsertEditorAction("Part", "\\part{", "}") \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/action/insert/InsertSectionAction.kt b/src/nl/hannahsten/texifyidea/action/insert/InsertSectionAction.kt index 1a0e0e7cf..85c9d115f 100644 --- a/src/nl/hannahsten/texifyidea/action/insert/InsertSectionAction.kt +++ b/src/nl/hannahsten/texifyidea/action/insert/InsertSectionAction.kt @@ -1,9 +1,8 @@ package nl.hannahsten.texifyidea.action.insert -import nl.hannahsten.texifyidea.TexifyIcons import nl.hannahsten.texifyidea.action.InsertEditorAction /** * @author Hannah Schellekens */ -class InsertSectionAction : InsertEditorAction("Section", TexifyIcons.DOT_SECTION, "\\section{", "}") \ No newline at end of file +class InsertSectionAction : InsertEditorAction("Section", "\\section{", "}") \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/action/insert/InsertSlantedAction.kt b/src/nl/hannahsten/texifyidea/action/insert/InsertSlantedAction.kt index 305587dd0..99903fd1c 100644 --- a/src/nl/hannahsten/texifyidea/action/insert/InsertSlantedAction.kt +++ b/src/nl/hannahsten/texifyidea/action/insert/InsertSlantedAction.kt @@ -1,9 +1,8 @@ package nl.hannahsten.texifyidea.action.insert -import nl.hannahsten.texifyidea.TexifyIcons import nl.hannahsten.texifyidea.action.InsertEditorAction /** * @author Hannah Schellekens */ -class InsertSlantedAction : InsertEditorAction("Slanted", TexifyIcons.FONT_SLANTED, "\\textsl{", "}") \ No newline at end of file +class InsertSlantedAction : InsertEditorAction("Slanted", "\\textsl{", "}") \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/action/insert/InsertSmallCapsAction.kt b/src/nl/hannahsten/texifyidea/action/insert/InsertSmallCapsAction.kt index 56ac1f6fc..24dbed448 100644 --- a/src/nl/hannahsten/texifyidea/action/insert/InsertSmallCapsAction.kt +++ b/src/nl/hannahsten/texifyidea/action/insert/InsertSmallCapsAction.kt @@ -1,9 +1,8 @@ package nl.hannahsten.texifyidea.action.insert -import nl.hannahsten.texifyidea.TexifyIcons import nl.hannahsten.texifyidea.action.InsertEditorAction /** * @author Hannah Schellekens */ -class InsertSmallCapsAction : InsertEditorAction("Small capitals", TexifyIcons.FONT_SMALLCAPS, "\\textsc{", "}") \ No newline at end of file +class InsertSmallCapsAction : InsertEditorAction("Small capitals", "\\textsc{", "}") \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/action/insert/InsertStrikethroughAction.kt b/src/nl/hannahsten/texifyidea/action/insert/InsertStrikethroughAction.kt index fbf49fb71..153a54111 100644 --- a/src/nl/hannahsten/texifyidea/action/insert/InsertStrikethroughAction.kt +++ b/src/nl/hannahsten/texifyidea/action/insert/InsertStrikethroughAction.kt @@ -4,7 +4,6 @@ import com.intellij.openapi.fileEditor.TextEditor import com.intellij.openapi.project.Project import com.intellij.openapi.vfs.VirtualFile import com.intellij.psi.PsiManager -import nl.hannahsten.texifyidea.TexifyIcons import nl.hannahsten.texifyidea.action.InsertEditorAction import nl.hannahsten.texifyidea.lang.LatexPackage.Companion.ULEM import nl.hannahsten.texifyidea.util.insertUsepackage @@ -14,8 +13,8 @@ import nl.hannahsten.texifyidea.util.insertUsepackage */ class InsertStrikethroughAction : InsertEditorAction( "Strikethrough (ulem package)", - TexifyIcons.FONT_STRIKETHROUGH, - "\\sout{", "}" + "\\sout{", + "}" ) { override fun actionPerformed(file: VirtualFile, project: Project, textEditor: TextEditor) { diff --git a/src/nl/hannahsten/texifyidea/action/insert/InsertSubParagraphAction.kt b/src/nl/hannahsten/texifyidea/action/insert/InsertSubParagraphAction.kt index b84058daf..4c3bef904 100644 --- a/src/nl/hannahsten/texifyidea/action/insert/InsertSubParagraphAction.kt +++ b/src/nl/hannahsten/texifyidea/action/insert/InsertSubParagraphAction.kt @@ -1,9 +1,8 @@ package nl.hannahsten.texifyidea.action.insert -import nl.hannahsten.texifyidea.TexifyIcons import nl.hannahsten.texifyidea.action.InsertEditorAction /** * @author Hannah Schellekens */ -class InsertSubParagraphAction : InsertEditorAction("Subparagraph", TexifyIcons.DOT_SUBPARAGRAPH, "\\subparagraph{", "}") \ No newline at end of file +class InsertSubParagraphAction : InsertEditorAction("Subparagraph", "\\subparagraph{", "}") \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/action/insert/InsertSubSectionAction.kt b/src/nl/hannahsten/texifyidea/action/insert/InsertSubSectionAction.kt index 170e49277..d1064e749 100644 --- a/src/nl/hannahsten/texifyidea/action/insert/InsertSubSectionAction.kt +++ b/src/nl/hannahsten/texifyidea/action/insert/InsertSubSectionAction.kt @@ -1,9 +1,8 @@ package nl.hannahsten.texifyidea.action.insert -import nl.hannahsten.texifyidea.TexifyIcons import nl.hannahsten.texifyidea.action.InsertEditorAction /** * @author Hannah Schellekens */ -class InsertSubSectionAction : InsertEditorAction("Subsection", TexifyIcons.DOT_SUBSECTION, "\\subsection{", "}") \ No newline at end of file +class InsertSubSectionAction : InsertEditorAction("Subsection", "\\subsection{", "}") \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/action/insert/InsertSubSubSectionAction.kt b/src/nl/hannahsten/texifyidea/action/insert/InsertSubSubSectionAction.kt index c26e2ef58..dcbc3557f 100644 --- a/src/nl/hannahsten/texifyidea/action/insert/InsertSubSubSectionAction.kt +++ b/src/nl/hannahsten/texifyidea/action/insert/InsertSubSubSectionAction.kt @@ -1,9 +1,8 @@ package nl.hannahsten.texifyidea.action.insert -import nl.hannahsten.texifyidea.TexifyIcons import nl.hannahsten.texifyidea.action.InsertEditorAction /** * @author Hannah Schellekens */ -class InsertSubSubSectionAction : InsertEditorAction("Subsubsection", TexifyIcons.DOT_SUBSUBSECTION, "\\subsubsection{", "}") \ No newline at end of file +class InsertSubSubSectionAction : InsertEditorAction("Subsubsection", "\\subsubsection{", "}") \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/action/insert/InsertTable.kt b/src/nl/hannahsten/texifyidea/action/insert/InsertTable.kt index 121fd2956..9c06ddca2 100644 --- a/src/nl/hannahsten/texifyidea/action/insert/InsertTable.kt +++ b/src/nl/hannahsten/texifyidea/action/insert/InsertTable.kt @@ -1,7 +1,6 @@ package nl.hannahsten.texifyidea.action.insert -import nl.hannahsten.texifyidea.TexifyIcons import nl.hannahsten.texifyidea.action.InsertEditorAction class InsertTable(tableAsString: String? = "") : - InsertEditorAction("Table", TexifyIcons.STATS, tableAsString, "") // The icon is never used. \ No newline at end of file + InsertEditorAction("Table", tableAsString, "") // The icon is never used. \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/action/insert/InsertTypewriterAction.kt b/src/nl/hannahsten/texifyidea/action/insert/InsertTypewriterAction.kt index 6cec938d2..2c8fbac17 100644 --- a/src/nl/hannahsten/texifyidea/action/insert/InsertTypewriterAction.kt +++ b/src/nl/hannahsten/texifyidea/action/insert/InsertTypewriterAction.kt @@ -1,9 +1,8 @@ package nl.hannahsten.texifyidea.action.insert -import nl.hannahsten.texifyidea.TexifyIcons import nl.hannahsten.texifyidea.action.InsertEditorAction /** * @author Hannah Schellekens */ -class InsertTypewriterAction : InsertEditorAction("Typewriter (monospace)", TexifyIcons.FONT_TYPEWRITER, "\\texttt{", "}") \ No newline at end of file +class InsertTypewriterAction : InsertEditorAction("Typewriter (monospace)", "\\texttt{", "}") \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/action/insert/InsertUnderlineAction.kt b/src/nl/hannahsten/texifyidea/action/insert/InsertUnderlineAction.kt index 542ef2b85..be557d609 100644 --- a/src/nl/hannahsten/texifyidea/action/insert/InsertUnderlineAction.kt +++ b/src/nl/hannahsten/texifyidea/action/insert/InsertUnderlineAction.kt @@ -1,9 +1,8 @@ package nl.hannahsten.texifyidea.action.insert -import nl.hannahsten.texifyidea.TexifyIcons import nl.hannahsten.texifyidea.action.InsertEditorAction /** * @author Hannah Schellekens */ -class InsertUnderlineAction : InsertEditorAction("Underline", TexifyIcons.FONT_UNDERLINE, "\\underline{", "}") \ No newline at end of file +class InsertUnderlineAction : InsertEditorAction("Underline", "\\underline{", "}") \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/action/preview/PreviewAction.kt b/src/nl/hannahsten/texifyidea/action/preview/PreviewAction.kt index cd9308c9a..47771fb0c 100644 --- a/src/nl/hannahsten/texifyidea/action/preview/PreviewAction.kt +++ b/src/nl/hannahsten/texifyidea/action/preview/PreviewAction.kt @@ -25,7 +25,7 @@ import javax.swing.Icon * @author Sergei Izmailov * @author FalseHonesty */ -abstract class PreviewAction(name: String, val icon: Icon?) : EditorAction(name, icon) { +abstract class PreviewAction(name: String, val icon: Icon?) : EditorAction(name) { /** * This function is used to display the preview requested as the name suggests. diff --git a/src/nl/hannahsten/texifyidea/action/reformat/ExternalReformatAction.kt b/src/nl/hannahsten/texifyidea/action/reformat/ExternalReformatAction.kt index 6472eba03..4ba2b1923 100644 --- a/src/nl/hannahsten/texifyidea/action/reformat/ExternalReformatAction.kt +++ b/src/nl/hannahsten/texifyidea/action/reformat/ExternalReformatAction.kt @@ -22,7 +22,7 @@ import java.util.concurrent.TimeUnit * * @author Thomas */ -abstract class ExternalReformatAction(title: String, val isValidFile: (file: PsiFile) -> Boolean) : AnAction(title), DumbAware { +abstract class ExternalReformatAction(val isValidFile: (file: PsiFile) -> Boolean) : AnAction(), DumbAware { override fun update(event: AnActionEvent) { // Possible improvement: make visible anyway in LaTeX project (but only enabled if cursor in file) diff --git a/src/nl/hannahsten/texifyidea/action/reformat/ReformatWithBibtexTidy.kt b/src/nl/hannahsten/texifyidea/action/reformat/ReformatWithBibtexTidy.kt index ce4508d5a..913a54ec2 100644 --- a/src/nl/hannahsten/texifyidea/action/reformat/ReformatWithBibtexTidy.kt +++ b/src/nl/hannahsten/texifyidea/action/reformat/ReformatWithBibtexTidy.kt @@ -13,7 +13,7 @@ import org.apache.maven.artifact.versioning.DefaultArtifactVersion * * @author Thomas */ -class ReformatWithBibtexTidy : ExternalReformatAction("Reformat File with bibtex-tidy", { it.fileType == BibtexFileType }) { +class ReformatWithBibtexTidy : ExternalReformatAction({ it.fileType == BibtexFileType }) { companion object { diff --git a/src/nl/hannahsten/texifyidea/action/reformat/ReformatWithLatexindent.kt b/src/nl/hannahsten/texifyidea/action/reformat/ReformatWithLatexindent.kt index fd4067785..1c68fedd6 100644 --- a/src/nl/hannahsten/texifyidea/action/reformat/ReformatWithLatexindent.kt +++ b/src/nl/hannahsten/texifyidea/action/reformat/ReformatWithLatexindent.kt @@ -15,7 +15,7 @@ import nl.hannahsten.texifyidea.util.files.isLatexFile * * @author Thomas */ -class ReformatWithLatexindent : ExternalReformatAction("Reformat File with Latexindent", { it.isLatexFile() }) { +class ReformatWithLatexindent : ExternalReformatAction({ it.isLatexFile() }) { override fun getCommand(file: PsiFile): List { // Ensure the document is saved, before we run anything on it diff --git a/src/nl/hannahsten/texifyidea/action/sumatra/ConfigureInverseSearchAction.kt b/src/nl/hannahsten/texifyidea/action/sumatra/ConfigureInverseSearchAction.kt index 3f3c618ac..c9747b4e7 100644 --- a/src/nl/hannahsten/texifyidea/action/sumatra/ConfigureInverseSearchAction.kt +++ b/src/nl/hannahsten/texifyidea/action/sumatra/ConfigureInverseSearchAction.kt @@ -20,11 +20,7 @@ import javax.swing.SwingConstants * @author Sten Wessel * @since b0.4 */ -open class ConfigureInverseSearchAction : AnAction( - "_Configure Inverse Search", - "Setup inverse search integration with SumatraPDF and TeXiFy IDEA.", - null -) { +open class ConfigureInverseSearchAction : AnAction() { override fun actionPerformed(e: AnActionEvent) { DialogBuilder().apply { diff --git a/src/nl/hannahsten/texifyidea/completion/LatexCommandsAndEnvironmentsCompletionProvider.kt b/src/nl/hannahsten/texifyidea/completion/LatexCommandsAndEnvironmentsCompletionProvider.kt index 4150c8ac3..9b805c9d5 100644 --- a/src/nl/hannahsten/texifyidea/completion/LatexCommandsAndEnvironmentsCompletionProvider.kt +++ b/src/nl/hannahsten/texifyidea/completion/LatexCommandsAndEnvironmentsCompletionProvider.kt @@ -105,7 +105,7 @@ class LatexCommandsAndEnvironmentsCompletionProvider internal constructor(privat // completion would be flooded with duplicate commands from packages that nobody uses. // For example, the (initially) first suggestion for \enquote is the version from the aiaa package, which is unlikely to be correct. // Therefore, we limit ourselves to packages included somewhere in the project (directly or indirectly). - val packagesInProject = if (!isTexliveAvailable) emptyList() else includedPackages(LatexIncludesIndex.getItems(project), project).plus(LatexPackage.DEFAULT) + val packagesInProject = if (!isTexliveAvailable) emptyList() else includedPackages(LatexIncludesIndex.Util.getItems(project), project).plus(LatexPackage.DEFAULT) val lookupElementBuilders = mutableSetOf() diff --git a/src/nl/hannahsten/texifyidea/completion/LatexEnvironmentProvider.kt b/src/nl/hannahsten/texifyidea/completion/LatexEnvironmentProvider.kt index fc1c62fc5..a90415f87 100644 --- a/src/nl/hannahsten/texifyidea/completion/LatexEnvironmentProvider.kt +++ b/src/nl/hannahsten/texifyidea/completion/LatexEnvironmentProvider.kt @@ -25,7 +25,7 @@ object LatexEnvironmentProvider { val project = parameters.editor.project ?: return val usesTexlive = LatexCommandsAndEnvironmentsCompletionProvider.isTexliveAvailable - val packagesInProject = if (!usesTexlive) emptyList() else includedPackages(LatexIncludesIndex.getItems(project), project).plus( + val packagesInProject = if (!usesTexlive) emptyList() else includedPackages(LatexIncludesIndex.Util.getItems(project), project).plus( LatexPackage.DEFAULT ) @@ -53,7 +53,7 @@ object LatexEnvironmentProvider { // Find all environments. val environments: MutableList = ArrayList() Collections.addAll(environments, *DefaultEnvironment.values()) - LatexDefinitionIndex.getItemsInFileSet(parameters.originalFile).stream() + LatexDefinitionIndex.Util.getItemsInFileSet(parameters.originalFile).stream() .map { it as LatexCommands } .filter { cmd -> CommandMagic.environmentDefinitions.contains(cmd.name) } .map { cmd -> cmd.requiredParameter(0) } diff --git a/src/nl/hannahsten/texifyidea/completion/LatexGlossariesCompletionProvider.kt b/src/nl/hannahsten/texifyidea/completion/LatexGlossariesCompletionProvider.kt index aab43c6e0..b14cf800e 100644 --- a/src/nl/hannahsten/texifyidea/completion/LatexGlossariesCompletionProvider.kt +++ b/src/nl/hannahsten/texifyidea/completion/LatexGlossariesCompletionProvider.kt @@ -44,7 +44,7 @@ object LatexGlossariesCompletionProvider : CompletionProvider when (command.name) { NEWACRONYM.cmd, NEWABBREVIATION.cmd -> { diff --git a/src/nl/hannahsten/texifyidea/completion/pathcompletion/LatexFileProvider.kt b/src/nl/hannahsten/texifyidea/completion/pathcompletion/LatexFileProvider.kt index 78d1a2c8d..87f039df2 100644 --- a/src/nl/hannahsten/texifyidea/completion/pathcompletion/LatexFileProvider.kt +++ b/src/nl/hannahsten/texifyidea/completion/pathcompletion/LatexFileProvider.kt @@ -12,7 +12,7 @@ class LatexFileProvider : LatexPathProviderBase() { override fun selectScanRoots(file: PsiFile): List { val searchDirs = getProjectRoots().toMutableList() - val allIncludeCommands = LatexIncludesIndex.getItems(file) + val allIncludeCommands = LatexIncludesIndex.Util.getItems(file) for (command in allIncludeCommands) { searchDirs.addAll(getParentDirectoryByImportPaths(command)) } diff --git a/src/nl/hannahsten/texifyidea/completion/pathcompletion/LatexFolderProvider.kt b/src/nl/hannahsten/texifyidea/completion/pathcompletion/LatexFolderProvider.kt index ad434fd2a..72f8e68fc 100644 --- a/src/nl/hannahsten/texifyidea/completion/pathcompletion/LatexFolderProvider.kt +++ b/src/nl/hannahsten/texifyidea/completion/pathcompletion/LatexFolderProvider.kt @@ -12,7 +12,7 @@ class LatexFolderProvider : LatexPathProviderBase() { override fun selectScanRoots(file: PsiFile): List { val searchDirs = getProjectRoots().toMutableList() - val allIncludeCommands = LatexIncludesIndex.getItems(file) + val allIncludeCommands = LatexIncludesIndex.Util.getItems(file) for (command in allIncludeCommands) { searchDirs.addAll(findRelativeSearchPathsForImportCommands(command)) } diff --git a/src/nl/hannahsten/texifyidea/completion/pathcompletion/LatexGraphicsPathProvider.kt b/src/nl/hannahsten/texifyidea/completion/pathcompletion/LatexGraphicsPathProvider.kt index 2c5adb1f0..1af487424 100644 --- a/src/nl/hannahsten/texifyidea/completion/pathcompletion/LatexGraphicsPathProvider.kt +++ b/src/nl/hannahsten/texifyidea/completion/pathcompletion/LatexGraphicsPathProvider.kt @@ -58,7 +58,7 @@ class LatexGraphicsPathProvider : LatexPathProviderBase() { // First find all graphicspaths commands in the file of the given command val graphicsPaths = graphicsPathsInFile(command.containingFile).toMutableList() - val allIncludeCommands = LatexIncludesIndex.getItems(command.project) + val allIncludeCommands = LatexIncludesIndex.Util.getItems(command.project) // Commands which may include the current file (this is an overestimation, better would be to check for RequiredFileArguments) var includingCommands = allIncludeCommands.filter { includeCommand -> includeCommand.getRequiredParameters().any { it.contains(command.containingFile.name.removeFileExtension()) } } diff --git a/src/nl/hannahsten/texifyidea/gutter/LatexElementColorProvider.kt b/src/nl/hannahsten/texifyidea/gutter/LatexElementColorProvider.kt index 36d5b3e80..390b88ffe 100644 --- a/src/nl/hannahsten/texifyidea/gutter/LatexElementColorProvider.kt +++ b/src/nl/hannahsten/texifyidea/gutter/LatexElementColorProvider.kt @@ -92,7 +92,7 @@ class LatexElementColorProvider : ElementColorProvider { return if (defaultHex != null) Color(defaultHex) else { - val colorDefiningCommands = LatexCommandsIndex.getCommandsByNames( + val colorDefiningCommands = LatexCommandsIndex.Util.getCommandsByNames( file, *ColorMagic.colorDefinitions.map { "\\${it.command}" } .toTypedArray() diff --git a/src/nl/hannahsten/texifyidea/highlighting/LatexAnnotator.kt b/src/nl/hannahsten/texifyidea/highlighting/LatexAnnotator.kt index a6d3a1ed9..a2c25e57c 100644 --- a/src/nl/hannahsten/texifyidea/highlighting/LatexAnnotator.kt +++ b/src/nl/hannahsten/texifyidea/highlighting/LatexAnnotator.kt @@ -197,7 +197,7 @@ open class LatexAnnotator : Annotator { // Make user-defined commands highlighting customizable if (Cache.allUserDefinedCommands.isEmpty()) { - Cache.allUserDefinedCommands = LatexDefinitionIndex.getItems(command.project) + Cache.allUserDefinedCommands = LatexDefinitionIndex.Util.getItems(command.project) .filter { it.isCommandDefinition() } .mapNotNull { it.definedCommandName() } } diff --git a/src/nl/hannahsten/texifyidea/index/LatexCommandsIndex.kt b/src/nl/hannahsten/texifyidea/index/LatexCommandsIndex.kt index a287bd5a3..cffa7a099 100644 --- a/src/nl/hannahsten/texifyidea/index/LatexCommandsIndex.kt +++ b/src/nl/hannahsten/texifyidea/index/LatexCommandsIndex.kt @@ -9,10 +9,9 @@ import nl.hannahsten.texifyidea.psi.LatexCommands */ open class LatexCommandsIndex : StringStubIndexExtension() { - companion object : IndexCommandsUtilBase(IndexKeys.COMMANDS_KEY) + object Util : IndexCommandsUtilBase(IndexKeys.COMMANDS_KEY) - @Suppress("RedundantCompanionReference") // Avoid type checking issues - override fun getKey() = Companion.key() + override fun getKey() = Util.key() override fun getVersion() = LatexParserDefinition.Cache.FILE.stubVersion } diff --git a/src/nl/hannahsten/texifyidea/index/LatexDefinitionIndex.kt b/src/nl/hannahsten/texifyidea/index/LatexDefinitionIndex.kt index 197a7cd54..1cc911128 100644 --- a/src/nl/hannahsten/texifyidea/index/LatexDefinitionIndex.kt +++ b/src/nl/hannahsten/texifyidea/index/LatexDefinitionIndex.kt @@ -9,10 +9,9 @@ import nl.hannahsten.texifyidea.psi.LatexCommands */ open class LatexDefinitionIndex : StringStubIndexExtension() { - companion object : IndexCommandsUtilBase(IndexKeys.DEFINITIONS_KEY) + object Util : IndexCommandsUtilBase(IndexKeys.DEFINITIONS_KEY) - @Suppress("RedundantCompanionReference") - override fun getKey() = Companion.key() + override fun getKey() = Util.key() override fun getVersion() = LatexParserDefinition.Cache.FILE.stubVersion } \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/index/LatexEnvironmentsIndex.kt b/src/nl/hannahsten/texifyidea/index/LatexEnvironmentsIndex.kt index 177404eb6..9fea0e704 100644 --- a/src/nl/hannahsten/texifyidea/index/LatexEnvironmentsIndex.kt +++ b/src/nl/hannahsten/texifyidea/index/LatexEnvironmentsIndex.kt @@ -9,10 +9,9 @@ import nl.hannahsten.texifyidea.psi.LatexEnvironment */ class LatexEnvironmentsIndex : StringStubIndexExtension() { - companion object : IndexUtilBase(LatexEnvironment::class.java, IndexKeys.ENVIRONMENTS_KEY) + object Util : IndexUtilBase(LatexEnvironment::class.java, IndexKeys.ENVIRONMENTS_KEY) - @Suppress("RedundantCompanionReference") - override fun getKey() = Companion.key() + override fun getKey() = Util.key() override fun getVersion() = LatexParserDefinition.Cache.FILE.stubVersion } \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/index/LatexGlossaryEntryIndex.kt b/src/nl/hannahsten/texifyidea/index/LatexGlossaryEntryIndex.kt index 31ebf1c16..df65bbaee 100644 --- a/src/nl/hannahsten/texifyidea/index/LatexGlossaryEntryIndex.kt +++ b/src/nl/hannahsten/texifyidea/index/LatexGlossaryEntryIndex.kt @@ -9,10 +9,9 @@ import nl.hannahsten.texifyidea.psi.LatexCommands */ class LatexGlossaryEntryIndex : StringStubIndexExtension() { - companion object : IndexUtilBase(LatexCommands::class.java, IndexKeys.GLOSSARY_ENTRIES_KEY) + object Util : IndexUtilBase(LatexCommands::class.java, IndexKeys.GLOSSARY_ENTRIES_KEY) - @Suppress("RedundantCompanionReference") // Avoid type checking issues - override fun getKey() = Companion.key() + override fun getKey() = Util.key() override fun getVersion() = LatexParserDefinition.Cache.FILE.stubVersion } \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/index/LatexIncludesIndex.kt b/src/nl/hannahsten/texifyidea/index/LatexIncludesIndex.kt index e8ca1ef92..f5495ccf7 100644 --- a/src/nl/hannahsten/texifyidea/index/LatexIncludesIndex.kt +++ b/src/nl/hannahsten/texifyidea/index/LatexIncludesIndex.kt @@ -10,10 +10,9 @@ import nl.hannahsten.texifyidea.psi.LatexCommands */ class LatexIncludesIndex : StringStubIndexExtension() { - companion object : IndexCommandsUtilBase(IndexKeys.INCLUDES_KEY) + object Util : IndexCommandsUtilBase(IndexKeys.INCLUDES_KEY) - @Suppress("RedundantCompanionReference") - override fun getKey() = Companion.key() + override fun getKey() = Util.key() override fun getVersion() = LatexParserDefinition.Cache.FILE.stubVersion } diff --git a/src/nl/hannahsten/texifyidea/index/LatexIndexUtil.kt b/src/nl/hannahsten/texifyidea/index/LatexIndexUtil.kt index 94ff05a8b..985ca8fba 100644 --- a/src/nl/hannahsten/texifyidea/index/LatexIndexUtil.kt +++ b/src/nl/hannahsten/texifyidea/index/LatexIndexUtil.kt @@ -4,9 +4,9 @@ import com.intellij.psi.PsiElement import com.intellij.psi.stubs.IndexSink import nl.hannahsten.texifyidea.highlighting.LatexAnnotator -fun indexSinkOccurrence(indexSink: IndexSink, index: IndexUtilBase, token: String) { +fun indexSinkOccurrence(indexSink: IndexSink, util: IndexUtilBase, token: String) { // Clear cache to be sure that any update will be reflected (we don't know whether something will be added to the index or whether it's already in there) - index.cache.clear() - indexSink.occurrence(index.key(), token) + util.cache.clear() + indexSink.occurrence(util.key(), token) LatexAnnotator.Cache.allUserDefinedCommands = emptyList() } \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/index/LatexMagicCommentIndex.kt b/src/nl/hannahsten/texifyidea/index/LatexMagicCommentIndex.kt index 6b3a2a91f..f72335989 100644 --- a/src/nl/hannahsten/texifyidea/index/LatexMagicCommentIndex.kt +++ b/src/nl/hannahsten/texifyidea/index/LatexMagicCommentIndex.kt @@ -7,10 +7,9 @@ import nl.hannahsten.texifyidea.psi.LatexMagicComment class LatexMagicCommentIndex : StringStubIndexExtension() { - companion object : IndexUtilBase(LatexMagicComment::class.java, IndexKeys.MAGIC_COMMENTS_KEY) + object Util : IndexUtilBase(LatexMagicComment::class.java, IndexKeys.MAGIC_COMMENTS_KEY) - @Suppress("RedundantCompanionReference") - override fun getKey(): StubIndexKey = Companion.key() + override fun getKey(): StubIndexKey = Util.key() override fun getVersion() = LatexParserDefinition.Cache.FILE.stubVersion } \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/index/LatexParameterLabeledCommandsIndex.kt b/src/nl/hannahsten/texifyidea/index/LatexParameterLabeledCommandsIndex.kt index e6c8dc189..63572ada1 100644 --- a/src/nl/hannahsten/texifyidea/index/LatexParameterLabeledCommandsIndex.kt +++ b/src/nl/hannahsten/texifyidea/index/LatexParameterLabeledCommandsIndex.kt @@ -9,10 +9,9 @@ import nl.hannahsten.texifyidea.psi.LatexCommands */ class LatexParameterLabeledCommandsIndex : StringStubIndexExtension() { - companion object : IndexUtilBase(LatexCommands::class.java, IndexKeys.LABELED_COMMANDS_KEY) + object Util : IndexUtilBase(LatexCommands::class.java, IndexKeys.LABELED_COMMANDS_KEY) - @Suppress("RedundantCompanionReference") - override fun getKey() = Companion.key() + override fun getKey() = Util.key() override fun getVersion() = LatexParserDefinition.Cache.FILE.stubVersion } \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/index/LatexParameterLabeledEnvironmentsIndex.kt b/src/nl/hannahsten/texifyidea/index/LatexParameterLabeledEnvironmentsIndex.kt index e85006301..a2e4cbd86 100644 --- a/src/nl/hannahsten/texifyidea/index/LatexParameterLabeledEnvironmentsIndex.kt +++ b/src/nl/hannahsten/texifyidea/index/LatexParameterLabeledEnvironmentsIndex.kt @@ -10,10 +10,9 @@ import nl.hannahsten.texifyidea.psi.LatexEnvironment */ class LatexParameterLabeledEnvironmentsIndex : StringStubIndexExtension() { - companion object : IndexUtilBase(LatexEnvironment::class.java, IndexKeys.LABELED_ENVIRONMENTS_KEY) + object Util : IndexUtilBase(LatexEnvironment::class.java, IndexKeys.LABELED_ENVIRONMENTS_KEY) - @Suppress("RedundantCompanionReference") - override fun getKey() = Companion.key() + override fun getKey() = Util.key() override fun getVersion() = LatexParserDefinition.Cache.FILE.stubVersion } \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/index/stub/LatexCommandsStubElementType.kt b/src/nl/hannahsten/texifyidea/index/stub/LatexCommandsStubElementType.kt index 25c5e3110..7ed214e38 100644 --- a/src/nl/hannahsten/texifyidea/index/stub/LatexCommandsStubElementType.kt +++ b/src/nl/hannahsten/texifyidea/index/stub/LatexCommandsStubElementType.kt @@ -8,9 +8,9 @@ import nl.hannahsten.texifyidea.index.* import nl.hannahsten.texifyidea.index.file.LatexIndexableSetContributor import nl.hannahsten.texifyidea.psi.LatexCommands import nl.hannahsten.texifyidea.psi.impl.LatexCommandsImpl -import nl.hannahsten.texifyidea.util.parser.toStringMap import nl.hannahsten.texifyidea.util.getIncludeCommands import nl.hannahsten.texifyidea.util.magic.CommandMagic +import nl.hannahsten.texifyidea.util.parser.toStringMap import java.io.IOException import java.util.regex.Pattern import java.util.stream.Collectors @@ -91,19 +91,19 @@ class LatexCommandsStubElementType(debugName: String) : } val token = latexCommandsStub.commandToken - indexSinkOccurrence(indexSink, LatexCommandsIndex, token) + indexSinkOccurrence(indexSink, LatexCommandsIndex.Util, token) if (token in getIncludeCommands()) { - indexSinkOccurrence(indexSink, LatexIncludesIndex, token) + indexSinkOccurrence(indexSink, LatexIncludesIndex.Util, token) } if (token in CommandMagic.definitions) { - indexSinkOccurrence(indexSink, LatexDefinitionIndex, token) + indexSinkOccurrence(indexSink, LatexDefinitionIndex.Util, token) } if (token in CommandMagic.labelAsParameter && "label" in latexCommandsStub.optionalParams) { val label = latexCommandsStub.optionalParams["label"]!! - indexSinkOccurrence(indexSink, LatexParameterLabeledCommandsIndex, label) + indexSinkOccurrence(indexSink, LatexParameterLabeledCommandsIndex.Util, label) } if (token in CommandMagic.glossaryEntry && latexCommandsStub.requiredParams.isNotEmpty()) { - indexSinkOccurrence(indexSink, LatexGlossaryEntryIndex, latexCommandsStub.requiredParams[0]) + indexSinkOccurrence(indexSink, LatexGlossaryEntryIndex.Util, latexCommandsStub.requiredParams[0]) } } diff --git a/src/nl/hannahsten/texifyidea/index/stub/LatexEnvironmentStubElementType.kt b/src/nl/hannahsten/texifyidea/index/stub/LatexEnvironmentStubElementType.kt index 6eb49fe41..7fdac1317 100644 --- a/src/nl/hannahsten/texifyidea/index/stub/LatexEnvironmentStubElementType.kt +++ b/src/nl/hannahsten/texifyidea/index/stub/LatexEnvironmentStubElementType.kt @@ -38,11 +38,11 @@ open class LatexEnvironmentStubElementType(debugName: String) : IStubElementType } override fun indexStub(stub: LatexEnvironmentStub, sink: IndexSink) { - indexSinkOccurrence(sink, LatexEnvironmentsIndex, stub.environmentName) + indexSinkOccurrence(sink, LatexEnvironmentsIndex.Util, stub.environmentName) // only record environments with a label in the optional parameters if (stub.label.isNotEmpty() && EnvironmentMagic.labelAsParameter.contains(stub.environmentName)) { - indexSinkOccurrence(sink, LatexParameterLabeledEnvironmentsIndex, stub.label) + indexSinkOccurrence(sink, LatexParameterLabeledEnvironmentsIndex.Util, stub.label) } } } \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/index/stub/LatexMagicCommentStubElementType.kt b/src/nl/hannahsten/texifyidea/index/stub/LatexMagicCommentStubElementType.kt index dda467714..c1bc92494 100644 --- a/src/nl/hannahsten/texifyidea/index/stub/LatexMagicCommentStubElementType.kt +++ b/src/nl/hannahsten/texifyidea/index/stub/LatexMagicCommentStubElementType.kt @@ -33,6 +33,6 @@ open class LatexMagicCommentStubElementType(debugName: String) : IStubElementTyp } override fun indexStub(stub: LatexMagicCommentStub, sink: IndexSink) { - indexSinkOccurrence(sink, LatexMagicCommentIndex, stub.key) + indexSinkOccurrence(sink, LatexMagicCommentIndex.Util, stub.key) } } diff --git a/src/nl/hannahsten/texifyidea/inspections/bibtex/BibtexDuplicateBibliographyInspection.kt b/src/nl/hannahsten/texifyidea/inspections/bibtex/BibtexDuplicateBibliographyInspection.kt index cfff08343..c10d1be94 100644 --- a/src/nl/hannahsten/texifyidea/inspections/bibtex/BibtexDuplicateBibliographyInspection.kt +++ b/src/nl/hannahsten/texifyidea/inspections/bibtex/BibtexDuplicateBibliographyInspection.kt @@ -45,7 +45,7 @@ open class BibtexDuplicateBibliographyInspection : TexifyInspectionBase() { // Map each bibliography file to all the commands which include it val groupedIncludes = mutableMapOf>() - LatexIncludesIndex.getItemsInFileSet(file).asSequence() + LatexIncludesIndex.Util.getItemsInFileSet(file).asSequence() .filter { it.name == "\\bibliography" || it.name == "\\addbibresource" } .forEach { command -> for (fileName in command.getIncludedFiles(false).map { it.name }) { diff --git a/src/nl/hannahsten/texifyidea/inspections/latex/codematurity/LatexOverInsteadOfFracInspection.kt b/src/nl/hannahsten/texifyidea/inspections/latex/codematurity/LatexOverInsteadOfFracInspection.kt index b0f85c843..7c069d8d8 100644 --- a/src/nl/hannahsten/texifyidea/inspections/latex/codematurity/LatexOverInsteadOfFracInspection.kt +++ b/src/nl/hannahsten/texifyidea/inspections/latex/codematurity/LatexOverInsteadOfFracInspection.kt @@ -44,7 +44,7 @@ class LatexOverInsteadOfFracInspection : TexifyInspectionBase() { isOntheFly: Boolean ): List { val descriptors = descriptorList() - val commands = LatexCommandsIndex.getItems(file) + val commands = LatexCommandsIndex.Util.getItems(file) for (command in commands) { if ("\\over" == command.name) { descriptors.add( diff --git a/src/nl/hannahsten/texifyidea/inspections/latex/codematurity/LatexPrimitiveStyleInspection.kt b/src/nl/hannahsten/texifyidea/inspections/latex/codematurity/LatexPrimitiveStyleInspection.kt index 46f7c8847..2054a88ce 100644 --- a/src/nl/hannahsten/texifyidea/inspections/latex/codematurity/LatexPrimitiveStyleInspection.kt +++ b/src/nl/hannahsten/texifyidea/inspections/latex/codematurity/LatexPrimitiveStyleInspection.kt @@ -42,7 +42,7 @@ class LatexPrimitiveStyleInspection : TexifyInspectionBase() { isOntheFly: Boolean ): List { val descriptors = mutableListOf() - val commands = LatexCommandsIndex.getItems(file) + val commands = LatexCommandsIndex.Util.getItems(file) for (command in commands) { val index = CommandMagic.stylePrimitives.indexOf(command.name) if (index < 0) { diff --git a/src/nl/hannahsten/texifyidea/inspections/latex/codestyle/LatexMightBreakTexifyInspection.kt b/src/nl/hannahsten/texifyidea/inspections/latex/codestyle/LatexMightBreakTexifyInspection.kt index 34970f9a0..f685910e5 100644 --- a/src/nl/hannahsten/texifyidea/inspections/latex/codestyle/LatexMightBreakTexifyInspection.kt +++ b/src/nl/hannahsten/texifyidea/inspections/latex/codestyle/LatexMightBreakTexifyInspection.kt @@ -36,7 +36,7 @@ class LatexMightBreakTexifyInspection : TexifyInspectionBase() { isOntheFly: Boolean ): List { val descriptors = descriptorList() - val commands = LatexCommandsIndex.getItems(file) + val commands = LatexCommandsIndex.Util.getItems(file) for (command in commands) { // Error when \newcommand is used on existing command if (CommandMagic.commandRedefinitions.contains(command.name)) { diff --git a/src/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexInclusionLoopInspection.kt b/src/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexInclusionLoopInspection.kt index d29ffd2d4..57f70ccb5 100644 --- a/src/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexInclusionLoopInspection.kt +++ b/src/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexInclusionLoopInspection.kt @@ -26,7 +26,7 @@ open class LatexInclusionLoopInspection : TexifyInspectionBase() { override fun inspectFile(file: PsiFile, manager: InspectionManager, isOntheFly: Boolean): MutableList { val descriptors = descriptorList() - val allIncludeCommands = LatexIncludesIndex.getItems(file.project) + val allIncludeCommands = LatexIncludesIndex.Util.getItems(file.project) // Maps every file to all the files it includes. val inclusions: MutableMap> = HashMap() diff --git a/src/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexNestedIncludesInspection.kt b/src/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexNestedIncludesInspection.kt index e3f9f133f..a44cfc8b4 100644 --- a/src/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexNestedIncludesInspection.kt +++ b/src/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexNestedIncludesInspection.kt @@ -37,7 +37,7 @@ open class LatexNestedIncludesInspection : TexifyInspectionBase() { val descriptors = descriptorList() val root = file.findRootFile() - val isInclude = LatexIncludesIndex.getItemsInFileSet(file).any { + val isInclude = LatexIncludesIndex.Util.getItemsInFileSet(file).any { it.name == "\\include" && it.requiredParameter(0)?.let { f -> root.findFile(f) } == file } 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 571acc683..1de521bf8 100644 --- a/src/nl/hannahsten/texifyidea/inspections/latex/probablebugs/packages/LatexPackageCouldNotBeFound.kt +++ b/src/nl/hannahsten/texifyidea/inspections/latex/probablebugs/packages/LatexPackageCouldNotBeFound.kt @@ -29,7 +29,7 @@ class LatexPackageCouldNotBeFound : TexifyInspectionBase() { override fun inspectFile(file: PsiFile, manager: InspectionManager, isOntheFly: Boolean): List { val descriptors = descriptorList() val ctanPackages = PackageUtils.CTAN_PACKAGE_NAMES.map { it.lowercase(Locale.getDefault()) } - val customPackages = LatexDefinitionIndex.getCommandsByName("\\ProvidesPackage", file.project, file.project.projectSearchScope) + val customPackages = LatexDefinitionIndex.Util.getCommandsByName("\\ProvidesPackage", file.project, file.project.projectSearchScope) .map { it.requiredParameter(0) } .map { it?.lowercase(Locale.getDefault()) } val packages = ctanPackages + customPackages 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 330439566..b22bb07e2 100644 --- a/src/nl/hannahsten/texifyidea/inspections/latex/probablebugs/packages/LatexPackageNotInstalledInspection.kt +++ b/src/nl/hannahsten/texifyidea/inspections/latex/probablebugs/packages/LatexPackageNotInstalledInspection.kt @@ -51,7 +51,7 @@ class LatexPackageNotInstalledInspection : TexifyInspectionBase() { // We have to check whether tlmgr is installed, for those users who don't want to install TeX Live in the official way if (LatexSdkUtil.isTlmgrAvailable(file.project)) { val installedPackages = TexLivePackages.packageList - val customPackages = LatexDefinitionIndex.getCommandsByName( + val customPackages = LatexDefinitionIndex.Util.getCommandsByName( "\\ProvidesPackage", file.project, file.project .projectSearchScope diff --git a/src/nl/hannahsten/texifyidea/inspections/latex/typesetting/LatexIncorrectSectionNestingInspection.kt b/src/nl/hannahsten/texifyidea/inspections/latex/typesetting/LatexIncorrectSectionNestingInspection.kt index a51d80022..34553ce2f 100644 --- a/src/nl/hannahsten/texifyidea/inspections/latex/typesetting/LatexIncorrectSectionNestingInspection.kt +++ b/src/nl/hannahsten/texifyidea/inspections/latex/typesetting/LatexIncorrectSectionNestingInspection.kt @@ -37,7 +37,7 @@ open class LatexIncorrectSectionNestingInspection : TexifyInspectionBase() { override fun getDisplayName() = "Incorrect nesting" override fun inspectFile(file: PsiFile, manager: InspectionManager, isOntheFly: Boolean): List { - return LatexCommandsIndex.getCommandsByNames(file, *sectioningCommands()) + return LatexCommandsIndex.Util.getCommandsByNames(file, *sectioningCommands()) .sortedBy { it.textOffset } .zipWithNext() .filter { (first, second) -> diff --git a/src/nl/hannahsten/texifyidea/lang/alias/AliasManager.kt b/src/nl/hannahsten/texifyidea/lang/alias/AliasManager.kt index 51ac66b6a..ad71a7b7b 100644 --- a/src/nl/hannahsten/texifyidea/lang/alias/AliasManager.kt +++ b/src/nl/hannahsten/texifyidea/lang/alias/AliasManager.kt @@ -135,7 +135,7 @@ abstract class AliasManager { // If the command name itself is not directly in the given set, check if it is perhaps an alias of a command in the set // Uses projectScope now, may be improved to filesetscope - val indexedCommandDefinitions = LatexDefinitionIndex.getItems(project).toSet() + val indexedCommandDefinitions = LatexDefinitionIndex.Util.getItems(project).toSet() // Check if something has changed (the number of indexed command might be the same while the content is different), and if so, update the aliases. // Also do this the first time something is registered, because then we have to update aliases as well diff --git a/src/nl/hannahsten/texifyidea/reference/CommandDefinitionReference.kt b/src/nl/hannahsten/texifyidea/reference/CommandDefinitionReference.kt index 314455694..391c5ddff 100644 --- a/src/nl/hannahsten/texifyidea/reference/CommandDefinitionReference.kt +++ b/src/nl/hannahsten/texifyidea/reference/CommandDefinitionReference.kt @@ -34,7 +34,7 @@ class CommandDefinitionReference(element: LatexCommands) : PsiReferenceBase // Find the command being defined, e.g. \hi in case of \newcommand{\hi}{} diff --git a/src/nl/hannahsten/texifyidea/reference/LatexGlossaryReference.kt b/src/nl/hannahsten/texifyidea/reference/LatexGlossaryReference.kt index 58b8be0ed..fe0fa8726 100644 --- a/src/nl/hannahsten/texifyidea/reference/LatexGlossaryReference.kt +++ b/src/nl/hannahsten/texifyidea/reference/LatexGlossaryReference.kt @@ -28,7 +28,7 @@ class LatexGlossaryReference(element: LatexParameterText) : } override fun multiResolve(incompleteCode: Boolean): Array { - val glossaryEntries = LatexGlossaryEntryIndex.getItemsInFileSet(myElement.containingFile.originalFile) + val glossaryEntries = LatexGlossaryEntryIndex.Util.getItemsInFileSet(myElement.containingFile.originalFile) return glossaryEntries .filter { LatexGlossariesCommand.extractGlossaryLabel(it) == myElement.name } .toSet() diff --git a/src/nl/hannahsten/texifyidea/run/latex/MakeindexUtil.kt b/src/nl/hannahsten/texifyidea/run/latex/MakeindexUtil.kt index b383839e6..c58221e18 100644 --- a/src/nl/hannahsten/texifyidea/run/latex/MakeindexUtil.kt +++ b/src/nl/hannahsten/texifyidea/run/latex/MakeindexUtil.kt @@ -69,7 +69,7 @@ private fun getIndexPackageOptions(mainFile: VirtualFile?, project: Project): Li return runReadAction { // Find index package options val mainPsiFile = mainFile?.psiFile(project) ?: throw ExecutionException("Main file not found") - LatexCommandsIndex.getItemsInFileSet(mainPsiFile) + LatexCommandsIndex.Util.getItemsInFileSet(mainPsiFile) .filter { it.commandToken.text in CommandMagic.packageInclusionCommands } .filter { command -> command.getRequiredParameters().any { it in PackageMagic.index.map { pkg -> pkg.name } || it in PackageMagic.glossary.map { pkg -> pkg.name } } } .flatMap { it.getOptionalParameterMap().toStringMap().keys } @@ -88,7 +88,7 @@ fun getMakeindexOptions(mainFile: VirtualFile?, project: Project): Map() - LatexCommandsIndex.getItemsInFileSet(mainPsiFile) + LatexCommandsIndex.Util.getItemsInFileSet(mainPsiFile) .filter { it.commandToken.text == "\\makeindex" } .forEach { makeindexOptions.putAll(it.getOptionalParameterMap().toStringMap()) diff --git a/src/nl/hannahsten/texifyidea/settings/sdk/TectonicSdk.kt b/src/nl/hannahsten/texifyidea/settings/sdk/TectonicSdk.kt index 009ccea78..a6bb9e9a8 100644 --- a/src/nl/hannahsten/texifyidea/settings/sdk/TectonicSdk.kt +++ b/src/nl/hannahsten/texifyidea/settings/sdk/TectonicSdk.kt @@ -30,6 +30,7 @@ class TectonicSdk : LatexSdk("Tectonic SDK") { if (Cache.fileLocationCache == null) { Cache.fileLocationCache = File("$homePath/urls").listFiles() // Get manifest names + ?.asSequence() ?.mapNotNull { it.readText().trim() } // Get manifest contents ?.flatMap { File("$homePath/manifests/$it.txt").readLines().map { line -> line.trim() } } diff --git a/src/nl/hannahsten/texifyidea/structure/latex/LatexStructureViewElement.kt b/src/nl/hannahsten/texifyidea/structure/latex/LatexStructureViewElement.kt index f60a5a4a8..1dc3b787f 100644 --- a/src/nl/hannahsten/texifyidea/structure/latex/LatexStructureViewElement.kt +++ b/src/nl/hannahsten/texifyidea/structure/latex/LatexStructureViewElement.kt @@ -71,7 +71,7 @@ class LatexStructureViewElement(private val element: PsiElement) : StructureView // Get document class. val scope = GlobalSearchScope.fileScope(element as PsiFile) - val docClass = LatexCommandsIndex.getItems(element.getProject(), scope).asSequence() + val docClass = LatexCommandsIndex.Util.getItems(element.getProject(), scope).asSequence() .filter { cmd -> cmd.commandToken.text == "\\documentclass" && cmd.getRequiredParameters().isNotEmpty() } .map { cmd -> cmd.getRequiredParameters()[0] } .firstOrNull() ?: "article" diff --git a/src/nl/hannahsten/texifyidea/util/Commands.kt b/src/nl/hannahsten/texifyidea/util/Commands.kt index bfee1ebd0..69b07b51c 100644 --- a/src/nl/hannahsten/texifyidea/util/Commands.kt +++ b/src/nl/hannahsten/texifyidea/util/Commands.kt @@ -26,7 +26,7 @@ import java.util.stream.Collectors * @return The found commands. */ fun Project.findCommandDefinitions(): Collection { - return LatexDefinitionIndex.getItems(this).filter { + return LatexDefinitionIndex.Util.getItems(this).filter { it.isCommandDefinition() } } @@ -90,7 +90,7 @@ fun expandCommandsOnce(inputText: String, project: Project, file: PsiFile?): Str for (command in commandsInText) { // Expand the command once, and replace the command with the expanded text - val commandExpansion = LatexCommandsIndex.getCommandsByNames( + val commandExpansion = LatexCommandsIndex.Util.getCommandsByNames( file ?: return null, *CommandMagic.commandDefinitionsAndRedefinitions.toTypedArray() ) @@ -124,5 +124,5 @@ fun getCommandsInFiles(files: MutableSet, originalFile: PsiFile): Colle .collect(Collectors.toSet()) searchFiles.add(originalFile.virtualFile) val scope = GlobalSearchScope.filesScope(project, searchFiles) - return LatexCommandsIndex.getItems(project, scope) + return LatexCommandsIndex.Util.getItems(project, scope) } diff --git a/src/nl/hannahsten/texifyidea/util/Environments.kt b/src/nl/hannahsten/texifyidea/util/Environments.kt index 027862bde..d1c2babfb 100644 --- a/src/nl/hannahsten/texifyidea/util/Environments.kt +++ b/src/nl/hannahsten/texifyidea/util/Environments.kt @@ -11,7 +11,7 @@ import nl.hannahsten.texifyidea.util.magic.CommandMagic * @return The found definition commands. */ fun Project.findEnvironmentDefinitions(): Collection { - return LatexDefinitionIndex.getItems(this).filter { + return LatexDefinitionIndex.Util.getItems(this).filter { it.name in CommandMagic.environmentDefinitions } } diff --git a/src/nl/hannahsten/texifyidea/util/Projects.kt b/src/nl/hannahsten/texifyidea/util/Projects.kt index 400ffddb8..4bb57768a 100644 --- a/src/nl/hannahsten/texifyidea/util/Projects.kt +++ b/src/nl/hannahsten/texifyidea/util/Projects.kt @@ -45,7 +45,7 @@ val Project.sourceSetSearchScope: GlobalSearchScope * Looks for all defined document classes in the project. */ fun Project.findAvailableDocumentClasses(): Set { - val defines = LatexDefinitionIndex.getCommandsByName("ProvidesClass", this, sourceSetSearchScope) + val defines = LatexDefinitionIndex.Util.getCommandsByName("ProvidesClass", this, sourceSetSearchScope) return defines.asSequence() .map { it.getRequiredParameters() } .filter { it.isNotEmpty() } @@ -136,6 +136,6 @@ fun Project.isTestProject() = name.contains("_temp_") || basePath?.contains("uni * * @return A list containing all the section marker [LatexCommands]. */ -fun Project.findSectionMarkers() = LatexCommandsIndex.getItems(this).filter { +fun Project.findSectionMarkers() = LatexCommandsIndex.Util.getItems(this).filter { it.commandToken.text in CommandMagic.sectionMarkers } \ No newline at end of file diff --git a/src/nl/hannahsten/texifyidea/util/files/FileSet.kt b/src/nl/hannahsten/texifyidea/util/files/FileSet.kt index 7adb417ad..23a97dc98 100644 --- a/src/nl/hannahsten/texifyidea/util/files/FileSet.kt +++ b/src/nl/hannahsten/texifyidea/util/files/FileSet.kt @@ -24,7 +24,7 @@ import nl.hannahsten.texifyidea.util.parser.isDefinition internal fun PsiFile.findReferencedFileSetWithoutCache(): Set { // Setup. val project = this.project - val includes = LatexIncludesIndex.getItems(project) + val includes = LatexIncludesIndex.Util.getItems(project) // Find all root files. val roots = includes.asSequence() @@ -72,20 +72,20 @@ fun PsiFile.referencedFileSet(): Set { fun PsiFile.bibtexIdsInFileSet() = BibtexEntryIndex().getIndexedEntriesInFileSet(this) /** - * @see [LatexCommandsIndex.getItemsInFileSet] + * @see [LatexCommandsIndex.Util.getItemsInFileSet] */ -fun PsiFile.commandsInFileSet(): Collection = LatexCommandsIndex.getItemsInFileSet(this) +fun PsiFile.commandsInFileSet(): Collection = LatexCommandsIndex.Util.getItemsInFileSet(this) /** - * @see [LatexCommandsIndex.getItemsAndFilesInFileSet] + * @see [LatexCommandsIndex.Util.getItemsAndFilesInFileSet] */ -fun PsiFile.commandsAndFilesInFileSet(): List>> = LatexCommandsIndex.getItemsAndFilesInFileSet(this) +fun PsiFile.commandsAndFilesInFileSet(): List>> = LatexCommandsIndex.Util.getItemsAndFilesInFileSet(this) /** * Get all the definitions in the file set. */ fun PsiFile.definitionsInFileSet(): Collection { - return LatexDefinitionIndex.getItemsInFileSet(this) + return LatexDefinitionIndex.Util.getItemsInFileSet(this) .filter { it.isDefinition() } } @@ -93,5 +93,5 @@ fun PsiFile.definitionsInFileSet(): Collection { * Get all the definitions and redefinitions in the file set. */ fun PsiFile.definitionsAndRedefinitionsInFileSet(): Collection { - return LatexDefinitionIndex.getItemsInFileSet(this) + return LatexDefinitionIndex.Util.getItemsInFileSet(this) } diff --git a/src/nl/hannahsten/texifyidea/util/files/ImportPackage.kt b/src/nl/hannahsten/texifyidea/util/files/ImportPackage.kt index 8be1beabe..788f4353d 100644 --- a/src/nl/hannahsten/texifyidea/util/files/ImportPackage.kt +++ b/src/nl/hannahsten/texifyidea/util/files/ImportPackage.kt @@ -21,12 +21,12 @@ import kotlin.math.min */ fun searchFileByImportPaths(command: LatexCommands): PsiFile? { // Check if import commands are used (do this now, to only search for import paths when needed) - val allRelativeImportCommands = LatexIncludesIndex.getCommandsByNames( + val allRelativeImportCommands = LatexIncludesIndex.Util.getCommandsByNames( CommandMagic.relativeImportCommands, command.project, GlobalSearchScope.projectScope(command.project) ) - val allAbsoluteImportCommands = LatexIncludesIndex.getCommandsByNames( + val allAbsoluteImportCommands = LatexIncludesIndex.Util.getCommandsByNames( CommandMagic.absoluteImportCommands, command.project, GlobalSearchScope.projectScope(command.project) @@ -86,7 +86,7 @@ fun checkForAbsolutePath(command: LatexCommands): VirtualFile? { fun findRelativeSearchPathsForImportCommands(command: LatexCommands, givenRelativeSearchPaths: List = listOf("")): List { var relativeSearchPaths = givenRelativeSearchPaths.toMutableSet() - val allIncludeCommands = LatexIncludesIndex.getItems(command.project) + val allIncludeCommands = LatexIncludesIndex.Util.getItems(command.project) // Commands which may include the current file (this is an overestimation, better would be to check for RequiredFileArguments) var includingCommands = allIncludeCommands.filter { includeCommand -> diff --git a/src/nl/hannahsten/texifyidea/util/files/PsiFile.kt b/src/nl/hannahsten/texifyidea/util/files/PsiFile.kt index 6cc0aa1a8..0e39ac924 100644 --- a/src/nl/hannahsten/texifyidea/util/files/PsiFile.kt +++ b/src/nl/hannahsten/texifyidea/util/files/PsiFile.kt @@ -40,7 +40,7 @@ val PsiFile.fileSearchScope: GlobalSearchScope * @return A list containing all included files. */ fun PsiFile.findInclusions(): List { - return LatexIncludesIndex.getItems(this) + return LatexIncludesIndex.Util.getItems(this) .flatMap { it.getIncludedFiles(false) } .toList() } @@ -112,7 +112,7 @@ internal fun PsiFile.referencedFiles(rootFile: VirtualFile): Set { * Recursive implementation of [referencedFiles]. */ private fun PsiFile.referencedFiles(files: MutableCollection, rootFile: VirtualFile) { - LatexIncludesIndex.getItems(project, fileSearchScope).forEach command@{ command -> + LatexIncludesIndex.Util.getItems(project, fileSearchScope).forEach command@{ command -> command.references.filterIsInstance() .mapNotNull { it.resolve(false, rootFile, true) } .forEach { @@ -205,7 +205,7 @@ fun PsiFile.document(): Document? = PsiDocumentManager.getInstance(project).getD * @param commandName * The name of the command including a backslash, or `null` for all commands. * - * @see [LatexCommandsIndex.getItems] + * @see [LatexCommandsIndex.Util.getItems] */ @JvmOverloads fun PsiFile.commandsInFile(commandName: String? = null): Collection { @@ -215,9 +215,9 @@ fun PsiFile.commandsInFile(commandName: String? = null): Collection = LatexEnvironmentsIndex.getItems(this) +fun PsiFile.environmentsInFile(): Collection = LatexEnvironmentsIndex.Util.getItems(this) /** * Get the editor of the file if it is currently opened. Note that the returned editor does not have to be a text editor, @@ -245,7 +245,7 @@ fun PsiFile.openedTextEditor(): Editor? = openedEditor()?.let { * Get all the definitions in the file. */ fun PsiFile.definitions(): Collection { - return LatexDefinitionIndex.getItems(this) + return LatexDefinitionIndex.Util.getItems(this) .filter { it.isDefinition() } } @@ -254,7 +254,7 @@ fun PsiFile.definitions(): Collection { */ @Suppress("unused") fun PsiFile.definitionsAndRedefinitions(): Collection { - return LatexDefinitionIndex.getItems(this) + return LatexDefinitionIndex.Util.getItems(this) } /** diff --git a/src/nl/hannahsten/texifyidea/util/files/ReferencedFileSetCache.kt b/src/nl/hannahsten/texifyidea/util/files/ReferencedFileSetCache.kt index 6810c9c5a..6a59cca30 100644 --- a/src/nl/hannahsten/texifyidea/util/files/ReferencedFileSetCache.kt +++ b/src/nl/hannahsten/texifyidea/util/files/ReferencedFileSetCache.kt @@ -106,8 +106,8 @@ class ReferencedFileSetCache { // Do NOT use a coroutine here, because then when typing (so the caller is e.g. gutter icons, inspections, line makers etc.) somehow the following (at least the runReadAction parts) will block the UI. Note that certain user-triggered actions (think run configuration) will still lead to this blocking the UI if not run in the background explicitly mutex.withLock { // Use the keys of the whole project, because suppose a new include includes the current file, it could be anywhere in the project - // Note that LatexIncludesIndex.getItems(file.project) may be a slow operation and should not be run on EDT - val includes = LatexIncludesIndex.getItems(file.project) + // Note that LatexIncludesIndex.Util.getItems(file.project) may be a slow operation and should not be run on EDT + val includes = LatexIncludesIndex.Util.getItems(file.project) val numberOfIncludesChanged = if (includes.size != numberOfIncludes[file.project]) { numberOfIncludes[file.project] = includes.size dropAllCaches() diff --git a/src/nl/hannahsten/texifyidea/util/labels/Labels.kt b/src/nl/hannahsten/texifyidea/util/labels/Labels.kt index cc98ee113..4d122f633 100644 --- a/src/nl/hannahsten/texifyidea/util/labels/Labels.kt +++ b/src/nl/hannahsten/texifyidea/util/labels/Labels.kt @@ -36,8 +36,8 @@ fun PsiFile.findLatexLabelStringsInFileSetAsSequence(): Sequence { */ fun PsiFile.findLatexLabelingElementsInFile(): Sequence = sequenceOf( findLabelingCommandsInFile(), - LatexParameterLabeledEnvironmentsIndex.getItems(this).asSequence(), - LatexParameterLabeledCommandsIndex.getItems(this).asSequence() + LatexParameterLabeledEnvironmentsIndex.Util.getItems(this).asSequence(), + LatexParameterLabeledCommandsIndex.Util.getItems(this).asSequence() ).flatten() /** @@ -46,8 +46,8 @@ fun PsiFile.findLatexLabelingElementsInFile(): Sequence = sequenceOf */ fun PsiFile.findLatexLabelingElementsInFileSet(): Sequence = sequenceOf( findLabelingCommandsInFileSet(), - LatexParameterLabeledEnvironmentsIndex.getItemsInFileSet(this).asSequence(), - LatexParameterLabeledCommandsIndex.getItemsInFileSet(this).asSequence() + LatexParameterLabeledEnvironmentsIndex.Util.getItemsInFileSet(this).asSequence(), + LatexParameterLabeledCommandsIndex.Util.getItemsInFileSet(this).asSequence() ).flatten() /** diff --git a/src/nl/hannahsten/texifyidea/util/labels/ProjectLabels.kt b/src/nl/hannahsten/texifyidea/util/labels/ProjectLabels.kt index 37d961b3e..8c5699ce9 100644 --- a/src/nl/hannahsten/texifyidea/util/labels/ProjectLabels.kt +++ b/src/nl/hannahsten/texifyidea/util/labels/ProjectLabels.kt @@ -15,10 +15,10 @@ import nl.hannahsten.texifyidea.util.magic.CommandMagic * @return The found label commands. */ fun Project.findAllLabelsAndBibtexIds(): Collection { - val commands = LatexCommandsIndex.getItems(this).findLatexCommandsLabels(this) + val commands = LatexCommandsIndex.Util.getItems(this).findLatexCommandsLabels(this) val bibtexIds = BibtexEntryIndex().getIndexedEntries(this) - val environments = LatexParameterLabeledEnvironmentsIndex.getItems(this) - val parameterLabeledCommands = LatexParameterLabeledCommandsIndex.getItems(this) + val environments = LatexParameterLabeledEnvironmentsIndex.Util.getItems(this) + val parameterLabeledCommands = LatexParameterLabeledCommandsIndex.Util.getItems(this) val result = ArrayList(commands) result.addAll(bibtexIds) result.addAll(environments) diff --git a/test/nl/hannahsten/texifyidea/lang/magic/MagicCommentPsiTest.kt b/test/nl/hannahsten/texifyidea/lang/magic/MagicCommentPsiTest.kt index 5b95f1632..426c1338c 100644 --- a/test/nl/hannahsten/texifyidea/lang/magic/MagicCommentPsiTest.kt +++ b/test/nl/hannahsten/texifyidea/lang/magic/MagicCommentPsiTest.kt @@ -9,7 +9,7 @@ class MagicCommentPsiTest : BasePlatformTestCase() { fun `test get magic comment for command`() { myFixture.configureByText(LatexFileType, "%! suppress = FileNotFound\n\\documentclass{article}") - val command = LatexCommandsIndex.getCommandsByName("\\documentclass", myFixture.file).first() + val command = LatexCommandsIndex.Util.getCommandsByName("\\documentclass", myFixture.file).first() val magic = command.magicComment() Assertions.assertEquals(arrayListOf("suppress = FileNotFound"), magic.toCommentString()) }