-
Notifications
You must be signed in to change notification settings - Fork 131
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
Wrong define symbols in packages #710
Comments
related to #629 |
This files are Misc file, we shouldn't analyse them. @kashmervil Lets take a look? |
I usually create separated DotSettings files to exclude each group of third party assets from analysis easily. When I need to read the code or fix something, I disable the respective DotSettings layer to have full analysis on the group. This has been very useful for me when dealing with external code. With Unity packages, we usually[1] won't edit them, as they are meant to be read-only. But, having the possibility to enable analysis on them is still very useful when reading/navigating the code. [1] I do edit some on occasion. Usually to workaround a bug that is yet to be fixed upstream. |
Actually, I think this happens for any code that is under an assembly definition file (.asmdef), not just for external code. If I use |
@tbg10101 This doesn't reproduce for me. Can I take a look at csproj and asmdef? |
Apologies, it looks like this was just because the project was not using the correct profile. |
Good day! Are there any known workarounds to this issue? |
The problem here is that these files are not part of a project, so there is no project context for Rider to work with. It knows some things - e.g. it gets navigation information from PDBs and so on. But when parsing and highlighting, without a project context, it sits in what we call the "Misc Files" project, in which there are no define symbols set. And that means something like However, this is mainly a presentation issue. Since these files aren't part of a project, Rider isn't actually analysing them, it's just showing them, and trying its best to highlight. There's not a huge amount we can do about this, but it's something we can look at in a future version. One workaround is to use the checkboxes on Unity's External Tools settings page to generate projects for different package kinds. This isn't encouraged, however, as this causes Rider to treat your packages as user code, and they're not. The code lives in |
I've begun to run into that "no analysis" issue while working on Unity packages. For example: https://github.com/tbg10101/DOTS-Hybrid-Simulation-Worlds I can check that repo out and open the example project with Unity. Then, when I open the solution in Rider, only the package scripts are analyzed but none of the scripts from the example project are. This seems bizarre and the opposite of what @citizenmatt described but has the same effect. |
This is a bit of a special case due to the layout of that project. The sample project is in a folder called So Rider (mostly) ignores the files under the But things are complicated further by the fact that while the IntelliJ Platform side of things ignores this file, the underlying ReSharper engine (that's doing the C# analysis) doesn't follow the same rule. So we've got the analysis actually happening, just not being shown in the UI. We should be handling this a bit more coherently. I've raised an issue for this: RIDER-48339. And since this is a fairly common Unity pattern, it would probably be a good idea if we notify the user when we get into this scenario: #1784 The issue of non-project/read-only packages not using the correct defined symbols is a separate issue, and there is actually stuff we can do here. I'm planning on getting it working for Rider 2020.3 |
Hi any info on this? The explanation of packages being read only so it doesn't matter that much is not actually true. You can embed packages which we do, to edit them and they still reside outside of the project folder so the mentioned issue is there. The ability to embed packages for editing is used heavily in our pipeline to update custom packages and then publish them to repository. Instead of having separate project with packages folder directly inside it. As packages behave differently so developing pacakges and their testing and workflow is way better with embedded packages use. |
Can you explain how you're embedding your packages, please? If you make them part of your project (e.g. copied into |
Rider will fail to see project defines when opening a cs file that is in a package.
Unity compiles packages in the same "context" as the normal assemblies. The define symbols are the same as those from the normal assemblies.
For example, opening
PackageManagerWindow.cs
from the Package Manager UI package shows this:Notice how the
#if UNITY_2018_1_OR_NEWER
branch is disabled. But, it should not be, since the symbolUNITY_2018_1_OR_NEWER
is defined.This report applies to the latest nightly Rider with Unity 2018.2
The text was updated successfully, but these errors were encountered: