-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable clangd on HLSL sources #392
base: master
Are you sure you want to change the base?
Changes from all commits
f4bb4ba
6270255
04cd252
1feba07
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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'}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this part is "just code", I think we can make it conditional on a config option. |
||
]; | ||
|
||
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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A couple of issues here:
Can we instead replace Note that the use of |
||
} | ||
|
||
class ClangdLanguageClient extends vscodelc.LanguageClient { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can't be conditional, but I think this just wakes up the plugin when an HLSL file is opened, and would just waste a few resources if the documentSelector doesn't have HLSL.