Skip to content

Commit a5510fb

Browse files
TIHanbrettfo
authored andcommitted
Roslyn Shim - First Phase (#6498)
* Trying to use shim * Removed contenttypelangservice, it's in externalaccess now * Added namespace * Added diagnosticanalyzerservice shim * Using Brace matching from external access * Using VSWorkspace extensions * More apis * Using shim for IEditorFormattingService * More apis * More shims * Updating shim * Update VisualFSharp.UnitTests.fsproj * Fixed api call * Fix debugging * Fixed unit test fsproj, find all refs shimmed * Change analyserservice * Fixed build * Updating shim with FSharp prefixes * Fixing glyph helpers * Fixing typemap * Update fsi.fsproj * Update Versions.props * Update RoslynPackageVersion.txt * Update prim-lexing.fs * Update prim-lexing.fs * Update fsi.fsproj * Update fsi.fsproj * Update VisualFSharp.UnitTests.fsproj * Update CompletionProvider.fs * Fixed package
1 parent 69539f2 commit a5510fb

27 files changed

+92
-76
lines changed

RoslynPackageVersion.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0.0-beta4-19170-01
1+
3.1.0-beta3-19222-02

eng/Versions.props

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
https://api.nuget.org/v3/index.json;
5252
https://dotnet.myget.org/F/roslyn/api/v3/index.json;
5353
https://dotnet.myget.org/F/symreader-converter/api/v3/index.json;
54+
https://dotnet.myget.org/F/interactive-window/api/v3/index.json;
5455
https://myget.org/F/vs-devcore/api/v3/index.json;
5556
https://myget.org/F/vs-editor/api/v3/index.json;
5657
https://vside.myget.org/F/vssdk/api/v3/index.json;

vsintegration/src/FSharp.Editor/Classification/ClassificationService.fs

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ open Microsoft.CodeAnalysis.Classification
1313
open Microsoft.CodeAnalysis.Editor
1414
open Microsoft.CodeAnalysis.Host.Mef
1515
open Microsoft.CodeAnalysis.Text
16+
open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Classification
1617

1718
// IEditorClassificationService is marked as Obsolete, but is still supported. The replacement (IClassificationService)
1819
// is internal to Microsoft.CodeAnalysis.Workspaces which we don't have internals visible to. Rather than add yet another
@@ -21,7 +22,7 @@ open Microsoft.CodeAnalysis.Text
2122

2223
open FSharp.Compiler.SourceCodeServices
2324

24-
[<ExportLanguageService(typeof<IEditorClassificationService>, FSharpConstants.FSharpLanguageName)>]
25+
[<Export(typeof<IFSharpClassificationService>)>]
2526
type internal FSharpClassificationService
2627
[<ImportingConstructor>]
2728
(
@@ -30,7 +31,7 @@ type internal FSharpClassificationService
3031
) =
3132
static let userOpName = "SemanticColorization"
3233

33-
interface IEditorClassificationService with
34+
interface IFSharpClassificationService with
3435
// Do not perform classification if we don't have project options (#defines matter)
3536
member __.AddLexicalClassifications(_: SourceText, _: TextSpan, _: List<ClassifiedSpan>, _: CancellationToken) = ()
3637

vsintegration/src/FSharp.Editor/CodeLens/CodeLensProvider.fs

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ open Microsoft.VisualStudio.Text.Classification
1919
open Microsoft.VisualStudio.ComponentModelHost
2020
open System.Threading
2121
open Microsoft.VisualStudio.FSharp.Editor.Logging
22+
open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor.Shared.Utilities
2223

2324
[<Export(typeof<IWpfTextViewCreationListener>)>]
2425
[<Export(typeof<IViewTaggerProvider>)>]
@@ -32,7 +33,7 @@ type internal CodeLensProvider
3233
textDocumentFactory: ITextDocumentFactoryService,
3334
checkerProvider: FSharpCheckerProvider,
3435
projectInfoManager: FSharpProjectOptionsManager,
35-
typeMap : ClassificationTypeMap Lazy,
36+
typeMap : FSharpClassificationTypeMap Lazy,
3637
settings: EditorOptions
3738
) =
3839

vsintegration/src/FSharp.Editor/CodeLens/FSharpCodeLensService.fs

