Skip to content

Commit

Permalink
Release 2023.3
Browse files Browse the repository at this point in the history
2023.3
  • Loading branch information
Garethp authored Sep 17, 2023
2 parents a120d6a + 00714b9 commit 934c428
Show file tree
Hide file tree
Showing 28 changed files with 1,352 additions and 153 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 2023.3
* Rimworld XML will now exist as it's own project
* Added some new problem analyzers to catch simple typing errors in Rimworld XML
* Enabled spell checking for XML
* Add a new Settings Page to allow a user to manually configure their Rimworld location
* Enables automatic smart completion for XML in Visual Studio, although it's broken entirely in ReSharper 2023.2

## 2023.2.1
* Fixed an issue for non-Rimworld projects that caused a hang on solution wide analysis

Expand Down
58 changes: 2 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,62 +19,8 @@ into the definitions on which the XML sits.
* Autocomplete certain values for properties with fixed options (Such as Altitude Layer, boolean and directions)
* A Rimworld Run Configuration with a Debug option
* Rimworld Mod support in New Solution

### Configuring your project
To give Rider all the information it needs to not only auto-complete and reference C# but also XML Defs, it's suggested
that you add the XML Defs of your project and Vanilla Rimworld to your C# Project. Adding both the necessary folders into
the project itself allows Rider to scan them for all the existing Defs and provide information about them as you try to
refer to them. Please note that sometimes the linked folders may not show everything as they do not update consistently.
If you see a missing file, right click on your project and select `Reload Project` to force the links to update.

#### Attaching Defs Via the UI
Simply right click on your C# project in Rider and choose `Add -> Add Existing Item...`.
Then select the Rimworld `Data` folder as well as your own mod's `Defs` folder and any others you'd like.
You'll be asked if you want to `Copy`, `Move` or `Add Links`. Select `Add Links` to add the folder as a link.

Note that this adds a lot to your `.csproj` file as there is one entry per file.
For a cleaner option see the below section on [Attaching Defs Manually](#attaching-defs-manually)

#### Attaching Defs Manually
Rather than adding each def file to the `.csproj` file it is possible to just attach the top level folders.
From Rider you can right click on the project then go to `Edit` and choose the option to edit the `.csproj` file.
Or simply use any normal test editor and add a new ItemGroup into your project which links to the top level folders to search.
Something like this:

```xml
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
...
<ItemGroup>
<Content Include="..\..\..\..\..\Data\">
<Link>Data</Link>
</Content>
<Content Include="..\..\Defs\">
<Link>Defs</Link>
</Content>
</ItemGroup>
...
</Project>
```

It is possible to group up all your imported defs into a folder for tidiness and use globs to select a lot at once e.g.
```xml
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
...
<ItemGroup>
<Content Include="..\..\..\..\..\Data\*\Defs\**\*">
<Link>AttachedDefs\Rimworld\%(RecursiveDir)/%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
<Content Include="..\..\Defs\**\*">
<Link>AttachedDefs\Project\%(RecursiveDir)/%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
</ItemGroup>
...
</Project>
```
* Custom Rimworld XML Projects
* Basic validation for some XML Values

## Roadmap

Expand Down
20 changes: 9 additions & 11 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@
* Handle Defs with custom classes instead of Rimworld classes
* We need to be able to support "LoadAlias", such as "StorageSettings.priority"

* Error Detection of special types
* Enum
* Rot4
* Boolean
* IntRange
* int
* Vector2
* Vector3

* \<li> handling
* Can we look for, and try to handle, instances where it doesn't have a Type against it's List?

Expand All @@ -26,7 +17,14 @@
`
* Documentation
* Re-read and document References.RimworldXmlReference
* If you have an XML file open while Rider is still initializing, that file doesn't get autocompletion. Document that

* Tests
* It's not a serious project without Tests IMO. Let's at least aim to get one or two unit tests to start with
* It's not a serious project without Tests IMO. Let's at least aim to get one or two unit tests to start with

* Project Structure
* When the issue with the project location is fixed, move to 2023.3 to take advantage of that so that we don't need to build the structure ourselves

* Investigate the possibility of tying a version number to our types in the SymbolScope so that we can don't cross reference between versions
* Right now we only try to load the latest version of the XML, since we aren't built for loading multiple copies of the same def

* Refactor all reading of `About.xml` into a single class that holds that information for that file
2 changes: 1 addition & 1 deletion buildPlugin.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Param(
$Version = "2023.1.1"
$Version = "2023.3"
)

Set-StrictMode -Version Latest
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
DotnetPluginId=ReSharperPlugin.RimworldDev
DotnetSolution=ReSharperPlugin.RimworldDev.sln
RiderPluginId=com.jetbrains.rider.plugins.rimworlddev
PluginVersion=2023.2.1
PluginVersion=2023.3

BuildConfiguration=Release

Expand Down
2 changes: 1 addition & 1 deletion src/dotnet/Plugin.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>

<PropertyGroup>
<SdkVersion>2023.1.0</SdkVersion>
<SdkVersion>2023.1.2</SdkVersion>

<Title>Rimworld Development Environment</Title>
<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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JetBrains.ReSharper.SDK.Tests" Version="2023.1.0">
<PackageReference Include="JetBrains.ReSharper.SDK" Version="$(SdkVersion)" PrivateAssets="all">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
namespace ReSharperPlugin.RimworldDev.ProblemAnalyzers;

using System.Collections.Generic;
using JetBrains.Application.Settings;
using JetBrains.ReSharper.Daemon.UsageChecking;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.Files;
using JetBrains.ReSharper.Psi.Xml;
using JetBrains.ReSharper.Psi.Xml.Tree;
using JetBrains.Util;
using JetBrains.Util.DataStructures.Collections;

[DaemonStage(
StagesBefore = new[] { typeof(CollectUsagesStage) },
StagesAfter = new[] { typeof(LanguageSpecificDaemonStage) })]
public class CustomXmlAnalysisStage : IDaemonStage
{
private static IXmlFile GetPrimaryXmlFile(IPsiSourceFile sourceFile)
{
if (sourceFile == null || !sourceFile.PrimaryPsiLanguage.Is<XmlLanguage>())
return null;

var xmlFile = sourceFile.GetPrimaryPsiFile() as IXmlFile;
return xmlFile;
}

public IEnumerable<IDaemonStageProcess> CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings,
DaemonProcessKind processKind)
{
var primaryXmlFile = GetPrimaryXmlFile(process.SourceFile);
if (primaryXmlFile != null)
{
return FixedList.Of(new CustomXmlAnalysisStageProcess(primaryXmlFile, process, settings));
}

return EmptyList<IDaemonStageProcess>.InstanceList;
}
}
Loading

0 comments on commit 934c428

Please sign in to comment.