From 66cbf9baa80240f100da5f8b4a48ae0960d69ca9 Mon Sep 17 00:00:00 2001 From: Adam Boniecki Date: Mon, 14 Aug 2023 21:39:57 +0200 Subject: [PATCH 1/2] Revert "Make in-memory cross-project references the only option (by removing the switch) (#15116)" This reverts commit c6e2b7f4f6d1de11425a96b3c6f7c7790ed7b29d. --- .../FSharpProjectOptionsManager.fs | 39 +++++++++++-------- .../LanguageService/LanguageService.fs | 3 ++ .../FSharp.Editor/Options/EditorOptions.fs | 5 +++ ...nguageServicePerformanceOptionControl.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 +++++ 19 files changed, 188 insertions(+), 17 deletions(-) diff --git a/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs b/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs index c84ebfd8104..345bd3d707f 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs @@ -85,9 +85,13 @@ module private FSharpProjectOptionsHelpers = let v2 = p2.GetDependentVersionAsync(ct).Result v1 <> v2)) - let inline isProjectInvalidated (oldProject: Project) (newProject: Project) ct = - hasProjectVersionChanged oldProject newProject - || hasDependentVersionChanged oldProject newProject ct + let isProjectInvalidated (oldProject: Project) (newProject: Project) ct = + let hasProjectVersionChanged = hasProjectVersionChanged oldProject newProject + + if newProject.AreFSharpInMemoryCrossProjectReferencesEnabled then + hasProjectVersionChanged || hasDependentVersionChanged oldProject newProject ct + else + hasProjectVersionChanged [] type private FSharpProjectOptionsMessage = @@ -272,20 +276,21 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) = let referencedProjects = ResizeArray() - for projectReference in project.ProjectReferences do - let referencedProject = project.Solution.GetProject(projectReference.ProjectId) - - if referencedProject.Language = FSharpConstants.FSharpLanguageName then - match! tryComputeOptions referencedProject ct with - | None -> canBail <- true - | Some (_, projectOptions) -> - referencedProjects.Add( - FSharpReferencedProject.FSharpReference(referencedProject.OutputFilePath, projectOptions) - ) - elif referencedProject.SupportsCompilation then - let! comp = referencedProject.GetCompilationAsync(ct) |> Async.AwaitTask - let peRef = createPEReference referencedProject comp - referencedProjects.Add(peRef) + if project.AreFSharpInMemoryCrossProjectReferencesEnabled then + for projectReference in project.ProjectReferences do + let referencedProject = project.Solution.GetProject(projectReference.ProjectId) + + if referencedProject.Language = FSharpConstants.FSharpLanguageName then + match! tryComputeOptions referencedProject ct with + | None -> canBail <- true + | Some (_, projectOptions) -> + referencedProjects.Add( + FSharpReferencedProject.FSharpReference(referencedProject.OutputFilePath, projectOptions) + ) + elif referencedProject.SupportsCompilation then + let! comp = referencedProject.GetCompilationAsync(ct) |> Async.AwaitTask + let peRef = createPEReference referencedProject comp + referencedProjects.Add(peRef) if canBail then return None diff --git a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs index 21c694f060e..8c811aed78b 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs @@ -116,6 +116,9 @@ type internal FSharpWorkspaceServiceFactory [] let useSyntaxTreeCache = editorOptions.LanguageServicePerformance.UseSyntaxTreeCache + let enableInMemoryCrossProjectReferences = + editorOptions.LanguageServicePerformance.EnableInMemoryCrossProjectReferences + let enableFastFindReferences = editorOptions.LanguageServicePerformance.EnableFastFindReferencesAndRename diff --git a/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs b/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs index b220b66865f..5c3fd525812 100644 --- a/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs +++ b/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs @@ -78,6 +78,7 @@ type CodeFixesOptions = [] type LanguageServicePerformanceOptions = { + EnableInMemoryCrossProjectReferences: bool AllowStaleCompletionResults: bool TimeUntilStaleCompletion: int EnableParallelReferenceResolution: bool @@ -92,6 +93,7 @@ type LanguageServicePerformanceOptions = static member Default = { + EnableInMemoryCrossProjectReferences = true AllowStaleCompletionResults = true TimeUntilStaleCompletion = 2000 // In ms, so this is 2 seconds EnableParallelReferenceResolution = false @@ -227,6 +229,9 @@ module EditorOptionsExtensions = member private this.EditorOptions = this.Solution.Workspace.Services.GetService() + member this.AreFSharpInMemoryCrossProjectReferencesEnabled = + this.EditorOptions.LanguageServicePerformance.EnableInMemoryCrossProjectReferences + member this.IsFSharpCodeFixesAlwaysPlaceOpensAtTopLevelEnabled = this.EditorOptions.CodeFixes.AlwaysPlaceOpensAtTopLevel diff --git a/vsintegration/src/FSharp.UIResources/LanguageServicePerformanceOptionControl.xaml b/vsintegration/src/FSharp.UIResources/LanguageServicePerformanceOptionControl.xaml index 554e5d76e09..074bc7febc8 100644 --- a/vsintegration/src/FSharp.UIResources/LanguageServicePerformanceOptionControl.xaml +++ b/vsintegration/src/FSharp.UIResources/LanguageServicePerformanceOptionControl.xaml @@ -19,6 +19,10 @@ + diff --git a/vsintegration/src/FSharp.UIResources/Strings.Designer.cs b/vsintegration/src/FSharp.UIResources/Strings.Designer.cs index 81039f0090d..0c8d435f87d 100644 --- a/vsintegration/src/FSharp.UIResources/Strings.Designer.cs +++ b/vsintegration/src/FSharp.UIResources/Strings.Designer.cs @@ -177,6 +177,15 @@ public static string Enable_Fast_Find_References { } } + /// + /// Looks up a localized string similar to _Enable in-memory cross project references. + /// + public static string Enable_in_memory_cross_project_references { + get { + return ResourceManager.GetString("Enable_in_memory_cross_project_references", resourceCulture); + } + } + /// /// Looks up a localized string similar to Use live (unsaved) buffers for checking (restart required). /// @@ -519,6 +528,15 @@ public static string Time_until_stale_completion { } } + /// + /// Looks up a localized string similar to In-memory cross-project references store project-level data in memory to allow IDE features to work across projects.. + /// + public static string Tooltip_in_memory_cross_project_references { + get { + return ResourceManager.GetString("Tooltip_in_memory_cross_project_references", resourceCulture); + } + } + /// /// Looks up a localized string similar to Format signature to the given width by adding line breaks conforming with F# syntax rules. . /// diff --git a/vsintegration/src/FSharp.UIResources/Strings.resx b/vsintegration/src/FSharp.UIResources/Strings.resx index b6446a35004..f0ae6b60146 100644 --- a/vsintegration/src/FSharp.UIResources/Strings.resx +++ b/vsintegration/src/FSharp.UIResources/Strings.resx @@ -147,6 +147,9 @@ _Show completion list after a character is typed + + _Enable in-memory cross project references + S_how navigation links as @@ -192,6 +195,9 @@ Enable stale data for IntelliSense features + + In-memory cross-project references store project-level data in memory to allow IDE features to work across projects. + Always add new line on enter diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf index 5d7d6408c82..fc6191d7055 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf @@ -167,6 +167,11 @@ _Zobrazovat seznam dokončení po zadání znaku + + _Enable in-memory cross project references + _Povolit odkazy mezi projekty v paměti + + S_how navigation links as Zo_brazit navigační odkazy jako @@ -242,6 +247,11 @@ Povolit zastaralá data pro funkce IntelliSense + + In-memory cross-project references store project-level data in memory to allow IDE features to work across projects. + V odkazech v paměti pro různé projekty jsou uložená data na úrovni projektů, aby mohly mezi projekty fungovat funkce IDE. + + Always add new line on enter Při stisku Enter vždy přidat nový řádek diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf index f8f4c8c200b..c9fe10de771 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf @@ -167,6 +167,11 @@ _Vervoll­ständigungsliste nach Eingabe eines Zeichens anzeigen + + _Enable in-memory cross project references + Proj_ektübergreifende Verweise im Arbeitsspeicher aktivieren + + S_how navigation links as Navigationslink_s anzeigen als @@ -242,6 +247,11 @@ Veraltete Daten für IntelliSense-Features aktivieren + + In-memory cross-project references store project-level data in memory to allow IDE features to work across projects. + Bei projektübergreifenden In-Memory-Verweisen werden Daten auf Projektebene im Arbeitsspeicher abgelegt, damit IDE-Features projektübergreifend verwendet werden können. + + Always add new line on enter Nach Drücken der EINGABETASTE immer neue Zeile hinzufügen diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf index c54943633bc..d2de44fb296 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf @@ -167,6 +167,11 @@ _Mostrar lista de finalización después de escribir un carácter + + _Enable in-memory cross project references + _Habilitar referencias entre proyectos en memoria + + S_how navigation links as M_ostrar vínculos de navegación como @@ -242,6 +247,11 @@ Habilitar datos obsoletos para características de IntelliSense + + In-memory cross-project references store project-level data in memory to allow IDE features to work across projects. + Las referencias en memoria entre proyectos almacenan los datos de nivel de proyecto en memoria para permitir que las características del IDE funcionen de unos proyectos a otros. + + Always add new line on enter Siempre agregar una nueva línea al pulsar Intro diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf index 5daa2d66a70..03ae77ec939 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf @@ -167,6 +167,11 @@ _Afficher la liste de saisie semi-automatique après la saisie d'un caractère + + _Enable in-memory cross project references + _Activer les références de projet croisé en mémoire + + S_how navigation links as Affic_her les liens de navigation en tant que @@ -242,6 +247,11 @@ Activer les données périmées pour les fonctionnalités IntelliSense + + In-memory cross-project references store project-level data in memory to allow IDE features to work across projects. + Les références inter-projets en mémoire stockent les données de niveau projet dans la mémoire pour permettre aux fonctionnalités de l'IDE de fonctionner sur plusieurs projets. + + Always add new line on enter Toujours ajouter une nouvelle ligne en appuyant sur Entrée diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf index 19cdc2990ab..e3b948f6d8f 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf @@ -167,6 +167,11 @@ Mo_stra elenco di completamento dopo la digitazione di un carattere + + _Enable in-memory cross project references + _Abilita i riferimenti tra progetti in memoria + + S_how navigation links as M_ostra collegamenti di navigazione come @@ -242,6 +247,11 @@ Abilita dati non aggiornati per le funzionalità IntelliSense + + In-memory cross-project references store project-level data in memory to allow IDE features to work across projects. + I riferimenti tra progetti in memoria consentono di archiviare in memoria i dati a livello di progetto per consentire l'uso di funzionalità IDE tra progetti. + + Always add new line on enter Aggiungi sempre una nuova riga dopo INVIO diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf index 73a53cc0a57..b0ddce5658d 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf @@ -167,6 +167,11 @@ 文字が入力された後に入力候補一覧を表示する(_S) + + _Enable in-memory cross project references + メモリ内のプロジェクト間参照を有効にする(_E) + + S_how navigation links as 次としてナビゲーション リンクを表示する(_H) @@ -242,6 +247,11 @@ IntelliSense 機能に対して古いデータを有効にする + + In-memory cross-project references store project-level data in memory to allow IDE features to work across projects. + メモリ内のプロジェクト間参照に、プロジェクトをまたいで IDE 機能を動作可能にするプロジェクト レベルのデータが格納されます。 + + Always add new line on enter Enter を押すと常に新しい行を追加します diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf index 99bdefcf6f7..6d3d8a13a53 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf @@ -167,6 +167,11 @@ 문자를 입력하면 완성 목록 표시(_S) + + _Enable in-memory cross project references + 메모리 내 크로스 프로젝트 참조 사용(_E) + + S_how navigation links as 탐색 링크를 다음으로 표시(_H) @@ -242,6 +247,11 @@ IntelliSense 기능에 대해 부실 데이터 사용 + + In-memory cross-project references store project-level data in memory to allow IDE features to work across projects. + 메모리 내 크로스 프로젝트 참조가 메모리에 프로젝트 수준 데이터를 저장하여 IDE 기능이 프로젝트에서 작동하도록 합니다. + + Always add new line on enter 입력 시 새 줄 항상 추가 diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf index d2e38970150..b4d2cf145ab 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf @@ -167,6 +167,11 @@ _Pokaż listę uzupełniania po wpisaniu znaku + + _Enable in-memory cross project references + _Włącz odwołania między projektami w pamięci + + S_how navigation links as P_okaż linki nawigacyjne jako @@ -242,6 +247,11 @@ Włącz dane nieodświeżone na potrzeby funkcji IntelliSense + + In-memory cross-project references store project-level data in memory to allow IDE features to work across projects. + Odwołania między projektami w pamięci przechowują dane na poziomie projektu w pamięci, aby umożliwić funkcjom środowiska IDE działanie w wielu projektach. + + Always add new line on enter Zawsze dodawaj nowy wiersz po naciśnięciu klawisza Enter diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.pt-BR.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.pt-BR.xlf index bd7c1990659..ecd4611a48a 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.pt-BR.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.pt-BR.xlf @@ -167,6 +167,11 @@ _Mostrar lista de conclusão depois que um caractere é digitado + + _Enable in-memory cross project references + _Habilitar referências de projeto cruzado na memória + + S_how navigation links as E_xibir link de navegação como @@ -242,6 +247,11 @@ Habilitar dados obsoletos para os recursos do IntelliSense + + In-memory cross-project references store project-level data in memory to allow IDE features to work across projects. + As referências entre projetos na memória armazenam os dados de nível de projeto na memória para permitir que os recursos do IDE funcionem nos projetos. + + Always add new line on enter Sempre adicionar uma nova linha ao pressionar enter diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf index 9c7f138e6ae..3fcde247df6 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf @@ -167,6 +167,11 @@ _Показывать список завершения после ввода знака + + _Enable in-memory cross project references + _Включить перекрестные ссылки между проектами в памяти + + S_how navigation links as П_оказать ссылки навигации как @@ -242,6 +247,11 @@ Включение устаревших данных для функций IntelliSense + + In-memory cross-project references store project-level data in memory to allow IDE features to work across projects. + Перекрестные ссылки между проектами в памяти хранят данные уровня проекта в памяти, поэтому функции и компоненты IDE могут работать в разных проектах. + + Always add new line on enter Всегда добавлять новую строку при нажатии клавиши ВВОД diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf index 33fe963154a..b1451e5a571 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf @@ -167,6 +167,11 @@ Bir karakter yazıldıktan sonra tamamlanma listesini _göster + + _Enable in-memory cross project references + _Bellek içi çapraz proje başvurularını etkinleştir + + S_how navigation links as Gezinti bağlantılarını farklı _göster @@ -242,6 +247,11 @@ IntelliSense özellikleri için eski verileri etkinleştir + + In-memory cross-project references store project-level data in memory to allow IDE features to work across projects. + Bellek içi projeler arası başvurular, IDE özelliklerinin farklı projelerde çalışmasına imkan tanımak için bellekte proje düzeyi veriler depolar. + + Always add new line on enter Enter'a basıldığında her zaman yeni satır ekle diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf index 70bbc8c22d0..1dcbb550d8e 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf @@ -167,6 +167,11 @@ 键入字符后显示完成列表(_S) + + _Enable in-memory cross project references + 启用内存中跨项目引用(_E) + + S_how navigation links as 导航链接显示方式(_H) @@ -242,6 +247,11 @@ 针对 IntelliSense 功能启用过时数据 + + In-memory cross-project references store project-level data in memory to allow IDE features to work across projects. + 内存中跨项目引用将项目级数据存储在内存中,让 IDE 功能能够跨项目工作。 + + Always add new line on enter 始终在点击回车时时添加新行 diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf index 4be9f930908..8f70454be10 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf @@ -167,6 +167,11 @@ 輸入一個字元後顯示完成清單(_S) + + _Enable in-memory cross project references + 允許記憶體內跨專案參考(_E) + + S_how navigation links as 顯示導覽連結為(_H) @@ -242,6 +247,11 @@ 為 IntelliSense 功能啟用過時資料 + + In-memory cross-project references store project-level data in memory to allow IDE features to work across projects. + 記憶體內跨專案參考,會在記憶體中儲存專案等級的資料,以允許 IDE 功能在各專案中皆可運作。 + + Always add new line on enter 一律在按 ENTER 時新增新行 From 762c189d7e17eeef1336c2d10463f5cad79c8451 Mon Sep 17 00:00:00 2001 From: Adam Boniecki Date: Mon, 14 Aug 2023 21:57:22 +0200 Subject: [PATCH 2/2] Fix merge - add info to telemetry --- .../src/FSharp.Editor/LanguageService/LanguageService.fs | 1 + 1 file changed, 1 insertion(+) diff --git a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs index 8c811aed78b..ce2b568fe8b 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs @@ -159,6 +159,7 @@ type internal FSharpWorkspaceServiceFactory [] nameof enableLiveBuffers, enableLiveBuffers nameof useSyntaxTreeCache, useSyntaxTreeCache nameof enableParallelReferenceResolution, enableParallelReferenceResolution + nameof enableInMemoryCrossProjectReferences, enableInMemoryCrossProjectReferences nameof enableFastFindReferences, enableFastFindReferences nameof isInlineParameterNameHintsEnabled, isInlineParameterNameHintsEnabled nameof isInlineTypeHintsEnabled, isInlineTypeHintsEnabled