diff --git a/package.json b/package.json index 07bf16be..77158413 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,8 @@ "C++", "clang", "clangd", - "LLVM" + "LLVM", + "HLSL" ], "activationEvents": [ "onLanguage:c", @@ -28,6 +29,7 @@ "onLanguage:cuda-cpp", "onLanguage:objective-c", "onLanguage:objective-cpp", + "onLanguage:hlsl", "onCommand:clangd.activate", "onCommand:clangd.install", "onCommand:clangd.update" @@ -170,6 +172,11 @@ "type": "number", "default": 0.55, "description": "Opacity of inactive regions (used only if clangd.inactiveRegions.useBackgroundHighlight=false)" + }, + "clangd.enableHLSL": { + "type": "boolean", + "default": false, + "description": "Enable experimental HLSL Support." } } }, diff --git a/src/clangd-context.ts b/src/clangd-context.ts index 0fef3f5a..2434ab39 100644 --- a/src/clangd-context.ts +++ b/src/clangd-context.ts @@ -19,10 +19,13 @@ export const clangdDocumentSelector = [ {scheme: 'file', language: 'cuda-cpp'}, {scheme: 'file', language: 'objective-c'}, {scheme: 'file', language: 'objective-cpp'}, + {scheme: 'file', language: 'hlsl'}, ]; export function isClangdDocument(document: vscode.TextDocument) { - return vscode.languages.match(clangdDocumentSelector, document); + if (vscode.workspace.getConfiguration('clangd').get('enableHLSL')) + return vscode.languages.match(clangdDocumentSelector, document); + return vscode.languages.match(clangdDocumentSelector.slice(0, -1), document); } class ClangdLanguageClient extends vscodelc.LanguageClient {