+5-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ open Microsoft.CodeAnalysis
1515
open Microsoft.CodeAnalysis.Editor.Shared.Extensions
1616
open Microsoft.CodeAnalysis.Editor.Shared.Utilities
1717
open Microsoft.CodeAnalysis.Classification
18+
open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Classification
1819

1920
open FSharp.Compiler
2021
open FSharp.Compiler.Ast
@@ -31,6 +32,8 @@ open Microsoft.VisualStudio.Text.Formatting
3132

3233
open Internal.Utilities.StructuredFormat
3334

35+
open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor.Shared.Utilities
36+
3437
type internal CodeLens(taggedText, computed, fullTypeSignature, uiElement) =
3538
member val TaggedText: Async<(ResizeArray<Layout.TaggedText> * QuickInfoNavigation) option> = taggedText
3639
member val Computed: bool = computed with get, set
@@ -46,7 +49,7 @@ type internal FSharpCodeLensService
4649
checker: FSharpChecker,
4750
projectInfoManager: FSharpProjectOptionsManager,
4851
classificationFormatMapService: IClassificationFormatMapService,
49-
typeMap: Lazy<ClassificationTypeMap>,
52+
typeMap: Lazy<FSharpClassificationTypeMap>,
5053
codeLens : CodeLensDisplayService,
5154
settings: EditorOptions
5255
) as self =
@@ -78,7 +81,7 @@ type internal FSharpCodeLensService
7881
let layoutTagToFormatting (layoutTag: LayoutTag) =
7982
layoutTag
8083
|> RoslynHelpers.roslynTag
81-
|> ClassificationTags.GetClassificationTypeName
84+
|> FSharpClassificationTags.GetClassificationTypeName
8285
|> typeMap.Value.GetClassificationType
8386
|> formatMap.Value.GetTextProperties
8487

vsintegration/src/FSharp.Editor/Common/ContentType.fs

+1-8
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ open System.ComponentModel.Composition
66

77
open Microsoft.CodeAnalysis.Editor
88
open Microsoft.VisualStudio.Utilities
9+
open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor
910

1011
module FSharpStaticTypeDefinitions =
1112
[<Export>]
@@ -17,11 +18,3 @@ module FSharpStaticTypeDefinitions =
1718
[<Name(FSharpConstants.FSharpSignatureHelpContentTypeName)>]
1819
[<BaseDefinition("sighelp")>]
1920
let FSharpSignatureHelpContentTypeDefinition = ContentTypeDefinition()
20-
21-
[<ExportContentTypeLanguageService(FSharpConstants.FSharpContentTypeName, FSharpConstants.FSharpLanguageName)>]
22-
type FSharpContentType [<System.Composition.ImportingConstructor>](contentTypeRegistry : IContentTypeRegistryService) =
23-
member this.contentTypeRegistryService = contentTypeRegistry
24-
25-
interface IContentTypeLanguageService with
26-
member this.GetDefaultContentType() =
27-
this.contentTypeRegistryService.GetContentType(FSharpConstants.FSharpContentTypeName)

vsintegration/src/FSharp.Editor/Common/Extensions.fs

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ open Microsoft.CodeAnalysis.Host
1111
open FSharp.Compiler.Text
1212
open FSharp.Compiler.Ast
1313
open FSharp.Compiler.SourceCodeServices
14+
open Microsoft.CodeAnalysis.ExternalAccess.FSharp
15+
16+
type private FSharpGlyph = FSharp.Compiler.SourceCodeServices.FSharpGlyph
17+
type private Glyph = Microsoft.CodeAnalysis.ExternalAccess.FSharp.FSharpGlyph
1418

1519

1620
type Path with

vsintegration/src/FSharp.Editor/Common/RoslynHelpers.fs

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ open FSharp.Compiler.Layout
1515
open FSharp.Compiler.SourceCodeServices
1616
open FSharp.Compiler.Range
1717
open Microsoft.VisualStudio.FSharp.Editor.Logging
18+
open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Diagnostics
1819

