Skip to content

Commit 9a6ac3d

Browse files
majochaKevinRansom
authored andcommitted
Settings store and Text Editor option pages (dotnet#2805)
* settings store and editor options * show CLIMutable record use, guid constants * saner composition * fix CompletionProvider tests * fix public surface area * localization * move xaml into separate project * updated vsintegration readme * correct type in change handler * use Newtonsoft's PopulateObject for cheap schema evolution * cleanup added project * Revert "cleanup added project" This reverts commit 163ebda. * cleanup, another attempt
1 parent dc6f54e commit 9a6ac3d

33 files changed

+928
-75
lines changed

VisualFSharp.sln

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 15
4-
VisualStudioVersion = 15.0.26206.0
4+
VisualStudioVersion = 15.0.26403.0
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler", "src\fsharp\FSharp.Compiler\FSharp.Compiler.fsproj", "{2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}"
77
EndProject
@@ -136,6 +136,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Utils", "Utils", "{D086C8C6
136136
EndProject
137137
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "LanguageServiceProfiling", "vsintegration\Utils\LanguageServiceProfiling\LanguageServiceProfiling.fsproj", "{E7FA3A71-51AF-4FCA-9C2F-7C853E515903}"
138138
EndProject
139+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FSharp.UIResources", "vsintegration\src\FSharp.UIResources\FSharp.UIResources.csproj", "{C4586A06-1402-48BC-8E35-A1B8642F895B}"
140+
EndProject
139141
Global
140142
GlobalSection(SolutionConfigurationPlatforms) = preSolution
141143
Debug|Any CPU = Debug|Any CPU
@@ -749,6 +751,18 @@ Global
749751
{E7FA3A71-51AF-4FCA-9C2F-7C853E515903}.Release|Any CPU.Build.0 = Release|Any CPU
750752
{E7FA3A71-51AF-4FCA-9C2F-7C853E515903}.Release|x86.ActiveCfg = Release|Any CPU
751753
{E7FA3A71-51AF-4FCA-9C2F-7C853E515903}.Release|x86.Build.0 = Release|Any CPU
754+
{C4586A06-1402-48BC-8E35-A1B8642F895B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
755+
{C4586A06-1402-48BC-8E35-A1B8642F895B}.Debug|Any CPU.Build.0 = Debug|Any CPU
756+
{C4586A06-1402-48BC-8E35-A1B8642F895B}.Debug|x86.ActiveCfg = Debug|Any CPU
757+
{C4586A06-1402-48BC-8E35-A1B8642F895B}.Debug|x86.Build.0 = Debug|Any CPU
758+
{C4586A06-1402-48BC-8E35-A1B8642F895B}.Proto|Any CPU.ActiveCfg = Proto|Any CPU
759+
{C4586A06-1402-48BC-8E35-A1B8642F895B}.Proto|Any CPU.Build.0 = Proto|Any CPU
760+
{C4586A06-1402-48BC-8E35-A1B8642F895B}.Proto|x86.ActiveCfg = Proto|Any CPU
761+
{C4586A06-1402-48BC-8E35-A1B8642F895B}.Proto|x86.Build.0 = Proto|Any CPU
762+
{C4586A06-1402-48BC-8E35-A1B8642F895B}.Release|Any CPU.ActiveCfg = Release|Any CPU
763+
{C4586A06-1402-48BC-8E35-A1B8642F895B}.Release|Any CPU.Build.0 = Release|Any CPU
764+
{C4586A06-1402-48BC-8E35-A1B8642F895B}.Release|x86.ActiveCfg = Release|Any CPU
765+
{C4586A06-1402-48BC-8E35-A1B8642F895B}.Release|x86.Build.0 = Release|Any CPU
752766
EndGlobalSection
753767
GlobalSection(SolutionProperties) = preSolution
754768
HideSolutionNode = FALSE
@@ -811,5 +825,6 @@ Global
811825
{2E60864A-E3FF-4BCC-810F-DC7C34E6B236} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449}
812826
{D086C8C6-D00D-4C3B-9AB2-A4286C9F5922} = {4C7B48D7-19AF-4AE7-9D1D-3BB289D5480D}
813827
{E7FA3A71-51AF-4FCA-9C2F-7C853E515903} = {D086C8C6-D00D-4C3B-9AB2-A4286C9F5922}
828+
{C4586A06-1402-48BC-8E35-A1B8642F895B} = {4C7B48D7-19AF-4AE7-9D1D-3BB289D5480D}
814829
EndGlobalSection
815830
EndGlobal

src/update.cmd

+2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ rem Disable strong-name validation for F# binaries built from open source that a
5656
%SN32% -q -Vr FSharp.Compiler,b03f5f7f11d50a3a
5757
%SN32% -q -Vr FSharp.Compiler.Server.Shared,b03f5f7f11d50a3a
5858
%SN32% -q -Vr FSharp.Editor,b03f5f7f11d50a3a
59+
%SN32% -q -Vr FSharp.UIResources,b03f5f7f11d50a3a
5960
%SN32% -q -Vr FSharp.LanguageService,b03f5f7f11d50a3a
6061
%SN32% -q -Vr FSharp.LanguageService.Base,b03f5f7f11d50a3a
6162
%SN32% -q -Vr FSharp.LanguageService.Compiler,b03f5f7f11d50a3a
@@ -81,6 +82,7 @@ if /i "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
8182
%SN64% -q -Vr FSharp.Compiler,b03f5f7f11d50a3a
8283
%SN64% -q -Vr FSharp.Compiler.Server.Shared,b03f5f7f11d50a3a
8384
%SN64% -q -Vr FSharp.Editor,b03f5f7f11d50a3a
85+
%SN64% -q -Vr FSharp.UIResources,b03f5f7f11d50a3a
8486
%SN64% -q -Vr FSharp.LanguageService,b03f5f7f11d50a3a
8587
%SN64% -q -Vr FSharp.LanguageService.Base,b03f5f7f11d50a3a
8688
%SN64% -q -Vr FSharp.LanguageService.Compiler,b03f5f7f11d50a3a

vsintegration/Vsix/VisualFSharpFull/Source.extension.vsixmanifest

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<Action Type="Ngen" Path="FSharp.Compiler.Server.Shared.dll" />
2121
<Action Type="Ngen" Path="FSharp.Core.dll" />
2222
<Action Type="Ngen" Path="FSharp.Editor.dll" />
23+
<Action Type="Ngen" Path="FSharp.UIResources.dll" />
2324
<Action Type="Ngen" Path="FSharp.LanguageService.Base.dll" />
2425
<Action Type="Ngen" Path="FSharp.LanguageService.Compiler.dll" />
2526
<Action Type="Ngen" Path="FSharp.LanguageService.dll" />
@@ -65,6 +66,6 @@
6566
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="ProjectSystem.Base" Path="|ProjectSystem.Base|" />
6667
</Assets>
6768
<Prerequisites>
68-
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0,16.0)" DisplayName="Visual Studio core editor" />
69+
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0,16.0)" DisplayName="Visual Studio core editor" />
6970
</Prerequisites>
7071
</PackageManifest>

