Skip to content

Multi-target project support #205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@

<ItemGroup>
<Compile Include="Tooling.fs" />
<Compile Include="CodeActionTests.fs" />
<Compile Include="DiagnosticTests.fs" />
<Compile Include="DocumentationTests.fs" />
<Compile Include="HoverTests.fs" />
<Compile Include="InitializationTests.fs" />
<Compile Include="ReferenceTests.fs" />
<Compile Include="DefinitionTests.fs" />
<Compile Include="DocumentFormattingTests.fs" />
</ItemGroup>

<ItemGroup>
Expand Down
32 changes: 32 additions & 0 deletions tests/CSharpLanguageServer.Tests/InitializationTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,35 @@

Assert.IsTrue(client.ServerDidRespondTo "initialize")
Assert.IsTrue(client.ServerDidRespondTo "initialized")


[<TestCase>]
let testMultiTargetProjectLoads () =
use client = setupServerClient { defaultClientProfile with LoggingEnabled=true }
"TestData/testMultiTargetProjectLoads"
client.StartAndWaitForSolutionLoad()

use classFile = client.Open("Project/Class.cs")

let hover0Params: HoverParams =
{ TextDocument = { Uri = classFile.Uri }
Position = { Line = 2u; Character = 16u }
WorkDoneToken = None
}

let hover0: Hover option =
client.Request("textDocument/hover", hover0Params)

match hover0 with
| Some hover ->
match hover.Contents with
| U3.C1 c ->
Assert.AreEqual(MarkupKind.Markdown, c.Kind)
Assert.AreEqual("`` void Class.Method(string arg) ``", c.Value)
| _ -> failwith "C1 was expected"

Assert.IsTrue(hover.Range.IsNone)

| x -> failwithf "Some (U3.C1 c) was expected but '%s' received" (string x)

Assert.IsTrue(false)

Check warning on line 162 in tests/CSharpLanguageServer.Tests/InitializationTests.fs

View workflow job for this annotation

GitHub Actions / build (ubuntu-24.04, 9.0.x)

Main module of program is empty: nothing will happen when it is run

Check warning on line 162 in tests/CSharpLanguageServer.Tests/InitializationTests.fs

View workflow job for this annotation

GitHub Actions / build (ubuntu-24.04, 9.0.x)

Main module of program is empty: nothing will happen when it is run

Check warning on line 162 in tests/CSharpLanguageServer.Tests/InitializationTests.fs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 9.0.x)

Main module of program is empty: nothing will happen when it is run

Check warning on line 162 in tests/CSharpLanguageServer.Tests/InitializationTests.fs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 9.0.x)

Main module of program is empty: nothing will happen when it is run
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class Class
{
public void Method(string arg)
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
</PropertyGroup>
</Project>
Loading