1920
[<RequireQualifiedAccess>]
2021
module internal RoslynHelpers =
@@ -149,7 +150,7 @@ module internal RoslynHelpers =
149150
let severity = if error.Severity = FSharpErrorSeverity.Error then DiagnosticSeverity.Error else DiagnosticSeverity.Warning
150151
let customTags =
151152
match error.ErrorNumber with
152-
| 1182 -> DiagnosticCustomTags.Unnecessary
153+
| 1182 -> FSharpDiagnosticCustomTags.Unnecessary
153154
| _ -> null
154155
let descriptor = new DiagnosticDescriptor(id, emptyString, description, error.Subcategory, severity, true, emptyString, String.Empty, customTags)
155156
Diagnostic.Create(descriptor, location)

vsintegration/src/FSharp.Editor/Completion/CompletionProvider.fs

+2-2
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ type internal FSharpCompletionProvider
156156
| _, idents -> Array.last idents
157157

158158
let completionItem =
159-
CommonCompletionItem.Create(name, null, glyph = Nullable glyph, rules = getRules intellisenseOptions.ShowAfterCharIsTyped, filterText = filterText)
159+
CommonCompletionItem.Create(name, null, rules = getRules intellisenseOptions.ShowAfterCharIsTyped, glyph = Nullable (Microsoft.CodeAnalysis.ExternalAccess.FSharp.FSharpGlyphHelpersObsolete.Convert(glyph)), filterText = filterText)
160160
.AddProperty(FullNamePropName, declarationItem.FullName)
161161

162162
let completionItem =
@@ -303,4 +303,4 @@ type internal FSharpCompletionProvider
303303
}
304304
|> Async.map (Option.defaultValue (CompletionChange.Create(TextChange(item.Span, nameInCode))))
305305

306-
} |> RoslynHelpers.StartAsyncAsTask cancellationToken
306+
} |> RoslynHelpers.StartAsyncAsTask cancellationToken

vsintegration/src/FSharp.Editor/Completion/FileSystemCompletion.fs

+2-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ type internal HashDirectiveCompletionProvider(workspace: Workspace, projectInfoM
129129
rules)
130130

131131
let pathThroughLastSlash = getPathThroughLastSlash(text, position, quotedPathGroup)
132-
context.AddItems(helper.GetItems(pathThroughLastSlash, ct))
132+
let! items = helper.GetItemsAsync(pathThroughLastSlash, ct) |> Async.AwaitTask |> liftAsync
133+
context.AddItems(items)
133134
}
134135
|> Async.Ignore
135136
|> RoslynHelpers.StartAsyncUnitAsTask context.CancellationToken

vsintegration/src/FSharp.Editor/Debugging/BreakpointResolutionService.fs

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ open Microsoft.CodeAnalysis
1313
open Microsoft.CodeAnalysis.Editor.Implementation.Debugging
1414
open Microsoft.CodeAnalysis.Host.Mef
1515
open Microsoft.CodeAnalysis.Text
16+
open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor.Implementation.Debugging
1617

1718
open FSharp.Compiler.SourceCodeServices
1819
open FSharp.Compiler.Range
1920

20-
[<Shared>]
21-
[<ExportLanguageService(typeof<IBreakpointResolutionService>, FSharpConstants.FSharpLanguageName)>]
21+
[<Export(typeof<IFSharpBreakpointResolutionService>)>]
2222
type internal FSharpBreakpointResolutionService
2323
[<ImportingConstructor>]
2424
(
@@ -41,18 +41,18 @@ type internal FSharpBreakpointResolutionService
4141
return parseResults.ValidateBreakpointLocation(mkPos fcsTextLineNumber textLineColumn)
4242
}
4343

44-
interface IBreakpointResolutionService with
45-
member this.ResolveBreakpointAsync(document: Document, textSpan: TextSpan, cancellationToken: CancellationToken): Task<BreakpointResolutionResult> =
44+
interface IFSharpBreakpointResolutionService with
45+
member this.ResolveBreakpointAsync(document: Document, textSpan: TextSpan, cancellationToken: CancellationToken): Task<FSharpBreakpointResolutionResult> =
4646
asyncMaybe {
4747
let! parsingOptions, _options = projectInfoManager.TryGetOptionsForEditingDocumentOrProject(document, cancellationToken)
4848
let! sourceText = document.GetTextAsync(cancellationToken)
4949
let! range = FSharpBreakpointResolutionService.GetBreakpointLocation(checkerProvider.Checker, sourceText, document.Name, textSpan, parsingOptions)
5050
let! span = RoslynHelpers.TryFSharpRangeToTextSpan(sourceText, range)
51-
return BreakpointResolutionResult.CreateSpanResult(document, span)
51+
return FSharpBreakpointResolutionResult.CreateSpanResult(document, span)
5252
}
5353
|> Async.map Option.toObj
5454
|> RoslynHelpers.StartAsyncAsTask cancellationToken
5555

