Hey, i tried to format a simple shader with the extension, but nothing happens. Other parts of the tool like syntax highlighting or "Go to Definition" seem to work. The only log output i could find was this:
2026-02-24 20:19:13.618 [error] [shader-slang.slang-language-extension] provider FAILED
2026-02-24 20:19:13.619 [error] TypeError: Cannot read properties of undefined (reading 'length')
at Object.map (c:\Users\-\.vscode\extensions\shader-slang.slang-language-extension-2.0.7-win32-x64\client\dist\nativeClientMain.js:6541:17)
at Object.asCompletionResult (c:\Users\-\.vscode\extensions\shader-slang.slang-language-extension-2.0.7-win32-x64\client\dist\nativeClientMain.js:7879:39)
at c:\Users\-\.vscode\extensions\shader-slang.slang-language-extension-2.0.7-win32-x64\client\dist\nativeClientMain.js:12176:55
at async AR.provideCompletionItems (file:///c:/Users/-/AppData/Local/Programs/Microsoft%20VS%20Code/072586267e/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:144:161150)
I have clangd-format installed
> clang-format --version
clang-format version 21.1.8
I have no clue what the error means or what could be the issue. Any ideas?
Edit 1: Okay, so setting the clang format style to "Microsoft" or "LLVM" works, it must be the default "file" setting and clang-format not finding the appropriate .clang-format file. I do have such a file, but it's only for Language: Cpp. I guess clang-format uses this file, figures out there's no valid settings for slang and does nothing?
Edit 2: I think the .clang-format file was the issue. It also didnt work properly on cpp files, however the clangd extension at least reported an issue with the cpp file, the slang extension seems to not report the output of it's clangd-usage on slang files.
Here an example of the clangd output, would be cool to have a similar report with slang:
I[21:04:44.110] getStyle() failed for file c:\Graphics\Vulkan\Vulkan-Tutorial\src\tutorial.cpp: Error reading c:\Graphics\Vulkan\Vulkan-Tutorial\.clang-format: invalid argument. Fallback is LLVM style.
c:\Graphics\Vulkan\Vulkan-Tutorial\.clang-format:6:1: error: unknown key '...'
Edit 3: Also, is it true i need to set Language: CSharp in .clang-format to have slang specific formatting options? It seems to work but i don't find any documentation on it.
Edit 4: One more related issue i came across was the formatting of e.g. this code:
static float3 colors[3] = float3[](float3(1.0, 0.0, 0.0), float3(0.0, 1.0, 0.0), float3(0.0, 0.0, 1.0));
Options like BreakAfterOpenBracketBracedList seem to do nothing. It will always be formatted to a single line. Is clang-format overwhelmed with the syntax here? Could it be due to CSharp?
Hey, i tried to format a simple shader with the extension, but nothing happens. Other parts of the tool like syntax highlighting or "Go to Definition" seem to work. The only log output i could find was this:
I have clangd-format installed
I have no clue what the error means or what could be the issue. Any ideas?
Edit 1: Okay, so setting the clang format style to "Microsoft" or "LLVM" works, it must be the default "file" setting and clang-format not finding the appropriate .clang-format file. I do have such a file, but it's only for
Language: Cpp. I guess clang-format uses this file, figures out there's no valid settings for slang and does nothing?Edit 2: I think the
.clang-formatfile was the issue. It also didnt work properly on cpp files, however the clangd extension at least reported an issue with the cpp file, the slang extension seems to not report the output of it's clangd-usage on slang files.Here an example of the clangd output, would be cool to have a similar report with slang:
Edit 3: Also, is it true i need to set
Language: CSharpin .clang-format to have slang specific formatting options? It seems to work but i don't find any documentation on it.Edit 4: One more related issue i came across was the formatting of e.g. this code:
static float3 colors[3] = float3[](float3(1.0, 0.0, 0.0), float3(0.0, 1.0, 0.0), float3(0.0, 0.0, 1.0));Options like
BreakAfterOpenBracketBracedListseem to do nothing. It will always be formatted to a single line. Is clang-format overwhelmed with the syntax here? Could it be due to CSharp?