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

Commit66109b7

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.Added 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#199closesdotnet#491commitda9f29aAuthor: latkin <latkin@microsoft.com>Date: Wed Jun 10 09:33:28 2015 -0700 Don't create unused binding in VS 12.0commit92c8919Author: latkin <latkin@microsoft.com>Date: Tue Jun 9 18:55:54 2015 -0700 APIs used are new for 14.0, omit them for 12.0 buildscommita662e18Author: latkin <latkin@microsoft.com>Date: Tue Jun 9 17:28:22 2015 -0700 Code review feedback, and add clickable URLs settingcommitb6697a7Author: latkin <latkin@microsoft.com>Date: Mon Jun 8 18:13:35 2015 -0700 Explicitly set custom F# VS settings if they are missing
1 parent275b832 commit66109b7

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
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: 35 additions & 1 deletion
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,41 @@ type FSharpPackage() as self =
20162021
letcallback=new ServiceCreatorCallback(CreateIfEnabled)
20172022

20182023
let mutablemgr:IOleComponentManager=null
2019-
2024+
2025+
#if!VS_VERSION_DEV12
2026+
letfsharpSpecificProfileSettings=
2027+
[|"TextEditor.F#.Insert Tabs", boxfalse
2028+
"TextEditor.F#.Brace Completion", boxtrue
2029+
"TextEditor.F#.Make URLs Hot", boxfalse
2030+
"TextEditor.F#.Indent Style", box1u|]
2031+
#endif
2032+
20202033
overrideself.Initialize()=
20212034
UIThread.CaptureSynchronizationContext()
2035+
self.EstablishDefaultSettingsIfMissing()
20222036
(self:> IServiceContainer).AddService(typeof<FSharpLanguageService>, callback,true)
20232037
base.Initialize()
20242038

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp