Skip to content

Commit e5c55da

Browse files
authored
#78 - Fix XML manging in Rider (#84)
* #78 - Fix XML manging in Rider
1 parent 5d0d6cf commit e5c55da

11 files changed

Lines changed: 76 additions & 37 deletions

File tree

.github/workflows/CI.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
Build:
1111
runs-on: ubuntu-latest
1212
steps:
13+
- uses: jlumbroso/free-disk-space@main
1314
- uses: actions/checkout@v4
1415
with:
1516
submodules: recursive
@@ -19,6 +20,10 @@ jobs:
1920
distribution: 'corretto'
2021
java-version: '21'
2122
cache: 'gradle'
23+
- name: Setup .NET
24+
uses: actions/setup-dotnet@v4
25+
with:
26+
dotnet-version: 8.0.x
2227
- run: ./gradlew :buildPlugin --no-daemon
2328
- run: ./gradlew :buildResharperPlugin --no-daemon
2429
- uses: actions/upload-artifact@v4
@@ -29,13 +34,18 @@ jobs:
2934
Test:
3035
runs-on: ubuntu-latest
3136
steps:
37+
- uses: jlumbroso/free-disk-space@main
3238
- uses: actions/checkout@v4
3339
with:
3440
submodules: recursive
3541
- name: configure_java
3642
uses: actions/setup-java@v4
3743
with:
3844
distribution: 'corretto'
39-
java-version: '17'
45+
java-version: '21'
4046
cache: 'gradle'
47+
- name: Setup .NET
48+
uses: actions/setup-dotnet@v4
49+
with:
50+
dotnet-version: 8.0.x
4151
- run: ./gradlew :testDotNet --no-daemon

.github/workflows/Deploy.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ jobs:
1010
runs-on: ubuntu-latest
1111
environment: Deploy
1212
steps:
13+
- uses: jlumbroso/free-disk-space@main
1314
- uses: actions/checkout@v4
1415
with:
1516
submodules: recursive
1617
- name: configure_java
1718
uses: actions/setup-java@v4
1819
with:
1920
distribution: 'corretto'
20-
java-version: '17'
21+
java-version: '21'
2122
cache: 'gradle'
2223
- name: Setup .NET
2324
uses: actions/setup-dotnet@v4

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 2025.1.5
4+
* Fix the issue with XML tags getting messed up in Rider
5+
36
## 2025.1.4
47
* Fixed Autocomplete in XML
58

Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22

33
<PropertyGroup>
4-
<SdkVersion>2025.1.0</SdkVersion>
4+
<SdkVersion>2025.3.*</SdkVersion>
55

66
<Title>Rimworld Development Environment</Title>
77
<Description>Bring the intelligence of your IDE to Rimworld XML files. Use information backed by Rimworlds DLL file to autocomplete your XML, Ctrl+Click into the C# that your XML gets translated into and see what options you have when adding items in your mods!</Description>
@@ -36,7 +36,7 @@
3636
</PropertyGroup>
3737

3838
<ItemGroup>
39-
<PackageReference Include="JetBrains.Annotations" Version="2024.3.0" />
39+
<PackageReference Include="JetBrains.Annotations" Version="2025.2.4" />
4040
<PackageReference Include="JetBrains.Lifetimes" Version="$(SdkVersion)" />
4141
<PackageReference Include="JetBrains.RdFramework" Version="$(SdkVersion)" />
4242
<PackageReference Include="System.Diagnostics.TraceSource" Version="4.3.0" />

build.gradle.kts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,7 @@ dependencies {
167167
jetbrainsRuntime()
168168

169169
bundledPlugin("com.intellij.resharper.unity")
170-
171-
if (ProductVersion.contains("2025.2")) {
172-
bundledModule("intellij.spellchecker")
173-
}
170+
bundledModule("intellij.spellchecker")
174171
}
175172
}
176173

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
DotnetPluginId=ReSharperPlugin.RimworldDev
55
DotnetSolution=ReSharperPlugin.RimworldDev.sln
66
RiderPluginId=com.jetbrains.rider.plugins.rimworlddev
7-
PluginVersion=2025.1.4
7+
PluginVersion=2025.1.5
88

99
BuildConfiguration=Release
1010

@@ -14,14 +14,14 @@ PublishToken="_PLACEHOLDER_"
1414
# Release: 2020.2
1515
# Nightly: 2020.3-SNAPSHOT
1616
# EAP: 2020.3-EAP2-SNAPSHOT
17-
ProductVersion=2025.1
17+
ProductVersion=2025.3
1818

1919
# Kotlin 1.4 will bundle the stdlib dependency by default, causing problems with the version bundled with the IDE
2020
# https://blog.jetbrains.com/kotlin/2020/07/kotlin-1-4-rc-released/#stdlib-default
2121
kotlin.stdlib.default.dependency=false
2222
org.gradle.jvmargs=-Xmx4g
2323

24-
rdVersion=2025.1
24+
rdVersion=2025.3
2525
rdKotlinVersion=2.1.0
2626
intellijPlatformGradlePluginVersion=2.2.1
2727
gradleJvmWrapperVersion=0.14.0

