From 83cc0e4f5a958da008706f2448fe3ee3036df145 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Fri, 16 Jun 2023 20:49:47 +0200 Subject: [PATCH 1/4] internalerror with MakeValueAssign fixed? --- .../Language/RegressionTests.fs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/FSharp.Compiler.ComponentTests/Language/RegressionTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/RegressionTests.fs index 81e55158788..68b710f85ae 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/RegressionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/RegressionTests.fs @@ -19,3 +19,13 @@ type TestItemSeq = |> compile |> withErrorCodes [39] |> ignore + + + [] + let ``Member val regression - not allowed without primary constructor`` () = + Fs """module Test + type Bad3 = + member val X = 1 + 1 """ + |> typecheck + |> shouldFail + |> withDiagnostics [] From cb05a62da514fb4bfc76511f6d9751fedb895312 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Wed, 12 Jul 2023 17:13:27 +0200 Subject: [PATCH 2/4] Add in optional setting for solution-wide background analysis --- .../LanguageService/LanguageService.fs | 29 ++++++++----------- .../FSharp.Editor/Options/EditorOptions.fs | 2 ++ .../AdvancedOptionsControl.xaml | 4 +++ .../FSharp.UIResources/Strings.Designer.cs | 18 ++++++++++++ .../src/FSharp.UIResources/Strings.resx | 6 ++++ .../src/FSharp.UIResources/xlf/Strings.cs.xlf | 10 +++++++ .../src/FSharp.UIResources/xlf/Strings.de.xlf | 10 +++++++ .../src/FSharp.UIResources/xlf/Strings.es.xlf | 10 +++++++ .../src/FSharp.UIResources/xlf/Strings.fr.xlf | 10 +++++++ .../src/FSharp.UIResources/xlf/Strings.it.xlf | 10 +++++++ .../src/FSharp.UIResources/xlf/Strings.ja.xlf | 10 +++++++ .../src/FSharp.UIResources/xlf/Strings.ko.xlf | 10 +++++++ .../src/FSharp.UIResources/xlf/Strings.pl.xlf | 10 +++++++ .../FSharp.UIResources/xlf/Strings.pt-BR.xlf | 10 +++++++ .../src/FSharp.UIResources/xlf/Strings.ru.xlf | 10 +++++++ .../src/FSharp.UIResources/xlf/Strings.tr.xlf | 10 +++++++ .../xlf/Strings.zh-Hans.xlf | 10 +++++++ .../xlf/Strings.zh-Hant.xlf | 10 +++++++ 18 files changed, 172 insertions(+), 17 deletions(-) diff --git a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs index d008115d892..9badfa80f01 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs @@ -423,28 +423,23 @@ type internal FSharpLanguageService(package: FSharpPackage) = override _.Initialize() = base.Initialize() - let globalOptions = - package - .ComponentModel - .DefaultExportProvider - .GetExport() - .Value + let exportProvider = package.ComponentModel.DefaultExportProvider + let globalOptions = exportProvider.GetExport().Value - globalOptions.BlockForCompletionItems <- false - globalOptions.SetBackgroundAnalysisScope(openFilesOnly = true) + let workspace = package.ComponentModel.GetService() - let globalOptions = - package - .ComponentModel - .DefaultExportProvider - .GetExport() - .Value + let solutionAnalysis = + workspace + .Services + .GetService() + .Advanced + .SolutionBackgroundAnalysis - globalOptions.BlockForCompletionItems <- false + globalOptions.SetBackgroundAnalysisScope(openFilesOnly = not solutionAnalysis) - let theme = - package.ComponentModel.DefaultExportProvider.GetExport().Value + globalOptions.BlockForCompletionItems <- false + let theme = exportProvider.GetExport().Value theme.SetColors() override _.ContentTypeName = FSharpConstants.FSharpContentTypeName diff --git a/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs b/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs index dd33df48d63..b220b66865f 100644 --- a/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs +++ b/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs @@ -114,6 +114,7 @@ type AdvancedOptions = IsInlineReturnTypeHintsEnabled: bool IsLiveBuffersEnabled: bool SendAdditionalTelemetry: bool + SolutionBackgroundAnalysis: bool } static member Default = @@ -125,6 +126,7 @@ type AdvancedOptions = IsInlineReturnTypeHintsEnabled = false IsLiveBuffersEnabled = FSharpExperimentalFeaturesEnabledAutomatically SendAdditionalTelemetry = true + SolutionBackgroundAnalysis = false } [] diff --git a/vsintegration/src/FSharp.UIResources/AdvancedOptionsControl.xaml b/vsintegration/src/FSharp.UIResources/AdvancedOptionsControl.xaml index d9388204b6a..a452a0a256f 100644 --- a/vsintegration/src/FSharp.UIResources/AdvancedOptionsControl.xaml +++ b/vsintegration/src/FSharp.UIResources/AdvancedOptionsControl.xaml @@ -42,6 +42,10 @@ + + + diff --git a/vsintegration/src/FSharp.UIResources/Strings.Designer.cs b/vsintegration/src/FSharp.UIResources/Strings.Designer.cs index 69eca550813..81039f0090d 100644 --- a/vsintegration/src/FSharp.UIResources/Strings.Designer.cs +++ b/vsintegration/src/FSharp.UIResources/Strings.Designer.cs @@ -78,6 +78,24 @@ public static string Always_place_opens_at_top_level { } } + /// + /// Looks up a localized string similar to Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart). + /// + public static string Analyze_full_solution_on_background { + get { + return ResourceManager.GetString("Analyze_full_solution_on_background", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Background analysis. + /// + public static string Background_analysis { + get { + return ResourceManager.GetString("Background_analysis", resourceCulture); + } + } + /// /// Looks up a localized string similar to Block Structure Guides. /// diff --git a/vsintegration/src/FSharp.UIResources/Strings.resx b/vsintegration/src/FSharp.UIResources/Strings.resx index 744428afe80..b6446a35004 100644 --- a/vsintegration/src/FSharp.UIResources/Strings.resx +++ b/vsintegration/src/FSharp.UIResources/Strings.resx @@ -276,4 +276,10 @@ Display return type hints (preview) + + Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart) + + + Background analysis + \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf index da3fb391af1..5d7d6408c82 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf @@ -12,6 +12,16 @@ Vždy umístit otevřené příkazy na nejvyšší úroveň + + Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart) + Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart) + + + + Background analysis + Background analysis + + Capture identifiers while parsing Capture identifiers while parsing diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf index ed31dab343d..f8f4c8c200b 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf @@ -12,6 +12,16 @@ open-Anweisungen immer an oberster Ebene platzieren + + Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart) + Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart) + + + + Background analysis + Background analysis + + Capture identifiers while parsing Capture identifiers while parsing diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf index 78b806cf790..c54943633bc 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf @@ -12,6 +12,16 @@ Colocar siempre las instrucciones open en el nivel superior + + Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart) + Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart) + + + + Background analysis + Background analysis + + Capture identifiers while parsing Capture identifiers while parsing diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf index 5478e422532..5daa2d66a70 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf @@ -12,6 +12,16 @@ Placer toujours les instructions open au niveau supérieur + + Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart) + Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart) + + + + Background analysis + Background analysis + + Capture identifiers while parsing Capture identifiers while parsing diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf index 20f3f4644d6..19cdc2990ab 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf @@ -12,6 +12,16 @@ Inserisci sempre le istruzioni OPEN al primo livello + + Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart) + Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart) + + + + Background analysis + Background analysis + + Capture identifiers while parsing Capture identifiers while parsing diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf index 05f4288e8e8..73a53cc0a57 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf @@ -12,6 +12,16 @@ Open ステートメントを常に最上位に配置する + + Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart) + Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart) + + + + Background analysis + Background analysis + + Capture identifiers while parsing Capture identifiers while parsing diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf index 6b629fc4621..99bdefcf6f7 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf @@ -12,6 +12,16 @@ 항상 최상위에 open 문 배치 + + Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart) + Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart) + + + + Background analysis + Background analysis + + Capture identifiers while parsing Capture identifiers while parsing diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf index 9197fbd8920..d2e38970150 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf @@ -12,6 +12,16 @@ Zawsze umieszczaj otwarte instrukcje na najwyższym poziomie + + Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart) + Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart) + + + + Background analysis + Background analysis + + Capture identifiers while parsing Capture identifiers while parsing diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.pt-BR.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.pt-BR.xlf index a6e151fed23..bd7c1990659 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.pt-BR.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.pt-BR.xlf @@ -12,6 +12,16 @@ Sempre coloque as instruções abertas no nível superior + + Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart) + Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart) + + + + Background analysis + Background analysis + + Capture identifiers while parsing Capture identifiers while parsing diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf index 1bcad7fe621..9c7f138e6ae 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf @@ -12,6 +12,16 @@ Всегда располагайте открытые операторы на верхнем уровне + + Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart) + Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart) + + + + Background analysis + Background analysis + + Capture identifiers while parsing Capture identifiers while parsing diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf index 637d5903b36..33fe963154a 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf @@ -12,6 +12,16 @@ Açık deyimleri her zaman en üst düzeye yerleştir + + Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart) + Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart) + + + + Background analysis + Background analysis + + Capture identifiers while parsing Capture identifiers while parsing diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf index 71be5eec586..70bbc8c22d0 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf @@ -12,6 +12,16 @@ 始终在顶层放置 open 语句 + + Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart) + Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart) + + + + Background analysis + Background analysis + + Capture identifiers while parsing Capture identifiers while parsing diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf index c5197db55ff..4be9f930908 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf @@ -12,6 +12,16 @@ 一律將 open 陳述式放在最上層 + + Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart) + Keep analyzing the entire solution for diagnostics as a low priority background task (requires restart) + + + + Background analysis + Background analysis + + Capture identifiers while parsing Capture identifiers while parsing From e640ee447a2920d78315149254c05a5fdcd30a4b Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Wed, 12 Jul 2023 17:19:22 +0200 Subject: [PATCH 3/4] fix --- .../Language/RegressionTests.fs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/Language/RegressionTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/RegressionTests.fs index 5298fa87f2c..b29311ba33b 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/RegressionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/RegressionTests.fs @@ -19,13 +19,3 @@ type TestItemSeq = |> compile |> withErrorCodes [39] |> ignore - - - [] - let ``Member val regression - not allowed without primary constructor`` () = - Fs """module Test - type Bad3 = - member val X = 1 + 1 """ - |> typecheck - |> shouldFail - |> withDiagnostics [] From 4a3d20e6fdcc9f414a0474c608bc9b7cbd236c49 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Mon, 17 Jul 2023 14:52:18 +0200 Subject: [PATCH 4/4] telementry - lang service started will report background analysis flag --- .../src/FSharp.Editor/LanguageService/LanguageService.fs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs index 9badfa80f01..0972540f604 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs @@ -146,6 +146,9 @@ type internal FSharpWorkspaceServiceFactory [] let captureIdentifiersWhenParsing = editorOptions.LanguageServicePerformance.CaptureIdentifiersWhenParsing + // Default is false here + let solutionCrawler = editorOptions.Advanced.SolutionBackgroundAnalysis + use _eventDuration = TelemetryReporter.ReportSingleEventWithDuration( TelemetryEvents.LanguageServiceStarted, @@ -163,6 +166,7 @@ type internal FSharpWorkspaceServiceFactory [] nameof enableBackgroundItemKeyStoreAndSemanticClassification, enableBackgroundItemKeyStoreAndSemanticClassification nameof captureIdentifiersWhenParsing, captureIdentifiersWhenParsing + nameof solutionCrawler, solutionCrawler |], TelemetryThrottlingStrategy.NoThrottling )