Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ScipDotnet.Tests/ScipDotnet.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net10.0;net9.0;net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net10.0;net9.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
Expand Down
5 changes: 3 additions & 2 deletions ScipDotnet/IndexCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<FileInfo> 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();
Expand All @@ -133,7 +134,7 @@ private static List<FileInfo> 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<FileInfo>();
}
Expand Down
2 changes: 1 addition & 1 deletion ScipDotnet/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static async Task<int> Main(string[] args)
{
var indexCommand = new Command("index", "Index a solution file")
{
new Argument<FileInfo>("projects", "Path to the .sln (solution) or .csproj/.vbproj file")
new Argument<FileInfo>("projects", "Path to the .sln/.slnx (solution) or .csproj/.vbproj file")
{ Arity = ArgumentArity.ZeroOrMore },
new Option<string>("--output", () => "index.scip",
"Path to the output SCIP index file"),
Expand Down
16 changes: 8 additions & 8 deletions ScipDotnet/ScipDotnet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.2.13</Version>
<Version>0.2.14</Version>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageReadmeFile>readme.md</PackageReadmeFile>
<PackageType>DotnetTool</PackageType>
<TargetFrameworks>net10.0;net9.0;net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net10.0;net9.0;net8.0</TargetFrameworks>
<PackAsTool>true</PackAsTool>
<AssemblyName>scip-dotnet</AssemblyName>
<RepositoryUrl>https://github.com/sourcegraph/scip-dotnet</RepositoryUrl>
Expand All @@ -19,14 +19,14 @@
<None Include="../readme.md" Pack="true" PackagePath="" />
<PackageReference Include="Google.Protobuf" Version="3.30.0" />
<PackageReference Include="Microsoft.Build.Locator" Version="1.7.8" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.4.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Features" Version="4.4.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.4.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Features" Version="4.4.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.4.0" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="5.3.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Features" Version="5.3.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="5.3.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Features" Version="5.3.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="5.3.0" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageReference Include="System.CommandLine.Hosting" Version="0.4.0-alpha.22272.1" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="7.0.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="9.0.0" />
</ItemGroup>

</Project>
8 changes: 6 additions & 2 deletions ScipDotnet/ScipProjectIndexer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ public ScipProjectIndexer(ILogger<ScipProjectIndexer> 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}\"";
Expand Down Expand Up @@ -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<MSBuildWorkspace>()
Expand Down
10 changes: 10 additions & 0 deletions snapshots/input/syntax-slnx/Main/Main.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net10.0;net9.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
15 changes: 15 additions & 0 deletions snapshots/input/syntax-slnx/Main/Program.cs
Original file line number Diff line number Diff line change
@@ -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"));
}
}
3 changes: 3 additions & 0 deletions snapshots/input/syntax-slnx/syntax-slnx.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="Main/Main.csproj" />
</Solution>
34 changes: 34 additions & 0 deletions snapshots/output-net10.0/syntax-slnx/Main/Program.cs
Original file line number Diff line number Diff line change
@@ -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().
}
}