Coder Social home page Coder Social logo

cmarfil / resharper-unity Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jetbrains/resharper-unity

0.0 1.0 0.0 1.95 MB

ReSharper support for Unity

License: Apache License 2.0

C# 93.38% PowerShell 1.25% Shell 0.08% Java 0.98% Kotlin 4.31%

resharper-unity's Introduction

Unity Support for ReSharper and Rider

The "Unity Support" plugin adds Unity specific functionality to ReSharper and 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 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, as well as 2017.1.

Event functions:

  • Event functions and fields implicitly used by Unity are marked with an icon in the gutter.

  • Empty event functions are marked as dead code, with a Quick Fix to remove the method.

  • When Solution Wide Analysis is enabled, implicitly used fields and event functions are marked as in use. Fields are highlighted if they aren't accessed in your code.

  • A new "Generate Unity event function" menu item is added to the Alt+Insert Generate Code menu, to generate event functions via GUI. This action is also available from Alt+Enter on a Unity based class's name.

  • 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.

  • 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. 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 plugin.

  • "Read more" in QuickDoc 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.

Networking:

  • Code completion, find usages and rename support for string literals in [SyncVar(hook = "OnValueChanged")].
  • Highlight usage of SyncVarAttribute in any class other than NetworkBehaviour as an error.

Inspections and Quick Fixes:

  • Empty event functions are shown as dead code, with a quick fix to remove the method.

  • Using the SyncVarAttribute inside any class other than NetworkBehaviour is treated as an error.

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

  • "Create serialized field" from usage of unresolved symbol.

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

  • Inspections and Quick Fixes for incorrect method or static constructor signatures for InitializeOnLoad attributes.

  • Inspections for incorrectly calling new on a MonoBehaviour or ScriptableObject. Quick Fixes will convert to calls to GameObject.AddComponent<T>() and ScriptableObject.CreateInstance<T>().

  • Inspection for unused coroutine return value.

External Annotations:

  • Treat code marked with attributes from UnityEngine.dll, UnityEngine.Networking.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.
  • Assertions.Assert methods marked as assertion methods to help null-value analysis.
  • EditorTestsWithLogParser.ExpectLogLineRegex gets regular expression helper functionality.
  • Various attributes now require the class they are applied to derive from a specific base type. E.g. [CustomEditor] requires a base class of Editor).

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 plugin.

  • Disables the Assets and Assets\Scripts folders from being considered as "namespace providers". 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 Alt+Enter will open the colour palette editor to modify the colour. Also supports named colours and Color.HSVToRGB.

Rider specific functionality

The plugin also adds some functionality just for Rider:

  • The Library and Temp folders are automatically excluded from Rider's full text search, used for the "Find in Path" feature. These folders can become very large, and can take a long time to index if not excluded.

  • Rider will automatically create an "Attach to Unity Editor" run configuration. When the debug button is clicked, Rider will automatically attach to the editor and start debugging. Rider will look for a Library/EditorInstance.json file, created by Unity 2017.1, or by the latest versions of the Unity3dRider plugin. If the file doesn't exist and only a single instance of Unity is running, Rider will attach to this instance. If multiple instances are running, Rider will prompt for which instance to attach to.

Please suggest new features in the issues!

Installing

To install into ReSharper:

  • Use ReSharper's Extension Manager (ReSharper โ†’ 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 page in Preferences, click Install JetBrains Plugin and search for "Unity". Rider will need to be restarted.

Please watch the repo for updates, or follow @citizenmatt, @resharper or @JetBrainsRider on twitter for updates.

Roadmap

Check the milestones for plans, and please raise an issue with feature requests or bugs.

resharper-unity's People

Contributors

bigbadtrumpet avatar chippit avatar citizenmatt avatar cmcpasserby avatar derigel23 avatar derkork avatar garfeild avatar ivanpashchenko avatar jorgeamado avatar liortal53 avatar manuelrauber avatar mrjul avatar shalupov avatar sirrah avatar swalex avatar tallior avatar tutushkin avatar van800 avatar z3ntu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.