|
3 | 3 | */
|
4 | 4 | package com.intellij.plugin.powershell.lang.lsp.languagehost
|
5 | 5 |
|
6 |
| -import com.intellij.collaboration.async.launchNow |
7 | 6 | import com.intellij.ide.actions.ShowSettingsUtilImpl
|
8 | 7 | import com.intellij.notification.*
|
9 | 8 | import com.intellij.openapi.Disposable
|
@@ -33,10 +32,7 @@ import com.intellij.plugin.powershell.lang.lsp.ide.settings.PowerShellConfigurab
|
33 | 32 | import com.intellij.plugin.powershell.lang.lsp.util.getTextEditor
|
34 | 33 | import com.intellij.plugin.powershell.lang.lsp.util.isRemotePath
|
35 | 34 | 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.* |
40 | 36 | import org.eclipse.lsp4j.*
|
41 | 37 | import org.eclipse.lsp4j.jsonrpc.messages.Either
|
42 | 38 | import org.eclipse.lsp4j.launch.LSPLauncher
|
@@ -87,7 +83,7 @@ class LanguageServerEndpoint(
|
87 | 83 | }
|
88 | 84 |
|
89 | 85 | fun start() {
|
90 |
| - coroutineScope.launchNow { |
| 86 | + coroutineScope.launch(start = CoroutineStart.UNDISPATCHED) { |
91 | 87 | ensureStarted()
|
92 | 88 | val capabilities = getServerCapabilities()
|
93 | 89 | if (capabilities != null) {
|
@@ -130,7 +126,7 @@ class LanguageServerEndpoint(
|
130 | 126 | documentListener.setManager(manager)
|
131 | 127 | selectionListener.setManager(manager)
|
132 | 128 | manager.registerListeners()
|
133 |
| - coroutineScope.launchNow { manager.documentOpened() } |
| 129 | + coroutineScope.launch(start = CoroutineStart.UNDISPATCHED) { manager.documentOpened() } |
134 | 130 | logger.debug("Created manager for $uri")
|
135 | 131 | return@async manager
|
136 | 132 | }
|
@@ -180,7 +176,7 @@ class LanguageServerEndpoint(
|
180 | 176 | fun disconnectEditor(uri: URI) {
|
181 | 177 | val deferred = connectedEditors.remove(uri)
|
182 | 178 | if (deferred != null) {
|
183 |
| - coroutineScope.launchNow { |
| 179 | + coroutineScope.launch(start = CoroutineStart.UNDISPATCHED) { |
184 | 180 | val manager = deferred.await()
|
185 | 181 | manager?.removeListeners()
|
186 | 182 | manager?.documentClosed()
|
@@ -273,7 +269,7 @@ class LanguageServerEndpoint(
|
273 | 269 | .filter { isRemotePath(it) }
|
274 | 270 | .map { Paths.get(it).toUri().toASCIIString() }
|
275 | 271 | .forEach { uri ->
|
276 |
| - coroutineScope.launchNow { |
| 272 | + coroutineScope.launch(start = CoroutineStart.UNDISPATCHED) { |
277 | 273 | textDocumentServiceQueue.didSave(DidSaveTextDocumentParams(TextDocumentIdentifier(uri), null))
|
278 | 274 | }
|
279 | 275 | }
|
|
0 commit comments