Skip to content

Commit 816bd37

Browse files
authored
Merge pull request #68 from RabotaRu/v3.13.0
v3.13.0
2 parents 1d6ed57 + 74bfadd commit 816bd37

File tree

8 files changed

+139
-123
lines changed

8 files changed

+139
-123
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Project Properties
22
group=org.dochub.idea
3-
version=3.12.1
3+
version=3.13.0
44

55
# Supported build number ranges and IntelliJ Platform versions
66
pluginSinceBuild=231

src/main/java/org/dochub/idea/arch/completions/FormattingInsertHandler.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@
99
import com.intellij.openapi.editor.Editor;
1010
import com.intellij.openapi.editor.ScrollType;
1111
import com.intellij.util.text.CharArrayUtil;
12-
import org.apache.commons.lang.StringUtils;
1312
import org.jetbrains.annotations.NotNull;
1413

14+
import java.util.Objects;
15+
16+
import static org.apache.commons.lang3.StringUtils.repeat;
17+
1518
public class FormattingInsertHandler implements InsertHandler {
1619
private final CompletionKey key;
1720

@@ -44,19 +47,19 @@ public void handleInsert(@NotNull final InsertionContext context, @NotNull final
4447
TabOutScopesTracker.getInstance().registerEmptyScopeAtCaret(context.getEditor());
4548
editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
4649
editor.getSelectionModel().removeSelection();
47-
AutoPopupController.getInstance(editor.getProject()).scheduleAutoPopup(editor);
50+
AutoPopupController.getInstance(Objects.requireNonNull(editor.getProject())).scheduleAutoPopup(editor);
4851
}
4952

5053
private String getCharsToInsert() {
5154
StringBuilder result = new StringBuilder(":");
5255
switch (key.getValueType()) {
5356
case MAP:
5457
result.append("\n")
55-
.append(StringUtils.repeat(" ", (documentLevel + 1) * 2));
58+
.append(repeat(" ", (documentLevel + 1) * 2));
5659
break;
5760
case LIST:
5861
result.append("\n")
59-
.append(StringUtils.repeat(" ", (documentLevel + 1) * 2))
62+
.append(repeat(" ", (documentLevel + 1) * 2))
6063
.append("- ");
6164
break;
6265
default:

src/main/java/org/dochub/idea/arch/indexing/DocHubIndexData.java

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,27 @@
55
import com.intellij.psi.PsiFile;
66
import org.yaml.snakeyaml.Yaml;
77

8-
import java.io.*;
8+
import java.io.DataInput;
9+
import java.io.DataOutput;
10+
import java.io.FileInputStream;
11+
import java.io.IOException;
12+
import java.io.InputStream;
913
import java.nio.charset.StandardCharsets;
1014
import java.util.ArrayList;
15+
import java.util.Collection;
1116
import java.util.HashMap;
1217
import java.util.List;
1318
import java.util.Map;
1419
import java.util.Objects;
20+
import java.util.Optional;
1521

1622
public final class DocHubIndexData extends HashMap<String, DocHubIndexData.Section> {
1723

1824
public class Section {
19-
public ArrayList<String> locations = new ArrayList();
20-
public ArrayList<String> ids = new ArrayList();
25+
public List<String> locations = new ArrayList<>();
26+
public List<String> ids = new ArrayList<>();
2127
public List<String> imports = new ArrayList<>();
28+
2229
public boolean isEmpty() {
2330
return (locations.size() + ids.size() + imports.size()) == 0;
2431
}
@@ -110,8 +117,15 @@ public void parse(DataInput in) throws ClassNotFoundException, IOException {
110117
}
111118

112119
public void makeCacheDataImports(Map<String, Object> yaml) {
113-
ArrayList<String> result = (ArrayList<String>) yaml.get("imports");
114-
if ((result != null) && (result.size() > 0)) {
120+
List<String> imports = (List<String>) yaml.get("imports");
121+
122+
List<String> result = Optional.ofNullable(imports)
123+
.stream()
124+
.flatMap(Collection::stream)
125+
.filter(e -> e != null && !e.isEmpty())
126+
.toList();
127+
128+
if (!result.isEmpty()) {
115129
Section section = new Section();
116130
section.imports = result;
117131
this.put("imports", section);
@@ -123,27 +137,28 @@ public void makeCacheDataSection(Map<String, Object> yaml, String section) {
123137
try {
124138
Map<String, Object> keys = (Map<String, Object>) yaml.get(section);
125139
if (keys != null) {
126-
for ( String id : keys.keySet()) {
140+
for (String id : keys.keySet()) {
127141
secData.ids.add(id);
128142
Object object = yaml.get(id);
129143
if (object instanceof Map) {
130144
Object location = ((Map) object).get("location");
131145
if (location instanceof String) {
132-
if (location != null) secData.locations.add((String) location);
146+
secData.locations.add((String) location);
133147
}
134148
}
135149
}
136150
}
137-
if ((secData.locations.size()) > 0 || (secData.ids.size() > 0) )
151+
if ((secData.locations.size()) > 0 || (secData.ids.size() > 0))
138152
this.put(section, secData);
139-
} catch (ClassCastException e) {}
153+
} catch (ClassCastException e) {
154+
}
140155
}
141156

142157
public void makeCacheDataManifest(PsiFile file) {
143158
VirtualFile vFile = file.getVirtualFile();
144159
if (vFile != null) {
145160
String path = vFile.getPath();
146-
try(InputStream inputStream = new FileInputStream(path)) {
161+
try (InputStream inputStream = new FileInputStream(path)) {
147162
Yaml yaml = new Yaml();
148163
Map<String, Object> sections = yaml.load(inputStream);
149164
if (sections != null) {
@@ -154,7 +169,8 @@ public void makeCacheDataManifest(PsiFile file) {
154169
makeCacheDataSection(sections, "docs");
155170
makeCacheDataSection(sections, "datasets");
156171
}
157-
} catch (Exception e) {}
172+
} catch (Exception e) {
173+
}
158174
}
159175
}
160176

src/main/java/org/dochub/idea/arch/jsonschema/EntityManager.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ public static VirtualFile applySchema(Project project, String schema) {
3535
LocalFileSystem fs = LocalFileSystem.getInstance();
3636
currentSchema = fs.findFileByPath(file.getAbsolutePath());
3737

38-
VirtualFileManager.getInstance().refreshAndFindFileByNioPath(file.toPath());
39-
40-
4138
schemas.put(projectHash, currentSchema);
4239

4340
Runnable dropCaches = () -> {

src/main/resources/html/plugin.html

Lines changed: 99 additions & 99 deletions
Large diffs are not rendered by default.

src/main/resources/metamodel/dochub/entities/components/base.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ entities:
99
schema:
1010
type: object
1111
patternProperties:
12-
"^[a-zA-Z][a-zA-Z0-9_-]*(\\.[a-zA-Z][a-zA-Z0-9_-]*)*$":
12+
"^[a-zA-Z][a-zA-Z0-9_-]*(\\.[a-zA-Z0-9][a-zA-Z0-9_-]*)*$":
1313
type: object
1414
properties:
1515
title:

src/main/resources/metamodel/dochub/entities/contexts/base.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ entities:
2525
items:
2626
type: string
2727
title: Идентификатор компонента или маска
28-
pattern: "^[0-9a-zA-Z][a-zA-Z0-9\\_]*(\\.([a-zA-Z][a-zA-Z0-9\\_]*|\\*))*$"
28+
pattern: "^[0-9a-zA-Z][a-zA-Z0-9\\_]*(\\.([a-zA-Z0-9][a-zA-Z0-9\\_]*|\\*))*$"
2929
extra-links:
3030
title: Отображать компоненты ближайших связей
3131
type: boolean

src/main/resources/metamodel/dochub/entities/contexts/plantuml.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,12 @@ entities:
127127
properties:
128128
"dh-context-id":
129129
title: Идентификатор контекста
130-
type: string
131-
pattern: ^[0-9a-zA-Z][a-zA-Z0-9_-]*(\.[a-zA-Z][a-zA-Z0-9_-]*)*$
130+
type: string
131+
pattern: ^[0-9a-zA-Z][a-zA-Z0-9_-]*(\.[0-9a-zA-Z][a-zA-Z0-9_-]*)*$
132132
"dh-focus-id":
133133
title: Идентификатор требующий подсветку
134134
type: string
135-
pattern: ^[0-9a-zA-Z][a-zA-Z0-9_-]*(\.[a-zA-Z][a-zA-Z0-9_-]*)*$
135+
pattern: ^[0-9a-zA-Z][a-zA-Z0-9_-]*(\.[a-zA-Z0-9][a-zA-Z0-9_-]*)*$
136136
required:
137137
- dh-context-id
138138
type: plantuml

0 commit comments

Comments
 (0)