diff --git a/vsintegration/src/FSharp.Editor/Common/LanguageService.fs b/vsintegration/src/FSharp.Editor/Common/LanguageService.fs index c3be3b4d5cb..5ab75966bb4 100644 --- a/vsintegration/src/FSharp.Editor/Common/LanguageService.fs +++ b/vsintegration/src/FSharp.Editor/Common/LanguageService.fs @@ -18,6 +18,8 @@ open Microsoft.FSharp.Compiler.SourceCodeServices open Microsoft.CodeAnalysis open Microsoft.CodeAnalysis.Diagnostics open Microsoft.CodeAnalysis.Editor.Options +open Microsoft.CodeAnalysis.Completion +open Microsoft.CodeAnalysis.Options open Microsoft.VisualStudio open Microsoft.VisualStudio.Editor open Microsoft.VisualStudio.Text @@ -115,7 +117,6 @@ type internal ProjectInfoManager checkerProvider.Checker.InvalidateConfiguration(options) projectTable.[projectId] <- options - /// Get compilation defines relevant for syntax processing. /// Quicker then TryGetOptionsForDocumentOrProject as it doesn't need to recompute the exact project /// options for a script. @@ -174,6 +175,18 @@ type internal FSharpCheckerWorkspaceService = abstract Checker: FSharpChecker abstract ProjectInfoManager: ProjectInfoManager +type internal RoamingProfileStorageLocation(keyName: string) = + inherit OptionStorageLocation() + + member __.GetKeyNameForLanguage(languageName: string) = + let unsubstitutedKeyName = keyName + + match languageName with + | null -> unsubstitutedKeyName + | _ -> + let substituteLanguageName = if languageName = FSharpCommonConstants.FSharpLanguageName then "FSharp" else languageName + unsubstitutedKeyName.Replace("%LANGUAGE%", substituteLanguageName) + [] [, Microsoft.CodeAnalysis.Host.Mef.ServiceLayer.Default)>] type internal FSharpCheckerWorkspaceServiceFactory @@ -305,6 +318,13 @@ type internal FSharpLanguageService(package : FSharpPackage) as this = workspace.Options <- workspace.Options.WithChangedOption(NavigationBarOptions.ShowNavigationBar, FSharpCommonConstants.FSharpLanguageName, true) let textViewAdapter = this.Package.ComponentModel.GetService() + let blockForCompletionOption = + PerLanguageOption( + "CompletionOptions", "BlockForCompletionItems", defaultValue = true, + storageLocations = [| RoamingProfileStorageLocation("TextEditor.%%LANGUAGE%%.Specific.CompletionOptions - BlockForCompletionItems") |]) + + workspace.Options <- workspace.Options.WithChangedOption(blockForCompletionOption, FSharpCommonConstants.FSharpLanguageName, false) + match textView.GetBuffer() with | (VSConstants.S_OK, textLines) -> let filename = VsTextLines.GetFilename textLines