vsintegration/Vsix/VisualFSharpFull/VisualFSharpFull.csproj

+14-1
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,13 @@
166166
<IncludeOutputGroupsInVSIXLocalOnly>DebugSymbolsProjectOutputGroup%3b</IncludeOutputGroupsInVSIXLocalOnly>
167167
<Private>True</Private>
168168
</ProjectReference>
169+
<ProjectReference Include="$(FSharpSourcesRoot)\..\vsintegration\src\FSharp.UIResources\FSharp.UIResources.csproj">
170+
<Project>{c4586a06-1402-48bc-8e35-a1b8642f895b}</Project>
171+
<Name>FSharp.UIResources</Name>
172+
<IncludeOutputGroupsInVSIX>BuiltProjectOutputGroup%3bGetCopyToOutputDirectoryItems%3bSatelliteDllsProjectOutputGroup%3b</IncludeOutputGroupsInVSIX>
173+
<IncludeOutputGroupsInVSIXLocalOnly>DebugSymbolsProjectOutputGroup%3b</IncludeOutputGroupsInVSIXLocalOnly>
174+
<Private>True</Private>
175+
</ProjectReference>
169176
<ProjectReference Include="$(FSharpSourcesRoot)\..\vsintegration\src\FSharp.LanguageService.Base\FSharp.LanguageService.Base.csproj">
170177
<Project>{1C5C163C-37EA-4A3C-8CCC-0D34B74BF8EF}</Project>
171178
<Name>FSharp.LanguageService.Base</Name>
@@ -313,6 +320,12 @@
313320
<Private>True</Private>
314321
</ProjectReference>
315322
</ItemGroup>
323+
<ItemGroup>
324+
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
325+
<SpecificVersion>False</SpecificVersion>
326+
<HintPath>$(FSharpSourcesRoot)\..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
327+
</Reference>
328+
</ItemGroup>
316329
<Import Project="$(FSharpSourcesRoot)\..\vsintegration\src\FSharp.tools.targets" />
317330
<Import Project="$(FSharpSourcesRoot)\Microbuild.Settings.targets" />
318331
<Target Name="GatherBinariesToBeSigned" AfterTargets="Localize" Condition="'$(UseGatherBinaries)' == 'true'">
@@ -323,4 +336,4 @@
323336
</FilesToSign>
324337
</ItemGroup>
325338
</Target>
326-
</Project>
339+
</Project>

