diff --git a/ScipDotnet.Tests/ScipDotnet.Tests.csproj b/ScipDotnet.Tests/ScipDotnet.Tests.csproj index e717dde..e957400 100644 --- a/ScipDotnet.Tests/ScipDotnet.Tests.csproj +++ b/ScipDotnet.Tests/ScipDotnet.Tests.csproj @@ -1,7 +1,7 @@ - net10.0;net9.0;net8.0;net7.0;net6.0 + net10.0;net9.0;net8.0 enable enable false diff --git a/ScipDotnet/IndexCommandHandler.cs b/ScipDotnet/IndexCommandHandler.cs index 63cdb74..f4d8e8c 100644 --- a/ScipDotnet/IndexCommandHandler.cs +++ b/ScipDotnet/IndexCommandHandler.cs @@ -116,13 +116,14 @@ private static async Task ScipIndex(IHost host, IndexCommandOptions options) } private static string FixThisProblem(string examplePath) => - "To fix this problem, pass the path of a solution (.sln) or project (.csproj/.vbrpoj) file to the `scip-dotnet index` command. " + + "To fix this problem, pass the path of a solution (.sln/.slnx) or project (.csproj/.vbproj) file to the `scip-dotnet index` command. " + $"For example, run: scip-dotnet index {examplePath}"; private static List FindSolutionOrProjectFile(FileInfo workingDirectory, ILogger logger) { var paths = Directory.GetFiles(workingDirectory.FullName).Where(file => string.Equals(Path.GetExtension(file), ".sln", StringComparison.OrdinalIgnoreCase) || + string.Equals(Path.GetExtension(file), ".slnx", StringComparison.OrdinalIgnoreCase) || string.Equals(Path.GetExtension(file), ".csproj", StringComparison.OrdinalIgnoreCase) || string.Equals(Path.GetExtension(file), ".vbproj", StringComparison.OrdinalIgnoreCase) ).ToList(); @@ -133,7 +134,7 @@ private static List FindSolutionOrProjectFile(FileInfo workingDirector } logger.LogError( - "No solution (.sln) or .csproj/.vbproj file detected in the working directory '{WorkingDirectory}'. {FixThis}", + "No solution (.sln/.slnx) or .csproj/.vbproj file detected in the working directory '{WorkingDirectory}'. {FixThis}", workingDirectory.FullName, FixThisProblem("SOLUTION_FILE")); return new List(); } diff --git a/ScipDotnet/Program.cs b/ScipDotnet/Program.cs index ec6ab57..c51c6b8 100644 --- a/ScipDotnet/Program.cs +++ b/ScipDotnet/Program.cs @@ -21,7 +21,7 @@ public static async Task Main(string[] args) { var indexCommand = new Command("index", "Index a solution file") { - new Argument("projects", "Path to the .sln (solution) or .csproj/.vbproj file") + new Argument("projects", "Path to the .sln/.slnx (solution) or .csproj/.vbproj file") { Arity = ArgumentArity.ZeroOrMore }, new Option("--output", () => "index.scip", "Path to the output SCIP index file"), diff --git a/ScipDotnet/ScipDotnet.csproj b/ScipDotnet/ScipDotnet.csproj index 6816cb1..7851e12 100644 --- a/ScipDotnet/ScipDotnet.csproj +++ b/ScipDotnet/ScipDotnet.csproj @@ -4,11 +4,11 @@ Exe enable enable - 0.2.13 + 0.2.14 LICENSE readme.md DotnetTool - net10.0;net9.0;net8.0;net7.0;net6.0 + net10.0;net9.0;net8.0 true scip-dotnet https://github.com/sourcegraph/scip-dotnet @@ -19,14 +19,14 @@ - - - - - + + + + + - + \ No newline at end of file diff --git a/ScipDotnet/ScipProjectIndexer.cs b/ScipDotnet/ScipProjectIndexer.cs index 00306f0..1f1debf 100644 --- a/ScipDotnet/ScipProjectIndexer.cs +++ b/ScipDotnet/ScipProjectIndexer.cs @@ -20,7 +20,9 @@ public ScipProjectIndexer(ILogger logger) => private void Restore(IndexCommandOptions options, FileInfo project) { - var arguments = project.Extension.Equals(".sln") ? $"restore {project.FullName} /p:EnableWindowsTargeting=true" : "restore /p:EnableWindowsTargeting=true"; + var isSolution = project.Extension.Equals(".sln", StringComparison.OrdinalIgnoreCase) + || project.Extension.Equals(".slnx", StringComparison.OrdinalIgnoreCase); + var arguments = isSolution ? $"restore {project.FullName} /p:EnableWindowsTargeting=true" : "restore /p:EnableWindowsTargeting=true"; if (options.NugetConfigPath != null) { arguments += $" --configfile \"{options.NugetConfigPath.FullName}\""; @@ -64,7 +66,9 @@ private void Restore(IndexCommandOptions options, FileInfo project) Restore(options, rootProject); } - var projects = (string.Equals(rootProject.Extension, ".csproj") || string.Equals(rootProject.Extension, ".vbproj") + var isProjectFile = string.Equals(rootProject.Extension, ".csproj", StringComparison.OrdinalIgnoreCase) + || string.Equals(rootProject.Extension, ".vbproj", StringComparison.OrdinalIgnoreCase); + var projects = (isProjectFile ? new[] { await host.Services.GetRequiredService() diff --git a/snapshots/input/syntax-slnx/Main/Main.csproj b/snapshots/input/syntax-slnx/Main/Main.csproj new file mode 100644 index 0000000..3e3505f --- /dev/null +++ b/snapshots/input/syntax-slnx/Main/Main.csproj @@ -0,0 +1,10 @@ + + + + Exe + net10.0;net9.0;net8.0 + enable + enable + + + diff --git a/snapshots/input/syntax-slnx/Main/Program.cs b/snapshots/input/syntax-slnx/Main/Program.cs new file mode 100644 index 0000000..44ce3ae --- /dev/null +++ b/snapshots/input/syntax-slnx/Main/Program.cs @@ -0,0 +1,15 @@ +namespace SlnxTest; + +public class Greeter +{ + public string Greet(string name) => $"Hello, {name}!"; +} + +public static class Program +{ + public static void Main() + { + var greeter = new Greeter(); + Console.WriteLine(greeter.Greet("World")); + } +} diff --git a/snapshots/input/syntax-slnx/syntax-slnx.slnx b/snapshots/input/syntax-slnx/syntax-slnx.slnx new file mode 100644 index 0000000..3c34d87 --- /dev/null +++ b/snapshots/input/syntax-slnx/syntax-slnx.slnx @@ -0,0 +1,3 @@ + + + diff --git a/snapshots/output-net10.0/syntax-slnx/Main/Program.cs b/snapshots/output-net10.0/syntax-slnx/Main/Program.cs new file mode 100644 index 0000000..5411353 --- /dev/null +++ b/snapshots/output-net10.0/syntax-slnx/Main/Program.cs @@ -0,0 +1,34 @@ + namespace SlnxTest; +// ^^^^^^^^ reference scip-dotnet nuget . . SlnxTest/ + + public class Greeter +// ^^^^^^^ definition scip-dotnet nuget . . SlnxTest/Greeter# +// documentation ```cs\nclass Greeter\n``` + { + public string Greet(string name) => $"Hello, {name}!"; +// ^^^^^ definition scip-dotnet nuget . . SlnxTest/Greeter#Greet(). +// documentation ```cs\npublic string Greeter.Greet(string name)\n``` +// ^^^^ definition scip-dotnet nuget . . SlnxTest/Greeter#Greet().(name) +// documentation ```cs\nstring name\n``` +// ^^^^ reference scip-dotnet nuget . . SlnxTest/Greeter#Greet().(name) + } + + public static class Program +// ^^^^^^^ definition scip-dotnet nuget . . SlnxTest/Program# +// documentation ```cs\nclass Program\n``` + { + public static void Main() +// ^^^^ definition scip-dotnet nuget . . SlnxTest/Program#Main(). +// documentation ```cs\npublic static void Program.Main()\n``` + { + var greeter = new Greeter(); +// ^^^^^^^ definition local 0 +// documentation ```cs\nGreeter? greeter\n``` +// ^^^^^^^ reference scip-dotnet nuget . . SlnxTest/Greeter# + Console.WriteLine(greeter.Greet("World")); +// ^^^^^^^ reference scip-dotnet nuget System.Console 10.0.0.0 System/Console# +// ^^^^^^^^^ reference scip-dotnet nuget System.Console 10.0.0.0 System/Console#WriteLine(+11). +// ^^^^^^^ reference local 0 +// ^^^^^ reference scip-dotnet nuget . . SlnxTest/Greeter#Greet(). + } + }