Skip to content

Commit f6e8c98

Browse files
committed
Add additional file extensions
1 parent 74bfa52 commit f6e8c98

4 files changed

Lines changed: 13 additions & 2 deletions

File tree

Extension/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@
6868
"languages": [
6969
{
7070
"id": "cpp",
71+
"extensions": [
72+
".ccm",
73+
".cppm",
74+
".hip",
75+
".ixx",
76+
".sycl"
77+
],
7178
"filenames": [
7279
"algorithm",
7380
"any",

Extension/src/LanguageServer/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2734,7 +2734,7 @@ export class DefaultClient implements Client {
27342734
});
27352735

27362736
// Fallback for native binaries that do not publish effective file type mappings.
2737-
this.associations_for_did_change = new Set<string>(["cu", "cuh", "c", "i", "cpp", "cc", "cxx", "c++", "cp", "hpp", "hh", "hxx", "h++", "hp", "h", "ii", "ino", "inl", "ipp", "tcc", "txx", "tpp", "idl"]);
2737+
this.associations_for_did_change = new Set<string>(["cu", "cuh", "c", "i", "cpp", "cc", "ccm", "cxx", "c++", "cp", "cppm", "hip", "hpp", "hh", "hxx", "h++", "hp", "h", "ii", "ino", "inl", "ipp", "ixx", "sycl", "tcc", "txx", "tpp", "idl"]);
27382738
const assocs: any = new OtherSettings().filesAssociations;
27392739
for (const assoc in assocs) {
27402740
const dotIndex: number = assoc.lastIndexOf('.');

Extension/src/fileType.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const bootstrapMappings: FileTypeMappings = {
2323
extensions: [
2424
...['.cuh', '.hpp', '.hh', '.hxx', '.h++', '.hp', '.h', '.inl', '.ipp', '.tcc', '.txx', '.tpp', '.tlh', '.tli']
2525
.map(name => ({ name, kind: 'header' as const, language: name === '.cuh' ? 'cuda' as const : 'cpp' as const })),
26-
...['.cu', '.cpp', '.cc', '.cxx', '.c++', '.cp', '.ii', '.ino']
26+
...['.cu', '.cpp', '.cc', '.ccm', '.cxx', '.c++', '.cp', '.cppm', '.hip', '.ii', '.ino', '.ixx', '.sycl']
2727
.map(name => ({ name, kind: 'source' as const, language: name === '.cu' ? 'cuda' as const : 'cpp' as const })),
2828
...['.c', '.i'].map(name => ({ name, kind: 'source' as const, language: 'c' as const })),
2929
{ name: '.idl', kind: 'idl' }

Extension/test/unit/fileType.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ describe('file type mappings', () => {
2020
equal(hasNativeFileTypeMappings(), false);
2121
deepStrictEqual(classifyFilePath('file.hpp'), { name: '.hpp', kind: 'header', language: 'cpp' });
2222
deepStrictEqual(classifyFilePath('file.C'), { name: '.C', kind: 'source', language: 'cpp' });
23+
for (const extension of ['ccm', 'cppm', 'hip', 'ixx', 'sycl']) {
24+
deepStrictEqual(classifyFilePath(`file.${extension}`), { name: `.${extension}`, kind: 'source', language: 'cpp' });
25+
equal(isTagParsableFile(`file.${extension}`), true);
26+
}
2327
deepStrictEqual(classifyFilePath('Makefile'), { name: '', kind: 'header' });
2428
});
2529

0 commit comments

Comments
 (0)