Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IntelliJ Update #332

Merged
merged 2 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -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"

Expand Down
4 changes: 1 addition & 3 deletions intellij-updater.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)])
Expand Down Expand Up @@ -115,7 +114,7 @@ class LSPInitMain : PersistentStateComponent<LSPInitMain.PowerShellInfo>, 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")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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? {
Expand All @@ -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-")