Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion vsintegration/src/FSharp.Editor/Common/LanguageService.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)

[<Composition.Shared>]
[<Microsoft.CodeAnalysis.Host.Mef.ExportWorkspaceServiceFactory(typeof<FSharpCheckerWorkspaceService>, Microsoft.CodeAnalysis.Host.Mef.ServiceLayer.Default)>]
type internal FSharpCheckerWorkspaceServiceFactory
Expand Down Expand Up @@ -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<IVsEditorAdaptersFactoryService>()

let blockForCompletionOption =
PerLanguageOption<bool>(
"CompletionOptions", "BlockForCompletionItems", defaultValue = true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want to use "true" here as the default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea. As we pass false later, I don't think it matters.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, thanks.

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
Expand Down