diff --git a/build.gradle.kts b/build.gradle.kts index e75950b8..2b3bc7db 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -60,7 +60,7 @@ val powerShellEditorServices: Configuration by configurations.creating dependencies { intellijPlatform { - intellijIdeaCommunity(libs.versions.intellij) + intellijIdeaCommunity(libs.versions.intellij, useInstaller = !libs.versions.intellij.get().contains("SNAPSHOT")) bundledPlugins("org.intellij.intelliLang", "org.jetbrains.plugins.terminal") bundledLibrary(provider { // TODO[#340]: This is a workaround, remove in intellij-platform-gradle-plugin 2.2.2 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2a17f4b9..abd4a5e2 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] -intellij = "2024.3" -intellijPreview = "2024.3" +intellij = "251.20015-EAP-CANDIDATE-SNAPSHOT" +intellijPreview = "251.20015-EAP-CANDIDATE-SNAPSHOT" junixsocket = "2.10.1" lsp4j = "0.24.0" diff --git a/intellij-updater.json b/intellij-updater.json index 20e9f501..f63f2315 100644 --- a/intellij-updater.json +++ b/intellij-updater.json @@ -3,9 +3,7 @@ "file": "gradle/libs.versions.toml", "field": "intellij", "kind": "intellij-idea-community", - "versionFlavor": "release", - "versionConstraint": "latestWave", - "order": "oldest" + "versionFlavor": "eap" }, { "file": "gradle/libs.versions.toml", "field": "intellijPreview", diff --git a/src/main/kotlin/com/intellij/plugin/powershell/lang/lsp/LSPInitMain.kt b/src/main/kotlin/com/intellij/plugin/powershell/lang/lsp/LSPInitMain.kt index 03215bf2..cadef8eb 100644 --- a/src/main/kotlin/com/intellij/plugin/powershell/lang/lsp/LSPInitMain.kt +++ b/src/main/kotlin/com/intellij/plugin/powershell/lang/lsp/LSPInitMain.kt @@ -15,7 +15,7 @@ import com.intellij.openapi.fileEditor.FileDocumentManager import com.intellij.openapi.project.Project import com.intellij.openapi.project.ProjectManager import com.intellij.openapi.project.ProjectManagerListener -import com.intellij.openapi.vfs.VfsUtil +import com.intellij.openapi.util.io.toNioPathOrNull import com.intellij.openapi.vfs.VirtualFile import com.intellij.plugin.powershell.PowerShellFileType import com.intellij.plugin.powershell.ide.PluginProjectRoot @@ -24,7 +24,6 @@ import com.intellij.plugin.powershell.lang.lsp.languagehost.EditorServicesLangua import com.intellij.plugin.powershell.lang.lsp.languagehost.LanguageServerEndpoint import com.intellij.plugin.powershell.lang.lsp.languagehost.terminal.PowerShellConsoleTerminalRunner import com.intellij.plugin.powershell.lang.lsp.util.isRemotePath -import java.io.File import java.util.concurrent.ConcurrentHashMap @State(name = "PowerShellSettings", storages = [Storage(value = "powerShellSettings.xml", roamingType = RoamingType.DISABLED)]) @@ -115,7 +114,7 @@ class LSPInitMain : PersistentStateComponent, Dispos val vfile = FileDocumentManager.getInstance().getFile(editor.document) ?: return if (vfile.fileType !is PowerShellFileType) return val server = findServer(vfile, project) ?: return - server.disconnectEditor(VfsUtil.toUri(File(vfile.path))) + server.disconnectEditor(vfile.path.toNioPathOrNull()?.toUri() ?: return) LOG.debug("Removed ${vfile.name} script from server: $server") } diff --git a/src/main/kotlin/com/intellij/plugin/powershell/lang/lsp/languagehost/LanguageServerEndpoint.kt b/src/main/kotlin/com/intellij/plugin/powershell/lang/lsp/languagehost/LanguageServerEndpoint.kt index d93bebc1..6980ad11 100644 --- a/src/main/kotlin/com/intellij/plugin/powershell/lang/lsp/languagehost/LanguageServerEndpoint.kt +++ b/src/main/kotlin/com/intellij/plugin/powershell/lang/lsp/languagehost/LanguageServerEndpoint.kt @@ -11,6 +11,7 @@ import com.intellij.openapi.editor.Editor import com.intellij.openapi.fileEditor.FileDocumentManager import com.intellij.openapi.project.Project import com.intellij.openapi.util.Disposer +import com.intellij.openapi.util.io.toNioPathOrNull import com.intellij.openapi.vfs.AsyncFileListener import com.intellij.openapi.vfs.VfsUtil import com.intellij.openapi.vfs.VirtualFileManager @@ -38,7 +39,6 @@ import org.eclipse.lsp4j.jsonrpc.messages.Either import org.eclipse.lsp4j.launch.LSPLauncher import org.eclipse.lsp4j.services.LanguageServer import org.jetbrains.annotations.TestOnly -import java.io.File import java.net.URI import java.nio.file.Path import java.nio.file.Paths @@ -98,7 +98,7 @@ class LanguageServerEndpoint( return } val file = FileDocumentManager.getInstance().getFile(editor.document) ?: return - val uri = VfsUtil.toUri(File(file.path)) + val uri = file.path.toNioPathOrNull()?.toUri() ?: return @Suppress("DeferredResultUnused") connectedEditors.computeIfAbsent(uri) { coroutineScope.async { diff --git a/src/main/kotlin/com/intellij/plugin/powershell/lang/lsp/util/FileUtils.kt b/src/main/kotlin/com/intellij/plugin/powershell/lang/lsp/util/FileUtils.kt index 711a53db..c3d1a594 100644 --- a/src/main/kotlin/com/intellij/plugin/powershell/lang/lsp/util/FileUtils.kt +++ b/src/main/kotlin/com/intellij/plugin/powershell/lang/lsp/util/FileUtils.kt @@ -5,21 +5,13 @@ import com.intellij.openapi.fileEditor.FileDocumentManager import com.intellij.openapi.fileEditor.FileEditorManager import com.intellij.openapi.fileEditor.TextEditor import com.intellij.openapi.project.Project -import com.intellij.openapi.vfs.VfsUtil +import com.intellij.openapi.util.io.toNioPathOrNull import com.intellij.openapi.vfs.VirtualFile import com.intellij.plugin.powershell.ide.run.join -import java.io.File -import java.net.URI - fun editorToURIString(editor: Editor): String? { val file = FileDocumentManager.getInstance().getFile(editor.document)?: return null - return VfsUtil.toUri(File(file.path)).toString() -} - -fun editorToURI(editor: Editor): URI? { - val file = FileDocumentManager.getInstance().getFile(editor.document)?: return null - return VfsUtil.toUri(File(file.path)) + return file.path.toNioPathOrNull()?.toUri()?.toString() } fun getTextEditor(file: VirtualFile, project: Project): Editor? { @@ -28,4 +20,4 @@ fun getTextEditor(file: VirtualFile, project: Project): Editor? { fun isRemotePath(docPath: String?) = docPath != null && docPath.contains(REMOTE_FILES_DIR_PREFIX) -private val REMOTE_FILES_DIR_PREFIX = join(System.getProperty("java.io.tmpdir"), "PSES-") +private val REMOTE_FILES_DIR_PREFIX = join(System.getProperty("java.io.tmpdir"), "PSES-")