Skip to content
New issue

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

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

Already on GitHub? # to your account

Find usages and completion for ShaderLab properties #362

Merged
merged 13 commits into from
Feb 16, 2018

Conversation

citizenmatt
Copy link
Member

@citizenmatt citizenmatt commented Feb 15, 2018

Added a resolve step for ShaderLab, enabling find usages and highlighting usages of ShaderLab properties.

Note that this only works for usages of properties in ShaderLab blocks, and not for usages of the same property as a parameters to Cg/HLSL programs.

  • Declared elements for ShaderLab property declarations
  • First class references for variable usage in ShaderLab commands (e.g. Blend [_Src] [_Dst])
  • Report unresolved property errors
  • Report multiple candidates as an error
  • Find usages of properties within ShaderLab commands (NOT Cg/HLSL)
  • Context highlighting of properties
  • Code completion for known properties
  • TESTS!

@citizenmatt citizenmatt added this to the Rider 2018.1 milestone Feb 15, 2018
@citizenmatt citizenmatt self-assigned this Feb 15, 2018
{
public class ShaderLabDeclaredElementType : DeclaredElementType
{
// TODO: Proper icon
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want some unity-specific icon here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. I'll add a request

}

if (style.ShowConstantValue)
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this empty code block intentional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really. I meant to implement it, and forgot :) No-one's using it yet, though. I'll fix it.


namespace JetBrains.ReSharper.Plugins.Unity.ShaderLab.Psi.Resolve
{
// TODO: Terrible name...
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can use a sample of the entity it is describing in the comment then :)
Also, WDYT something like IReferenceToVariableReference (doesn't sound good to me too though)?

@citizenmatt citizenmatt changed the title WIP: Find usages for ShaderLab properties WIP: Find usages and completion for ShaderLab properties Feb 16, 2018
@citizenmatt citizenmatt merged commit 50ec92b into master Feb 16, 2018
@citizenmatt citizenmatt deleted the feature/shaderlab-resolve branch February 16, 2018 15:58
@citizenmatt citizenmatt changed the title WIP: Find usages and completion for ShaderLab properties Find usages and completion for ShaderLab properties Feb 19, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants