Skip to content

Commit 1e83e6e

Browse files
committed
(#273) Get rid of com.intellij.collaboration reference
1 parent 3af1625 commit 1e83e6e

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

src/main/kotlin/com/intellij/plugin/powershell/lang/lsp/ide/listeners/DocumentListenerImpl.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
*/
44
package com.intellij.plugin.powershell.lang.lsp.ide.listeners
55

6-
import com.intellij.collaboration.async.launchNow
76
import com.intellij.openapi.editor.event.DocumentEvent
87
import com.intellij.openapi.editor.event.DocumentListener
98
import kotlinx.coroutines.CoroutineScope
9+
import kotlinx.coroutines.CoroutineStart
10+
import kotlinx.coroutines.launch
1011

1112
class DocumentListenerImpl(private val coroutineScope: CoroutineScope) : LSPEditorListener(), DocumentListener {
1213
/**
@@ -23,7 +24,7 @@ class DocumentListenerImpl(private val coroutineScope: CoroutineScope) : LSPEdit
2324
*/
2425
override fun documentChanged(event: DocumentEvent) {
2526
if (checkManager()) {
26-
coroutineScope.launchNow { editorManager?.documentChanged(event) }
27+
coroutineScope.launch(start = CoroutineStart.UNDISPATCHED) { editorManager?.documentChanged(event) }
2728
}
2829
}
2930
}

src/main/kotlin/com/intellij/plugin/powershell/lang/lsp/languagehost/LanguageServerEndpoint.kt

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
*/
44
package com.intellij.plugin.powershell.lang.lsp.languagehost
55

6-
import com.intellij.collaboration.async.launchNow
76
import com.intellij.ide.actions.ShowSettingsUtilImpl
87
import com.intellij.notification.*
98
import com.intellij.openapi.Disposable
@@ -33,10 +32,7 @@ import com.intellij.plugin.powershell.lang.lsp.ide.settings.PowerShellConfigurab
3332
import com.intellij.plugin.powershell.lang.lsp.util.getTextEditor
3433
import com.intellij.plugin.powershell.lang.lsp.util.isRemotePath
3534
import com.intellij.util.io.await
36-
import kotlinx.coroutines.CoroutineScope
37-
import kotlinx.coroutines.Deferred
38-
import kotlinx.coroutines.async
39-
import kotlinx.coroutines.delay
35+
import kotlinx.coroutines.*
4036
import org.eclipse.lsp4j.*
4137
import org.eclipse.lsp4j.jsonrpc.messages.Either
4238
import org.eclipse.lsp4j.launch.LSPLauncher
@@ -87,7 +83,7 @@ class LanguageServerEndpoint(
8783
}
8884

8985
fun start() {
90-
coroutineScope.launchNow {
86+
coroutineScope.launch(start = CoroutineStart.UNDISPATCHED) {
9187
ensureStarted()
9288
val capabilities = getServerCapabilities()
9389
if (capabilities != null) {
@@ -130,7 +126,7 @@ class LanguageServerEndpoint(
130126
documentListener.setManager(manager)
131127
selectionListener.setManager(manager)
132128
manager.registerListeners()
133-
coroutineScope.launchNow { manager.documentOpened() }
129+
coroutineScope.launch(start = CoroutineStart.UNDISPATCHED) { manager.documentOpened() }
134130
logger.debug("Created manager for $uri")
135131
return@async manager
136132
}
@@ -180,7 +176,7 @@ class LanguageServerEndpoint(
180176
fun disconnectEditor(uri: URI) {
181177
val deferred = connectedEditors.remove(uri)
182178
if (deferred != null) {
183-
coroutineScope.launchNow {
179+
coroutineScope.launch(start = CoroutineStart.UNDISPATCHED) {
184180
val manager = deferred.await()
185181
manager?.removeListeners()
186182
manager?.documentClosed()
@@ -273,7 +269,7 @@ class LanguageServerEndpoint(
273269
.filter { isRemotePath(it) }
274270
.map { Paths.get(it).toUri().toASCIIString() }
275271
.forEach { uri ->
276-
coroutineScope.launchNow {
272+
coroutineScope.launch(start = CoroutineStart.UNDISPATCHED) {
277273
textDocumentServiceQueue.didSave(DidSaveTextDocumentParams(TextDocumentIdentifier(uri), null))
278274
}
279275
}

0 commit comments

Comments
 (0)