Skip to content

Handle namespace suggestions for external packages #1689

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

Merged
merged 3 commits into from
Jun 9, 2020

Conversation

citizenmatt
Copy link
Member

This PR expands on #1677 to support correct namespace suggestions for packages that are outside of the normal Unity project structure and included via file: references in Packages/manifest.json. It handles projects that live under the normal Unity project folder location (but not under Assets or Packages) and also projects outside of the solution structure completely.

To recap, the idea is this:

  • A package owner has no control over the location of a package, or the name of its root folder, so these things should not affect the namespace of the code. (E.g. a package can live in Packages, Library/PackageCache or anywhere else on disk, and when under Library/PackageCache, the name can contain ID and version, but won't have this name when cloned from GitHub)
  • An assembly definition file is in a specific location with a package or Assets, and those folder names should affect the namespace. Moving a package will not affect this.
  • Certain folder names should be ignored - Scripts, Runtime, Scripts/Runtime and Runtime/Scripts.

Works for packages that live at the root of a Unity solution, but doesn't work for packages external to the solution. External files are added to a project with a full path, and Rider will find the common ancestor folder and create a linked folder. This isn't included in namespace suggestions, and means we don't get a full folder structure for correct suggestions.

The solution would be to add Link attributes to describe the correct location relative to the containing package root.
@citizenmatt citizenmatt added this to the Rider 2020.2 milestone Jun 9, 2020
@citizenmatt citizenmatt self-assigned this Jun 9, 2020
@citizenmatt citizenmatt merged commit 6b1ff0d into net202 Jun 9, 2020
@citizenmatt citizenmatt deleted the feature/external-package-namespace branch June 9, 2020 23:30
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.

1 participant