Skip to content

Commit

Permalink
Adding editor jump analytics (#56)
Browse files Browse the repository at this point in the history
* Adding editor jump analytics

* Bumping version from 1.1.0 -> 1.2.0
  • Loading branch information
jyoo980 authored Jun 28, 2022
1 parent bf08125 commit 6c02136
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
pluginGroup = com.github.jyoo980.reachhover
pluginName = reach-hover
# SemVer format -> https://semver.org
pluginVersion = 1.1.0
pluginVersion = 1.2.0

# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
# for insight into build numbers and IntelliJ Platform versions.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.github.jyoo980.reachhover.actions

import com.github.jyoo980.reachhover.analytics.listeners.EditorSelectionListener
import com.intellij.openapi.editor.EditorFactory
import com.intellij.openapi.project.Project
import com.intellij.openapi.startup.StartupActivity

class StartupAction : StartupActivity {

override fun runActivity(project: Project) {
EditorFactory.getInstance().eventMulticaster.addCaretListener(EditorSelectionListener())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@ enum class EventType {
REACH_HOVER_INVOKED,
FILE_OPEN,
FILE_CLOSED,
MOUSE_CLICK
MOUSE_CLICK,
CURSOR_JUMP,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.github.jyoo980.reachhover.analytics.listeners

import com.github.jyoo980.reachhover.analytics.EventType
import com.github.jyoo980.reachhover.analytics.LogWriter
import com.intellij.openapi.editor.event.CaretEvent
import com.intellij.openapi.editor.event.CaretListener

class EditorSelectionListener : CaretListener {

override fun caretPositionChanged(event: CaretEvent) {
val editorType = event.editor.editorKind
LogWriter.write("Jump occurred in editor of type: $editorType", EventType.CURSOR_JUMP)
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.github.jyoo980.reachhover.analytics
package com.github.jyoo980.reachhover.analytics.listeners

import com.github.jyoo980.reachhover.analytics.EventType
import com.github.jyoo980.reachhover.analytics.LogWriter
import com.intellij.openapi.fileEditor.FileEditorManager
import com.intellij.openapi.fileEditor.FileEditorManagerListener
import com.intellij.openapi.vfs.VirtualFile
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
implementation="com.github.jyoo980.reachhover.listeners.EditorHoverListener"/>
<notificationGroup id="ReachHover"
displayType="BALLOON"/>

<postStartupActivity implementation="com.github.jyoo980.reachhover.actions.StartupAction"/>
</extensions>
<applicationListeners>
<listener
class="com.github.jyoo980.reachhover.analytics.ReachHoverAnalyticsService"
topic="com.intellij.openapi.actionSystem.ex.AnActionListener"/>
<listener
class="com.github.jyoo980.reachhover.analytics.FileListener"
class="com.github.jyoo980.reachhover.analytics.listeners.FileListener"
topic="com.intellij.openapi.fileEditor.FileEditorManagerListener"/>
</applicationListeners>

Expand Down

0 comments on commit 6c02136

Please sign in to comment.