Skip to content

Commit 053febe

Browse files
committed
Add more supported C++ file types
1 parent ea55b3b commit 053febe

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Sources/SourceKitBazelBSP/RequestHandlers/BuildTargets/SupportedExtension.swift

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,36 @@ private let logger = makeFileLevelBSPLogger()
2626
// Contains data about all the file types the BSP knows how to parse.
2727
// See also: DependencyRuleType.swift, TopLevelRuleType.swift
2828
enum SupportedExtension: String, CaseIterable {
29+
case cCaps = "C"
2930
case c
3031
case cc
3132
case cpp
3233
case cxx
34+
case inc
35+
case ipp
36+
case hCaps = "H"
3337
case h
38+
case hh
3439
case hpp
3540
case m
3641
case mm
3742
case swift
3843

3944
var kind: SourceKitSourceItemKind {
4045
switch self {
41-
case .h, .hpp: return .header
42-
case .c, .cc, .cpp, .cxx: return .source
46+
case .hCaps, .h, .hh, .hpp, .inc, .ipp: return .header
47+
case .cCaps, .c, .cc, .cpp, .cxx: return .source
4348
case .m, .mm: return .source
4449
case .swift: return .source
4550
}
4651
}
4752

48-
// Source: https://github.com/swiftlang/sourcekit-lsp/blob/7495f5532fdb17184d69518f46a207e596b26c64/Sources/LanguageServerProtocolExtensions/Language%2BInference.swift#L33
53+
// Source for .h == Obj-C++: https://github.com/swiftlang/sourcekit-lsp/blob/7495f5532fdb17184d69518f46a207e596b26c64/Sources/LanguageServerProtocolExtensions/Language%2BInference.swift#L33
54+
// Technically not 100% correct, but does the job for what it needs to do.
4955
var language: Language {
5056
switch self {
5157
case .c: return .c
52-
case .cpp, .cc, .cxx, .hpp: return .cpp
58+
case .cCaps, .cpp, .cc, .cxx, .hCaps, .hh, .hpp, .inc, .ipp: return .cpp
5359
case .m: return .objective_c
5460
case .mm, .h: return .objective_cpp
5561
case .swift: return .swift

0 commit comments

Comments
 (0)