5656
// FSROSLYNTODO: enable placing breakpoints by when user supplies fully-qualified function names
57-
member this.ResolveBreakpointsAsync(_, _, _): Task<IEnumerable<BreakpointResolutionResult>> =
58-
Task.FromResult(Enumerable.Empty<BreakpointResolutionResult>())
57+
member this.ResolveBreakpointsAsync(_, _, _): Task<IEnumerable<FSharpBreakpointResolutionResult>> =
58+
Task.FromResult(Enumerable.Empty<FSharpBreakpointResolutionResult>())

vsintegration/src/FSharp.Editor/Debugging/LanguageDebugInfoService.fs

+8-8
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ open Microsoft.CodeAnalysis.Classification
1313
open Microsoft.CodeAnalysis.Editor.Implementation.Debugging
1414
open Microsoft.CodeAnalysis.Host.Mef
1515
open Microsoft.CodeAnalysis.Text
16+
open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor.Implementation.Debugging
1617

1718
open FSharp.Compiler
1819

19-
[<Shared>]
20-
[<ExportLanguageService(typeof<ILanguageDebugInfoService>, FSharpConstants.FSharpLanguageName)>]
20+
[<Export(typeof<IFSharpLanguageDebugInfoService>)>]
2121
type internal FSharpLanguageDebugInfoService [<ImportingConstructor>](projectInfoManager: FSharpProjectOptionsManager) =
2222

2323
static member GetDataTipInformation(sourceText: SourceText, position: int, tokens: List<ClassifiedSpan>): TextSpan option =
@@ -44,13 +44,13 @@ type internal FSharpLanguageDebugInfoService [<ImportingConstructor>](projectInf
4444

4545
| _ -> None
4646

47-
interface ILanguageDebugInfoService with
47+
interface IFSharpLanguageDebugInfoService with
4848

4949
// FSROSLYNTODO: This is used to get function names in breakpoint window. It should return fully qualified function name and line offset from the start of the function.
50-
member this.GetLocationInfoAsync(_, _, _): Task<DebugLocationInfo> =
51-
Task.FromResult(Unchecked.defaultof<DebugLocationInfo>)
50+
member this.GetLocationInfoAsync(_, _, _): Task<FSharpDebugLocationInfo> =
51+
Task.FromResult(Unchecked.defaultof<FSharpDebugLocationInfo>)
5252

53-
member this.GetDataTipInfoAsync(document: Document, position: int, cancellationToken: CancellationToken): Task<DebugDataTipInfo> =
53+
member this.GetDataTipInfoAsync(document: Document, position: int, cancellationToken: CancellationToken): Task<FSharpDebugDataTipInfo> =
5454
async {
5555
let defines = projectInfoManager.GetCompilationDefinesForEditingDocument(document)
5656
let! cancellationToken = Async.CancellationToken
@@ -59,8 +59,8 @@ type internal FSharpLanguageDebugInfoService [<ImportingConstructor>](projectInf
5959
let classifiedSpans = Tokenizer.getClassifiedSpans(document.Id, sourceText, textSpan, Some(document.Name), defines, cancellationToken)
6060
let result =
6161
match FSharpLanguageDebugInfoService.GetDataTipInformation(sourceText, position, classifiedSpans) with
62-
| None -> DebugDataTipInfo()
63-
| Some textSpan -> DebugDataTipInfo(textSpan, sourceText.GetSubText(textSpan).ToString())
62+
| None -> FSharpDebugDataTipInfo()
63+
| Some textSpan -> FSharpDebugDataTipInfo(textSpan, sourceText.GetSubText(textSpan).ToString())
6464
return result
6565
}
6666
|> RoslynHelpers.StartAsyncAsTask(cancellationToken)

vsintegration/src/FSharp.Editor/Diagnostics/DocumentDiagnosticAnalyzer.fs

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ open System.Threading.Tasks
1111
open Microsoft.CodeAnalysis
1212
open Microsoft.CodeAnalysis.Diagnostics
1313
open Microsoft.CodeAnalysis.Text
14+
open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Diagnostics
1415

1516
open FSharp.Compiler
1617
open FSharp.Compiler.SourceCodeServices

vsintegration/src/FSharp.Editor/Diagnostics/SimplifyNameDiagnosticAnalyzer.fs

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ open FSharp.Compiler
1515
open FSharp.Compiler.Range
1616
open FSharp.Compiler.SourceCodeServices
1717
open System.Runtime.Caching
18+
open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Diagnostics
1819

1920
type private TextVersionHash = int
2021
type private PerDocumentSavedData = { Hash: int; Diagnostics: ImmutableArray<Diagnostic> }
@@ -39,7 +40,7 @@ type internal SimplifyNameDiagnosticAnalyzer() =
3940
category = DiagnosticCategory.Style,
4041
defaultSeverity = DiagnosticSeverity.Hidden,
4142
isEnabledByDefault = true,
42-
customTags = DiagnosticCustomTags.Unnecessary)
43+
customTags = FSharpDiagnosticCustomTags.Unnecessary)
4344

