Skip to content

Commit 87c4f5e

Browse files
author
Kevin Ransom
committed
Make cross language project references work when references are built
1 parent 1adf07b commit 87c4f5e

File tree

4 files changed

+25
-17
lines changed

4 files changed

+25
-17
lines changed

vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs

+5-5
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ open Microsoft.VisualStudio.Shell
3535
open Microsoft.VisualStudio.Shell.Interop
3636
open Microsoft.VisualStudio.ComponentModelHost
3737

38-
// Exposes FSharpChecker as MEF export
38+
/// Exposes FSharpChecker as MEF export
3939
[<Export(typeof<FSharpCheckerProvider>); Composition.Shared>]
4040
type internal FSharpCheckerProvider
4141
[<ImportingConstructor>]
@@ -82,10 +82,10 @@ type internal FSharpCheckerProvider
8282

8383

8484
/// Exposes FCS FSharpProjectOptions information management as MEF component.
85-
//
86-
// This service allows analyzers to get an appropriate FSharpProjectOptions value for a project or single file.
87-
// It also allows a 'cheaper' route to get the project options relevant to parsing (e.g. the #define values).
88-
// The main entrypoints are TryGetOptionsForDocumentOrProject and TryGetOptionsForEditingDocumentOrProject.
85+
///
86+
/// This service allows analyzers to get an appropriate FSharpProjectOptions value for a project or single file.
87+
/// It also allows a 'cheaper' route to get the project options relevant to parsing (e.g. the #define values).
88+
/// The main entrypoints are TryGetOptionsForDocumentOrProject and TryGetOptionsForEditingDocumentOrProject.
8989
[<Export(typeof<FSharpProjectOptionsManager>); Composition.Shared>]
9090
type internal FSharpProjectOptionsManager
9191
[<ImportingConstructor>]

vsintegration/src/FSharp.LanguageService/FSharp.LanguageService.fsproj

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
<GeneratedModuleName>Microsoft.VisualStudio.FSharp.LanguageService.Strings</GeneratedModuleName>
6868
</EmbeddedResource>
6969
<Compile Include="AssemblyInfo.fs" />
70+
<Compile Include="LanguageServiceConstants.fs" />
7071
<Compile Include="Error.fs" />
7172
<Compile Include="Vs.fs" />
7273
<Compile Include="Colorize.fs" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
2+
3+
namespace Microsoft.VisualStudio.FSharp.LanguageService
4+
5+
[<RequireQualifiedAccess>]
6+
module internal LanguageServiceConstants =
7+
8+
/// "F#"
9+
[<Literal>]
10+
let FSharpLanguageName = "F#"

vsintegration/src/FSharp.LanguageService/ProjectSitesAndFiles.fs

+9-12
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,20 @@ module internal rec Microsoft.VisualStudio.FSharp.LanguageService.SiteProvider
3434

3535
open System
3636
open System.Collections.Concurrent
37-
open System.ComponentModel.Composition
38-
open System.IO
3937
open System.Diagnostics
40-
open Microsoft.VisualStudio
41-
open Microsoft.VisualStudio.TextManager.Interop
42-
open Microsoft.VisualStudio.Shell.Interop
43-
open Microsoft.FSharp.Compiler.SourceCodeServices
38+
open System.IO
4439

4540
open Microsoft.CodeAnalysis
46-
open Microsoft.VisualStudio.LanguageServices
41+
open Microsoft.FSharp.Compiler.SourceCodeServices
42+
43+
open Microsoft.VisualStudio
44+
open Microsoft.VisualStudio.FSharp.LanguageService
4745
open Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem
4846
open Microsoft.VisualStudio.LanguageServices.Implementation.TaskList
49-
open VSLangProj
50-
open System.ComponentModel.Composition.Primitives
51-
open Microsoft.VisualStudio.Shell
52-
open System.Collections.Immutable
47+
open Microsoft.VisualStudio.Shell.Interop
48+
open Microsoft.VisualStudio.TextManager.Interop
5349

50+
open VSLangProj
5451

5552
/// An additional interface that an IProjectSite object can implement to indicate it has an FSharpProjectOptions
5653
/// already available, so we don't have to recreate it
@@ -274,7 +271,7 @@ type internal ProjectSitesAndFiles() =
274271
if not (isNull project) then
275272
for reference in project.ProjectReferences do
276273
let project = workspace.CurrentSolution.GetProject(reference.ProjectId)
277-
if not (isNull project) then
274+
if not (isNull project) && project.Language = LanguageServiceConstants.FSharpLanguageName then
278275
let siteProvider = provideProjectSiteProvider (workspace, project, serviceProvider, projectOptionsTable)
279276
let referenceProject = workspace.ProjectTracker.GetProject(reference.ProjectId)
280277
let outputPath = referenceProject.BinOutputPath

0 commit comments

Comments
 (0)