Skip to content

Commit

Permalink
Dev (#685)
Browse files Browse the repository at this point in the history
* protocol update

* bump

* refactor

* refactor

* refactor

* temp version

* refactor

* refactor

* refactor

* clean

* organize imports

* refactor

* refactor

* bump

* bump

* refactor

* validate marker auth over tcp

* refactor

* bump

* refactor

* bump

* bump

* backwards compatibility issues

* bump

* bump

* bump

* moved packages

* refactor

* better error message

* bump

* bump

* use official lib

* Update build.gradle.kts

* Update build.gradle.kts

* Update build.gradle.kts

* Update build.gradle.kts

* Update build.gradle.kts

* bump

* Update build.gradle.kts

* bump

* fixes #658

* refactor

* remove globalscope

* fixes #666

* refactor

* formatting

* fix log pattern ordering

* bump

* live variable presentation

* refactor

* use protocol marshaller

* require input

* skip if no pattern

* bump

* clean

* Watch log command (#673)

* watch log

* unused

* refactor

* refactor

* moved portal only code to portal

* protocol update

* clean

* watch log command

* bump

* refactor

* format

* remove subscription on mark remove

* move package

* move test

* bump

* remove mapper

* remove mapper

* unused

* remove unused

* remove unused

* remove portal tests

* exclude gen

* use protocol type

* start from current service

* remove portal config from status bars

* translations

* skywalking reroute

* skywalking reroute

* bump

* remove hardcoded config

* view event listener
merged instrument id source keys

* remove portal

* bump

* bump

* use marshaller

* use marshaller

* use marshaller

* re-impl portal

* refactor

* refactor

* bump

* refactor

* reimpl portal

* move portal code

* license

* sw live service

* bump

* move packages

* MARK_USER_DATA_UPDATED event

* bump

* activity quick stats

* clean

* createMethodInlayMark

* increase visibility

* formatting

* bump

* more logging

* import organizing

* remove specific subs instead of clearing all

* fix dupe quick stat inlays

* bump

* remove mapper

* reset

* Update ViewEventListener.kt

* merge refactor

* Update build.gradle.kts

* remove mapper

* compatibility

* overview wip

* fix edt warning
  • Loading branch information
BFergerson authored Mar 14, 2022
1 parent 0f66fa2 commit a4660c9
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,17 @@ object ArtifactNavigator {
//todo: remove method from method names and support navigating to classes?

fun navigateTo(project: Project, element: LiveStackTraceElement) {
ApplicationManager.getApplication().invokeLater {
ApplicationManager.getApplication().runReadAction {
val foundFiles = getFilesByName(project, element.sourceAsFilename()!!, allScope(project))
if (foundFiles.isNotEmpty()) {
val file = foundFiles[0]
val document: Document = PsiDocumentManager.getInstance(file.project).getDocument(file)!!
val offset = document.getLineStartOffset(element.sourceAsLineNumber()!! - 1)
PsiNavigationSupport.getInstance().createNavigatable(project, file.virtualFile, offset).navigate(true)

ApplicationManager.getApplication().invokeLater {
PsiNavigationSupport.getInstance().createNavigatable(project, file.virtualFile, offset)
.navigate(true)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,17 @@ interface Command {
Icon liveBreakpointSelected = IconLoader.getIcon("/icons/command/live-breakpoint_selected.svg", PluginIcons.class);
Icon liveBreakpointUnSelected = IconLoader.getIcon("/icons/command/live-breakpoint_unselected.svg", PluginIcons.class);

Icon livelogSelected = IconLoader.getIcon("/icons/command/live-log_selected.svg", PluginIcons.class);
Icon livelogUnSelected = IconLoader.getIcon("/icons/command/live-log_unselected.svg", PluginIcons.class);
Icon liveLogSelected = IconLoader.getIcon("/icons/command/live-log_selected.svg", PluginIcons.class);
Icon liveLogUnSelected = IconLoader.getIcon("/icons/command/live-log_unselected.svg", PluginIcons.class);

Icon liveMeterSelected = IconLoader.getIcon("/icons/command/live-meter_selected.svg", PluginIcons.class);
Icon liveMeterUnSelected = IconLoader.getIcon("/icons/command/live-meter_unselected.svg", PluginIcons.class);

Icon liveSpanSelected = IconLoader.getIcon("/icons/command/live-span_selected.svg", PluginIcons.class);
Icon liveSpanUnSelected = IconLoader.getIcon("/icons/command/live-span_unselected.svg", PluginIcons.class);

Icon viewOverviewSelected = IconLoader.getIcon("/icons/command/view-overview_selected.svg", PluginIcons.class);
Icon viewOverviewUnSelected = IconLoader.getIcon("/icons/command/view-overview_unselected.svg", PluginIcons.class);
Icon viewActivitySelected = IconLoader.getIcon("/icons/command/view-activity_selected.svg", PluginIcons.class);
Icon viewActivityUnSelected = IconLoader.getIcon("/icons/command/view-activity_unselected.svg", PluginIcons.class);
Icon viewTracesSelected = IconLoader.getIcon("/icons/command/view-traces_selected.svg", PluginIcons.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ object ControlBarController {
@Suppress("UselessCallOnCollection") //unknown enums are null
selfInfo.permissions.filterNotNull().map { it.name }.contains(it.name)
})
//availableCommands.add(VIEW_OVERVIEW) //todo: remove after v0.4.2
}

private fun determineAvailableCommandsAtLocation(inlayMark: ExpressionInlayMark): List<LiveControlCommand> {
Expand All @@ -79,7 +80,7 @@ object ControlBarController {
val parentMark = inlayMark.getParentSourceMark()
if (parentMark is MethodSourceMark) {
val loggerDetector = parentMark.getUserData(SourceMarkKeys.LOGGER_DETECTOR)
if (loggerDetector != null) {
if (loggerDetector != null && SourceServices.Instance.liveView != null) {
runBlocking {
val detectedLogs = loggerDetector.getOrFindLoggerStatements(parentMark)
val logOnCurrentLine = detectedLogs.find { it.lineLocation == inlayMark.lineNumber }
Expand All @@ -95,6 +96,7 @@ object ControlBarController {
fun handleCommandInput(input: String, editor: Editor) {
log.info("Processing command input: {}", input)
when (input) {
VIEW_OVERVIEW.command -> handleViewPortalCommand(editor, VIEW_OVERVIEW)
VIEW_ACTIVITY.command -> handleViewPortalCommand(editor, VIEW_ACTIVITY)
VIEW_TRACES.command -> handleViewPortalCommand(editor, VIEW_TRACES)
VIEW_LOGS.command -> handleViewPortalCommand(editor, VIEW_LOGS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ enum class LiveControlCommand(
val unselectedIcon: Icon? = null
) : AutocompleteFieldRow {

VIEW_OVERVIEW(
"View Overview",
"<html><span style=\"font-size: 80%; color: gray\">Live View ➛ Overview ➛ Scope: Class</span></html>",
PluginIcons.Command.viewOverviewSelected,
PluginIcons.Command.viewOverviewUnSelected
),
VIEW_ACTIVITY(
"View Activity",
"<html><span style=\"font-size: 80%; color: gray\">Live View ➛ Activity ➛ Scope: Method</span></html>",
Expand Down Expand Up @@ -75,8 +81,8 @@ enum class LiveControlCommand(
ADD_LIVE_LOG(
"Add Log",
"<html><span style=\"font-size: 80%; color: gray\">Live Instrument ➛ Add ➛ Location: </span><span style=\"font-size: 80%; color: #E6E6E6\">On line *lineNumber*</span></html>",
PluginIcons.Command.livelogSelected,
PluginIcons.Command.livelogUnSelected
PluginIcons.Command.liveLogSelected,
PluginIcons.Command.liveLogUnSelected
),
ADD_LIVE_METER(
"Add Meter",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,17 @@ import org.slf4j.LoggerFactory
import spp.jetbrains.marker.SourceMarker
import spp.jetbrains.marker.source.mark.api.component.jcef.SourceMarkJcefComponent
import spp.jetbrains.marker.source.mark.api.event.SourceMarkEventCode
import spp.jetbrains.marker.source.mark.gutter.GutterMark
import spp.jetbrains.portal.SourcePortal
import spp.jetbrains.portal.backend.PortalServer
import spp.jetbrains.portal.protocol.portal.PageType
import spp.jetbrains.sourcemarker.command.LiveControlCommand
import spp.jetbrains.sourcemarker.command.LiveControlCommand.*
import spp.jetbrains.sourcemarker.mark.SourceMarkKeys
import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig
import spp.protocol.artifact.ArtifactQualifiedName
import spp.protocol.marshall.KSerializers
import spp.protocol.marshall.LocalMessageCodec
import javax.swing.UIManager

class PortalController(private val markerConfig: SourceMarkerConfig) : CoroutineVerticle() {
Expand All @@ -54,9 +57,11 @@ class PortalController(private val markerConfig: SourceMarkerConfig) : Coroutine
vertx.deployVerticle(portalServer).await()
vertx.deployVerticle(PortalEventListener(markerConfig)).await()

// //todo: remove after v0.4.2
// vertx.eventBus().registerDefaultCodec(ArtifactQualifiedName::class.java, LocalMessageCodec())

SourceMarker.addGlobalSourceMarkEventListener {
if (it.eventCode == SourceMarkEventCode.MARK_BEFORE_ADDED) {
//todo: only register when needed
if (it.eventCode == SourceMarkEventCode.MARK_BEFORE_ADDED && it.sourceMark is GutterMark) {
//register portal for source mark
val portal = SourcePortal.getPortal(
SourcePortal.register(it.sourceMark.artifactQualifiedName, false)
Expand All @@ -72,6 +77,7 @@ class PortalController(private val markerConfig: SourceMarkerConfig) : Coroutine
it.sourceMark.addEventListener {
if (it.eventCode == SourceMarkEventCode.UPDATE_PORTAL_CONFIG) {
when (val command = it.params.first() as LiveControlCommand) {
VIEW_OVERVIEW -> portal.configuration.config["currentPage"] = PageType.OVERVIEW
VIEW_ACTIVITY -> portal.configuration.config["currentPage"] = PageType.ACTIVITY
VIEW_TRACES -> portal.configuration.config["currentPage"] = PageType.TRACES
VIEW_LOGS -> portal.configuration.config["currentPage"] = PageType.LOGS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig
import spp.protocol.SourceServices.Instance
import spp.protocol.SourceServices.Provide.toLiveViewSubscriberAddress
import spp.protocol.artifact.ArtifactQualifiedName
import spp.protocol.artifact.ArtifactType
import spp.protocol.artifact.QueryTimeFrame
import spp.protocol.artifact.exception.LiveStackTraceElement
import spp.protocol.artifact.log.Log
Expand Down Expand Up @@ -232,9 +233,9 @@ class PortalEventListener(
}
vertx.eventBus().consumer<ArtifactQualifiedName>(FindPortal) {
// val artifactQualifiedName = it.body()
// val sourceMarks = SourceMarker.getSourceMarks(artifactQualifiedName)
// if (sourceMarks.isNotEmpty()) {
// it.reply(sourceMarks[0].getUserData(SourceMarkKeys.SOURCE_PORTAL)!!)
// val portals = SourcePortal.getPortals(artifactQualifiedName)
// if (portals.isNotEmpty()) {
// it.reply(portals.first())
// } else {
// launch(vertx.dispatcher()) {
// val classArtifact = findArtifact(
Expand All @@ -250,7 +251,8 @@ class PortalEventListener(
// val gutterMark = creationService.getOrCreateMethodGutterMark(
// fileMarker, searchArtifact.nameIdentifier!!
// )!!
// it.reply(gutterMark.getUserData(SourceMarkKeys.SOURCE_PORTAL)!!)
// println(gutterMark)
// //it.reply(gutterMark.getUserData(SourceMarkKeys.SOURCE_PORTAL)!!)
// }
// }
// }
Expand All @@ -264,9 +266,9 @@ class PortalEventListener(
// ApplicationManager.getApplication().invokeLater {
// PsiNavigateUtil.navigate(sourceMark.getPsiElement())
//
// val portal = sourceMark.getUserData(SourceMarkKeys.SOURCE_PORTAL)!!
// openPortal(portal)
// it.reply(portal)
// val portals = SourcePortal.getPortals(artifactQualifiedName)
// openPortal(portals.first())
// it.reply(portals.first())
// }
// } else {
// log.warn("Failed to find portal for artifact: $artifactQualifiedName")
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a4660c9

Please sign in to comment.