diff --git a/README.md b/README.md index adcd6d7..ec840d5 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Marketplace Version](https://vsmarketplacebadge.apphb.com/version/xaver.clang-format.svg)](https://marketplace.visualstudio.com/items?itemName=xaver.clang-format) [![Installs](https://vsmarketplacebadge.apphb.com/installs/xaver.clang-format.svg)](https://marketplace.visualstudio.com/items?itemName=xaver.clang-format) -[Clang-Format](http://clang.llvm.org/docs/ClangFormat.html) is a tool to format C/C++/Java/JavaScript/Objective-C/Objective-C++/Protobuf code. It can be configured with a config file named `.clang-format` within the working folder or a parent folder. Configuration see: http://clang.llvm.org/docs/ClangFormatStyleOptions.html +[Clang-Format](http://clang.llvm.org/docs/ClangFormat.html) is a tool to format C/C++/Java/JavaScript/Objective-C/Objective-C++/Metal/Protobuf code. It can be configured with a config file named `.clang-format` within the working folder or a parent folder. Configuration see: http://clang.llvm.org/docs/ClangFormatStyleOptions.html ## Usage diff --git a/package.json b/package.json index 5ce9058..a4953d0 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,8 @@ "Clang", "LLVM", "Protobuf", - "CUDA" + "CUDA", + "Metal" ], "main": "./out/src/extension", "activationEvents": [ @@ -43,7 +44,8 @@ "onLanguage:glsl", "onLanguage:hlsl", "onLanguage:cuda", - "onLanguage:cuda-cpp" + "onLanguage:cuda-cpp", + "onLanguage:metal" ], "contributes": { "configuration": { @@ -305,6 +307,21 @@ "default": "", "description": "clang-format fallback style for CUDA, left empty to use clang-format.fallbackStyle" }, + "clang-format.language.metal.enable": { + "type": "boolean", + "default": true, + "description": "enable formatting for Metal Shader Files" + }, + "clang-format.language.metal.style": { + "type": "string", + "default": "", + "description": "clang-format fallback style for Metal Shader Files, left empty to use clang-format.style" + }, + "clang-format.language.metal.fallbackStyle": { + "type": "string", + "default": "", + "description": "clang-format fallback style for Metal Shader Files, left empty to use clang-format.fallbackStyle" + }, "clang-format.assumeFilename": { "type": "string", "default": "", diff --git a/src/clangMode.ts b/src/clangMode.ts index 5c16021..51ab9f1 100644 --- a/src/clangMode.ts +++ b/src/clangMode.ts @@ -7,7 +7,7 @@ export const ALIAS = { }; let languages: string[] = []; -for (let l of ['cpp', 'c', 'csharp', 'objective-c', 'objective-cpp', 'java', 'javascript', 'json', 'typescript', 'proto', 'proto3', 'textproto', 'apex', 'glsl', 'hlsl', 'cuda', 'cuda-cpp']) { +for (let l of ['cpp', 'c', 'csharp', 'objective-c', 'objective-cpp', 'java', 'javascript', 'json', 'typescript', 'proto', 'proto3', 'textproto', 'apex', 'glsl', 'hlsl', 'cuda', 'cuda-cpp', 'metal']) { let confKey = `language.${ALIAS[l] || l}.enable`; if (vscode.workspace.getConfiguration('clang-format').get(confKey)) { languages.push(l);