Search Unity

ShaderlabVSCode - Visual Studio Code extensions for Unity Shaderlab programming

Discussion in 'Assets and Asset Store' started by Amlovey, Jul 7, 2017.

  1. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    facebook.png
    Purchase From Asset Store | Purchase From MianBaoDuo (China Only) | Free Version | Documents | Email

    ShaderlabVSCode is a Visual Studio Code extension for Unity Shaderlab programming.

    A preview video see below.



    Asset Store
    https://assetstore.unity.com/packages/tools/utilities/shaderlabvscode-94653

    Or purchase from MianBaoDuo (China Only) with lower price.

    Key Feathers
    1. Syntax Highlighting
    2. Code Completion and Basic Intellisense
    3. Hover Information
    4. Signature Help
    5. Go To Definition
    6. Code Snippets
    7. Document Format
    8. SRP supports

    Image Previw
    a733s-tc3nv.jpg






    Any issues or questions, welcome to send email to amlovey@qq.com
     
    Last edited: Jan 13, 2021
  2. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Beta 1 is available on Unity Asset Store now
     
  3. Would this work with VS 2015 Community?
     
  4. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    @NoobStudios Not supports Visual Studio for now. I will publish Visual Stuido plugin in future depends on how this assets going on Unity Assets Store.
     
  5. Aww, that sucks. I really needed this to work on both Code and VS.
     
  6. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
  7. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Beta2 with snippets support is available on Asset Store now
     
  8. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    V1.0.3 is available on Asset Store now
     
  9. GreenMartian

    GreenMartian

    Joined:
    Aug 4, 2015
    Posts:
    2
    看起来不错,便宜点就好了,我等等看看有没有降价或打折活动
     
  10. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    V1.0.5 with Region mark support is available on Asset Store. BTW One Week Sales will end in few days.
     
  11. LastMonopoly

    LastMonopoly

    Joined:
    Jan 31, 2017
    Posts:
    4
    Bug report on document format :

    Before format:
    #pragma surface surf Lambert vertex:vert​
    After format:
    #pragma surface surf Lambert vertex: vert​

    Formatted version causes shader compile error, plz fix that asap.
     
  12. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Thank you for details. I will fix it ASAP.
     
  13. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    V1.0.6 with fix of Document Format is available on Asset Store now.
     
  14. SteeLMan

    SteeLMan

    Joined:
    Jul 2, 2015
    Posts:
    5
    Hello! I recently use your extension for visual studio code, I really like it. But I noticed one bug, with several document formatting, indentation after #if, #endif and so on.
    Also, the formatting inside the structures leads to alignment with the variables, I would like to see

    #if defined(_RENDERING_CUTOUT)
    clip(alpha - _AlphaCutoff);
    #endif

    but not

    #if defined (_RENDERING_CUTOUT)
    clip (alpha - _AlphaCutoff);
    #endif

    Thank you for the wonderful extension!

    PS. Sorry for my bad English.
     
  15. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Hi,

    Would you mind send a email to me? I have do some improvement today, I think I have fix it. I will send you the new package. Thank you!
     
  16. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    v1.1.0 with .hlsl and .cg file support is available on Asset Store now
     
  17. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    20% OFF SALE for Spring Festival of China
     
  18. lyons1005

    lyons1005

    Joined:
    Nov 3, 2010
    Posts:
    10
    Asset Store claims there was an update to 1.1.4 but I can't seem to import anything above 1.1.2?
     
  19. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    I'm not sure what happen to Asset Store. Did you try to delete the local copy of ShaderlabVSCode and download from Asset Store again?
     
  20. lyons1005

    lyons1005

    Joined:
    Nov 3, 2010
    Posts:
    10
    Deleting it from my project worked, thanks.
     
    Amlovey likes this.
  21. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    ShaderlabVSCode is on 40% OFF sales now.
     
  22. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Sales will be end in next few days.
     
  23. PuzzledBoy

    PuzzledBoy

    Joined:
    Sep 9, 2014
    Posts:
    23
    Greate help!
     
  24. Lex-DRL

    Lex-DRL

    Joined:
    Oct 10, 2011
    Posts:
    140
    @Amlovey ,
    Before I buy the asset, I've got a few questions about it:

    1. Does it inspect included files? I.e., will it suggest functions for autocompletion if I have those declared in an external ".cginc" / ".hlsl" file which is included:
    a) from the same folder, with
    Code (CSharp):
    1. #include "file.hlsl"
    b) from any other folder, with
    Code (CSharp):
    1. #include "Assets/path/to/file.hlsl"
    2. #include "Packages/path/to/shader/library.hlsl"
    2. Does this plugin support new SRP-style shaders (for URP/HDRP)?
    I.e., detecting included files from packages (as in example above), parsing HLSLPROGRAM block, support for texture samplers declaration, pass names/tags suggestion ("LightMode"="UniversalForward"), etc.

    3. Is it possible to customize code style? Specifically, tabs instead of spaces (for indents), brackets positioning (end of line / new line - for structs/funcs/pass blocks).
     
    Last edited: Feb 14, 2020
  25. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Hi

    Thank you for your post.

    For #1, it works for same folder and relative path base on the shader file folder.
    For #2, Not support for now. But I can add it for later release.
    For #3, Not full support now. No brackets positioning options..but have indents feature which base on VSCode Settings.
     
  26. Lex-DRL

    Lex-DRL

    Joined:
    Oct 10, 2011
    Posts:
    140
    @Amlovey
    Thanks for the reply.

    Unfortunately, 1.b (including files by the full path based on the project root, not relatively to the shader) and 2 (SRP support, at least for HLSL part) are two things that I absolutely need.

    The plugin itself looks great. Would love to see the updated version with these 2 features added.
     
  27. gam0022

    gam0022

    Joined:
    Dec 24, 2017
    Posts:
    2
    Thank you for the great extension!

    I would appreciate it if you could fix the code format issue.

    Before format:

    Code (CSharp):
    1.  
    2. float test()
    3. {
    4.     if (1 == 1)
    5.     {
    6.         float a = 1;
    7.     }
    8.  
    9.     if (2 == 2)
    10.     {
    11.         float b = 2;
    12.     }
    13.  
    14.     return 0;
    15. }
    16.  
    After format: The white space after the second if statement disappears.

    Code (CSharp):
    1.  
    2. float test()
    3. {
    4.     if (1 == 1)
    5.     {
    6.         float a = 1;
    7.     }
    8.  
    9.     if(2 == 2)
    10.     {
    11.         float b = 2;
    12.     }
    13.  
    14.     return 0;
    15. }
    16.  
     
  28. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    I will fix it in next release, Thank you for feedback.
     
  29. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    From Version 1.2.2, ShaderlabVSCode supports builtin CGInclude files in Unity Editor application and the version is already available on Asset Store now.
     
  30. gam0022

    gam0022

    Joined:
    Dec 24, 2017
    Posts:
    2
    > After format: The white space after the second if statement disappears.
    This issue was fixed in 1.2.2! Thank you for the fix!

    I found another new issue with the format.

    Before format:

    Code (CSharp):
    1. float test()
    2. {
    3.     for (int i = 0; i < 10; i++)
    4.     {
    5.         // do something
    6.     }
    7.  
    8.     return 0;
    9. }
    After format: A space is inserted before ++.

    Code (CSharp):
    1. float test()
    2. {
    3.     for (int i = 0; i < 10; i ++)
    4.     {
    5.         // do something
    6.     }
    7.  
    8.     return 0;
    9. }
     
    Amlovey likes this.
  31. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Thank you very much for feedback. I have already fix it in my side. Would you mind drop an email to amlovey@qq.com. I can send you the latest packages via email.
     
  32. m_hakozaki

    m_hakozaki

    Joined:
    May 15, 2014
    Posts:
    4
    Thanks for the great plugin.
    I don't want to put a line break before the curly brackets "{".
    I want to set whether or not to start a new line.
     
    Last edited: Dec 30, 2020
  33. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    I think I can add a setting item to config whether start a new line or not. I will add it in next release.
     
  34. m_hakozaki

    m_hakozaki

    Joined:
    May 15, 2014
    Posts:
    4
    Thank you!
     
  35. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Hi @hacozac , new version v1.2.3 is available on asset store. The new formatting setting item is added. Uncheck the setting item will not place open brace on new line
    settings.png
     
    m_hakozaki likes this.
  36. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Version 1.2.4 will be submitted to Asset Store in next few days. Two main improvements in new release

    1. `Go To Definition` works for methods/variables/structs



    2. Hover information support variable type information

    upload_2021-1-13_10-50-41.png
     
  37. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Version 1.2.4 is available on Asset Store already.
     
  38. fleity

    fleity

    Joined:
    Oct 13, 2015
    Posts:
    345
    Hi amlovey,

    I recently bought the asset and already love the autocompletion <3
    However I noticed one thing I would very kindly ask for you to consider as another fix / feature

    Pass tags get autoformatted into one line even if they are placed into multiple ones. This is not particularly inconvenient but it is inconsistent with Subshader tags which remain on separate lines if they have been placed like that. Having another option to configure this or just keep current style would be nice :)

    this:
    Screenshot 2021-06-30 110702.jpg

    becomes this:
    Screenshot 2021-06-30 110716.jpg

    I noticed this because I had a pass tag that was commented out in the first line and this resulted in all tags being commented out including the closing bracket.
    Code (CSharp):
    1. Tags { // "LightMode" = "Always" }
     
  39. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Hi, thank you for purchasing. It’s good idea that add a new option to config style. I will add it in next release.
     
    fleity likes this.
  40. Matt-Ostgard

    Matt-Ostgard

    Joined:
    Jul 23, 2012
    Posts:
    7
    Hi @Amlovey ,

    I saw your update added my requested feature which was the ability to indent Instancing buffer start/ends. First of all, thanks! However, it seems it only accounts for the obsolete version of the macro name. Thankfully, the way you implemented the feature to the extension makes it easy to fix. Adding
    UNITY_INSTANCING_BUFFER_START: 'UNITY_INSTANCING_BUFFER_END',
    to
    MACRO_METHODS_PAIR
    in the Formatter module fixes it.

    Thanks again! Got 5 stars from me!
     
  41. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Thank you for review :)
     
  42. 8bitgoose

    8bitgoose

    Joined:
    Dec 28, 2014
    Posts:
    448
    I am a bit confused by the two version on the Asset store. What is the difference ShaderLabVS Pro and ShaderLabVSCode? I am looking for a tool to help me write shaders directly in HLSL and provide the functionality that comes along with C# in Visual Studio.

    Thanks! Glad to made this. Editing HLSL is such a disaster without any code completion.
     
  43. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Hi,

    ShaderlabVSCode is extension of Visual Studio Code
    ShaderlabVS Pro is extension of Visual Studio
     
  44. 8bitgoose

    8bitgoose

    Joined:
    Dec 28, 2014
    Posts:
    448
    Oh wow, thanks for clarifying. For some reason I thought Visual Studio Code and Visual Studio was the same thing. Thanks so much! That clarifies it all.
     
  45. fleity

    fleity

    Joined:
    Oct 13, 2015
    Posts:
    345
    I installed the extension again today on a new machine and noticed that block comments get indented every time I press shift + alt + f
    Is there a setting to change this or is this a fixable bug?
     

    Attached Files:

  46. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Thank you for feedbacks. It will be fixed in next release.
     
    fleity likes this.
  47. fleity

    fleity

    Joined:
    Oct 13, 2015
    Posts:
    345
    Found another bug, sorry :confused: (thanks for fixing the indenting btw)
    in hlsl files if you comment closing include guards the way unity does it too:
    Code (CSharp):
    1. #endif // RANDOMROTATIONTEXTURESAMPLE_INCLUDED
    Formatting the document removes the last letter until the entire comment is removed (becomes: #endif //).
    Probably because it should remove spaces / breaks at the end of file an treats comments the same way?
     
  48. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Seems that it’s a regression bug. I will fix it in next few days
     
  49. Amlovey

    Amlovey

    Joined:
    May 10, 2016
    Posts:
    253
    Hi @fleity,

    The package with the fix is available on Unity Asset Store now.
     
    fleity likes this.
  50. hangaoquan

    hangaoquan

    Joined:
    Oct 2, 2023
    Posts:
    2
    I don't know how to use install