From ffc89f2f872665bb2961ebe4640cb6cb417ff141 Mon Sep 17 00:00:00 2001 From: Thomas Schouten Date: Sun, 24 Nov 2024 17:56:35 +0100 Subject: [PATCH 1/2] Do not format existing directories in the given path in the file creation quickfix dialog --- CHANGELOG.md | 1 + .../texifyidea/ui/CreateFileDialog.kt | 26 +++++++++++++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79c92d0d2..557803bf5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [Unreleased] ### Added +* Do not format existing directories in the given path in the file creation quickfix dialog ### Fixed diff --git a/src/nl/hannahsten/texifyidea/ui/CreateFileDialog.kt b/src/nl/hannahsten/texifyidea/ui/CreateFileDialog.kt index 5d74be87d..0cb415745 100644 --- a/src/nl/hannahsten/texifyidea/ui/CreateFileDialog.kt +++ b/src/nl/hannahsten/texifyidea/ui/CreateFileDialog.kt @@ -2,6 +2,7 @@ package nl.hannahsten.texifyidea.ui import com.intellij.openapi.fileChooser.FileChooserDescriptor import com.intellij.openapi.ui.* +import com.intellij.openapi.vfs.LocalFileSystem import nl.hannahsten.texifyidea.util.formatAsFilePath import java.io.File import javax.swing.JPanel @@ -12,12 +13,11 @@ import javax.swing.JTextField * * Dialog to ask the user for a file name and location when creating a new file. * - * @param currentFilePath The path of the file we are currently in, e.g., the file from which an intention was triggered - * that creates a new file. + * @param basePath The path of the file to which the newFileName is relative * @param newFileName The name of the new file, with or without the extension. Will be reformatted before being shown to the user. * @param newFileFullPath The full path of the new file, without tex extension. */ -class CreateFileDialog(private val currentFilePath: String?, private val newFileName: String, var newFileFullPath: String? = null) { +class CreateFileDialog(private val basePath: String?, private val newFileName: String, var newFileFullPath: String? = null) { init { DialogBuilder().apply { @@ -26,10 +26,26 @@ class CreateFileDialog(private val currentFilePath: String?, private val newFile panel.layout = VerticalFlowLayout(VerticalFlowLayout.TOP) // Field to enter the name of the new file. - val nameField = JTextField(newFileName.formatAsFilePath()) + // If only the file is new, but the directory exists, use the existing directory and don't change it to follow conventions + val formattedPath = if (basePath != null) { + var existingPath = LocalFileSystem.getInstance().findFileByPath(basePath) + var existingRelativePath = "" + val partsToFormat = newFileName.split('/').dropWhile { part -> + if (existingPath?.exists() == false) return@dropWhile false + existingPath = existingPath?.children?.firstOrNull { it.name == part } ?: return@dropWhile false + existingRelativePath += "$part/" + true + } + existingRelativePath + partsToFormat.joinToString("/").formatAsFilePath() + } + else { + newFileName.formatAsFilePath() + } + val nameField = JTextField(formattedPath) + // Field to select the folder/location of the new file. val pathField = TextFieldWithBrowseButton() - pathField.text = currentFilePath ?: return@apply + pathField.text = basePath ?: return@apply // Make sure the dialog is wide enough to fit the whole path in the text field. pathField.textField.columns = pathField.text.length From 3f302b3adff40ffa2ee1fc667984b5195467c003 Mon Sep 17 00:00:00 2001 From: Thomas Schouten Date: Sun, 24 Nov 2024 20:44:06 +0100 Subject: [PATCH 2/2] 0.9.9-alpha.7 --- CHANGELOG.md | 31 ++++++++++++++++++++++++++++++- gradle.properties | 2 +- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ad9b2637..48fb0f35c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,12 +3,40 @@ ## [Unreleased] ### Added + +### Fixed + +## [0.9.9-alpha.7] - 2024-11-24 + +### Added + * 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 '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.6] - 2024-11-23 @@ -488,7 +516,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.6...HEAD +[Unreleased]: https://github.com/Hannah-Sten/TeXiFy-IDEA/compare/v0.9.9-alpha.7...HEAD +[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 [0.9.9-alpha.3]: https://github.com/Hannah-Sten/TeXiFy-IDEA/compare/v0.9.9-alpha.2...v0.9.9-alpha.3 diff --git a/gradle.properties b/gradle.properties index a4bc80112..e1150a553 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -pluginVersion = 0.9.9-alpha.6 +pluginVersion = 0.9.9-alpha.7 # 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.*