Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ type internal FSharpWorkspaceServiceFactory
| _ ->
let checker =
lazy
TelemetryReporter.reportEvent "languageservicestarted" []

let editorOptions =
let editorOptions = workspace.Services.GetService<EditorOptions>()

Expand All @@ -128,6 +126,18 @@ type internal FSharpWorkspaceServiceFactory
let useSyntaxTreeCache =
getOption (fun options -> options.LanguageServicePerformance.UseSyntaxTreeCache) LanguageServicePerformanceOptions.Default.UseSyntaxTreeCache

let enableInMemoryCrossProjectReferences =
getOption (fun options -> options.LanguageServicePerformance.EnableInMemoryCrossProjectReferences) false

let enableFastFindReferences =
getOption (fun options -> options.LanguageServicePerformance.EnableFastFindReferences) false

let isInlineParameterNameHintsEnabled =
getOption (fun options -> options.Advanced.IsInlineParameterNameHintsEnabled) false

let isInlineTypeHintsEnabled =
getOption (fun options -> options.Advanced.IsInlineTypeHintsEnabled) false

let checker =
FSharpChecker.Create(
projectCacheSize = 5000, // We do not care how big the cache is. VS will actually tell FCS to clear caches, so this is fine.
Expand All @@ -142,6 +152,16 @@ type internal FSharpWorkspaceServiceFactory
documentSource = (if enableLiveBuffers then DocumentSource.Custom getSource else DocumentSource.FileSystem),
useSyntaxTreeCache = useSyntaxTreeCache)

TelemetryReporter.reportEvent "languageservicestarted" [
nameof enableLiveBuffers, enableLiveBuffers
nameof useSyntaxTreeCache, useSyntaxTreeCache
nameof enableParallelReferenceResolution, enableParallelReferenceResolution
nameof enableInMemoryCrossProjectReferences, enableInMemoryCrossProjectReferences
nameof enableFastFindReferences, enableFastFindReferences
nameof isInlineParameterNameHintsEnabled, isInlineParameterNameHintsEnabled
nameof isInlineTypeHintsEnabled, isInlineTypeHintsEnabled
]

if enableLiveBuffers then
workspace.WorkspaceChanged.Add(fun args ->
if args.DocumentId <> null then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ open Microsoft.CodeAnalysis.Text
open FSharp.Compiler.CodeAnalysis
open FSharp.Compiler.Symbols
open FSharp.Compiler.Text
open Microsoft.VisualStudio.FSharp.Editor.Symbols
open Microsoft.VisualStudio.FSharp.Editor.Symbols
open Microsoft.VisualStudio.FSharp.Editor.Telemetry

module internal SymbolHelpers =
/// Used for local code fixes in a document, e.g. to rename local parameters
Expand All @@ -37,10 +38,19 @@ module internal SymbolHelpers =
}

let getSymbolUsesInProjects (symbol: FSharpSymbol, projects: Project list, onFound: Document -> TextSpan -> range -> Async<unit>, ct: CancellationToken) =
projects
|> Seq.map (fun project ->
Task.Run(fun () -> project.FindFSharpReferencesAsync(symbol, onFound, "getSymbolUsesInProjects", ct)))
|> Task.WhenAll
match projects with
| [] -> Task.CompletedTask
| firstProject::_ ->
let isFastFindReferencesEnabled = firstProject.IsFastFindReferencesEnabled
let props = [ nameof isFastFindReferencesEnabled, isFastFindReferencesEnabled :> obj ]
backgroundTask {
TelemetryReporter.reportEvent "getSymbolUsesInProjectsStarted" props
do! projects
|> Seq.map (fun project ->
Task.Run(fun () -> project.FindFSharpReferencesAsync(symbol, onFound, "getSymbolUsesInProjects", ct)))
|> Task.WhenAll
TelemetryReporter.reportEvent "getSymbolUsesInProjectsFinished" props
}

let getSymbolUsesInSolution (symbol: FSharpSymbol, declLoc: SymbolDeclarationLocation, checkFileResults: FSharpCheckFileResults, solution: Solution, ct: CancellationToken) =
async {
Expand Down