Skip to content

Commit

Permalink
Fixes #61, #276, #277, #278, - simple grammar, code navigation, struc…
Browse files Browse the repository at this point in the history
…ture view

file templates, settings, better keyword highlighting
  • Loading branch information
krasa committed Jan 14, 2021
1 parent fbced8a commit bd81a9b
Show file tree
Hide file tree
Showing 68 changed files with 3,004 additions and 583 deletions.
204 changes: 17 additions & 187 deletions META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<idea-plugin version="2">
<name>PlantUML integration</name>
<version>3.1.0</version>
<version>3.2.0</version>
<vendor url="https://github.com/esteinberg/plantuml4idea/">Eugene Steinberg</vendor>
<!-- IJ 12+ -->
<idea-version since-build="193"/>
Expand All @@ -9,6 +9,13 @@

<change-notes>
<![CDATA[
<p>3.2</p>
<ul>
<li>Added: ctrl+click - Go to Declaration/Usages, Rename...</li>
<li>Added: Structure view - shows the first occurrence of a word</li>
<li>Better keyword highlighting + settings to disable it</li>
<li>Updated file templates</li>
</ul>
<p>3.1</p>
<ul>
<li>Performance optimization when !includeurl is used</li>
Expand All @@ -23,192 +30,6 @@
<li>Option to name diagram files based on their title instead of page number (enabled by default)</li>
<li>Moved settings under "Languages and Frameworks".</li>
</ul>
<p>2.29</p>
<ul>
<li>Settings migration from CFG to XML</li>
<li>PlantUml library upgrade to v1.2020.23</li>
<li>JSON Diagram support</li>
</ul>
<p>2.28</p>
<ul>
<li>PlantUml library upgrade to v1.2020.20</li>
<li>zoom fix</li>
</ul>
<p>2.27</p>
<ul>
<li>PlantUml library upgrade to v1.2020.19</li>
<li>Fixed %filename() and %dirpath()</li>
<li>Latex support (#265)</li>
</ul>
<p>2.26</p>
<ul>
<li>New option to not display errors</li>
<li>Left click on the status label toggles between an error and a last non-error diagram</li>
<li>Markdown support</li>
</ul>
<p>2.25</p>
<ul>
<li>PlantUml library upgrade to v1.2020.9</li>
<li>Fixed scaling on multiple monitors with different DPI</li>
<li>Setting for PLANTUML_LIMIT_SIZE</li>
<li>Setting for plantuml.include.path</li>
</ul>
<p>2.24</p>
<ul>
<li>PlantUml library upgrade to v1.2020.7</li>
<li>Render URL links fix</li>
<li>Remember file extension in export dialog</li>
</ul>
<p>2.23</p>
<ul>
<li>PlantUml library upgrade to a new beta - to fix !include</li>
</ul>
<p>2.22</p>
<ul>
<li>NPE fix</li>
<li>PlantUml library upgrade to v1.2019.11</li>
</ul>
<p>2.21</p>
<ul>
<li>Fixed '*' stripping</li>
</ul>
<p>2.20</p>
<ul>
<li>PlantUml library upgrade to v1.2019.10</li>
</ul>
<p>2.19</p>
<ul>
<li>PlantUml library upgrade to v1.2019.8</li>
<li>Zooming fix</li>
<li>"IllegalStateException: Timeout4 TIMEOUT" while zooming fixed</li>
</ul>
<p>2.18</p>
<ul>
<li>PlantUml library upgrade to v1.2019.7</li>
<li>Fixed icons for IntelliJ 2019.2</li>
</ul>
<p>2.17</p>
<ul>
<li>Export diagram fix</li>
</ul>
<p>2.16</p>
<ul>
<li>Exception fix</li>
</ul>
<p>2.15</p>
<ul>
<li>PlantUml library upgrade to v1.2019.5</li>
<li>Caching edge case fixed</li>
<li>Autocomplete improvements</li>
</ul>
<p>2.14</p>
<ul>
<li>PlantUml library upgrade to v1.2019.4</li>
<li>Automatic code completion popup</li>
<li>Fixed reverse arrow intention</li>
<li>Added settings for encoding and PlantUML config (global include)</li>
<li>Using the filename from "@startuml name" when exporting</li>
<li>Added highlighting of comments</li>
<li>Updated highlighting of tags and keywords</li>
<li>Fixed copy to clipboard</li>
<li>reStructuredText files support</li>
</ul>
<p>2.13</p>
<ul>
<li>PlantUml library upgrade to v1.2019.3</li>
<li>Fixed image scaling in Windows 10</li>
<li>Added MindMap support</li>
<li>Added Gantt support</li>
<li>Added Work Breakdown Structure support</li>
<li>Added option to use GRAPHVIZ_DOT environment variable preferentially</li>
<li>Grouped file templates</li>
<li>Restoring scroll position after an error</li>
<li>Zooming even when scale is defined in the code</li>
</ul>
<p>2.12</p>
<ul>
<li>PlantUml library upgrade to v1.2018.11</li>
<li>Fixed diagram saving</li>
</ul>
<p>2.11</p>
<ul>
<li>PlantUml library upgrade to v1.2018.9</li>
</ul>
<p>2.10</p>
<ul>
<li>PlantUml library upgrade to v1.2018.1</li>
</ul>
<p>2.9</p>
<ul>
<li>PlantUml library upgrade to v1.2017.15</li>
<li>Exception fixes</li>
</ul>
<p>2.8</p>
<ul>
<li>PlantUml library upgrade to v1.2017.12</li>
</ul>
<p>2.7</p>
<ul>
<li>Fixed opening in an external editor for multiple-page diagrams</li>
<li>Fixed edge cases for Copy and Save diagram actions</li>
</ul>
<p>2.6</p>
<ul>
<li>NPE fix for AndroidStudio</li>
<li>PlantUml library upgrade to v2017.08</li>
<li>Added support for *.plantuml file extension</li>
</ul>
<p>2.5</p>
<ul>
<li>Disabled asserts in PlantUml - they were causing slow rendering</li>
<li>PlantUml library upgrade to 8053</li>
</ul>
<p>2.4</p>
<ul>
<li>PlantUml library upgrade to 8051</li>
<li>Changed default shortcuts to Ctrl+Alt+Shift+F and G</li>
<li>NPE fix</li>
</ul>
<p>2.3.1</p>
<ul>
<li>Fixed ASCII image rendering and typos</li>
</ul>
<p>2.3</p>
<ul>
<li>Path to Graphviz dot executable was ignored</li>
<li>PlantUml library upgrade to 8043</li>
<li>Added a low memory watcher for cache clearing</li>
</ul>
<p>2.2</p>
<ul>
<li>Toggle button for disabling automatic rendering</li>
<li>When auto-rendering is disabled, update and reload button will be red</li>
<li>ALT+D shortcut for diagram update</li>
<li>ALT+F shortcut for diagram reload</li>
<li>Page titles fixed for partial rendering</li>
<li>Usage manual</li>
<li>About dialog reworked</li>
<li>IJ 12 compatibility fix</li>
</ul>
<p>2.1</p>
<ul>
<li>Scrolling fixed for 2016.2</li>
<li>Remembering selected page per file</li>
<li>New right click action: Generate PlantUML Server link to clipboard</li>
<li>Page titles in the dropdown page selector</li>
</ul>
<p>2.0</p>
<ul>
<li>PlantUml library upgrade to 8042</li>
<li>Images can be copied to clipboard as ASCII Art</li>
<li>Fixed: @startditaa` not recognized</li>
<li>Added a configurable delay between key up event and rendering run</li>
<li>Disabled URL links rendering by default - doubles rendering time</li>
<li>A lot of caching and optimizations</li>
<li>Added incremental rendering - only changed pages will be rendered</li>
<li>Added partial rendering mode - useful in large files - the document will be splitted by (@)newpage and each piece will be rendered by itself.</li>
<li>Added intentions to disable syntax check, and enable partial rendering - available on the start tag (@startuml,...)</li>
</ul>
]]>
</change-notes>
<depends>com.intellij.modules.platform</depends>
Expand Down Expand Up @@ -332,5 +153,14 @@
implementationClass="org.plantuml.idea.lang.PlantUmlCompletionContributor"/>
<typedHandler implementation="org.plantuml.idea.lang.PlantUmlCompletionAutoPopupHandler"
id="PlantUmlCompletionAutoPopupHandler"/>

<lang.elementManipulator forClass="org.plantuml.idea.grammar.psi.PumlItem"
implementationClass="org.plantuml.idea.grammar.PumlElementManipulator"/>
<lang.namesValidator language="PUML" implementationClass="org.plantuml.idea.grammar.PumlNamesValidator"/>
<lang.findUsagesProvider language="PUML"
implementationClass="org.plantuml.idea.grammar.SimpleFindUsagesProvider"/>

<lang.psiStructureViewFactory language="PUML"
implementationClass="org.plantuml.idea.grammar.structure.PumlStructureViewFactory"/>
</extensions>
</idea-plugin>
10 changes: 4 additions & 6 deletions adapter/src/org/plantuml/idea/adapter/Annotator.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile;
import net.sourceforge.plantuml.syntax.SyntaxChecker;
import net.sourceforge.plantuml.syntax.SyntaxResult;
import org.apache.commons.lang.StringUtils;
Expand All @@ -24,13 +23,13 @@ public class Annotator {
private static final Logger logger = Logger.getInstance(Annotator.class);

@Nullable
public static Collection<SourceAnnotation> annotateSyntaxErrors(PsiFile file, String source) {
public static Collection<SourceAnnotation> annotateSyntaxErrors(String source, VirtualFile virtualFile) {
if (source.contains(IDEA_DISABLE_SYNTAX_CHECK)) {
return Collections.emptyList();
}
Collection<SourceAnnotation> result = new ArrayList<SourceAnnotation>();
long start = currentTimeMillis();
SyntaxResult syntaxResult = checkSyntax(file, source);
SyntaxResult syntaxResult = checkSyntax(source, virtualFile);
logger.debug("syntax checked in ", currentTimeMillis() - start, "ms");

if (syntaxResult.isError()) {
Expand All @@ -49,12 +48,11 @@ public static Collection<SourceAnnotation> annotateSyntaxErrors(PsiFile file, St
return result;
}

private static SyntaxResult checkSyntax(PsiFile file, String source) {
File baseDir = UIUtils.getParent(file.getVirtualFile());
private static SyntaxResult checkSyntax(String source, VirtualFile virtualFile) {
File baseDir = UIUtils.getParent(virtualFile);
if (baseDir != null) {
Utils.setPlantUmlDir(baseDir);

VirtualFile virtualFile = file.getVirtualFile();
Utils.saveAllDocuments(virtualFile==null?null:virtualFile.getPath());
} else {
Utils.resetPlantUmlDir();
Expand Down
6 changes: 3 additions & 3 deletions adapter/src/org/plantuml/idea/adapter/FacadeImpl.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.plantuml.idea.adapter;

import com.intellij.openapi.diagnostic.Logger;
import com.intellij.psi.PsiFile;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.ImageLoader;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -29,8 +29,8 @@ public class FacadeImpl implements PlantUmlFacade {

@Nullable
@Override
public Collection<SourceAnnotation> annotateSyntaxErrors(PsiFile file, String source) {
return Annotator.annotateSyntaxErrors(file, source);
public Collection<SourceAnnotation> annotateSyntaxErrors(String source, VirtualFile virtualFile) {
return Annotator.annotateSyntaxErrors(source, virtualFile);
}

@Override
Expand Down
27 changes: 14 additions & 13 deletions adapter/src/org/plantuml/idea/adapter/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.svg.MyTranscoder;
//import com.intellij.ui.svg.MyTranscoder;
import com.intellij.util.ImageLoader;
import net.sourceforge.plantuml.BlockUml;
import net.sourceforge.plantuml.FileSystem;
Expand Down Expand Up @@ -41,18 +41,19 @@ public class Utils {
private static final Logger LOG = Logger.getInstance(Utils.class);

public static BufferedImage loadWithoutCache(@Nullable URL url, @NotNull InputStream stream, double scale, @Nullable ImageLoader.Dimension2DDouble docSize /*OUT*/) {
try {
MyTranscoder transcoder = MyTranscoder.createImage(scale, createTranscodeInput(url, stream));
if (docSize != null) {
docSize.setSize(transcoder.getOrigDocWidth(), transcoder.getOrigDocHeight());
}
return transcoder.getImage();
} catch (Exception ex) {
if (docSize != null) {
docSize.setSize(0, 0);
}
throw new RuntimeException(ex);
}
// try {
// MyTranscoder transcoder = MyTranscoder.createImage(scale, createTranscodeInput(url, stream));
// if (docSize != null) {
// docSize.setSize(transcoder.getOrigDocWidth(), transcoder.getOrigDocHeight());
// }
// return transcoder.getImage();
// } catch (Exception ex) {
// if (docSize != null) {
// docSize.setSize(0, 0);
// }
// throw new RuntimeException(ex);
// }
return null;
}

@NotNull
Expand Down
Loading

0 comments on commit bd81a9b

Please sign in to comment.