vsintegration/Vsix/VisualFSharpOpenSource/Source.extension.vsixmanifest

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<Action Type="Ngen" Path="FSharp.Compiler.Server.Shared.dll" />
2121
<Action Type="Ngen" Path="FSharp.Core.dll" />
2222
<Action Type="Ngen" Path="FSharp.Editor.dll" />
23+
<Action Type="Ngen" Path="FSharp.UIResources.dll" />
2324
<Action Type="Ngen" Path="FSharp.LanguageService.Base.dll" />
2425
<Action Type="Ngen" Path="FSharp.LanguageService.Compiler.dll" />
2526
<Action Type="Ngen" Path="FSharp.LanguageService.dll" />

vsintegration/Vsix/VisualFSharpOpenSource/VisualFSharpOpenSource.csproj

+13
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,13 @@
165165
<IncludeOutputGroupsInVSIXLocalOnly>DebugSymbolsProjectOutputGroup%3b</IncludeOutputGroupsInVSIXLocalOnly>
166166
<Private>True</Private>
167167
</ProjectReference>
168+
<ProjectReference Include="$(FSharpSourcesRoot)\..\vsintegration\src\FSharp.UIResources\FSharp.UIResources.csproj">
169+
<Project>{c4586a06-1402-48bc-8e35-a1b8642f895b}</Project>
170+
<Name>FSharp.UIResources</Name>
171+
<IncludeOutputGroupsInVSIX>BuiltProjectOutputGroup%3bGetCopyToOutputDirectoryItems%3bSatelliteDllsProjectOutputGroup%3b</IncludeOutputGroupsInVSIX>
172+
<IncludeOutputGroupsInVSIXLocalOnly>DebugSymbolsProjectOutputGroup%3b</IncludeOutputGroupsInVSIXLocalOnly>
173+
<Private>True</Private>
174+
</ProjectReference>
168175
<ProjectReference Include="$(FSharpSourcesRoot)\..\vsintegration\src\FSharp.LanguageService.Base\FSharp.LanguageService.Base.csproj">
169176
<Project>{1C5C163C-37EA-4A3C-8CCC-0D34B74BF8EF}</Project>
170177
<Name>FSharp.LanguageService.Base</Name>
@@ -312,6 +319,12 @@
312319
<Private>True</Private>
313320
</ProjectReference>
314321
</ItemGroup>
322+
<ItemGroup>
323+
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
324+
<SpecificVersion>False</SpecificVersion>
325+
<HintPath>$(FSharpSourcesRoot)\..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
326+
</Reference>
327+
</ItemGroup>
315328
<Import Project="$(FSharpSourcesRoot)\..\vsintegration\src\FSharp.tools.targets" />
316329
<Import Project="$(FSharpSourcesRoot)\Microbuild.Settings.targets" />
317330
<Target Name="GatherBinariesToBeSigned" AfterTargets="Localize" Condition="'$(UseGatherBinaries)' == 'true'">

vsintegration/fsharp-vsintegration-src-build.proj

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<ItemGroup>
88
<ProjectFiles Include="src\FSharp.Editor\FSharp.Editor.fsproj" />
99
<ProjectFiles Include="src\FSharp.LanguageService\FSharp.LanguageService.fsproj" />
10+
<ProjectFiles Include="src\FSharp.UIResources\FSharp.UIResources.csproj" />
1011
<ProjectFiles Include="src\FSharp.LanguageService.Base\FSharp.LanguageService.Base.csproj" />
1112
<ProjectFiles Include="src\FSharp.ProjectSystem.Base\Project\ProjectSystem.Base.csproj" />
1213
<ProjectFiles Include="src\FSharp.ProjectSystem.FSharp\ProjectSystem.fsproj" />

