Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Release 3.0.2 #390

Merged
merged 16 commits into from
Dec 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/PublishStable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ jobs:
include:
- ideaVersion: 2022.2.1
gkVersion: 2021.1.2
- ideaVersion: LATEST-EAP-SNAPSHOT
- ideaVersion: 2022.3.1
gkVersion: 2021.1.2
# - ideaVersion: LATEST-EAP-SNAPSHOT
# gkVersion: 2021.1.2

steps:
- uses: actions/checkout@v2
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
3.0.2
Dec 15, 2022

FIX: Detected bulk mode status update from DocumentBulkUpdateListener #384
FIX: Argument for @NotNull parameter 'parent' of PsiHelper.getNthChildOfType must not be null #372
FIX: Argument for @NotNull parameter 'element' of PsiHelper.getSiblingOfType must not be null #375
FIX: Cannot invoke "Document.getText()" because "document" is null #388
FIX: Cannot invoke "PsiFile.getProject()" because the return value of "CsvPsiTreeUpdater.getPsiFile()" is null #378
FIX: Argument for @NotNull parameter 'replacement' of CsvPsiTreeUpdater$ReplacePsiAction.<init> must not be null #380
FIX: provide project parameter for opening link
FIX: Cannot invoke "Document.insertString(int, java.lang.CharSequence)" because "document" is null #386
FIX: first extension sanity check

3.0.1
Nov 12, 2022

