Skip to content

Commit

Permalink
[INTERNAL] Resolve merge conflicts and revert changes towards v2019.2
Browse files Browse the repository at this point in the history
  • Loading branch information
SeeSharpSoft committed Sep 17, 2019
1 parent afcf20e commit 6212a9b
Show file tree
Hide file tree
Showing 25 changed files with 190 additions and 90 deletions.
10 changes: 6 additions & 4 deletions .travis.yml
Expand Up @@ -3,8 +3,10 @@ jdk:
- openjdk8

env:
- IDEA_VERSION=IC-192.5728.98 GRAMMAR_KIT_VERSION=2017.1.6
- IDEA_VERSION=PC-LATEST-EAP-SNAPSHOT GRAMMAR_KIT_VERSION=2017.1.6
- IDEA_VERSION=IC-2017.3.1 GRAMMAR_KIT_VERSION=2017.1.2
- IDEA_VERSION=IC-2018.3.2 GRAMMAR_KIT_VERSION=2017.1.7
- IDEA_VERSION=IC-2019.1.3 GRAMMAR_KIT_VERSION=2017.1.7
- IDEA_VERSION=PC-LATEST-EAP-SNAPSHOT GRAMMAR_KIT_VERSION=07f30a1e7666f36ae780f614b6bbc89690ba36c3

script: xvfb-run gradle check

Expand All @@ -14,9 +16,9 @@ after_success:
jobs:
include:
- if: (branch = master AND type = push) OR (type = pull_request)
env: IDEA_VERSION=IC-192.5728.98 GRAMMAR_KIT_VERSION=2017.1.6
env: IDEA_VERSION=IC-191.5701.16 GRAMMAR_KIT_VERSION=2017.1.7
script: xvfb-run gradle check verifyPlugin
- stage: deploy
if: branch IN (Testing, Staging, Stable) AND type = push
env: IDEA_VERSION=IC-192.5728.98 GRAMMAR_KIT_VERSION=2017.1.6 JI_CHANNELS=$TRAVIS_BRANCH
env: IDEA_VERSION=IC-191.5701.16 GRAMMAR_KIT_VERSION=2017.1.7 JI_CHANNELS=$TRAVIS_BRANCH
script: xvfb-run gradle publishPlugin
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -8,7 +8,7 @@

# Lightweight CSV Plugin for JetBrains IDE family

Compatible with _IntelliJ IDEA PhpStorm WebStorm PyCharm RubyMine AppCode CLion Gogland DataGrip Rider MPS Android Studio_ - __2016.3.2 and newer__
Compatible with _IntelliJ IDEA PhpStorm WebStorm PyCharm RubyMine AppCode CLion Gogland DataGrip Rider MPS Android Studio_ - __2017.3.1 and newer__