4445
static member LongIdentPropertyKey = "FullName"
4546
override __.Priority = 100 // Default = 50

vsintegration/src/FSharp.Editor/Diagnostics/UnusedDeclarationsAnalyzer.fs

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ open System.Threading.Tasks
1111
open Microsoft.CodeAnalysis
1212
open Microsoft.CodeAnalysis.Diagnostics
1313
open FSharp.Compiler.SourceCodeServices
14+
open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Diagnostics
1415

1516
[<DiagnosticAnalyzer(FSharpConstants.FSharpLanguageName)>]
1617
type internal UnusedDeclarationsAnalyzer() =
@@ -29,7 +30,7 @@ type internal UnusedDeclarationsAnalyzer() =
2930
category = DiagnosticCategory.Style,
3031
defaultSeverity = DiagnosticSeverity.Hidden,
3132
isEnabledByDefault = true,
32-
customTags = DiagnosticCustomTags.Unnecessary)
33+
customTags = FSharpDiagnosticCustomTags.Unnecessary)
3334

3435
let isPotentiallyUnusedDeclaration (symbol: FSharpSymbol) : bool =
3536
match symbol with

vsintegration/src/FSharp.Editor/Diagnostics/UnusedOpensDiagnosticAnalyzer.fs

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ open FSharp.Compiler.Ast
1616
open FSharp.Compiler.Range
1717
open FSharp.Compiler.SourceCodeServices
1818
open Microsoft.VisualStudio.FSharp.Editor.Symbols
19+
open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Diagnostics
1920

2021
[<DiagnosticAnalyzer(FSharpConstants.FSharpLanguageName)>]
2122
type internal UnusedOpensDiagnosticAnalyzer() =
@@ -33,7 +34,7 @@ type internal UnusedOpensDiagnosticAnalyzer() =
3334
category = DiagnosticCategory.Style,
3435
defaultSeverity = DiagnosticSeverity.Hidden,
3536
isEnabledByDefault = true,
36-
customTags = DiagnosticCustomTags.Unnecessary)
37+
customTags = FSharpDiagnosticCustomTags.Unnecessary)
3738

3839
override __.Priority = 90 // Default = 50
3940
override __.SupportedDiagnostics = ImmutableArray.Create Descriptor

vsintegration/src/FSharp.Editor/FSharp.Editor.fsproj