Expand Down
33 changes: 14 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
// https://github.com/JetBrains/gradle-intellij-plugin
id 'org.jetbrains.intellij' version '1.9.0'
id 'org.jetbrains.intellij' version '1.10.1'
id 'jacoco'
id 'com.github.kt3k.coveralls' version '2.8.4'
id 'com.github.ManifestClasspath' version '0.1.0-RELEASE'
Expand Down Expand Up @@ -57,8 +57,8 @@ sourceSets {
apply plugin: 'idea'
idea {
project {
jdkName = JavaVersion.VERSION_11
languageLevel = JavaVersion.VERSION_11
jdkName = JavaVersion.VERSION_17
languageLevel = JavaVersion.VERSION_17
vcs = 'Git'
}
module {
Expand All @@ -73,7 +73,7 @@ var final EAP_BUILD = '223'
var idea_version = System.getenv().getOrDefault('IDEA_VERSION', '2022.2.1')
var build_version = idea_version == EAP_VERSION ? EAP_BUILD : idea_version.substring(2, 4) + idea_version.charAt(5) // extract e.g. '221' from '2022.1.1'

version '3.0.1-' + build_version
version '3.0.2-' + build_version

apply plugin: 'org.jetbrains.intellij'
intellij {
Expand Down Expand Up @@ -107,15 +107,17 @@ Feedback is welcome!
PS: The previous versions are still available on the project page.


Update 3.0.1

FIX: cannot init component state (componentName=CsvFileAttributes) #359
FIX: cannot invoke "add(Object)" because "this.myUncommittedActions" is null #361
FIX: cannot invoke "createNotification(...)" because "notificationGroup" is null #362
FIX: cannot invoke "getManager()" because the return value of "getPsiFile()" is null #363
FIX: image in plugin description
FIX: plugin update restart
Update 3.0.2

FIX: Detected bulk mode status update from DocumentBulkUpdateListener #384
FIX: Argument for @NotNull parameter 'parent' of PsiHelper.getNthChildOfType must not be null #372
FIX: Argument for @NotNull parameter 'element' of PsiHelper.getSiblingOfType must not be null #375
FIX: Cannot invoke "Document.getText()" because "document" is null #388
FIX: Cannot invoke "PsiFile.getProject()" because the return value of "CsvPsiTreeUpdater.getPsiFile()" is null #378
FIX: Argument for @NotNull parameter 'replacement' of CsvPsiTreeUpdater\$ReplacePsiAction.<init> must not be null #380
FIX: provide project parameter for opening link
FIX: Cannot invoke "Document.insertString(int, java.lang.CharSequence)" because "document" is null #386
FIX: first extension sanity check

</pre>"""
}
Expand Down Expand Up @@ -164,10 +166,3 @@ tasks.named("generateLexer").configure {
compileJava {
dependsOn generateLexer
}

// TODO https://youtrack.jetbrains.com/issue/IDEA-298989 - remove after gradle plugin v1.9.1 or v1.10.0 released
setupDependencies {
doLast {
fileTree("$buildDir/instrumented/instrumentCode") { include("**/*TableEditorSwing.class") }.files.forEach { delete(it) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static boolean isCsvFile(String extension) {
}

public static boolean isCsvFile(Project project, VirtualFile file) {
if (project == null || file == null) {
if (project == null || file == null || !isCsvFile(file.getExtension())) {
return false;
}
final Language language = LanguageUtil.getLanguageForPsi(project, file);
Expand Down Expand Up @@ -312,10 +312,6 @@ public static String quoteCsvField(String content,
}
if (quotingEnforced || isQuotingRequired(content, valueSeparator)) {
String result = content;
// if (escapeCharacter != CsvEscapeCharacter.QUOTE) {
// result = result.replaceAll(escapeCharacter.getRegexPattern(),
// escapeCharacter.getRegexPattern() + escapeCharacter.getRegexPattern());
// }
result = result.replaceAll("\"", escapeCharacter.getRegexPattern() + "\"");
return "\"" + result + "\"";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private static void openLink(Project project, String link) {
if (link.startsWith("#")) {
((ShowSettingsUtilImpl) ShowSettingsUtil.getInstance()).showSettingsDialog(project, link.substring(1), null);
} else {
BrowserUtil.browse(link);
BrowserUtil.browse(link, project);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ public void setValue(String value, int rowIndex, int columnIndex) {
}

private int getColumnCount(int rowIndex) {
return getColumnCount(PsiHelper.getNthChildOfType(getPsiTreeUpdater().getPsiFile(), rowIndex, CsvRecord.class));
PsiFile psiFile = getPsiFile();
if (psiFile == null) return 0;
return getColumnCount(PsiHelper.getNthChildOfType(psiFile, rowIndex, CsvRecord.class));
}

private int getColumnCount(PsiElement record) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ public String getFamilyName() {
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
PsiElement element = descriptor.getPsiElement();
Document document = PsiDocumentManager.getInstance(project).getDocument(element.getContainingFile());
List<Integer> quotePositions = new ArrayList<>();
if (document == null) return;

List<Integer> quotePositions = new ArrayList<>();
int quotePosition = CsvIntentionHelper.getOpeningQuotePosition(element);
if (quotePosition != -1) {
quotePositions.add(quotePosition);
Expand All @@ -147,6 +148,8 @@ public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descri
try {
PsiElement element = descriptor.getPsiElement();
Document document = PsiDocumentManager.getInstance(project).getDocument(element.getContainingFile());
if (document == null) return;

CsvValueSeparator separator = CsvHelper.getValueSeparator(element.getContainingFile());
String text = document.getText();
document.setText(text.substring(0, element.getTextOffset()) + separator.getCharacter() + text.substring(element.getTextOffset()));
Expand All @@ -166,6 +169,8 @@ public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descri
try {
PsiElement element = descriptor.getPsiElement();
Document document = PsiDocumentManager.getInstance(project).getDocument(element.getContainingFile());
if (document == null) return;

document.setText(document.getText() + "\"");
} catch (IncorrectOperationException e) {
LOG.error(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ public static Collection<PsiElement> getAllElements(PsiFile file) {

public static void quoteAll(@NotNull Project project, @NotNull PsiFile psiFile) {
Document document = PsiDocumentManager.getInstance(project).getDocument(psiFile);
List<Integer> quotePositions = new ArrayList<>();
if (document == null) return;

List<Integer> quotePositions = new ArrayList<>();
PsiTreeUtil.processElements(psiFile, CsvField.class, field -> {
if (PsiHelper.getElementType(field.getFirstChild()) != CsvTypes.QUOTE) {
quotePositions.add(field.getTextRange().getStartOffset());
Expand All @@ -63,6 +64,8 @@ public static void quoteAll(@NotNull Project project, @NotNull PsiFile psiFile)

public static void quoteValue(@NotNull Project project, @NotNull final PsiElement field) {
Document document = PsiDocumentManager.getInstance(project).getDocument(field.getContainingFile());
if (document == null) return;

List<Integer> quotePositions = new ArrayList<>();
if (PsiHelper.getElementType(field.getFirstChild()) != CsvTypes.QUOTE) {
quotePositions.add(field.getTextRange().getStartOffset());
Expand All @@ -75,9 +78,9 @@ public static void quoteValue(@NotNull Project project, @NotNull final PsiElemen

public static void unquoteAll(@NotNull Project project, @NotNull PsiFile psiFile) {
Document document = PsiDocumentManager.getInstance(project).getDocument(psiFile);
if (document == null) return;

final List<PsiElement> quotePositions = new ArrayList<>();

PsiTreeUtil.processElements(psiFile, CsvField.class, field -> {
if (getChildren(field).stream().noneMatch(element -> PsiHelper.getElementType(element) == CsvTypes.ESCAPED_TEXT)) {
Pair<PsiElement, PsiElement> positions = getQuotePositions(field);
Expand Down Expand Up @@ -115,7 +118,7 @@ private static Pair<PsiElement, PsiElement> getQuotePositions(PsiElement element
return null;
}

public static void addQuotes(final Document document, List<Integer> quotePositions) {
public static void addQuotes(@NotNull final Document document, List<Integer> quotePositions) {
int offset = 0;
String quote = "\"";
quotePositions.sort(Integer::compareTo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ protected static void changeLeftAndRightColumnOrder(@NotNull Project project,
CsvColumnInfo<PsiElement> leftColumnInfo,
CsvColumnInfo<PsiElement> rightColumnInfo) {
Document document = PsiDocumentManager.getInstance(project).getDocument(csvFile);
if (document == null) return;

document.setText(
changeLeftAndRightColumnOrder(document.getText(), CsvHelper.getValueSeparator(csvFile), leftColumnInfo, rightColumnInfo)
);
Expand Down
Loading