microsoft / microsoft/vscode-cpptools

Formatting GLSL not supported, even though it should be able to format GLSL

Open
#9,902 12 comments 12 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Feature: Code Formatting Language Service
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and version: Windows_NT x64 10.0.19044
  • VS Code: 1.71.2 (user setup)
  • C/C++ extension: v1.12.4
  • OS and version of remote machine (if applicable):
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.

image

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

    "[glsl]": {
        "editor.defaultFormatter": "ms-vscode.cpptools"
    },

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:

  1. Set "editor.defaultFormatter": "ms-vscode.cpptools"
  2. Format a glsl file
Other Extensions

No response

Additional Information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce with a .frag GLSL file and the [glsl] editor.defaultFormatter setting shown in the issue. Inspect how the C/C++ extension registers its formatter and language support; done means the configured formatter is accepted for GLSL files and Format Document no longer reports that no formatter is installed.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.