Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@
"C++",
"clang",
"clangd",
"LLVM"
"LLVM",
"HLSL"
],
"activationEvents": [
"onLanguage:c",
"onLanguage:cpp",
"onLanguage:cuda-cpp",
"onLanguage:objective-c",
"onLanguage:objective-cpp"
"onLanguage:objective-cpp",
"onLanguage:hlsl"
],
"main": "./out/bundle",
"scripts": {
Expand Down Expand Up @@ -194,6 +196,11 @@
"type": "boolean",
"default": true,
"description": "Enable clangd language server features"
},
"clangd.enableHLSL": {
"type": "boolean",
"default": false,
"description": "Enable experimental HLSL Support."
}
}
},
Expand Down
14 changes: 12 additions & 2 deletions src/clangd-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,18 @@ export const clangdDocumentSelector = [
{scheme: 'file', language: 'objective-cpp'},
];

function getDocumentSelector()
{
var documentSelector = clangdDocumentSelector;
if (vscode.workspace.getConfiguration('clangd').get('enableHLSL'))
documentSelector.push({scheme: 'file', language: 'hlsl'});
return documentSelector;
}

export function isClangdDocument(document: vscode.TextDocument) {
return vscode.languages.match(clangdDocumentSelector, document);
const documentSelector = getDocumentSelector();

return vscode.languages.match(documentSelector, document);
}

class ClangdLanguageClient extends vscodelc.LanguageClient {
Expand Down Expand Up @@ -104,7 +114,7 @@ export class ClangdContext implements vscode.Disposable {

const clientOptions: vscodelc.LanguageClientOptions = {
// Register the server for c-family and cuda files.
documentSelector: clangdDocumentSelector,
documentSelector: getDocumentSelector(),
initializationOptions: {
clangdFileStatus: true,
fallbackFlags: await config.get<string[]>('fallbackFlags')
Expand Down
Loading