Skip to content

Commit 3691f40

Browse files
authored
Merge pull request #8 from ByteAurora/develop
Release CodeXP v1.2.0
2 parents 82628a6 + 7353dfd commit 3691f40

File tree

18 files changed

+516
-224
lines changed

18 files changed

+516
-224
lines changed

CHANGELOG.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,22 @@
66

77
### Added
88

9+
- Add 'Enter' event statistic and challenge
10+
- Display gained experience point from keyboard event into typed position
11+
- Add configurations for show gained experience and gained experience display position
12+
13+
### Changed
14+
15+
### Removed
16+
17+
### Fixed
18+
19+
- Fix an issue where settings applied in the CodeXP configuration window were not being saved
20+
21+
## [1.1.0] - 2023-07-16
22+
23+
### Added
24+
925
- Add CodeXP configuration in IDE setting
1026
- Add checkbox for show/hide completed challenges
1127

@@ -16,4 +32,10 @@
1632
- Implement core logic of CodeXP
1733
- Implement CodeXP Dashboard
1834
- Define events to detect and add challenges for each event
19-
- Implement notification alert feature for leveling up or completing challenges
35+
- Implement notification alert feature for leveling up or completing challenges
36+
37+
[Unreleased]: https://github.com/ILoveGameCoding/intellij-codexp/compare/v1.1.0...HEAD
38+
39+
[1.1.0]: https://github.com/ILoveGameCoding/intellij-codexp/compare/v1.0.0...v1.1.0
40+
41+
[1.0.0]: https://github.com/ILoveGameCoding/intellij-codexp/commits/v1.0.0

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pluginGroup = com.github.ilovegamecoding.intellijcodexp
44
pluginName = intellij-codexp
55
pluginRepositoryUrl = https://github.com/ILoveGameCoding/intellij-codexp
66
# SemVer format -> https://semver.org
7-
pluginVersion=1.1.0
7+
pluginVersion=1.2.0
88

99
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
1010
pluginSinceBuild = 221

src/main/java/com/github/ilovegamecoding/intellijcodexp/form/CodeXPConfigurationForm.form

Lines changed: 58 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.github.ilovegamecoding.intellijcodexp.form.CodeXPConfigurationForm">
3-
<grid id="27dc6" binding="pMain" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
3+
<grid id="27dc6" binding="pMain" layout-manager="GridLayoutManager" row-count="7" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
44
<margin top="0" left="0" bottom="0" right="0"/>
55
<constraints>
6-
<xy x="20" y="20" width="567" height="400"/>
6+
<xy x="20" y="20" width="621" height="400"/>
77
</constraints>
88
<properties/>
99
<border type="none"/>
@@ -35,9 +35,64 @@
3535
</component>
3636
<vspacer id="43cd9">
3737
<constraints>
38-
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
38+
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
3939
</constraints>
4040
</vspacer>
41+
<component id="a4d9f" class="javax.swing.JCheckBox" binding="cbShowGainedXP">
42+
<constraints>
43+
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
44+
</constraints>
45+
<properties>
46+
<text resource-bundle="messages/CodeXPBundle" key="TEXT_SHOW_GAINED_XP"/>
47+
</properties>
48+
</component>
49+
<grid id="1c92c" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
50+
<margin top="0" left="22" bottom="0" right="0"/>
51+
<constraints>
52+
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
53+
</constraints>
54+
<properties/>
55+
<border type="none"/>
56+
<children>
57+
<component id="9ca3" class="javax.swing.JComboBox" binding="cbPositionToDisplayGainedXP">
58+
<constraints>
59+
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
60+
</constraints>
61+
<properties/>
62+
</component>
63+
<hspacer id="3944">
64+
<constraints>
65+
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
66+
</constraints>
67+
</hspacer>
68+
<component id="d236" class="javax.swing.JLabel">
69+
<constraints>
70+
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
71+
</constraints>
72+
<properties>
73+
<text resource-bundle="messages/CodeXPBundle" key="TEXT_CARETS"/>
74+
</properties>
75+
</component>
76+
</children>
77+
</grid>
78+
<grid id="9e7ee" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
79+
<margin top="0" left="22" bottom="0" right="0"/>
80+
<constraints>
81+
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
82+
</constraints>
83+
<properties/>
84+
<border type="none"/>
85+
<children>
86+
<component id="57ce1" class="javax.swing.JLabel">
87+
<constraints>
88+
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
89+
</constraints>
90+
<properties>
91+
<text resource-bundle="messages/CodeXPBundle" key="TEXT_SHOW_GAINED_XP_DESCRIPTION"/>
92+
</properties>
93+
</component>
94+
</children>
95+
</grid>
4196
</children>
4297
</grid>
4398
</form>

