diff --git a/CHANGELOG b/CHANGELOG index eca28b5e..bdc847e0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ +2.17.0 +Jun 20, 2021 + +NEW: Plugin name change: CSV +FIX: Null pointer when using csv rendering in Markdown documentation #292 +FIX: NullPointerException on startup #295 + 2.16.4 May 27, 2021 diff --git a/build.gradle b/build.gradle index f3d4a2a3..86808b42 100644 --- a/build.gradle +++ b/build.gradle @@ -28,7 +28,7 @@ jacocoTestReport { } group 'net.seesharpsoft.intellij.plugins' -version '2.16.4' +version '2.17.0' apply plugin: 'java' project.sourceCompatibility = JavaVersion.VERSION_11 diff --git a/src/main/java/net/seesharpsoft/intellij/plugins/csv/CsvStorageHelper.java b/src/main/java/net/seesharpsoft/intellij/plugins/csv/CsvStorageHelper.java index a677a182..6ab6d8be 100644 --- a/src/main/java/net/seesharpsoft/intellij/plugins/csv/CsvStorageHelper.java +++ b/src/main/java/net/seesharpsoft/intellij/plugins/csv/CsvStorageHelper.java @@ -1,5 +1,6 @@ package net.seesharpsoft.intellij.plugins.csv; +import com.intellij.injected.editor.VirtualFileWindow; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.io.FileUtil; @@ -17,11 +18,17 @@ public static String getRelativeFilePath(Project project, VirtualFile virtualFil if (project == null || virtualFile == null) { return null; } + if (virtualFile instanceof VirtualFileWindow) { + virtualFile = ((VirtualFileWindow) virtualFile).getDelegate(); + } String filePath = virtualFile.getUserData(RELATIVE_FILE_URL); if (filePath == null && project.getBasePath() != null) { + String localFilePath = PathUtil.getLocalPath(virtualFile); + if (localFilePath == null) { + return null; + } String projectDir = PathUtil.getLocalPath(project.getBasePath()); - filePath = PathUtil.getLocalPath(virtualFile) - .replaceFirst("^" + Pattern.quote(projectDir), ""); + filePath = localFilePath.replaceFirst("^" + Pattern.quote(projectDir), ""); virtualFile.putUserData(RELATIVE_FILE_URL, filePath); } return filePath; diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index e0f1d0f9..a2f673e6 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -1,6 +1,6 @@ net.seesharpsoft.intellij.plugins.csv - CSV Plugin + CSV Martin Sommer @@ -50,8 +50,9 @@ -FIX: fully prevent calculateDistributedColumnWidth on erroneous CSV #283 -FIX: Memory leak of PsiFile #284 +NEW: Plugin name change: CSV +FIX: Null pointer when using csv rendering in Markdown documentation #292 +FIX: NullPointerException on startup #295 ]]>