This plugin introduces CSV (_Comma-Separated Values_) as a language to Jetbrains IDE with a syntax definition, structured language elements and associated file types (.csv/.tsv/.psv).
This enables default editor features like syntax validation, highlighting and inspections for CSV-alike files.
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Expand Up @@ -71,11 +71,11 @@ idea {
apply plugin: 'org.jetbrains.intellij'
intellij {
// IDE version - https://www.jetbrains.com/intellij-repository/releases
version = System.getenv().getOrDefault('IDEA_VERSION', 'IC-192.5728.98')
version = System.getenv().getOrDefault('IDEA_VERSION', 'IC-191.5701.16')
pluginName = 'CSV Plugin'
instrumentCode = true
updateSinceUntilBuild = false
downloadSources = false
downloadSources = true
}
publishPlugin {
token = System.getenv().getOrDefault('JI_TOKEN', '')
Expand Down
@@ -0,0 +1,12 @@
package net.seesharpsoft.intellij.plugins.csv;

import com.intellij.openapi.fileTypes.FileTypeConsumer;
import com.intellij.openapi.fileTypes.FileTypeFactory;
import org.jetbrains.annotations.NotNull;

public class CsvFileTypeFactory extends FileTypeFactory {
@Override
public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) {
fileTypeConsumer.consume(CsvFileType.INSTANCE, String.join(FileTypeConsumer.EXTENSION_DELIMITER, new String[] {"csv"}));
}
}
Expand Up @@ -243,6 +243,7 @@ public void setTableAutoColumnWidthOnOpen(boolean tableAutoColumnWidthOnOpen) {
public boolean isAdvancedFontHandling() {
return getState().ADVANCED_FONT_HANDLING;
}

public void setAdvancedFontHandling(boolean advancedFontHandling) {
getState().ADVANCED_FONT_HANDLING = advancedFontHandling;
}
Expand Down
Expand Up @@ -9,6 +9,7 @@
import com.intellij.util.ui.UIUtil;
import net.seesharpsoft.intellij.plugins.csv.editor.CsvEditorSettingsExternalizable;
import net.seesharpsoft.intellij.plugins.csv.settings.CsvColorSettings;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;
import javax.swing.border.EmptyBorder;
Expand Down Expand Up @@ -80,13 +81,13 @@ public Component getTableCellRendererComponent(JTable table, Object value, boole
myTextArea.setBorder(new EmptyBorder(1, 2, 1, 2));
}

this.setText(value == null ? "" : value.toString());

final int columnWidth = table.getColumnModel().getColumn(column).getWidth();
final int rowHeight = table.getRowHeight(row);
this.setFont(table.getFont());

this.setSize(columnWidth, rowHeight);
this.validate();
myTextArea.setText((value == null) ? "" : value.toString());
myTextArea.setFont(table.getFont());
myTextArea.setSize(columnWidth, rowHeight);
myTextArea.validate();

Expand Down Expand Up @@ -118,30 +119,30 @@ public Object getCellEditorValue() {
return myTextArea.getText();
}

@Override
public void setText(String text) {
if (CsvEditorSettingsExternalizable.getInstance().isAdvancedFontHandling()) {
setFont(determineFont(text));
}
super.setText(text);
protected void setText(@NotNull String text) {
Font font = determineFont(text);
this.setFont(font);
myTextArea.setFont(font);
myTextArea.setText(text);
}

public Font determineFont(String text) {
Font baseFont = UIUtil.getFontWithFallback(EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN));

FontFallbackIterator it = new FontFallbackIterator();
it.setPreferredFont(baseFont.getFamily(), baseFont.getSize());
it.setFontStyle(baseFont.getStyle());
it.start(text, 0, text.length());
protected Font determineFont(@NotNull String text) {
Font finalFont = UIUtil.getFontWithFallback(EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN));

Font finalFont = baseFont;
for(; !it.atEnd(); it.advance()) {
Font font = it.getFont();
if(!font.getFamily().equals(baseFont.getFamily())) {
finalFont = font;
break;
if (CsvEditorSettingsExternalizable.getInstance().isAdvancedFontHandling()) {
FontFallbackIterator it = new FontFallbackIterator();
it.setPreferredFont(finalFont.getFamily(), finalFont.getSize());
it.setFontStyle(finalFont.getStyle());
it.start(text, 0, text.length());
for (; !it.atEnd(); it.advance()) {
Font font = it.getFont();
if (!font.getFamily().equals(finalFont.getFamily())) {
finalFont = font;
break;
}
}
}

return finalFont;
}

Expand Down
@@ -0,0 +1,12 @@
package net.seesharpsoft.intellij.plugins.psv;

import com.intellij.openapi.fileTypes.FileTypeConsumer;
import com.intellij.openapi.fileTypes.FileTypeFactory;
import org.jetbrains.annotations.NotNull;

public class PsvFileTypeFactory extends FileTypeFactory {
@Override
public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) {
fileTypeConsumer.consume(PsvFileType.INSTANCE, String.join(FileTypeConsumer.EXTENSION_DELIMITER, new String[] {"psv"}));
}
}
@@ -0,0 +1,12 @@
package net.seesharpsoft.intellij.plugins.tsv;

import com.intellij.openapi.fileTypes.FileTypeConsumer;
import com.intellij.openapi.fileTypes.FileTypeFactory;
import org.jetbrains.annotations.NotNull;

public class TsvFileTypeFactory extends FileTypeFactory {
@Override
public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) {
fileTypeConsumer.consume(TsvFileType.INSTANCE, String.join(FileTypeConsumer.EXTENSION_DELIMITER, new String[] {"tsv", "tab"}));
}
}
118 changes: 89 additions & 29 deletions src/main/resources/META-INF/plugin.xml
Expand Up @@ -7,28 +7,27 @@

<description><![CDATA[
<p>The <em>Table Editor</em> is a newly introduced feature of CSV Plugin v2.*. Support its ongoing development by <a href="https://github.com/SeeSharpSoft/intellij-csv-validator/issues">reporting issues, providing suggestions, contributing ideas/features</a> or by just <a href="https://plugins.jetbrains.com/plugin/10037-csv-plugin">giving it a thumbs up.</a></p>
<p>Lightweight plugin for editing CSV/TSV/PSV files with a flexible table editor, syntax validation, structure highlighting, customizable coloring, new intentions and helpful inspections.</p>
<br><hr/><br>
Lightweight CSV plugin that supports editing files in CSV/TSV format.<br><br>
<b>Features:</b><br>
<ul>
<li>CSV/TSV/PSV file detection</li>
<li>table editor</li>
<li>support for CSV/TSV/PSV file extensions</li>
<li>customizable table editor</li>
<li>customizable text editor</li>
<li>customizable column coloring</li>
<li>syntax validation</li>
<li>syntax highlighting (configurable)</li>
<li>content formatting (configurable)</li>
<li>syntax highlighting</li>
<li>content formatting</li>
<li>quick fix inspections</li>
<li>intentions (Alt+Enter), e.g. Quote/Unquote (all), Shift Column Left/Right</li>
<li>balloon help & spell checker</li>
<li>structure view (header-entry layout)</li>
<li>support for ',', ';', '|' or '&#8633;' as value separator</li>
<li>highlight of active column values</li>
<li>customizable column coloring</li>
<li>tab (&#8633;) separator highlighting</li>
</ul>
<b>TSV file support:</b> <em>TSV files are recognized as such but treated as a variant of CSV files, the same syntax highlighting and code style settings are applied.</em>
<b>TSV/PSV file support:</b> <em>TSV/PSV files are recognized as such but treated as a variant of CSV files, the same syntax highlighting and code style settings are applied.</em>
<br><br>
<b>Code formatting:</b> <em>Default code formatting is 'Tabularize'. Can be changed in Settings -> Editor -> Code Style -> CSV</em>
<br><br>
Expand All @@ -46,37 +45,24 @@

<change-notes><![CDATA[
<pre style="font-family: sans-serif">
FIX: Index out of bound error on multi line clear cells #151
NEW: add separator selection to table editor #140
FIX: coloring of table cells (e.g. selection mode)
FIX: enter edit mode via keyboard (e.g. ENTER key in cell)
</pre>
]]>
</change-notes>

<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description -->
<idea-version since-build="192.5728.98"/>
<idea-version since-build="173.2099.1" />

<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
on how to target different products -->
<depends>com.intellij.modules.lang</depends>

<extensions defaultExtensionNs="com.intellij">
<fileType name="CSV"
implementationClass="net.seesharpsoft.intellij.plugins.csv.CsvFileType"
extensions="csv"
language="csv"
fieldName="INSTANCE"
/>
<fileType name="TSV"
implementationClass="net.seesharpsoft.intellij.plugins.tsv.TsvFileType"
extensions="tsv;tab"
language="tsv"
fieldName="INSTANCE"
/>
<fileType name="PSV"
implementationClass="net.seesharpsoft.intellij.plugins.psv.PsvFileType"
extensions="psv"
language="psv"
fieldName="INSTANCE"
/>
<fileTypeFactory implementation="net.seesharpsoft.intellij.plugins.csv.CsvFileTypeFactory"/>
<fileTypeFactory implementation="net.seesharpsoft.intellij.plugins.tsv.TsvFileTypeFactory"/>
<fileTypeFactory implementation="net.seesharpsoft.intellij.plugins.psv.PsvFileTypeFactory"/>

<lang.parserDefinition language="csv"
implementationClass="net.seesharpsoft.intellij.plugins.csv.CsvParserDefinition"/>
Expand Down Expand Up @@ -160,6 +146,77 @@ FIX: Index out of bound error on multi line clear cells #151
</extensions>

<actions>
<group id="CsvTableEditorColumnContextMenu"
popup="true"
>
<separator />
</group>
<group id="CsvTableEditorRowContextMenu"
popup="true"
>
<separator />
</group>
<action class="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AddColumnBefore"
id="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AddColumnBefore"
text="New column before (Ctrl+Left)"
icon="/media/icons/add-column-before.png"
>
<add-to-group group-id="CsvTableEditorColumnContextMenu" anchor="first" />
</action>
<action class="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AddColumnAfter"
id="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AddColumnAfter"
text="New column after (Ctrl+Right)"
icon="/media/icons/add-column.png"
>
<add-to-group group-id="CsvTableEditorColumnContextMenu" relative-to-action="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AddColumnBefore" anchor="after" />
</action>
<action class="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$DeleteSelectedColumns"
id="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$DeleteSelectedColumns"
text="Delete selected column (Ctrl+Shift+Del)"
icon="/media/icons/remove-column.png"
>
<add-to-group group-id="CsvTableEditorColumnContextMenu" relative-to-action="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AddColumnAfter" anchor="after" />
</action>

<action class="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AddRowBefore"
id="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AddRowBefore"
text="New row before (Ctrl+Up)"
icon="/media/icons/add-row-before.png"
>
<add-to-group group-id="CsvTableEditorRowContextMenu" anchor="first" />
</action>
<action class="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AddRowAfter"
id="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AddRowAfter"
text="New row after (Ctrl+Down)"
icon="/media/icons/add-row.png"
>
<add-to-group group-id="CsvTableEditorRowContextMenu" relative-to-action="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AddRowBefore" anchor="after" />
</action>
<action class="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$DeleteSelectedRows"
id="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$DeleteSelectedRows"
text="Delete selected rows (Ctrl+Del)"
icon="/media/icons/remove-row.png"
>
<add-to-group group-id="CsvTableEditorRowContextMenu" relative-to-action="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AddRowAfter" anchor="after" />
</action>

<action class="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AdjustColumnWidths"
id="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AdjustColumnWidths"
text="Adjust column widths"
icon="/media/icons/adjust-column-width.png"
>
<add-to-group group-id="CsvTableEditorColumnContextMenu" />
<add-to-group group-id="CsvTableEditorRowContextMenu" />
</action>
<action class="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$ResetColumnWidths"
id="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$ResetColumnWidths"
text="Reset column widths to default"
icon="/media/icons/reset-column-width.png"
>
<add-to-group group-id="CsvTableEditorColumnContextMenu" relative-to-action="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AdjustColumnWidths" anchor="after" />
<add-to-group group-id="CsvTableEditorRowContextMenu" relative-to-action="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AdjustColumnWidths" anchor="after" />
</action>

<group id="net.seesharpsoft.intellij.plugins.csv.actions.CsvChangeSeparatorActionGroup"
class="net.seesharpsoft.intellij.plugins.csv.actions.CsvChangeSeparatorActionGroup"
text="CSV Separator"
Expand All @@ -169,7 +226,10 @@ FIX: Index out of bound error on multi line clear cells #151
icon="/media/icons/csv-icon.png"
>
<add-to-group group-id="EditorPopupMenu" anchor="last"/>
<add-to-group group-id="CsvTableEditorColumnContextMenu" anchor="last"/>
<add-to-group group-id="CsvTableEditorRowContextMenu" anchor="last"/>
</group>

</actions>

</idea-plugin>
@@ -1,10 +1,10 @@
package net.seesharpsoft.intellij.plugins.csv.actions;

import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.testFramework.fixtures.BasePlatformTestCase;
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
import net.seesharpsoft.intellij.plugins.csv.settings.CsvCodeStyleSettings;

public class CsvChangeSeparatorActionTest extends BasePlatformTestCase {
public class CsvChangeSeparatorActionTest extends LightPlatformCodeInsightFixtureTestCase {

@Override
protected String getTestDataPath() {
Expand Down
Expand Up @@ -14,7 +14,7 @@
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.testFramework.EdtTestUtil;
import com.intellij.testFramework.ExpectedHighlightingData;
import com.intellij.testFramework.fixtures.BasePlatformTestCase;
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
import org.jetbrains.annotations.NotNull;

import java.util.Collections;
Expand All @@ -23,7 +23,7 @@

import static net.seesharpsoft.intellij.plugins.csv.editor.CsvAnnotator.CSV_COLUMN_INFO_SEVERITY;

public class CsvAnnotatorTest extends BasePlatformTestCase {
public class CsvAnnotatorTest extends LightPlatformCodeInsightFixtureTestCase {

@Override
protected String getTestDataPath() {
Expand Down
@@ -1,11 +1,11 @@
package net.seesharpsoft.intellij.plugins.csv.editor;

import com.intellij.openapi.options.ConfigurationException;
import com.intellij.testFramework.fixtures.BasePlatformTestCase;
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;

import java.awt.*;

public class CsvEditorSettingsProviderTest extends BasePlatformTestCase {
public class CsvEditorSettingsProviderTest extends LightPlatformCodeInsightFixtureTestCase {

@Override
protected String getTestDataPath() {
Expand Down

0 comments on commit 6212a9b

Please sign in to comment.