Skip to content

Commit c8d597c

Browse files
authored
Merge pull request #138 from kdbinsidebrains/dict_highlighting
- options for Semantic highlighting added. Dict pairs highlighting ad…
2 parents 5d8f36d + ed47f50 commit c8d597c

File tree

21 files changed

+1002
-101
lines changed

21 files changed

+1002
-101
lines changed

CHANGELOG.md

Lines changed: 68 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# KdbInsideBrains Changelog
22

3+
## 6.6.0
4+
5+
### Added
6+
7+
- Dictionary keys/values pair highlighting
8+
39
## 6.5.2
410

511
### Added
@@ -87,9 +93,9 @@ Technical release:
8793
### Changed
8894

8995
- Charting View tools redesigned:
90-
- Crosshair tool supports multiple range axes as well as candlestick
91-
- Values tools supports candlestick
92-
- Enabled tools stored in new optimized format
96+
- Crosshair tool supports multiple range axes as well as candlestick
97+
- Values tools supports candlestick
98+
- Enabled tools stored in new optimized format
9399

94100
### Fixed
95101

@@ -106,10 +112,10 @@ Technical release:
106112
### Added
107113

108114
- KDB 4.1 Syntax added: major code redesign to support new language features including:
109-
- Working with icons was fully redesigned as well
110-
- New type Dict has been introduced with a set of new formatting rules
111-
- New type TypeVariable introduced with a set of new formatting rules
112-
- Indexing redesigned to support new types
115+
- Working with icons was fully redesigned as well
116+
- New type Dict has been introduced with a set of new formatting rules
117+
- New type TypeVariable introduced with a set of new formatting rules
118+
- Indexing redesigned to support new types
113119
- Select/Deselect all Values in Charting added
114120

115121
### Changed
@@ -141,8 +147,8 @@ Technical release:
141147
### Changed
142148

143149
- Function docs logic changed:
144-
- if there is more than one definition with the same semantic - the longest description is shown
145-
- if there is more than one definition with differing semantics - list of all definitions is shown
150+
- if there is more than one definition with the same semantic - the longest description is shown
151+
- if there is more than one definition with differing semantics - list of all definitions is shown
146152

147153
## 5.15.1
148154

@@ -159,10 +165,10 @@ Technical release:
159165
### Added
160166

