Skip to content

Commit 052628e

Browse files
committed
Fix #5238: Add support for .NET file extensions in codebase indexing
- Added Visual Basic .NET (.vb) extension support - Added F# (.fs, .fsx, .fsi) extension support - Added appropriate parser mappings for VB.NET and F# files - Added comprehensive test coverage for .NET extension support This resolves the issue where .NET projects were not being properly indexed because only C# files were supported. Now all common .NET file types are included in the codebase indexing system.
1 parent 3a8ba27 commit 052628e

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// npx vitest services/code-index/__tests__/dotnet-support.spec.ts
2+
3+
import { extensions } from "../../tree-sitter"
4+
import { scannerExtensions } from "../shared/supported-extensions"
5+
6+
describe(".NET file extension support", () => {
7+
it("should include C# files in supported extensions", () => {
8+
expect(extensions).toContain(".cs")
9+
expect(scannerExtensions).toContain(".cs")
10+
})
11+
12+
it("should include Visual Basic .NET files in supported extensions", () => {
13+
expect(extensions).toContain(".vb")
14+
expect(scannerExtensions).toContain(".vb")
15+
})
16+
17+
it("should include F# files in supported extensions", () => {
18+
expect(extensions).toContain(".fs")
19+
expect(extensions).toContain(".fsx")
20+
expect(extensions).toContain(".fsi")
21+
expect(scannerExtensions).toContain(".fs")
22+
expect(scannerExtensions).toContain(".fsx")
23+
expect(scannerExtensions).toContain(".fsi")
24+
})
25+
26+
it("should not include markdown files in scanner extensions", () => {
27+
expect(extensions).toContain(".md")
28+
expect(extensions).toContain(".markdown")
29+
expect(scannerExtensions).not.toContain(".md")
30+
expect(scannerExtensions).not.toContain(".markdown")
31+
})
32+
})

src/services/tree-sitter/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ const extensions = [
4646
"hpp",
4747
// C#
4848
"cs",
49+
// Visual Basic .NET
50+
"vb",
51+
// F#
52+
"fs",
53+
"fsx",
54+
"fsi",
4955
// Ruby
5056
"rb",
5157
"java",

src/services/tree-sitter/languageParser.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,18 @@ export async function loadRequiredLanguageParsers(filesToParse: string[], source
137137
language = await loadLanguage("c_sharp", sourceDirectory)
138138
query = new Query(language, csharpQuery)
139139
break
140+
case "vb":
141+
// Visual Basic .NET - use C# parser as fallback since VB.NET has similar structure
142+
language = await loadLanguage("c_sharp", sourceDirectory)
143+
query = new Query(language, csharpQuery)
144+
break
145+
case "fs":
146+
case "fsx":
147+
case "fsi":
148+
// F# - use OCaml parser since F# is based on OCaml
149+
language = await loadLanguage("ocaml", sourceDirectory)
150+
query = new Query(language, ocamlQuery)
151+
break
140152
case "rb":
141153
language = await loadLanguage("ruby", sourceDirectory)
142154
query = new Query(language, rubyQuery)

0 commit comments

Comments
 (0)