There must be a better way to work with HLSL. By default, there is no Intellisense support. I installed a VS extension "HLSL Tools for Visual Studio", and that helped a whole lot with that; however, VS2019 is now in the habit of mangling my code every time I write a new function. Note that all following code samples are HLSL. I left it on CSharp strictly for the syntax highlighting. For example, I might have a function like this (HLSL): Code (CSharp): float GetVelocity(float n, float A, float R, float S) { return ((1.49 / n) * A * pow(R, 2 / 3) * pow(S, 1 / 2)) / A; } If I add a function above it, it is mangled to the following (HLSL): Code (CSharp): float GetVelocity ( float n, float A, float R, float S) { return ((1.49 / n) * A * pow(R, 2 / 3) * pow(S, 1 / 2)) / A; } It is far worse if I have used any keywords like inout or out in my parameters (HLSL): Code (CSharp): float GetVelocity (in float n, in float A, in float R, in float S) { return ((1.49 / n) * A * pow(R, 2 / 3) * pow(S, 1 / 2)) / A; } In every case, it is mangled so badly that Ctrl-K + Ctrl-D cannot fix it, and it does this to every single function in the file below the function I am adding, every single time. How do you all work with HLSL? This is extremely frustrating.
Wow, that makes vi look pretty good! I have no idea... sounds like maybe something wrong with the HLSL code completer? Are there different "dialects" of that language grammar? Maybe it's using a newer dialect than Unity can handle. Perhaps look for dialect versions settings? Meanwhile, use vi I guess!
I've never had this issue in VS2019 editing shader files. To be honest, I have never tried to install a plugin for it, was happy with the out-of-the-box syntax highlighting. There isn't a lot of structure to most shaders. It's not like you're dealing with large and deep class hierarchies or complex APIs. Most shaders are a handful of basic functions all in one file. Intellisense is not going to get you much as the HLSL API is fairly small and completely flat. Just open a reference in a browser tab. Also, never use vi.
Though I do not have enough experience with shaders to say with any certainty, I think this may be a little more complicated than your average shader, and I am not so great at remembering exactly what I have called everything. I am trying to build an integrated mix of simulating very basic weather and several different types of erosion, the latter to a slightly greater depth than I have seen in the papers I have gone over. Mix that with not knowing what functions or types are available, and Intellisense is plain fantastic for productivity. I wound up going with VS Code. It has the exact same extension available, but it does not mangle my code in that editor.