Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude conflicting type names from import completion #1473

Merged
merged 5 commits into from
Dec 24, 2019

Conversation

citizenmatt
Copy link
Member

Adds Boo.Lang.* and UnityScript.* as namespaces to be excluded from auto-import. Also adds System.Diagnostics.Debug as a method to be ignored. This means that these namespaces and types are not shown in import completion popup lists, the auto-import tooltip popup, and any other quick fix. The only way to use these types is to manually add the using statement.

This addresses the issue that trying to complete List<T> can match Boo.Lang.List<T>.

This PR also adds an internal action to Rider that will dump all duplicate type names in a given project. Useful to show candidates that could use further rules.

Fixes #574

@citizenmatt citizenmatt changed the title Exclude awkward types from import completion Exclude conflicting type names from import completion Dec 22, 2019
@citizenmatt citizenmatt self-assigned this Dec 22, 2019
@citizenmatt citizenmatt added this to the Rider 2020.1 milestone Dec 22, 2019
@SugoiDev
Copy link

Ignoring System.Diagnostics.Debug will help a lot, since it is often the first choice when you use a Debug.Log* method and is always the wrong one.

I would really like to see this generalized to allow the user to add a new import completion ignore list.
There are quite a few DLLs in third party packages that, despite having public methods, should never be used. In particular obfuscated ones that only add noise.

@citizenmatt
Copy link
Member Author

This is already a generalised mechanism. This PR will add default entries into the Preferences | Editor | General | Auto Import settings page. You're free to add your own.

@citizenmatt
Copy link
Member Author

Other candidates for exclusion:

  • System.Numerics.Vector2, Vector3, Vector4, Quaternion and Plane conflict with the same types in UnityEngine. I think this is probably worth adding. In the context of Unity, you'll want to use the Unity types, as that's what the Unity APIs will expect.
  • System.Random and UnityEngine.Random. There is an argument for using System.Random - it's an object, so you can create a separate random source for different consumers, you can create an instance with a given feed so you can make it a little more reproducible, etc. But you can also argue those are advanced use cases, so it's ok to make you add the using manually.

Comments?

@citizenmatt citizenmatt marked this pull request as ready for review December 23, 2019 12:05
@citizenmatt citizenmatt merged commit 1c24783 into net201 Dec 24, 2019
@citizenmatt citizenmatt deleted the feature/exclude-boo branch December 24, 2019 10:14
@citizenmatt
Copy link
Member Author

Merged as-is. We'll review System.Numerics and Random during the EAP.

@citizenmatt
Copy link
Member Author

See also RIDER-33445

@keith-miller
Copy link

Thank you so much for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sort System.Collections.Generic above Boo.Lang
4 participants