Open FrostKiwi opened 1 year ago
Do you intend to format with vcFormat or clangFormat? If you set files.associations: { "*.frag": "c" }
that should be a workaround, but it would treat the file as C for all language service features. I'm not sure formatting would work without issues. We'd also have to disable non-formatting features like IntelliSense.
set
files.associations: { "*.frag": "c" }
that should be a workaround
Indeed, that works and formats the file correctly, but as you already guessed, IntelliSense flips out with errors:
I see no formatting issues with multiple files across GLSL vertex and fragment shaders. I presume the same to be true for DirectX HLSL shaders.
I wonder if I can setup a function,, that temporarily switches to files.associations: c, format file, and switch back to the original association as an extra dirty workaround. Bind it to the default Shift+Alt+F with .frag files as the conditional.
intend to format with vcFormat or clangFormat?
I never set it to clangFormat, so I presume the default(?) vcFormat is being used.
We'd also have to disable non-formatting features like IntelliSense.
I kinda presumed this "formatter" thingy is an extra component divorced from linting and stuff, but clearly this is a bit more complicated than I would have guessed...
You could try setting the C_Cpp.errorSquiggles to "Disabled". You may need to disable other language service features too. However, that would only work if you also don't want those in actual C/C++ files, unless possibly if you used a multi-root workspace with one workspace folder configured for GLSL formatting and another for C/C++.
The default is clangFormat.
I'm not sure if switching file associations back and forth would work.
The reason the formatting is embedded with the other language service features is due to our shared internal document object which is used by formatting and IntelliSense (and other configuration details).
The default is clangFormat.
Ohh, good to know.
You could try setting the C_Cpp.errorSquiggles to "Disabled"
I must remain in glsl mode to get the glsl linting via https://marketplace.visualstudio.com/items?itemName=dtoplak.vscode-glsllint .
I'm not sure if switching file associations back and forth would work.
It does! Hahaha, this is so ugly, but man is it ever better than installing an extra formatter:
{
"key": "ctrl+alt+f",
"command": "extension.multiCommand.execute",
"args": {
"sequence": [
{ "command": "commands.setEditorLanguage", "args": "c"},
{ "command": "editor.action.formatDocument"},
{ "command": "commands.setEditorLanguage", "args": "glsl"}
]
}
Using https://marketplace.visualstudio.com/items?itemName=usernamehw.commands to change the language mode and https://marketplace.visualstudio.com/items?itemName=ryuta46.multi-command to execute multiple commands with one keybind. It works and formats correctly in roughly half a second, so this is perfect.
This feature request is being closed due to insufficient upvotes. Please leave a 👍-upvote or 👎-downvote reaction on the issue to help us prioritize it. When enough upvotes are received, this issue will be eligible for our backlog.
This feature request has received enough votes to be added to our backlog.
Environment
Bug Summary and Steps to Reproduce
Posting issue here, as suggested by: https://github.com/microsoft/vscode/issues/161209#issuecomment-1251914962
Issuing the format document command on a GLSL file with .frag as the extension in case of the this fragment shader file, results in the
There is no formatter for 'glsl' files installed.
error message. Which is correct, I do not have one installed specifically for GLSL shaders.I would like to use the default formatter for C files, as GLSL is formatted identically to C. So I set the following in my settings .json
This does not change the error message, which persists.
I presume this is because ms-vscode.cpptools is not specifically registered to work with glsl files, although the formatter should be more than capable of formatting GLSL files. It would be excellent, if I could chose the C formatter for GLSL files.
Does this issue occur when all extensions are disabled?: Yes
Detailed version Info
``` Version: 1.71.2 (user setup) Commit: 74b1f979648cc44d385a2286793c226e611f59e7 Date: 2022-09-14T21:03:37.738Z Electron: 19.0.12 Chromium: 102.0.5005.167 Node.js: 16.14.2 V8: 10.2.154.15-electron.0 OS: Windows_NT x64 10.0.19044 Sandboxed: No ```Steps to Reproduce:
Other Extensions
No response
Additional Information
No response