src/dotnet/ReSharperPlugin.RimworldDev/TemplateParameters/RimworldDLLParameter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public override RdProjectTemplateOption CreateContent(ITemplateInfo templateInfo
1818
{
1919
var detectedPath = ScopeHelper.FindRimworldDll(Directory.GetCurrentDirectory())?.FullPath;
2020

21-
return new RdProjectTemplateTextOption(detectedPath ?? "", "string", Name, PresentableName, Tooltip);
21+
return new RdProjectTemplateTextOption(detectedPath ?? "", "string", Name, PresentableName, Tooltip, "");
2222
}
2323
}
2424

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package RimworldDev.Rider
2+
3+
import com.jetbrains.rider.editorActions.RiderEditorActionPolicy
4+
import com.jetbrains.rider.editorActions.RiderTypingPolicy
5+
6+
class XmlTypingPolicy : RiderTypingPolicy {
7+
override fun forceFrontendExecution(): Boolean {
8+
return true
9+
}
10+
}
11+
12+
class XmlEditorActionPolicy : RiderEditorActionPolicy {
13+
override fun forceFrontendExecution(): Boolean {
14+
return true
15+
}
16+
}

src/rider/main/kotlin/remodder/RemodderToolWindowFactory.kt

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import com.intellij.openapi.fileEditor.TextEditor
99
import com.intellij.openapi.project.Project
1010
import com.intellij.openapi.ui.DialogBuilder
1111
import com.intellij.openapi.ui.Messages
12+
import com.intellij.openapi.vfs.VirtualFile
1213
import com.intellij.openapi.wm.ToolWindow
1314
import com.intellij.openapi.wm.ToolWindowFactory
1415
import com.intellij.psi.PsiElement
@@ -52,36 +53,39 @@ class RemodderToolWindowFactory : ToolWindowFactory {
5253
refresh.addActionListener {
5354
val userAssemblies = project.getService<RemodderStateComponent>(RemodderStateComponent::class.java).state.userAssemblies
5455
val editor = (FileEditorManager.getInstance(project).selectedEditor as TextEditor).editor
55-
val view = PsiManager.getInstance(project).findViewProvider(editor.virtualFile)
56-
val el = view?.findElementAt(editor.caretModel.offset) ?: return@addActionListener
56+
var virtualFile: VirtualFile? = editor.virtualFile
57+
if (virtualFile != null) {
58+
val view = PsiManager.getInstance(project).findViewProvider(virtualFile)
59+
val el = view?.findElementAt(editor.caretModel.offset) ?: return@addActionListener
5760

58-
val filePath = editor.virtualFile.path
59-
val typeName = namespaceAndClassOfElement(el) ?: "<null>"
61+
val filePath = virtualFile.path
62+
val typeName = namespaceAndClassOfElement(el) ?: "<null>"
6063

61-
statusLabel.text = "$typeName..."
62-
errorDetails.isVisible = false
64+
statusLabel.text = "$typeName..."
65+
errorDetails.isVisible = false
6366

64-
project.solution.remodderProtocolModel.decompile.start(arrayOf(filePath, typeName) + userAssemblies).toPromise().then {
65-
if (it.size == 1)
66-
{
67-
statusLabel.text = "$typeName: ${it[0]}"
68-
errorDetails.isVisible = false
69-
return@then
70-
}
67+
project.solution.remodderProtocolModel.decompile.start(arrayOf(filePath, typeName) + userAssemblies)
68+
.toPromise().then {
69+
if (it.size == 1) {
70+
statusLabel.text = "$typeName: ${it[0]}"
71+
errorDetails.isVisible = false
72+
return@then
73+
}
7174

72-
val content1 = DiffContentFactory.getInstance().create(project, it[0], editor.virtualFile)
73-
val content2 = DiffContentFactory.getInstance().create(project, it[1], editor.virtualFile)
74-
content2.putUserData(DiffUserDataKeys.FORCE_READ_ONLY, true)
75+
val content1 = DiffContentFactory.getInstance().create(project, it[0], virtualFile)
76+
val content2 = DiffContentFactory.getInstance().create(project, it[1], virtualFile)
77+
content2.putUserData(DiffUserDataKeys.FORCE_READ_ONLY, true)
7578

76-
val request = SimpleDiffRequest("Original/Transpiled", content1, content2, "Original", "Transpiled")
77-
diffPanel.setRequest(request)
79+
val request = SimpleDiffRequest("Original/Transpiled", content1, content2, "Original", "Transpiled")
80+
diffPanel.setRequest(request)
7881

79-
statusLabel.text = typeName
80-
errorDetails.isVisible = false
81-
}.onError {
82-
errorMsg = it.toString()
83-
statusLabel.text = "$typeName: ERROR"
84-
errorDetails.isVisible = true
82+
statusLabel.text = typeName
83+
errorDetails.isVisible = false
84+
}.onError {
85+
errorMsg = it.toString()
86+
statusLabel.text = "$typeName: ERROR"
87+
errorDetails.isVisible = true
88+
}
8589
}
8690
}
8791

src/rider/main/kotlin/run/RunConfiguration.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ class RunConfiguration(project: Project, factory: ConfigurationFactory, name: St
132132
pathToRun = "/bin/sh"
133133
}
134134

135+
if (OS.CURRENT == OS.macOS) {
136+
arguments = "$pathToRun $arguments"
137+
pathToRun = "open"
138+
}
139+
135140
val commandLine = GeneralCommandLine(pathToRun)
136141
.withParameters(arguments.split(' ').filter { it.isNotEmpty() })
137142

0 commit comments

Comments
 (0)