Skip to content
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

Changes needed to create a F# language service based on Roslyn workspace model #8557

Merged
merged 8 commits into from
Feb 11, 2016
10 changes: 9 additions & 1 deletion build/Targets/GenerateInternalsVisibleTo.targets
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
<InternalsVisibleToMoq>
<Visible>false</Visible>
</InternalsVisibleToMoq>
<InternalsVisibleToFSharp>
<Visible>false</Visible>
</InternalsVisibleToFSharp>
</ItemDefinitionGroup>

<PropertyGroup Condition="'$(PublicKey)' != '' and '$(SignAssembly)' == 'True'">
Expand All @@ -33,7 +36,7 @@
Inputs="$(MSBuildThisFileFullPath);$(MSBuildProjectFile)"
Outputs="$(GeneratedInternalsVisibleToFile)"
DependsOnTargets="PrepareForBuild"
Condition="'@(InternalsVisibleTo)' != '' OR '@(InternalsVisibleToTest)' != '' OR '@(InternalsVisibleToTypeScript)' != '' OR '@(InternalsVisibleToMoq)' != ''">
Condition="'@(InternalsVisibleTo)' != '' OR '@(InternalsVisibleToTest)' != '' OR '@(InternalsVisibleToTypeScript)' != '' OR '@(InternalsVisibleToMoq)' != '' OR '@(InternalsVisibleToFSharp)' != ''">

<!--
This is a slightly evil trick. What we have is a group of InternalsVisibleTo items which
Expand Down Expand Up @@ -71,6 +74,11 @@
Condition="'@(InternalsVisibleToMoq)' != ''">
<Output TaskParameter="Include" ItemName="InternalsVisibleToAttribute" />
</CreateItem>
<CreateItem Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute"
AdditionalMetadata="_Parameter1=%(InternalsVisibleToFSharp.Identity), PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293"
Condition="'@(InternalsVisibleToFSharp)' != ''">
<Output TaskParameter="Include" ItemName="InternalsVisibleToAttribute" />
</CreateItem>

<!-- The necessity of this Task is tracked by https://github.com/dotnet/roslyn/issues/8421 -->
<WriteCodeFragmentEx
Expand Down
1 change: 1 addition & 0 deletions src/EditorFeatures/Core/EditorFeatures.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
<InternalsVisibleToTypeScript Include="Microsoft.Test.Apex.VisualStudio" />
<InternalsVisibleToTypeScript Include="Roslyn.Services.Editor.TypeScript.UnitTests" />
<InternalsVisibleToMoq Include="DynamicProxyGenAssembly2" />
<InternalsVisibleToFSharp Include="FSharp.Editor" />
</ItemGroup>
<ItemGroup>
<Compile Include="CommandArgs.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.Classification
[Export(typeof(ITaggerProvider))]
[ContentType(ContentTypeNames.CSharpContentType)]
[ContentType(ContentTypeNames.VisualBasicContentType)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we remove CSharpContentType and VisualBasicContentType now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes done.

[ContentType(ContentTypeNames.RoslynContentType)]
[TextViewRole(PredefinedTextViewRoles.Document)]
[TagType(typeof(IClassificationTag))]
internal partial class SyntacticClassificationTaggerProvider : ITaggerProvider
Expand Down
2 changes: 2 additions & 0 deletions src/EditorFeatures/Text/TextEditorFeatures.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
<InternalsVisibleToTest Include="Roslyn.Services.Editor.VisualBasic.UnitTests" />
<InternalsVisibleToTest Include="Roslyn.VisualStudio.Services.UnitTests" />
<InternalsVisibleToTest Include="RoslynETAHost" />
<InternalsVisibleToFSharp Include="FSharp.Editor" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to consider naming these the same way we do for C#/VB/TS. I think uniformity will make things a lot clearer.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're also in the test section. Ideally all your stuff would always be next to the TypeScript stuff.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean naming the F# dlls? Currently these are the names of the existing F# LS dlls. @otawfik-ms's plan is to start adding code to those existing dlls and refactor later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved all the F# IVTs next to the TypeScript ones.

<InternalsVisibleToFSharp Include="FSharp.LanguageService" />
</ItemGroup>
<ItemGroup>
<!-- Compile items go here -->
Expand Down
1 change: 1 addition & 0 deletions src/Features/Core/Portable/Features.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
<InternalsVisibleToTypeScript Include="Microsoft.VisualStudio.LanguageServices.TypeScript" />
<InternalsVisibleToTypeScript Include="Roslyn.Services.Editor.TypeScript.UnitTests" />
<InternalsVisibleToMoq Include="DynamicProxyGenAssembly2" />
<InternalsVisibleToFSharp Include="FSharp.Editor" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\Compilers\Shared\DesktopShim.cs">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,11 @@ public ImmutableArray<ProjectReference> GetCurrentProjectReferences()
{
return ImmutableArray.CreateRange(_projectReferences);
}

public ImmutableArray<VisualStudioMetadataReference> GetCurrentMetadataReferences()
{
return ImmutableArray.CreateRange(_metadataReferences);
}

public IVisualStudioHostDocument GetDocumentOrAdditionalDocument(DocumentId id)
{
Expand Down
2 changes: 2 additions & 0 deletions src/VisualStudio/Core/Def/ServicesVisualStudio.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@
<InternalsVisibleToTypeScript Include="ManagedSourceCodeAnalysis" />
<InternalsVisibleToTypeScript Include="CodeAnalysis" />
<InternalsVisibleToTypeScript Include="StanCore" />
<InternalsVisibleToFSharp Include="FSharp.Editor" />
<InternalsVisibleToFSharp Include="FSharp.LanguageService" />
</ItemGroup>
<ItemGroup>
<Reference Include="envdte, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
Expand Down
2 changes: 2 additions & 0 deletions src/VisualStudio/Core/Impl/ServicesVisualStudioImpl.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
<InternalsVisibleToTest Include="Roslyn.VisualStudio.Services.UnitTests" />
<InternalsVisibleToTypeScript Include="Microsoft.VisualStudio.LanguageServices.TypeScript" />
<InternalsVisibleToTypeScript Include="Microsoft.CodeAnalysis.TypeScript.EditorFeatures" />
<InternalsVisibleToFSharp Include="FSharp.Editor" />
<InternalsVisibleToFSharp Include="FSharp.LanguageService" />
</ItemGroup>
<ItemGroup>
<Reference Include="envdte, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
Expand Down
10 changes: 10 additions & 0 deletions src/Workspaces/Core/Portable/Diagnostics/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeFixes;
Expand Down Expand Up @@ -57,6 +58,15 @@ public static DiagnosticData ToDiagnosticData(this Diagnostic diagnostic, Projec
return DiagnosticData.Create(project.GetDocument(diagnostic.Location.SourceTree), diagnostic);
}

if (diagnostic.Location.Kind == LocationKind.ExternalFile)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may affect TypeScript. Can we check to make sure we don't get duplicated errors for TS issues? @vladima can also probably show you how to make a project level error to hit this codepath.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is only called by the SuggestActionProviders (through codeFix.GetPrimaryDiagnosticData()) and so TypeScript shouldn't be affected.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{
var document = project.Documents.FirstOrDefault(d => d.FilePath == diagnostic.Location.GetLineSpan().Path);
if (document != null)
{
return DiagnosticData.Create(document, diagnostic);
}
}

return DiagnosticData.Create(project, diagnostic);
}

Expand Down