161167
- QSpec Testing Framework added for Unit-Testing (https://www.kdbinsidebrains.dev/testing):
162-
- Downloading the lib from GitHub that is attached a synthetic library to any project with KDB code
163-
- Running an expectation, a description or even a directory
164-
- Test cases code analysis, suggestions, and completion
165-
- Quick generate actions for: description, before, after and expectations
168+
- Downloading the lib from GitHub that is attached a synthetic library to any project with KDB code
169+
- Running an expectation, a description or even a directory
170+
- Test cases code analysis, suggestions, and completion
171+
- Quick generate actions for: description, before, after and expectations
166172
- Run local KDB Instance functionality was redesigned to support QSpec Testing Framework
167173
- Exclusion list of undefined variables has been added: any undefined variable can be added to the list, and will be
168174
undefined inspection will be disabled for the variable.
@@ -191,10 +197,10 @@ Technical release:
191197
### Changed
192198

193199
- Charting is fully redesigned (https://www.kdbinsidebrains.dev/features/charting):
194-
- Issue with dropping grouped data is fixed: new Operation term (_sum, count, avg, min, max_) was introduced
195-
- Added an ability to ungroup data by any symbol/text field and show as a separate line
196-
- Line style can be changed (color, width and so on) by clicking on the legend title now: settings are not stored
197-
over restarts yet
200+
- Issue with dropping grouped data is fixed: new Operation term (_sum, count, avg, min, max_) was introduced
201+
- Added an ability to ungroup data by any symbol/text field and show as a separate line
202+
- Line style can be changed (color, width and so on) by clicking on the legend title now: settings are not stored
203+
over restarts yet
198204
- Charting templates are not backward compatible and will be removed after the upgrade due to significant changes
199205

200206
## 5.13.1
@@ -208,9 +214,9 @@ Technical release:
208214
### Changed
209215

210216
- Credential functionality was redesigned to support easier IDEA versions migration:
211-
- the plugins folder changed from <IdeaSystem>/KdbInsideBrains to <user.home>/.kdbinb
212-
- the plugin file can be copied to <user.home>/.kdbinb for auto-installation alongside UI settings
213-
- Connection Settings dialog supports dynamic plugins reloading (by "Apply" button) now
217+
- the plugins folder changed from <IdeaSystem>/KdbInsideBrains to <user.home>/.kdbinb
218+
- the plugin file can be copied to <user.home>/.kdbinb for auto-installation alongside UI settings
219+
- Connection Settings dialog supports dynamic plugins reloading (by "Apply" button) now
214220

215221
## 5.12.0
216222

@@ -641,9 +647,9 @@ Technical release:
641647
### Added
642648

643649
- Charting templates have been introduced: https://www.kdbinsidebrains.dev/features/charting#templates:
644-
- Save/Restore a chart configuration
645-
- Quick charting by template
646-
- Templates manager
650+
- Save/Restore a chart configuration
651+
- Quick charting by template
652+
- Templates manager
647653

648654
### Fixed
649655

@@ -654,15 +660,15 @@ Technical release:
654660
### Added
655661

656662
- Dedicated Live Templates context (KDB+ Q) added with a few templates:
657-
- sel - create a simple select query: select ... from ... where
658-
- td - today: .z.d
659-
- yd - yesterday: .z.d-1
660-
- l10s - time within the last 10 seconds by time column
661-
- l5m - time within the last 5 minutes by time column
663+
- sel - create a simple select query: select ... from ... where
664+
- td - today: .z.d
665+
- yd - yesterday: .z.d-1
666+
- l10s - time within the last 10 seconds by time column
667+
- l5m - time within the last 5 minutes by time column
662668
- Code Completion improved for queries:
663-
- suggest a table name after 'from' keyword
664-
- the selection from a table, when columns are extracted and suggested in 'select', 'be' and 'where' sections
665-
- completion works for defined tables as well as loaded from the Inspector
669+
- suggest a table name after 'from' keyword
670+
- the selection from a table, when columns are extracted and suggested in 'select', 'be' and 'where' sections
671+
- completion works for defined tables as well as loaded from the Inspector
666672
- Keys are loaded from KDB Instance at inspection time, NOTE: The Inspector query was changed
667673

668674
### Fixed
@@ -690,9 +696,9 @@ Technical release:
690696
### Added
691697

692698
- Inspector has been improved and more functionality added:
693-
- Scroll to source
694-
- Diff with the source for a function
695-
- Restore expanded/selected item between connection change/refresh
699+
- Scroll to source
700+
- Diff with the source for a function
701+
- Restore expanded/selected item between connection change/refresh
696702

697703
### Fixed
698704

@@ -719,9 +725,9 @@ Technical release:
719725
in
720726
the
721727
plugin:
722-
- Split logs by months introduced: https://www.kdbinsidebrains.dev/settings/options#log-queries
723-
- Ability to change the background of the console for colored
724-
instances: https://www.kdbinsidebrains.dev/features/instances#highlighting-severity
728+
- Split logs by months introduced: https://www.kdbinsidebrains.dev/settings/options#log-queries
729+
- Ability to change the background of the console for colored
730+
instances: https://www.kdbinsidebrains.dev/features/instances#highlighting-severity
725731
- IDEA 2022.3 supporting added
726732

727733
### Fixed
@@ -796,9 +802,9 @@ Technical release:
796802
### Added
797803

798804
- Table declaration annotations added:
799-
- tailing semicolon marked as an error
800-
- set of semicolon (empty declarations) marked as an error
801-
- even expressions are allowed without column names, they are marked as a warning if it's not declaration
805+
- tailing semicolon marked as an error
806+
- set of semicolon (empty declarations) marked as an error
807+
- even expressions are allowed without column names, they are marked as a warning if it's not declaration
802808

803809
### Fixed
804810

@@ -900,9 +906,9 @@ Technical release:
900906
### Added
901907

902908
- CredentialsPlugin functionality redesigned:
903-
- plugins copied into Idea System folder (current approach will be auto-migrated)
904-
- duplicate plugins are not allowed and adding a new version replaces exist one
905-
- plugin version and description added (plugins must be recompiled)
909+
- plugins copied into Idea System folder (current approach will be auto-migrated)
910+
- duplicate plugins are not allowed and adding a new version replaces exist one
911+
- plugin version and description added (plugins must be recompiled)
906912

907913
## 1.5.0
908914

@@ -1032,9 +1038,9 @@ Technical release:
10321038

10331039
- Dark icons set added with IntelliJ Idea colors
10341040
- Charting is ready now:
1035-
- A New Magnet/Snap tool has been added with the ability to snap to line, vertex or disable the tool (default)
1036-
- The Values Tool shows only series values and no range values anymore
1037-
- Measure Tool has a context menu with remove/clear ability
1041+
- A New Magnet/Snap tool has been added with the ability to snap to line, vertex or disable the tool (default)
1042+
- The Values Tool shows only series values and no range values anymore
1043+
- Measure Tool has a context menu with remove/clear ability
10381044

10391045
## 0.20.0
10401046

@@ -1047,9 +1053,9 @@ Technical release:
10471053
### Changed
10481054

10491055
- Console behaviours changed:
1050-
- Closing a console tab closes the connection as well now
1051-
- Changing active console tab changes active connection, so it's the same as select active connection from the
1052-
toolbar
1056+
- Closing a console tab closes the connection as well now
1057+
- Changing active console tab changes active connection, so it's the same as select active connection from the
1058+
toolbar
10531059

10541060
## 0.19.0
10551061

@@ -1063,14 +1069,14 @@ Technical release:
10631069
- Table Result supports search by words and regex with or without case match
10641070
- Right side toolbar in charts view has been added instead of the context menu
10651071
- Charting tools have been introduced:
1066-
- **Crosshair tool** - to show current values for the mouse position
1067-
- **Measure tool** - draw measuring rectangles on the chart with values diff: left mouse click to start, move, left
1068-
mouse click to finish.
1069-
Esc to cancel current drawing.
1070-
- **Points collector** - save any chart clicked values into the points' collector table with the ability to export
1071-
or
1072-
send
1073-
into another KDB instance.
1072+
- **Crosshair tool** - to show current values for the mouse position
1073+
- **Measure tool** - draw measuring rectangles on the chart with values diff: left mouse click to start, move, left
1074+
mouse click to finish.
1075+
Esc to cancel current drawing.
1076+
- **Points collector** - save any chart clicked values into the points' collector table with the ability to export
1077+
or
1078+
send
1079+
into another KDB instance.
10741080

10751081
## 0.18.1
10761082

@@ -1085,9 +1091,9 @@ Technical release:
10851091
- Charting configuration has been redesigned
10861092
- Candlestick chart has been added
10871093
- Line charts have been updated:
1088-
- Spline, Steps, Bar, Area, Diff and Scatter line charts have been added
1089-
- Ability to change line width and show shapes added
1090-
- Transparent colors and axes orders added
1094+
- Spline, Steps, Bar, Area, Diff and Scatter line charts have been added
1095+
- Ability to change line width and show shapes added
1096+
- Transparent colors and axes orders added
10911097

10921098
## 0.17.1
10931099

@@ -1113,8 +1119,8 @@ Technical release:
11131119
### Changed
11141120

11151121
- Excel exporting format changed to xlsx (Excel 2007) instead of xls (Excel 95)
1116-
- 1,048,576 rows instead of 65,536 and 16,384 cols instead of 256
1117-
- Streams worksheet is used to reduce memory footprint
1122+
- 1,048,576 rows instead of 65,536 and 16,384 cols instead of 256
1123+
- Streams worksheet is used to reduce memory footprint
11181124
- Export actions run as a background task to reduce UI freeze
11191125

11201126
## 0.15.0

build.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ dependencies {
8181
bundledPlugin("com.intellij.java")
8282
plugins(properties("platformPlugins").split(','))
8383

84+
testFramework(TestFrameworkType.Platform)
85+
testFramework(TestFrameworkType.Plugin.Java)
8486
testFramework(TestFrameworkType.JUnit5)
8587
}
8688

@@ -140,6 +142,10 @@ tasks {
140142
withJavadocJar()
141143
}
142144

145+
test {
146+
useJUnitPlatform()
147+
}
148+
143149
named("javadoc") {
144150
val docs = this as Javadoc
145151
val options = docs.options as StandardJavadocDocletOptions

src/main/java/org/kdb/inside/brains/lang/QRainbowVisitor.java

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,18 @@
1010
import org.jetbrains.annotations.NotNull;
1111
import org.kdb.inside.brains.QFileType;
1212
import org.kdb.inside.brains.psi.*;
13+
import org.kdb.inside.brains.settings.KdbSettingsService;
14+
import org.kdb.inside.brains.view.editor.EditorOptions;
1315

1416
import java.util.function.Predicate;
1517

1618
public class QRainbowVisitor extends RainbowVisitor {
19+
private final EditorOptions editorOptions;
20+
21+
public QRainbowVisitor() {
22+
editorOptions = KdbSettingsService.getInstance().getEditorOptions();
23+
}
24+
1725
@Override
1826
public boolean suitableForFile(@NotNull PsiFile psiFile) {
1927
return QFileType.is(psiFile);
@@ -22,15 +30,23 @@ public boolean suitableForFile(@NotNull PsiFile psiFile) {
2230
@Override
2331
public void visit(@NotNull PsiElement psiElement) {
2432
if (psiElement instanceof @NotNull QVariable var) {
25-
createVariableInfo(var);
33+
if (editorOptions.isRainbowVariables()) {
34+
createVariableInfo(var);
35+
}
2636
} else {
2737
final IElementType type = psiElement.getNode().getElementType();
2838
if (type == QTypes.BRACE_OPEN || type == QTypes.BRACE_CLOSE) {
29-
createBraceInfo(psiElement);
39+
if (editorOptions.isRainbowBrace()) {
40+
createBraceInfo(psiElement);
41+
}
3042
} else if (type == QTypes.PAREN_OPEN || type == QTypes.PAREN_CLOSE) {
31-
createParenInfo(psiElement);
43+
if (editorOptions.isRainbowParen()) {
44+
createParenInfo(psiElement);
45+
}
3246
} else if (type == QTypes.BRACKET_OPEN || type == QTypes.BRACKET_CLOSE) {
33-
createBracketInfo(psiElement);
47+
if (editorOptions.isRainbowBracket()) {
48+
createBracketInfo(psiElement);
49+
}
3450
}
3551
}
3652
}

src/main/java/org/kdb/inside/brains/lang/QSyntaxHighlighter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,12 @@ private static Map.Entry<IElementType, TextAttributesKey[]> entry(IElementType t
111111
entry(QTypes.BLOCK_COMMENT, COMMENT),
112112

113113
entry(QTypes.NILL, NILL),
114-
entry(QTypes.VECTOR, VECTOR),
115114
entry(QTypes.CHAR, CHAR),
116115
entry(QTypes.STRING, STRING),
117116

118117
entry(QTypes.SIGNED_ATOM, ATOM),
119118
entry(QTypes.UNSIGNED_ATOM, ATOM),
119+
entry(QTypes.LIST_ATOMS, VECTOR),
120120

121121
entry(TokenType.BAD_CHARACTER, BAD_CHARACTER)
122122
);

src/main/java/org/kdb/inside/brains/lang/QBracesMatcher.java renamed to src/main/java/org/kdb/inside/brains/lang/highlighting/QBracesMatcher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.kdb.inside.brains.lang;
1+
package org.kdb.inside.brains.lang.highlighting;
22

33
import com.intellij.codeInsight.highlighting.PairedBraceMatcherAdapter;
44
import com.intellij.lang.BracePair;

0 commit comments

Comments
 (0)