Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb6697a7

Browse files
committed
Explicitly set custom F# VS settings if they are missing
On package load, check if any of the custom F# settings are somehow missingfrom the settings store. Explicitly set them to their desired defaults ifthey are indeed missing.I've added this to the language service package since this is guaranteedto load any time the project system package is loaded, but the converse isnot true (e.g. open loose F# script file without opening a solution).fixesdotnet#199
1 parent275b832 commitb6697a7

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

‎vsintegration/src/vs/FsPkgs/FSharp.LanguageService/FSharp.LanguageService.fsproj‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
<ReferenceInclude="Microsoft.VisualStudio.Shell.Interop.10.0.dll" />
7272
<ReferenceInclude="Microsoft.VisualStudio.Shell.Interop.dll" />
7373
<ReferenceInclude="Microsoft.VisualStudio.Shell.Design, Version=$(VisualStudioVersion).0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
74+
<ReferenceInclude="Microsoft.VisualStudio.Utilities, Version=$(VisualStudioVersion).0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
7475
<ReferenceInclude="Microsoft.VisualStudio.Package.LanguageService.$(VisualStudioVersion)" />
7576
<ReferenceInclude="Microsoft.VisualStudio.Shell.Immutable.11.0" />
7677
<ReferenceInclude="Microsoft.VisualStudio.ProjectAggregator" />

‎vsintegration/src/vs/FsPkgs/FSharp.LanguageService/servicem.fs‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1992,6 +1992,11 @@ module Setup =
19921992
context.RemoveKey(providerRegKey())
19931993
#endif
19941994

1995+
// Workaround to access non-public settings persistence type.
1996+
// GetService( ) with this will work as long as the GUID matches the real type.
1997+
[<Guid("9B164E40-C3A2-4363-9BC5-EB4039DEF653")>]
1998+
typeinternalSVsSettingsPersistenceManager=classend
1999+
19952000
[<Guid("871D2A70-12A2-4e42-9440-425DD92A4116")>]
19962001
typeFSharpPackage()as self=
19972002
inherit Package()
@@ -2016,12 +2021,32 @@ type FSharpPackage() as self =
20162021
letcallback=new ServiceCreatorCallback(CreateIfEnabled)
20172022

20182023
let mutablemgr:IOleComponentManager=null
2024+
2025+
letfsharpSpecificProfileSettings=
2026+
[|"TextEditor.F#.Insert Tabs", boxfalse
2027+
"TextEditor.F#.Brace Completion", boxtrue
2028+
"TextEditor.F#.Indent Style", box1u|]
20192029

20202030
overrideself.Initialize()=
20212031
UIThread.CaptureSynchronizationContext()
2032+
self.EstablishDefaultSettingsIfMissing()
20222033
(self:> IServiceContainer).AddService(typeof<FSharpLanguageService>, callback,true)
20232034
base.Initialize()
20242035

2036+
/// In case custom VS profile settings for F# are not applied, explicitly set them here.
2037+
/// e.g. 'keep tabs' is the text editor default, but F# requires 'insert spaces'.
2038+
/// We specify our customizations in the General profile for VS, but we have found that in some cases
2039+
/// those customizations are incorrectly ignored.
2040+
memberprivatethis.EstablishDefaultSettingsIfMissing()=
2041+
letsettingsManager= this.GetService(typeof<SVsSettingsPersistenceManager>):?> Microsoft.VisualStudio.Settings.ISettingsManager
2042+
for settingName,defaultValuein fsharpSpecificProfileSettingsdo
2043+
// Only take action if the setting has no current custom value
2044+
// If cloud-synced settings have already been applied or the user has made an explicit change, do nothing
2045+
match settingsManager.TryGetValue(settingName)with
2046+
| Microsoft.VisualStudio.Settings.GetValueResult.Missing,_->
2047+
settingsManager.SetValueAsync(settingName, defaultValue,false)|> ignore
2048+
|_->()
2049+
20252050
memberself.RegisterForIdleTime()=
20262051
mgr<-(self.GetService(typeof<SOleComponentManager>):?> IOleComponentManager)
20272052
if(componentID=0u&& mgr<>null)then

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp