File tree Expand file tree Collapse file tree 3 files changed +18
-1
lines changed
common/src/main/kotlin/spp/jetbrains/status
marker/src/main/kotlin/spp/jetbrains/marker
plugin/src/main/kotlin/spp/jetbrains/sourcemarker/stat Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,9 @@ interface SourceStatusService {
2929 }
3030 }
3131
32+ fun isReady (): Boolean
33+ fun isConnected (): Boolean
34+
3235 fun getCurrentStatus (): Pair <SourceStatus , String ?>
3336 fun update (status : SourceStatus , message : String? = null)
3437}
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ import spp.jetbrains.marker.source.mark.api.event.SourceMarkEventListener
3232import spp.jetbrains.marker.source.mark.guide.GuideMark
3333import spp.jetbrains.marker.source.mark.gutter.GutterMark
3434import spp.jetbrains.marker.source.mark.inlay.InlayMark
35+ import spp.jetbrains.status.SourceStatusService
3536import spp.protocol.artifact.ArtifactQualifiedName
3637
3738/* *
@@ -101,9 +102,14 @@ class SourceMarker(private val project: Project) {
101102 if (fileMarker != null ) {
102103 return fileMarker
103104 } else if (! SourceFileMarker .isFileSupported(psiFile)) {
105+ log.warn(" File type not supported: ${psiFile.fileType.name} " )
104106 return null
105107 } else if (psiFile.virtualFile == null || ! psiFile.virtualFile.isInLocalFileSystem) {
106- return null // skip in-memory/non-local files
108+ log.warn(" Skipping in-memory/non-local file: ${psiFile.virtualFile} " )
109+ return null
110+ } else if (! SourceStatusService .getInstance(project).isConnected()) {
111+ log.warn(" Not connected, skipping source file marker creation for: $psiFile " )
112+ return null
107113 }
108114
109115 fileMarker = configuration.sourceFileMarkerProvider.createSourceFileMarker(psiFile)
Original file line number Diff line number Diff line change @@ -45,6 +45,14 @@ class SourceStatusServiceImpl(val project: Project) : SourceStatusService {
4545 private val reconnectionLock = Any ()
4646 private var reconnectionJob: Job ? = null
4747
48+ override fun isReady (): Boolean {
49+ return getCurrentStatus().first == Ready
50+ }
51+
52+ override fun isConnected (): Boolean {
53+ return getCurrentStatus().first.let { it == Ready || it == Pending }
54+ }
55+
4856 override fun getCurrentStatus (): Pair <SourceStatus , String ?> {
4957 synchronized(statusLock) {
5058 return Pair (status, message)
You can’t perform that action at this time.
0 commit comments