Skip to content

Commit

Permalink
Update readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
citizenmatt committed Mar 2, 2017
1 parent 8d129d7 commit 8628a8f
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 17 deletions.
Binary file added docs/create_serialized_field_from_usage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/incorrect_signature.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 50 additions & 17 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,99 @@
# Unity Support for ReSharper and Rider

This plugin adds [Unity](http://unity3d.com/) specific functionality to [ReSharper](https://www.jetbrains.com/resharper/) and [Rider](https://www.jetbrains.com/rider/).
The "Unity Support" plugin adds [Unity](http://unity3d.com/) specific functionality to [ReSharper](https://www.jetbrains.com/resharper/) and [Rider](https://www.jetbrains.com/rider/).

Rider is JetBrains' cross platform .NET IDE, which uses ReSharper out of process to provide language support - which is why it can run ReSharper plugins. See below for installation details.

Please see the [Unity3dRider](https://github.com/JetBrains/Unity3dRider#readme) plugin to add support to the Unity editor to open C# projects, files and error messages in Rider.
Rider is JetBrains' cross platform .NET IDE, based on ReSharper and the IntelliJ Platform. It can be used on Windows, Mac and Linux and together with the [Unity3dRider](https://github.com/JetBrains/Unity3dRider#readme) Unity plugin, can replace the default MonoDevelop editor with an IDE providing rich code navigation, inspections and refactorings.

## Features

The plugin adds knowledge of Unity based classes to ReSharper/Rider's analysis:

* The plugin knows about all Unity based classes (`MonoBehaviour`, `ScriptableObject`, `EditorWindow`, etc.) and their event functions via analysis of the Unity API surface and documentation.
* Support for Unity API versions 5.0 - 5.6.

Event functions:

* [Event functions](https://docs.unity3d.com/Manual/EventFunctions.html) and fields implicitly used by Unity are marked with an icon in the gutter.
* When [Solution Wide Analysis](https://www.jetbrains.com/help/resharper/2016.2/Code_Analysis__Solution-Wide_Analysis.html) is enabled, implicitly used fields and event functions are marked as in use. Fields are highlighted if they aren't accessed in your code.

<img src="docs/field_not_accessed.png" width="442">

* The plugin knows about all Unity based classes (`MonoBehaviour`, `ScriptableObject`, `EditorWindow`, etc.) and their event functions via analysis of the Unity API surface and documentation.
* Support for Unity API versions 5.2 - 5.5.
* <kbd>Alt</kbd>+<kbd>Insert</kbd> on Unity based classes to generate event functions methods via GUI.
* A new "Generate Unity event function" menu item is added to the <kbd>Alt</kbd>+<kbd>Insert</kbd> Generate Code menu, to generate event functions via GUI. This action is also available from <kbd>Alt</kbd>+<kbd>Enter</kbd> on a Unity based class's name.

<img src="docs/generate_menu.png" width="156">

<img src="docs/generate_dialog.png" width="442">

* Generate also available from <kbd>Alt</kbd>+<kbd>Enter</kbd> context menu on Unity based classes.
* Auto complete will suggest event function names when declaring methods in Unity based classes, and expand to include method signature. Simply start typing an event function within a class deriving from a known Unity class, such as `MonoBehaviour`.

<img src="docs/auto_complete_message.png" width="392">

* Incorrect method signatures and return types are shown as warnings, with a Quick Fix to create the correct signature.
* Optional parameters are called out in a tooltip, and marked as unused if not used in the body of the method, e.g. `OnCollisionEnter(Collision collision)`.
* Suppress naming consistency warnings for known Unity event functions. E.g. ReSharper no longer suggests that `AnimatorIK` be renamed to `AnimatorIk`.
* Descriptions for event functions and parameters in Unity based classes are shown in tooltips and [QuickDoc](https://www.jetbrains.com/help/resharper/2016.2/Coding_Assistance__Quick_Documentation.html). To show the information in tooltips, ReSharper's "Colour identifiers" and "Replace Visual Studio tooltips" setting must be enabled (search for them in settings). Alternatively, use the excellent [Enhanced Tooltip](https://github.com/MrJul/ReSharper.EnhancedTooltip#readme) plugin.

<img src="docs/quickdoc.png" width="500">

* "Read more" in [QuickDoc](https://www.jetbrains.com/help/resharper/2016.2/Coding_Assistance__Quick_Documentation.html) will navigate to the Unity API documentation, locally if available, or via the Unity website.

Coroutines and invokable methods:

* Event functions that can be coroutines are called out in tooltips.
* Context Action on methods that can be coroutines to convert method signature to/from coroutine.
* Warnings for unused coroutine return values.
* Code completion, find usages and rename support for string literals in `MonoBehaviour.Invoke`, `IsInvoking`, `InvokeRepeating` and `CancelInvoke`. Also supports `StartCoroutine` and `StopCoroutine`.

<img src="docs/invoke_completion.png" width="209">

* Inspection and Quick Fix to use `CompareTag` instead of string comparisons.
Inspections and Quick Fixes:

* Inspection and Quick Fix to use `CompareTag` instead of string comparison.

<img src="docs/compare_tag.gif" width="509">

* Suppress naming consistency warnings for known Unity event functions. E.g. ReSharper no longer suggests that `AnimatorIK` be renamed to `AnimatorIk`.
* Disables the `Assets` and `Assets\Scripts` folders from being considered as ["namespace providers"](https://www.jetbrains.com/help/resharper/2016.2/CheckNamespace.html). This means ReSharper will no longer suggest to include `Assets` or `Scripts` in the namespace of your code.
* "Create serialized field" from usage of unresolved symbol.

<img src="docs/create_serialized_field_from_usage.png" width="358">

* Inspections and Quick Fixes for incorrect event function signatures and return types.

<img src="docs/incorrect_signature.png" width="627">

* Inspection for unused coroutine return value.

[External Annotations](https://www.jetbrains.com/help/resharper/2016.2/Code_Analysis__External_Annotations.html):

* Treat code marked with attributes from UnityEngine.dll and UnityEditor.dll as implicitly used.
* Mark `Component.gameObject` and `Object.name` as not-nullable.
* `Debug.Assert` marked as assertion method to help null-value analysis (e.g. "value cannot be null" after `Debug.Assert(x != null)`)
* `Debug.AssertFormat`, `LogFormat`, etc. gets string formatting helper functionality.
* `EditorTestsWithLogParser.ExpectLogLineRegex` gets regular expression helper functionality.

Other:

* Synchronise .meta files on creation, deletion, rename and refactoring.
* Automatically sets correct C# language version, if not already specified in .csproj - ReSharper will no longer suggest code fixes that won't compile! Supports the default C# 4 compiler, Unity 5.5's optional C# 6 compiler and the C# 6/7.0 compiler in the [CSharp60Support](https://bitbucket.org/alexzzzz/unity-c-5.0-and-6.0-integration/src) plugin.
* Disables the `Assets` and `Assets\Scripts` folders from being considered as ["namespace providers"](https://www.jetbrains.com/help/resharper/2016.2/CheckNamespace.html). This means ReSharper will no longer suggest to include `Assets` or `Scripts` in the namespace of your code.
* Support for `UnityEngine.Color` and `UnityEngine.Color32`. The colour is highlighted, and hitting <kbd>Alt</kbd>+<kbd>Enter</kbd> will open the colour palette editor to modify the colour. Also supports named colours and `Color.HSVToRGB`.

<img src="docs/colours.png" width="425">

* [External annotations](https://www.jetbrains.com/help/resharper/2016.2/Code_Analysis__External_Annotations.html) to mark items as implicitly used, assertion methods and also provide string formatting assistance for logging methods.

Please feel free to [suggest new features in the issues](https://github.com/JetBrains/resharper-unity/issues)!
Please [suggest new features in the issues](https://github.com/JetBrains/resharper-unity/issues)!

## Installing

To install into ReSharper:

* Use ReSharper's Extension Manager (ReSharper &rarr; Extension Manager), search for "Unity" and install. Restart, and it'll just start working.

To install into Rider:

* Install from the "featured plugins" page of the welcome screen.
* Or, go to the Plugins settings page and install from there.
* Or, go to the Plugins page in Preferences, click Install JetBrains Plugin and search for "Unity". Rider will need to be restarted.

Please watch the repo or follow [@citizenmatt](https://twitter.com/citizenmatt) and [@slavikt](https://twitter.com/slavikt) on twitter for updates.
Please watch the repo for updates, or follow [@citizenmatt](https://twitter.com/citizenmatt), [@resharper](https://twitter.com/resharper) or [@JetBrainsRider](https://twitter.com/JetBrainsRider) on twitter for updates.

## Roadmap

There is no roadmap as such. I am not a Unity developer, so do not know what the common pain points are. If you'd like to suggest a feature, please [raise an issue](https://github.com/JetBrains/resharper-unity/issues).
Check the [milestones](https://github.com/JetBrains/resharper-unity/milestones) for plans, and please [raise an issue](https://github.com/JetBrains/resharper-unity/issues) with feature requests or bugs.

0 comments on commit 8628a8f

Please # to comment.