Skip to content

Commit

Permalink
Merge branch 'net193' into net193-eap7-rtm-2019.3.0-rtm-2019.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
citizenmatt committed Dec 16, 2019
2 parents c549562 + c8cb69b commit 7731655
Show file tree
Hide file tree
Showing 13 changed files with 278 additions and 112 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0).
This plugin has functionality that is common to both ReSharper and Rider. It also contains a plugin for the Unity editor that is used to communicate with Rider. Changes marked with a "Rider:" prefix are specific to Rider, while changes for the Unity editor plugin are marked with a "Unity editor:" prefix. No prefix means that the change is common to both Rider and ReSharper.

## 2019.3.1
* [Commits](https://github.com/JetBrains/resharper-unity/compare/net193-eap7-rtm-2019.3.0...net193)
* [Commits](https://github.com/JetBrains/resharper-unity/compare/net193-eap7-rtm-2019.3.0...net193-eap7-rtm-2019.3.0-rtm-2019.3.1)
* [Milestone](https://github.com/JetBrains/resharper-unity/milestone/33?closed=1)

### Added
Expand All @@ -17,10 +17,19 @@ This plugin has functionality that is common to both ReSharper and Rider. It als
### Changed

- Rider: Entire plugin is no longer disabled if the CSS plugin is disabled ([RIDER-36523](https://youtrack.jetbrains.com/issue/RIDER-36523), [#1443](https://github.com/JetBrains/resharper-unity/pull/1443))
- Rider: Make Attach to Unity Process dialog resizable ([#1446](https://github.com/JetBrains/resharper-unity/issues/1446), [#1450](https://github.com/JetBrains/resharper-unity/pull/1450))
- Rider: Identify child processes by role in Attach to Unity Process dialog ([#1328](https://github.com/JetBrains/resharper-unity/issues/1328), [#1450](https://github.com/JetBrains/resharper-unity/pull/1450))

### Fixed

- Fix usage count for custom event based event handlers in Unity 2018.4+ ([#1448](https://github.com/JetBrains/resharper-unity/issues/1448), [#1449](https://github.com/JetBrains/resharper-unity/pull/1449))
- Rider: Show correct project name when Unity started with certain command line on Windows ([#1450](https://github.com/JetBrains/resharper-unity/pull/1450))
- Rider: Show correct project name when multiple Unity processes listed in Attach to Process popup list ([#1456](https://github.com/JetBrains/resharper-unity/issues/1456), [#1450](https://github.com/JetBrains/resharper-unity/pull/1450))
- Rider: Fix exception in Attach to Unity Process dialog causing list to be empty ([#1454](https://github.com/JetBrains/resharper-unity/issues/1454), [#1450](https://github.com/JetBrains/resharper-unity/pull/1450))
- Rider: Show run configuration dialog for Unity class library projects ([#1445](https://github.com/JetBrains/resharper-unity/issues/1445), [#1450](https://github.com/JetBrains/resharper-unity/pull/1450))
- Rider: Fix finding existing Unity instance to debug ([RIDER-36256](https://youtrack.jetbrains.com/issue/RIDER-36256), [#1450](https://github.com/JetBrains/resharper-unity/pull/1450))
- Rider: Fix `EditorInstance.json` being locked by Rider ([#1450](https://github.com/JetBrains/resharper-unity/pull/1450))



## 2019.3
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.jetbrains.rider

import com.intellij.openapi.project.Project
import com.jetbrains.rd.util.reactive.valueOrDefault
import com.jetbrains.rdclient.util.idea.LifetimedProjectComponent
import com.jetbrains.rider.model.RdExistingSolution
import com.jetbrains.rider.plugins.unity.UnityHost
Expand All @@ -21,6 +22,13 @@ class UnityProjectDiscoverer(project: Project, unityHost: UnityHost) : Lifetimed
val isUnityGeneratedProject = isUnityProject && solutionNameMatchesUnityProjectName(project)
val isUnitySidecarProject = isUnityProject && !solutionNameMatchesUnityProjectName(project)

// Note that this will only return a sensible value once the solution + backend have finished loading
val isUnityClassLibraryProject: Boolean?
get() {
val hasReference = hasUnityReference.valueOrNull ?: return null
return hasReference && isCorrectlyLoadedSolution(project)
}

companion object {
fun getInstance(project: Project) = project.getComponent<UnityProjectDiscoverer>()

Expand Down Expand Up @@ -58,5 +66,6 @@ class UnityProjectDiscoverer(project: Project, unityHost: UnityHost) : Lifetimed
}

fun Project.isUnityGeneratedProject() = UnityProjectDiscoverer.getInstance(this).isUnityGeneratedProject
fun Project.isUnityClassLibraryProject() = UnityProjectDiscoverer.getInstance(this).isUnityClassLibraryProject
fun Project.isUnityProject()= UnityProjectDiscoverer.getInstance(this).isUnityProject
fun Project.isUnityProjectFolder()= UnityProjectDiscoverer.getInstance(this).isUnityProjectFolder
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package com.jetbrains.rider.plugins.unity.run
data class UnityPlayer(val host: String, val port: Int, val debuggerPort: Int,
val flags: Long, val guid: Long, val editorId: Long, val version: Int,
val id: String, val allowDebugging: Boolean, val packageName: String? = null,
val projectName: String? = null, val pid: Int? = null, val isEditor: Boolean = false) {
val projectName: String? = null, val pid: Int? = null, val roleName: String? = null,
val isEditor: Boolean = false) {
companion object {
fun createEditorPlayer(host: String, port: Int, id: String, pid: Int, projectName: String?): UnityPlayer {
fun createEditorPlayer(host: String, port: Int, id: String, pid: Int, projectName: String?, roleName: String?): UnityPlayer {
return UnityPlayer(host, port, port, flags = 0, guid = port.toLong(), editorId = port.toLong(), version = 0,
id = id, allowDebugging = true, pid = pid, projectName = projectName, isEditor = true)
id = id, allowDebugging = true, pid = pid, projectName = projectName, isEditor = true, roleName = roleName)
}

fun createRemotePlayer(host: String, port: Int): UnityPlayer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,12 @@ class UnityPlayerListener(private val project: Project,

private fun addLocalProcesses() {
val unityProcesses = OSProcessUtil.getProcessList().filter { UnityRunUtil.isUnityEditorProcess(it) }
val projectNames = UnityRunUtil.getUnityProcessProjectNames(unityProcesses, project)
val unityProcessInfoMap = UnityRunUtil.getAllUnityProcessInfo(unityProcesses, project)
unityProcesses.map { processInfo ->
val projectName = projectNames[processInfo.pid]
val unityProcessInfo = unityProcessInfoMap[processInfo.pid]
val port = convertPidToDebuggerPort(processInfo.pid)
UnityPlayer.createEditorPlayer("127.0.0.1", port, processInfo.executableName, processInfo.pid, projectName)
UnityPlayer.createEditorPlayer("127.0.0.1", port, processInfo.executableName, processInfo.pid,
unityProcessInfo?.projectName, unityProcessInfo?.roleName)
}.forEach {
onPlayerAdded(it)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ class UnityProcessPickerDialog(private val project: Project) : DialogWrapper(pro
}
commentRow("Please ensure both the <i>Development Build</i> and <i>Script Debugging</i> options are checked in Unity's <i>Build Settings</i> dialog. " +
"Standalone players must be visible to the current network.")
}.apply { minimumSize = Dimension(650, 300) }
}.apply { preferredSize = Dimension(650, 450) }

isOKActionEnabled = false
cancelAction.putValue(FOCUSED_ACTION, true)
init()
setResizable(false)
setResizable(true)
}

// DialogWrapper only lets the Mac set the preferred component via FOCUSED_ACTION because reasons
Expand Down Expand Up @@ -159,6 +159,9 @@ class UnityProcessPickerDialog(private val project: Project) : DialogWrapper(pro
val debug = player.allowDebugging && !UnityRunUtil.isDebuggerAttached(player.host, player.port, project)
val attributes = if (debug) SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES else SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES
append(player.id, attributes)
if (player.roleName != null) {
append(" ${player.roleName}", attributes)
}
if (player.projectName != null) {
append(" - ${player.projectName}", attributes)
}
Expand Down
Loading

0 comments on commit 7731655

Please sign in to comment.