vsintegration/packages.config

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,6 @@
6868
<package id="Microsoft.VisualStudio.Platform.VSEditor" version="15.0.26201-alpha" targetFramework="net46" />
6969
<package id="Microsoft.VisualStudio.Platform.VSEditor.Interop" version="15.0.26201-alpha" targetFramework="net46" />
7070
<package id="Microsoft.VisualStudio.Telemetry" version="15.0.777-rtm6FAA2C78" targetFramework="net45" />
71-
71+
<package id="Newtonsoft.Json" version="10.0.2.0"/>
7272
</packages>
7373

vsintegration/readme.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ This folder contains projects and tests related to Visual Studio tooling and IDE
44

55
main project for Visual F# tooling
66

7+
# src/FSharp.UIResources
8+
9+
GUI controls and resources for Visual F# tooling
10+
711
# src/FSharp.LanguageService
812

913
legacy bits (before roslyn workspace)

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

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ open Microsoft.VisualStudio.Shell
99
[<assembly:System.Runtime.CompilerServices.InternalsVisibleTo("VisualFSharp.Salsa, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")>]
1010

1111
[<assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\FSharp.Editor.dll")>]
12+
[<assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\FSharp.UIResources.dll")>]
13+
[<assembly: ProvideCodeBase(CodeBase = @"$PackageFolder$\Newtonsoft.Json.dll")>]
1214

1315
do()
1416

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

+17-5
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ module internal FSharpConstants =
2222
/// "4EB7CCB7-4336-4FFD-B12B-396E9FD079A9"
2323
let editorFactoryGuidString = "4EB7CCB7-4336-4FFD-B12B-396E9FD079A9"
2424

25-
[<Literal>]
26-
/// "9B164E40-C3A2-4363-9BC5-EB4039DEF653"
27-
let svsSettingsPersistenceManagerGuidString = "9B164E40-C3A2-4363-9BC5-EB4039DEF653"
28-
2925
[<Literal>]
3026
/// "F#"
3127
let FSharpLanguageName = "F#"
@@ -51,4 +47,20 @@ module internal FSharpProviderConstants =
5147

5248
[<Literal>]
5349
/// "Session Capturing Quick Info Source Provider"
54-
let SessionCapturingProvider = "Session Capturing Quick Info Source Provider"
50+
let SessionCapturingProvider = "Session Capturing Quick Info Source Provider"
51+
52+
53+
[<RequireQualifiedAccess>]
54+
module internal Guids =
55+
56+
[<Literal>]
57+
/// "9B164E40-C3A2-4363-9BC5-EB4039DEF653"
58+
let svsSettingsPersistenceManagerIdString = "9B164E40-C3A2-4363-9BC5-EB4039DEF653"
59+
60+
[<Literal>]
61+
/// "9b3c6b8a-754a-461d-9ebe-de1a682d57c1"
62+
let intelliSenseOptionPageIdString = "9b3c6b8a-754a-461d-9ebe-de1a682d57c1"
63+
64+
[<Literal>]
65+
/// "1e2b3290-4d67-41ff-a876-6f41f868e28f"
66+
let quickInfoOptionPageIdString = "1e2b3290-4d67-41ff-a876-6f41f868e28f"

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ type internal FSharpCompletionProvider
5555
static let noCommitOnSpaceRules =
5656
CompletionItemRules.Default.WithCommitCharacterRule(CharacterSetModificationRule.Create(CharacterSetModificationKind.Remove, ' ', '.', '<', '>', '(', ')', '!'))
5757

58-
static let getRules() = if IntelliSenseSettings.ShowAfterCharIsTyped then noCommitOnSpaceRules else CompletionItemRules.Default
58+
static let getRules() = if Settings.IntelliSense.ShowAfterCharIsTyped then noCommitOnSpaceRules else CompletionItemRules.Default
5959

6060
static let mruItems = Dictionary<(* Item.FullName *) string, (* hints *) int>()
6161

@@ -80,7 +80,7 @@ type internal FSharpCompletionProvider
8080
else
8181
let documentId, filePath, defines = getInfo()
8282
CompletionUtils.shouldProvideCompletion(documentId, filePath, defines, sourceText, triggerPosition) &&
83-
(IntelliSenseSettings.ShowAfterCharIsTyped && CompletionUtils.isStartingNewWord(sourceText, triggerPosition))
83+
(Settings.IntelliSense.ShowAfterCharIsTyped && CompletionUtils.isStartingNewWord(sourceText, triggerPosition))
8484

8585
static member ProvideCompletionsAsyncAux(checker: FSharpChecker, sourceText: SourceText, caretPosition: int, options: FSharpProjectOptions, filePath: string,
8686
textVersionHash: int, getAllSymbols: unit -> AssemblySymbol list) =

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

+11-1
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,16 @@
3939
<Compile Include="Common\RoslynHelpers.fs" />
4040
<Compile Include="Common\CodeAnalysisExtensions.fs" />
4141
<Compile Include="Common\ContentType.fs" />
42+
<Compile Include="Options\SettingsPersistence.fs" />
43+
<Compile Include="Options\UIHelpers.fs" />
44+
<Compile Include="Options\EditorOptions.fs" />
4245
<Compile Include="LanguageService\Tokenizer.fs" />
4346
<Compile Include="LanguageService\Symbols.fs" />
4447
<Compile Include="LanguageService\TypedAstUtils.fs" />
4548
<Compile Include="LanguageService\FSharpCheckerExtensions.fs" />
4649
<Compile Include="LanguageService\LanguageService.fs" />
4750
<Compile Include="LanguageService\AssemblyContentProvider.fs" />
4851
<Compile Include="LanguageService\SymbolHelpers.fs" />
49-
<Compile Include="Properties\IntelliSensePropertyPage.fs" />
5052
<Compile Include="Classification\ClassificationDefinitions.fs" />
5153
<Compile Include="Classification\ColorizationService.fs" />
5254
<Compile Include="Formatting\BraceMatchingService.fs" />
@@ -104,6 +106,11 @@
104106
<Name>FSharp.LanguageService.Compiler</Name>
105107
<Private>True</Private>
106108
</ProjectReference>
109+
<ProjectReference Include="$(FSharpSourcesRoot)\..\vsintegration\src\FSharp.UIResources\FSharp.UIResources.csproj">
110+
<Name>FSharp.UIResources</Name>
111+
<Project>{c4586a06-1402-48bc-8e35-a1b8642f895b}</Project>
112+
<Private>True</Private>
113+
</ProjectReference>
107114
<ProjectReference Include="..\FSharp.VS.FSI\FSharp.VS.FSI.fsproj">
108115
<Name>FSharp.VS.FSI</Name>
109116
<Project>{991dcf75-c2eb-42b6-9a0d-aa1d2409d519}</Project>
@@ -252,6 +259,9 @@
252259
<HintPath>$(FSharpSourcesRoot)\..\packages\System.Collections.Immutable.1.2.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
253260
<Private>True</Private>
254261
</Reference>
262+
<Reference Include="Newtonsoft.Json">
263+
<HintPath>$(FSharpSourcesRoot)\..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
264+
</Reference>
255265
</ItemGroup>
256266
<Import Project="$(FSharpSourcesRoot)\FSharpSource.targets" />
257267
<Import Project="$(VsSDKTargets)" />

vsintegration/src/FSharp.Editor/FSharp.Editor.resx

+2-8
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,7 @@
162162
<data name="6008" xml:space="preserve">
163163
<value>IntelliSense</value>
164164
</data>
165-
<data name="IntelliSensePropertyPageMiscCategory" xml:space="preserve">
166-
<value>Misc</value>
167-
</data>
168-
<data name="IntelliSensePropertyPageShowAfterCharIsTyped" xml:space="preserve">
169-
<value>Show after a character is typed</value>
170-
</data>
171-
<data name="IntelliSensePropertyPageShowAfterCharIsTypedDescr" xml:space="preserve">
172-
<value>Show completion list after a character is typed</value>
165+
<data name="6009" xml:space="preserve">
166+
<value>QuickInfo</value>
173167
</data>
174168
</root>

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

+8-6
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ open Microsoft.VisualStudio.Shell.Interop
3131
open Microsoft.VisualStudio.FSharp.LanguageService
3232
open Microsoft.VisualStudio.ComponentModelHost
3333

34-
// Workaround to access non-public settings persistence type.
35-
// GetService( ) with this will work as long as the GUID matches the real type.
36-
[<Guid(FSharpConstants.svsSettingsPersistenceManagerGuidString)>]
37-
type internal SVsSettingsPersistenceManager = class end
38-
3934
// Exposes FSharpChecker as MEF export
4035
[<Export(typeof<FSharpCheckerProvider>); Composition.Shared>]
4136
type internal FSharpCheckerProvider
@@ -195,6 +190,8 @@ type internal FSharpCheckerWorkspaceServiceFactory
195190

196191
type
197192
[<Guid(FSharpConstants.packageGuidString)>]
193+
[<ProvideLanguageEditorOptionPage(typeof<OptionsUI.IntelliSenseOptionPage>, "F#", null, "IntelliSense", "6008")>]
194+
[<ProvideLanguageEditorOptionPage(typeof<OptionsUI.QuickInfoOptionPage>, "F#", null, "QuickInfo", "6009")>]
198195
[<ProvideLanguageService(languageService = typeof<FSharpLanguageService>,
199196
strLanguageName = FSharpConstants.FSharpLanguageName,
200197
languageResourceID = 100,
@@ -213,7 +210,12 @@ type
213210
ShowDropDownOptions = true)>]
214211
internal FSharpPackage() =
215212
inherit AbstractPackage<FSharpPackage, FSharpLanguageService>()
216-
213+
214+
override this.Initialize() =
215+
base.Initialize()
216+
//initialize settings
217+
this.ComponentModel.GetService<SettingsPersistence.ISettings>() |> ignore
218+
217219
override this.RoslynLanguageName = FSharpConstants.FSharpLanguageName
218220

219221
override this.CreateWorkspace() = this.ComponentModel.GetService<VisualStudioWorkspaceImpl>()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
namespace Microsoft.VisualStudio.FSharp.Editor
2+
3+
open System.ComponentModel.Composition
4+
open System.Runtime.InteropServices
5+
6+
open Microsoft.VisualStudio.FSharp.UIResources
7+
open SettingsPersistence
8+
open OptionsUIHelpers
9+
10+
// CLIMutable to make the record work also as a view model
11+
[<CLIMutable>]
12+
type IntelliSenseOptions =
13+
{ ShowAfterCharIsTyped: bool
14+
ShowAfterCharIsDeleted: bool }
15+
16+
[<RequireQualifiedAccess>]
17+
type QuickInfoUnderlineStyle = Dot | Dash | Solid
18+
19+
// autoproperties can be used to both define defaults and faciliate data binding in WPF controls,
20+
// but the type should otherwise be treated as immutable.
21+
type QuickInfoOptions() =
22+
member val DisplayLinks = true with get, set
23+
member val UnderlineStyle = QuickInfoUnderlineStyle.Solid with get, set
24+
25+
[<Export(typeof<ISettings>)>]
26+
type internal Settings [<ImportingConstructor>](store: SettingsStore) =
27+
do // Initialize default settings
28+
29+
{ ShowAfterCharIsTyped = true
30+
ShowAfterCharIsDeleted = false }
31+
|> store.RegisterDefault
32+
33+
QuickInfoOptions()
34+
|> store.RegisterDefault
35+
36+
interface ISettings
37+
38+
static member IntelliSense : IntelliSenseOptions = getSettings()
39+
static member QuickInfo : QuickInfoOptions = getSettings()
40+
41+
module internal OptionsUI =
42+
43+
[<Guid(Guids.intelliSenseOptionPageIdString)>]
44+
type internal IntelliSenseOptionPage() =
45+
inherit AbstractOptionPage<IntelliSenseOptions>()
46+
override this.CreateView() =
47+
let view = IntelliSenseOptionControl()
48+
view.charTyped.Unchecked.Add <| fun _ -> view.charDeleted.IsChecked <- System.Nullable false
49+
upcast view
50+
51+
[<Guid(Guids.quickInfoOptionPageIdString)>]
52+
type internal QuickInfoOptionPage() =
53+
inherit AbstractOptionPage<QuickInfoOptions>()
54+
override this.CreateView() =
55+
let view = QuickInfoOptionControl()
56+
let path = "UnderlineStyle"
57+
bindRadioButton view.solid path QuickInfoUnderlineStyle.Solid
58+
bindRadioButton view.dot path QuickInfoUnderlineStyle.Dot
59+
bindRadioButton view.dash path QuickInfoUnderlineStyle.Dash
60+
bindCheckBox view.displayLinks "DisplayLinks"
61+
upcast view

0 commit comments

Comments
 (0)