src/main/java/com/github/ilovegamecoding/intellijcodexp/form/CodeXPConfigurationForm.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ public class CodeXPConfigurationForm {
77
public JCheckBox cbShowLevelUpNotification;
88
public JCheckBox cbShowCompletedChallenges;
99
public JPanel pMain;
10+
public JCheckBox cbShowGainedXP;
11+
public JComboBox cbPositionToDisplayGainedXP;
1012
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.github.ilovegamecoding.intellijcodexp.enums
2+
3+
/**
4+
* Event enum for the plugin events.
5+
*/
6+
enum class Event(val xpValue: Long) {
7+
NONE(0),
8+
TYPING(2),
9+
CUT(1),
10+
COPY(1),
11+
PASTE(1),
12+
BACKSPACE(1),
13+
TAB(2),
14+
ENTER(2),
15+
SAVE(10),
16+
BUILD(5),
17+
RUN(10),
18+
DEBUG(20),
19+
ACTION(5);
20+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.github.ilovegamecoding.intellijcodexp.enums
2+
3+
/**
4+
* Position enum for the gained XP label.
5+
*/
6+
enum class PositionToDisplayGainedXP(val x: Int, val y: Int) {
7+
TOP(0, -1),
8+
TOP_LEFT(-1, -1),
9+
LEFT(-1, 0),
10+
BOTTOM_LEFT(-1, 1),
11+
BOTTOM(0, 1),
12+
BOTTOM_RIGHT(1, 1),
13+
RIGHT(1, 0),
14+
TOP_RIGHT(1, -1)
15+
}
Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
package com.github.ilovegamecoding.intellijcodexp.listeners
22

3-
import com.github.ilovegamecoding.intellijcodexp.services.CodeXPService
3+
import com.github.ilovegamecoding.intellijcodexp.enums.Event
44
import com.intellij.openapi.actionSystem.AnAction
55
import com.intellij.openapi.actionSystem.AnActionEvent
66
import com.intellij.openapi.actionSystem.AnActionResult
77
import com.intellij.openapi.actionSystem.DataContext
88
import com.intellij.openapi.actionSystem.ex.AnActionListener
99
import com.intellij.openapi.application.ApplicationManager
10-
import com.intellij.openapi.diagnostic.thisLogger
1110

1211
/**
1312
* CodeXPEventListener class
@@ -17,33 +16,37 @@ import com.intellij.openapi.diagnostic.thisLogger
1716
internal class CodeXPEventListener : AnActionListener {
1817
override fun afterEditorTyping(c: Char, dataContext: DataContext) {
1918
super.afterEditorTyping(c, dataContext)
20-
fireEvent(CodeXPService.Event.TYPING)
19+
20+
fireEvent(Event.TYPING, dataContext)
2121
}
2222

2323
override fun afterActionPerformed(action: AnAction, event: AnActionEvent, result: AnActionResult) {
2424
super.afterActionPerformed(action, event, result)
25-
thisLogger().warn("Action performed: ${action.templateText}")
2625

27-
when (action.templateText) { // Fire event based on action.
28-
"Run" -> fireEvent(CodeXPService.Event.RUN)
29-
"Save All" -> fireEvent(CodeXPService.Event.SAVE)
30-
"Debug" -> fireEvent(CodeXPService.Event.DEBUG)
31-
"Build Project" -> fireEvent(CodeXPService.Event.BUILD)
32-
"Rebuild Project" -> fireEvent(CodeXPService.Event.BUILD)
33-
"Paste" -> fireEvent(CodeXPService.Event.PASTE)
34-
"Backspace" -> fireEvent(CodeXPService.Event.BACKSPACE)
35-
"Tab" -> fireEvent(CodeXPService.Event.TAB)
36-
else -> fireEvent(CodeXPService.Event.ACTION)
26+
when (action.templateText) {
27+
"Run" -> fireEvent(Event.RUN)
28+
"Save All" -> fireEvent(Event.SAVE)
29+
"Debug" -> fireEvent(Event.DEBUG)
30+
"Build Project" -> fireEvent(Event.BUILD)
31+
"Rebuild Project" -> fireEvent(Event.BUILD)
32+
"Cut" -> fireEvent(Event.CUT, event.dataContext)
33+
"Copy" -> fireEvent(Event.COPY, event.dataContext)
34+
"Paste" -> fireEvent(Event.PASTE, event.dataContext)
35+
"Backspace" -> fireEvent(Event.BACKSPACE, event.dataContext)
36+
"Tab" -> fireEvent(Event.TAB, event.dataContext)
37+
"Enter" -> fireEvent(Event.ENTER, event.dataContext)
38+
else -> fireEvent(Event.ACTION)
3739
}
3840
}
3941

4042
/**
4143
* Fire event to the message bus.
4244
*
4345
* @param event The event to fire.
46+
* @param dataContext The data context of the event.
4447
*/
45-
private fun fireEvent(event: CodeXPService.Event) {
48+
private fun fireEvent(event: Event, dataContext: DataContext? = null) {
4649
ApplicationManager.getApplication().messageBus.syncPublisher(CodeXPListener.CODEXP_EVENT)
47-
.eventOccurred(event)
50+
.eventOccurred(event, dataContext)
4851
}
4952
}

src/main/kotlin/com/github/ilovegamecoding/intellijcodexp/listeners/CodeXPListener.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.github.ilovegamecoding.intellijcodexp.listeners
22

3-
import com.github.ilovegamecoding.intellijcodexp.services.CodeXPService
3+
import com.github.ilovegamecoding.intellijcodexp.enums.Event
4+
import com.intellij.openapi.actionSystem.DataContext
45
import com.intellij.util.messages.Topic
56

67
/**
@@ -20,6 +21,7 @@ interface CodeXPListener {
2021
* Function that is called when an event occurs.
2122
*
2223
* @param event The event that occurred.
24+
* @param dataContext The data context of the event.
2325
*/
24-
fun eventOccurred(event: CodeXPService.Event)
26+
fun eventOccurred(event: Event, dataContext: DataContext? = null)
2527
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package com.github.ilovegamecoding.intellijcodexp.manager
1+
package com.github.ilovegamecoding.intellijcodexp.managers
22

3-
import com.github.ilovegamecoding.intellijcodexp.model.CodeXPChallenge
3+
import com.github.ilovegamecoding.intellijcodexp.models.CodeXPChallenge
44
import com.intellij.notification.NotificationGroup
55
import com.intellij.notification.NotificationGroupManager
66
import com.intellij.notification.NotificationType

0 commit comments

Comments
 (0)