Skip to content

Commit 73cdc50

Browse files
author
Omar Tawfik
committed
Adding back editor factories?
1 parent 3866b77 commit 73cdc50

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

vsintegration/VisualFSharpVsix/VisualFSharpVsix.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
<VSSDKTargetPlatformRegRootSuffix>$(VSRootSuffix)</VSSDKTargetPlatformRegRootSuffix>
7272
</PropertyGroup>
7373
<ItemGroup>
74+
<Content Include="RegisterFsharpPackage.pkgdef" />
7475
<None Include="Source.extension.vsixmanifest">
7576
<SubType>Designer</SubType>
7677
</None>

vsintegration/src/FSharp.LanguageService/FSharpCommonConstants.fs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ module internal FSharpCommonConstants =
1212
[<Literal>]
1313
let languageServiceGuidString = "BC6DD5A5-D4D6-4dab-A00D-A51242DBAF1B"
1414
[<Literal>]
15+
let editorFactoryGuidString = "4EB7CCB7-4336-4FFD-B12B-396E9FD079A9"
16+
[<Literal>]
17+
let codePageEditorFactoryGuidString = "82A16493-EF43-47E0-B42D-D87BAAB5335D"
18+
[<Literal>]
1519
let svsSettingsPersistenceManagerGuidString = "9B164E40-C3A2-4363-9BC5-EB4039DEF653"
1620
[<Literal>]
1721
let FSharpLanguageName = "F#"

vsintegration/src/FSharp.LanguageService/FSharpLanguageService.fs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,18 @@ type internal FSharpLanguageService(package : FSharpPackage) =
7171
| _ -> ()
7272
| _ -> ()
7373

74-
and
75-
[<ProvideLanguageService(FSharpCommonConstants.languageServiceGuidString, FSharpCommonConstants.FSharpContentTypeName, 1)>]
74+
and [<Guid(FSharpCommonConstants.editorFactoryGuidString)>]
75+
internal FSharpEditorFactory(package : FSharpPackage) =
76+
inherit AbstractEditorFactory(package)
77+
78+
override this.ContentTypeName = FSharpCommonConstants.FSharpContentTypeName
79+
override this.GetFormattedTextChanges(_, _, _, _) = upcast Array.empty
80+
81+
and [<Guid(FSharpCommonConstants.codePageEditorFactoryGuidString)>]
82+
internal FSharpCodePageEditorFactory(editorFactory: FSharpEditorFactory) =
83+
inherit AbstractCodePageEditorFactory(editorFactory)
84+
85+
and [<ProvideLanguageService(FSharpCommonConstants.languageServiceGuidString, FSharpCommonConstants.FSharpContentTypeName, 1)>]
7686
[<Guid(FSharpCommonConstants.packageGuidString)>]
7787
internal FSharpPackage() =
7888
inherit AbstractPackage<FSharpPackage, FSharpLanguageService, FSharpProjectSite>()
@@ -87,7 +97,14 @@ and
8797

8898
override this.CreateLanguageService() = new FSharpLanguageService(this)
8999

90-
override this.CreateEditorFactories() = Seq.empty<IVsEditorFactory>
100+
override this.CreateEditorFactories() =
101+
let editorFactory = new FSharpEditorFactory(this)
102+
let codePageEditorFactory = new FSharpCodePageEditorFactory(editorFactory)
103+
104+
[|
105+
editorFactory :> IVsEditorFactory;
106+
codePageEditorFactory :> IVsEditorFactory;
107+
|] :> seq<IVsEditorFactory>
91108

92109
override this.RegisterMiscellaneousFilesWorkspaceInformation(_) = ()
93110

0 commit comments

Comments
 (0)