diff --git a/CHANGELOG.md b/CHANGELOG.md index c92af46f5..d841c1d37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,44 @@ ### Fixed * Disallow unmatched braces after \@ifnextchar + +## [0.9.9-alpha.8] - 2024-11-28 + +### Added + +* Add support for \includesvg +* Support references in \subfix command +* Provide autocompletion for all relevant directories when using subfiles +* Do not format existing directories in the given path in the file creation quickfix dialog +* Disable Evince inverse search on Windows to avoid a UI freeze on opening a second project +* Use xdg-mime to choose a default pdf viewer in the run configuration template +* Don't insert the right brace when in front of text +* Add DeclareMathSymbol to indexed command definitions in installed packages +* Add support for TEXMFHOME for reference resolving +* Add diffcoeff and upgreek packages to autocompletion, by @Toseflo +* Improve reference resolving when using subfiles +* Add setting to disable auto-import of bibtex entries from remote libraries + +### Fixed + +* Fix exception #3771 when a file referenced from cache is deleted * Fix basic case of false positive of duplicate label inspection when user defined \if commands are used * Fix a parse error when using \else with a user defined \if-command +* Fix relative path conversion in graphics insertion wizard by resolving relative to the root file +* Fix exception #3763 +* Fix 'missing import' false positive in subfiles +* Don't override the file icon for .txt files, by @Steve-Li-1998 +* Fix exceptions #3754 and #3326 +* Fix exceptions in structure view when command parameters are missing +* Improve error report submitter for long stacktraces +* Fix a parser issue with bidirectional arrow in TikZ +* Fix default Docker image name when running Dockerized TeX Live without a project SDK +* Always use content roots to resolve references +* Fix 'package not found' error when using texlive-full on Windows, and improve running of system commands, by @tristankretzer +* Fix rename of files when using subfiles +* Fix incorrect 'package already included' warning for the subfiles package +* Fix exception #3557 if using bibtex structure view when bibtex file type is reassignd to plain text +* Avoid referencing obsolete psifiles, fix exception #3635 ## [0.9.9-alpha.7] - 2024-11-24 @@ -26,6 +62,7 @@ * Add setting to disable auto-import of bibtex entries from remote libraries ### Fixed + * Fix relative path conversion in graphics insertion wizard by resolving relative to the root file * Fix exception #3763 * Fix 'missing import' false positive in subfiles @@ -520,7 +557,8 @@ Thanks to @jojo2357 and @MisterDeenis for contributing to this release! * Fix some intention previews. ([#2796](https://github.com/Hannah-Sten/TeXiFy-IDEA/issues/2796)) * Other small bug fixes and improvements. ([#2776](https://github.com/Hannah-Sten/TeXiFy-IDEA/issues/2776), [#2774](https://github.com/Hannah-Sten/TeXiFy-IDEA/issues/2774), [#2765](https://github.com/Hannah-Sten/TeXiFy-IDEA/issues/2765)-[#2773](https://github.com/Hannah-Sten/TeXiFy-IDEA/issues/2773)) -[Unreleased]: https://github.com/Hannah-Sten/TeXiFy-IDEA/compare/v0.9.9-alpha.7...HEAD +[Unreleased]: https://github.com/Hannah-Sten/TeXiFy-IDEA/compare/v0.9.9-alpha.8...HEAD +[0.9.9-alpha.8]: https://github.com/Hannah-Sten/TeXiFy-IDEA/compare/v0.9.9-alpha.7...v0.9.9-alpha.8 [0.9.9-alpha.7]: https://github.com/Hannah-Sten/TeXiFy-IDEA/compare/v0.9.9-alpha.6...v0.9.9-alpha.7 [0.9.9-alpha.6]: https://github.com/Hannah-Sten/TeXiFy-IDEA/compare/v0.9.9-alpha.4...v0.9.9-alpha.6 [0.9.9-alpha.4]: https://github.com/Hannah-Sten/TeXiFy-IDEA/compare/v0.9.9-alpha.3...v0.9.9-alpha.4 diff --git a/gradle.properties b/gradle.properties index e1150a553..665ee2133 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -pluginVersion = 0.9.9-alpha.7 +pluginVersion = 0.9.9-alpha.8 # Info about build ranges: https://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html # Note that an xyz branch corresponds to version 20xy.z and a since build of xyz.* diff --git a/src/nl/hannahsten/texifyidea/completion/pathcompletion/LatexGraphicsPathProvider.kt b/src/nl/hannahsten/texifyidea/completion/pathcompletion/LatexGraphicsPathProvider.kt index 1af487424..b872d53e9 100644 --- a/src/nl/hannahsten/texifyidea/completion/pathcompletion/LatexGraphicsPathProvider.kt +++ b/src/nl/hannahsten/texifyidea/completion/pathcompletion/LatexGraphicsPathProvider.kt @@ -3,10 +3,10 @@ package nl.hannahsten.texifyidea.completion.pathcompletion import com.intellij.openapi.vfs.VirtualFile import com.intellij.psi.PsiFile import nl.hannahsten.texifyidea.index.LatexIncludesIndex -import nl.hannahsten.texifyidea.lang.commands.LatexGenericRegularCommand import nl.hannahsten.texifyidea.psi.LatexCommands import nl.hannahsten.texifyidea.psi.LatexNormalText import nl.hannahsten.texifyidea.util.files.* +import nl.hannahsten.texifyidea.util.magic.CommandMagic import nl.hannahsten.texifyidea.util.magic.cmd import nl.hannahsten.texifyidea.util.parser.childrenOfType import java.io.File @@ -33,7 +33,7 @@ class LatexGraphicsPathProvider : LatexPathProviderBase() { */ fun getGraphicsPathsInFileSet(file: PsiFile): List { val graphicsPaths = mutableListOf() - val graphicsPathCommands = file.commandsInFileSet().filter { it.name == LatexGenericRegularCommand.GRAPHICSPATH.cmd } + val graphicsPathCommands = file.commandsInFileSet().filter { command -> CommandMagic.graphicPathsCommands.map { it.cmd }.contains(command.name) } // Is a graphicspath defined? if (graphicsPathCommands.isNotEmpty()) { @@ -95,7 +95,7 @@ class LatexGraphicsPathProvider : LatexPathProviderBase() { * Get all the graphics paths defined by one \graphicspaths command. */ private fun LatexCommands.getGraphicsPaths(): List { - if (name != LatexGenericRegularCommand.GRAPHICSPATH.cmd) return emptyList() + if (!CommandMagic.graphicPathsCommands.map { it.cmd }.contains(name)) return emptyList() return parameterList.firstNotNullOfOrNull { it.requiredParam } // Each graphics path is in a group. ?.childrenOfType(LatexNormalText::class) diff --git a/src/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexFileNotFoundInspection.kt b/src/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexFileNotFoundInspection.kt index 4bc0b9e01..b1fc1a839 100644 --- a/src/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexFileNotFoundInspection.kt +++ b/src/nl/hannahsten/texifyidea/inspections/latex/probablebugs/LatexFileNotFoundInspection.kt @@ -115,7 +115,7 @@ open class LatexFileNotFoundInspection : TexifyInspectionBase() { // Display a dialog to ask for the location and name of the new file. // By default, all inclusion paths are relative to the main file - val newFilePath = CreateFileDialog(root, filePath.replace("$root/", "").formatAsFilePath()) + val newFilePath = CreateFileDialog(root, filePath.replace("$root/", "")) .newFileFullPath ?: return runWriteAction { diff --git a/src/nl/hannahsten/texifyidea/lang/LatexPackage.kt b/src/nl/hannahsten/texifyidea/lang/LatexPackage.kt index 84e559102..5b46f172f 100644 --- a/src/nl/hannahsten/texifyidea/lang/LatexPackage.kt +++ b/src/nl/hannahsten/texifyidea/lang/LatexPackage.kt @@ -83,6 +83,7 @@ open class LatexPackage @JvmOverloads constructor( val SPLITINDEX = LatexPackage("splitindex") val STMARYRD = LatexPackage("stmaryrd") val SUBFILES = LatexPackage("subfiles") + val SVG = LatexPackage("svg") val TABULARRAY = LatexPackage("tabularray") val TCOLORBOX = LatexPackage("tcolorbox") val TEXTCOMP = LatexPackage("textcomp") diff --git a/src/nl/hannahsten/texifyidea/lang/commands/LatexGenericRegularCommand.kt b/src/nl/hannahsten/texifyidea/lang/commands/LatexGenericRegularCommand.kt index e7b156501..2b2461886 100644 --- a/src/nl/hannahsten/texifyidea/lang/commands/LatexGenericRegularCommand.kt +++ b/src/nl/hannahsten/texifyidea/lang/commands/LatexGenericRegularCommand.kt @@ -11,6 +11,7 @@ import nl.hannahsten.texifyidea.lang.LatexPackage.Companion.GLOSSARIES import nl.hannahsten.texifyidea.lang.LatexPackage.Companion.GRAPHICX import nl.hannahsten.texifyidea.lang.LatexPackage.Companion.MATHTOOLS import nl.hannahsten.texifyidea.lang.LatexPackage.Companion.NTHEOREM +import nl.hannahsten.texifyidea.lang.LatexPackage.Companion.SVG import nl.hannahsten.texifyidea.lang.LatexPackage.Companion.TEXTCOMP import nl.hannahsten.texifyidea.lang.LatexPackage.Companion.ULEM import nl.hannahsten.texifyidea.lang.LatexPackage.Companion.VARIOREF @@ -147,6 +148,7 @@ enum class LatexGenericRegularCommand( INPUTMINTED("inputminted", "language".asRequired(Argument.Type.MINTED_FUNTIME_LAND), RequiredFileArgument("sourcefile", true, false, ""), dependency = LatexPackage.MINTED), INCLUDEGRAPHICS("includegraphics", "key-val-list".asOptional(), RequiredPicturePathArgument("imagefile", isAbsolutePathSupported = true, commaSeparatesArguments = false, FileMagic.graphicFileExtensions, supportsAnyExtension = false), dependency = GRAPHICX), INCLUDEONLY("includeonly", RequiredFileArgument("sourcefile", false, true, "tex")), + INCLUDESVG("includesvg", "options".asOptional(), RequiredPicturePathArgument("svg file", isAbsolutePathSupported = true, commaSeparatesArguments = false, extension = listOf("svg"), supportsAnyExtension = false), dependency = SVG), INDEXNAME("indexname", "name".asRequired()), INDEXSPACE("indexspace"), INDEX("intex", "entry".asRequired()), @@ -303,6 +305,7 @@ enum class LatexGenericRegularCommand( SUBSUBSECTION_STAR("subsubsection*", "title".asRequired(Argument.Type.TEXT)), SUBSUBSECTIONMARK("subsubsectionmark", "code".asRequired()), SUPPRESSFLOATS("suppressfloats", "placement".asOptional()), + SVGPATH("svgpath", RequiredFolderArgument("foldername"), dependency = SVG), SYMBOL("symbol", "n".asRequired()), TABCOLSEP("tabcolsep"), TABLENAME("tablename", "name".asRequired(Argument.Type.TEXT)), diff --git a/src/nl/hannahsten/texifyidea/reference/InputFileReference.kt b/src/nl/hannahsten/texifyidea/reference/InputFileReference.kt index d63fd907f..3866b0888 100644 --- a/src/nl/hannahsten/texifyidea/reference/InputFileReference.kt +++ b/src/nl/hannahsten/texifyidea/reference/InputFileReference.kt @@ -148,9 +148,12 @@ class InputFileReference( // Try graphicspaths if (targetFile == null) { // If we are not building the fileset, we can make use of it - if (!isBuildingFileset && element.containingFile.includedPackages().contains(LatexGenericRegularCommand.GRAPHICSPATH.dependency)) { - // Add the graphics paths to the search paths - searchPaths.addAll(LatexGraphicsPathProvider().getGraphicsPathsInFileSet(element.containingFile)) + if (!isBuildingFileset) { + val includedPackages = element.containingFile.includedPackages() + if (CommandMagic.graphicPathsCommands.any { includedPackages.contains(it.dependency) }) { + // Add the graphics paths to the search paths + searchPaths.addAll(LatexGraphicsPathProvider().getGraphicsPathsInFileSet(element.containingFile)) + } } for (searchPath in searchPaths) { val path = if (!searchPath.endsWith("/")) "$searchPath/" else searchPath diff --git a/src/nl/hannahsten/texifyidea/util/files/ReferencedFileSetCache.kt b/src/nl/hannahsten/texifyidea/util/files/ReferencedFileSetCache.kt index e579cb6bb..4c61fdd2d 100644 --- a/src/nl/hannahsten/texifyidea/util/files/ReferencedFileSetCache.kt +++ b/src/nl/hannahsten/texifyidea/util/files/ReferencedFileSetCache.kt @@ -122,7 +122,8 @@ class ReferencedFileSetCache { } } } - cache[file.virtualFile]?.mapNotNull { it.element }?.toSet() ?: setOf(file) + // Make sure to check if file is still valid after retrieving from cache (it may have been deleted) + cache[file.virtualFile]?.mapNotNull { it.element }?.filter { it.isValid }?.toSet() ?: setOf(file) } else { setOf(file) diff --git a/src/nl/hannahsten/texifyidea/util/magic/CommandMagic.kt b/src/nl/hannahsten/texifyidea/util/magic/CommandMagic.kt index e8cbb0f42..357dda39e 100644 --- a/src/nl/hannahsten/texifyidea/util/magic/CommandMagic.kt +++ b/src/nl/hannahsten/texifyidea/util/magic/CommandMagic.kt @@ -378,6 +378,8 @@ object CommandMagic { "\\DeclareDocumentEnvironment" ) + val graphicPathsCommands = listOf(GRAPHICSPATH, SVGPATH) + /** * Commands that should not have the given file extensions. */