+1
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@
136136
<PackageReference Include="Microsoft.CodeAnalysis.EditorFeatures.Text" Version="$(MicrosoftCodeAnalysisEditorFeaturesTextPackageVersion)" PrivateAssets="all" ExcludeAssets="runtime;contentFiles;build;analyzers;native" />
137137
<PackageReference Include="Microsoft.CodeAnalysis.EditorFeatures.Wpf" Version="$(MicrosoftCodeAnalysisEditorFeaturesWpfPackageVersion)" PrivateAssets="all" ExcludeAssets="runtime;contentFiles;build;analyzers;native" />
138138
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="$(MicrosoftCodeAnalysisWorkspacesCommonPackageVersion)" PrivateAssets="all" ExcludeAssets="runtime;contentFiles;build;analyzers;native" />
139+
<PackageReference Include="Microsoft.CodeAnalysis.ExternalAccess.FSharp" Version="$(MicrosoftCodeAnalysisWorkspacesCommonPackageVersion)" PrivateAssets="all" ExcludeAssets="runtime;contentFiles;build;analyzers;native" />
139140
<PackageReference Include="Microsoft.Composition" Version="$(MicrosoftCompositionPackageVersion)" PrivateAssets="all" ExcludeAssets="runtime;contentFiles;build;analyzers;native" />
140141
<PackageReference Include="Microsoft.VisualStudio.ComponentModelHost" Version="$(MicrosoftVisualStudioComponentModelHostPackageVersion)" PrivateAssets="all" ExcludeAssets="runtime;contentFiles;build;analyzers;native" />
141142
<PackageReference Include="Microsoft.VisualStudio.Editor" Version="$(MicrosoftVisualStudioEditorPackageVersion)" PrivateAssets="all" ExcludeAssets="runtime;contentFiles;build;analyzers;native" />

vsintegration/src/FSharp.Editor/Formatting/BraceMatchingService.fs

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ open Microsoft.CodeAnalysis.Text
77
open Microsoft.CodeAnalysis.Editor
88
open FSharp.Compiler.SourceCodeServices
99
open System.Runtime.InteropServices
10+
open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor
1011

11-
[<ExportBraceMatcher(FSharpConstants.FSharpLanguageName)>]
12+
[<Export(typeof<IFSharpBraceMatcher>)>]
1213
type internal FSharpBraceMatchingService
1314
[<ImportingConstructor>]
1415
(
@@ -33,15 +34,15 @@ type internal FSharpBraceMatchingService
3334
return matchedBraces |> Array.tryFind(fun (left, right) -> isPositionInRange left || isPositionInRange right)
3435
}
3536

36-
interface IBraceMatcher with
37+
interface IFSharpBraceMatcher with
3738
member this.FindBracesAsync(document, position, cancellationToken) =
3839
asyncMaybe {
3940
let! parsingOptions, _options = projectInfoManager.TryGetOptionsForEditingDocumentOrProject(document, cancellationToken)
4041
let! sourceText = document.GetTextAsync(cancellationToken)
4142
let! (left, right) = FSharpBraceMatchingService.GetBraceMatchingResult(checkerProvider.Checker, sourceText, document.Name, parsingOptions, position, defaultUserOpName)
4243
let! leftSpan = RoslynHelpers.TryFSharpRangeToTextSpan(sourceText, left)
4344
let! rightSpan = RoslynHelpers.TryFSharpRangeToTextSpan(sourceText, right)
44-
return BraceMatchingResult(leftSpan, rightSpan)
45+
return FSharpBraceMatchingResult(leftSpan, rightSpan)
4546
}
4647
|> Async.map Option.toNullable
4748
|> RoslynHelpers.StartAsyncAsTask cancellationToken

vsintegration/src/FSharp.Editor/Formatting/EditorFormattingService.fs

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ open Microsoft.CodeAnalysis.Editor
1010
open Microsoft.CodeAnalysis.Formatting
1111
open Microsoft.CodeAnalysis.Host.Mef
1212
open Microsoft.CodeAnalysis.Text
13+
open Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor
1314

1415
open FSharp.Compiler.SourceCodeServices
1516
open System.Threading
1617
open System.Windows.Forms
1718

18-
[<Shared>]
19-
[<ExportLanguageService(typeof<IEditorFormattingService>, FSharpConstants.FSharpLanguageName)>]
19+
[<Export(typeof<IFSharpEditorFormattingService>)>]
2020
type internal FSharpEditorFormattingService
2121
[<ImportingConstructor>]
2222
(
@@ -170,7 +170,7 @@ type internal FSharpEditorFormattingService
170170
return toIList Seq.empty
171171
}
172172

173-
interface IEditorFormattingService with
173+
interface IFSharpEditorFormattingService with
174174
member val SupportsFormatDocument = false
175175
member val SupportsFormatSelection = false
176176
member val SupportsFormatOnPaste = true

0 commit comments

Comments
 (0)