From f800722f604a8b2b5514f3403668fd0a482aa9c1 Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Thu, 4 Jun 2020 16:43:47 -0700 Subject: [PATCH 001/295] Upgrade to 16.7 Visual Studio shell packages The primary upgrade here is Microsoft.VisualStudio.Shell.Framework, the rest of them are upgrades happening to avoid package downgrades. --- eng/Versions.props | 19 ++++++++++--------- .../DevDivInsertionFiles.csproj | 1 + .../FileChangeWatcherProvider.cs | 3 ++- ...sualStudioWorkspaceImpl.OpenFileTracker.cs | 7 +++++-- .../VisualStudioDecompilerEulaService.cs | 3 ++- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 8020fd357a995..63ab3c246c6de 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -35,6 +35,7 @@ 16.4.248 5.0.0-alpha1.19409.1 16.8.5 + 16.7.30121.200-pre 12.0.2 - 2.4.34 + 2.6.21-alpha 5.0.0-preview.8.20371.14 5.0.0-preview.8.20371.14 1.1.1 diff --git a/src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj b/src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj index 6d407b98f7987..30bbcf8d7acb9 100644 --- a/src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj +++ b/src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj @@ -39,6 +39,7 @@ + From 22bfd91efbf7c901431b60928fe13334e3bd654e Mon Sep 17 00:00:00 2001 From: Gen Lu Date: Wed, 19 Aug 2020 13:39:03 -0700 Subject: [PATCH 011/295] Fix dependencies --- eng/Versions.props | 6 +++--- .../Core/Microsoft.CodeAnalysis.EditorFeatures.csproj | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 5ec96aec99fa4..fc6bf093bed6d 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -169,10 +169,10 @@ 12.0.30110 12.1.30328 16.0.0 - 16.7.53 - 16.7.29-alpha + 16.8.7-alpha + 16.8.7-alpha $(MicrosoftVisualStudioShellPackagesVersion) - 15.5.31 + 16.8.2-alpha 2.8.0 16.3.43 4.3.0 diff --git a/src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj b/src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj index 30bbcf8d7acb9..26677d27c64ec 100644 --- a/src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj +++ b/src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj @@ -40,6 +40,7 @@ + From ff23992d18b8863415a482b622f7af055a4e1f60 Mon Sep 17 00:00:00 2001 From: Gen Lu Date: Wed, 19 Aug 2020 14:13:40 -0700 Subject: [PATCH 012/295] Remove unused reference to Microsoft.VisualStudio.Imaging --- .../Core/Microsoft.CodeAnalysis.EditorFeatures.csproj | 1 - .../ServiceHub/Microsoft.CodeAnalysis.Remote.ServiceHub.csproj | 1 - 2 files changed, 2 deletions(-) diff --git a/src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj b/src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj index 26677d27c64ec..783a018eb8b5a 100644 --- a/src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj +++ b/src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj @@ -35,7 +35,6 @@ - diff --git a/src/Workspaces/Remote/ServiceHub/Microsoft.CodeAnalysis.Remote.ServiceHub.csproj b/src/Workspaces/Remote/ServiceHub/Microsoft.CodeAnalysis.Remote.ServiceHub.csproj index 838819a29260e..03336ee54a1f4 100644 --- a/src/Workspaces/Remote/ServiceHub/Microsoft.CodeAnalysis.Remote.ServiceHub.csproj +++ b/src/Workspaces/Remote/ServiceHub/Microsoft.CodeAnalysis.Remote.ServiceHub.csproj @@ -26,7 +26,6 @@ - From fde2b8ed20cbc147a8209dbdd017d6e45c59bacb Mon Sep 17 00:00:00 2001 From: Gen Lu Date: Wed, 19 Aug 2020 14:27:03 -0700 Subject: [PATCH 013/295] Remove usage of obselete API --- src/Workspaces/Remote/Core/RemoteEndPoint.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Workspaces/Remote/Core/RemoteEndPoint.cs b/src/Workspaces/Remote/Core/RemoteEndPoint.cs index 2ecc51b7a1f7f..9f10fb2ec6825 100644 --- a/src/Workspaces/Remote/Core/RemoteEndPoint.cs +++ b/src/Workspaces/Remote/Core/RemoteEndPoint.cs @@ -390,7 +390,7 @@ private void LogDisconnectInfo(JsonRpcDisconnectedEventArgs? e) { if (e != null) { - LogError($@"Stream disconnected unexpectedly: {e.Reason}, '{e.Description}', LastMessage: {e.LastMessage}, Exception: {e.Exception?.Message}"); + LogError($@"Stream disconnected unexpectedly: {e.Reason}, '{e.Description}', Exception: {e.Exception?.Message}"); } } From 97970e80c985d10ecdcdb1ac396036870a12ca13 Mon Sep 17 00:00:00 2001 From: Allison Chou Date: Mon, 31 Aug 2020 00:29:26 -0700 Subject: [PATCH 014/295] Merge conflict resolution --- .../LanguageServer/Handler/Initialize/InitializeHandler.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Initialize/InitializeHandler.cs b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Initialize/InitializeHandler.cs index 72642d6ae0634..5b7497f470000 100644 --- a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Initialize/InitializeHandler.cs +++ b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Initialize/InitializeHandler.cs @@ -34,15 +34,11 @@ public Task HandleRequestAsync(InitializeParams request, Reque { CompletionProvider = new CompletionOptions { ResolveProvider = true, TriggerCharacters = new string[] { "<", " ", ":", ".", "=", "\"", "'", "{", ",", "(" } }, HoverProvider = true, -<<<<<<< HEAD FoldingRangeProvider = new FoldingRangeOptions { }, -======= - FoldingRangeProvider = new FoldingRangeProviderOptions { }, DocumentFormattingProvider = true, DocumentRangeFormattingProvider = true, DocumentOnTypeFormattingProvider = new DocumentOnTypeFormattingOptions { FirstTriggerCharacter = ">", MoreTriggerCharacter = new string[] { "\n" } }, OnAutoInsertProvider = new DocumentOnAutoInsertOptions { TriggerCharacters = new[] { "=", "/", ">" } }, ->>>>>>> upstream/master TextDocumentSync = new TextDocumentSyncOptions { Change = TextDocumentSyncKind.None From d9eb166ce66364f0fe07a1f1114b63685ac04a07 Mon Sep 17 00:00:00 2001 From: Shen Chen Date: Fri, 4 Sep 2020 23:59:52 -0700 Subject: [PATCH 015/295] Fix the xlf file --- src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf | 5 +++++ src/Features/Core/Portable/xlf/FeaturesResources.de.xlf | 5 +++++ src/Features/Core/Portable/xlf/FeaturesResources.es.xlf | 5 +++++ src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf | 5 +++++ src/Features/Core/Portable/xlf/FeaturesResources.it.xlf | 5 +++++ src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf | 5 +++++ src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf | 5 +++++ src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf | 5 +++++ src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf | 5 +++++ src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf | 5 +++++ src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf | 5 +++++ src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf | 5 +++++ src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf | 5 +++++ 13 files changed, 65 insertions(+) diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf index 5f495e29b601f..d60b153e2883d 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf @@ -675,6 +675,11 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Povýšit členy na základní typ... + + Pull member(s) up to new base class... + Pull member(s) up to new base class... + + Quantifier {x,y} following nothing Před kvantifikátorem {x,y} není nic uvedeno. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf index 292c8731d7139..c6a29432b2d31 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf @@ -675,6 +675,11 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Member zum Basistyp ziehen... + + Pull member(s) up to new base class... + Pull member(s) up to new base class... + + Quantifier {x,y} following nothing Quantifizierer {x,y} nach nichts. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf index 48d5936dec8d0..96773e433cf70 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf @@ -675,6 +675,11 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Extraer miembros hasta el tipo de base... + + Pull member(s) up to new base class... + Pull member(s) up to new base class... + + Quantifier {x,y} following nothing Cuantificador {x, y} después de nada diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf index cbccf1aff51ac..ade3adb9deaf9 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf @@ -675,6 +675,11 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Tirer les membres jusqu'au type de base... + + Pull member(s) up to new base class... + Pull member(s) up to new base class... + + Quantifier {x,y} following nothing Le quantificateur {x,y} ne suit rien diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf index 5895e58bd62ad..55f3807f52f8d 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf @@ -675,6 +675,11 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Esegui pull dei membri fino al tipo di base... + + Pull member(s) up to new base class... + Pull member(s) up to new base class... + + Quantifier {x,y} following nothing Il quantificatore {x,y} non segue alcun elemento diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf index 2db411af0449b..56a4e1031c5ae 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf @@ -675,6 +675,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 基本型のメンバーをプル... + + Pull member(s) up to new base class... + Pull member(s) up to new base class... + + Quantifier {x,y} following nothing 量指定子 {x,y} の前に何もありません diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf index 25832c6aa68d9..0f3b9a6ac075e 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf @@ -675,6 +675,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 기본 형식까지 멤버를 풀... + + Pull member(s) up to new base class... + Pull member(s) up to new base class... + + Quantifier {x,y} following nothing 수량자 {x,y} 앞에 아무 것도 없습니다. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf index d4389d554d651..713bea9d0cc06 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf @@ -675,6 +675,11 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Ściągnij składowe aż do typu bazowego... + + Pull member(s) up to new base class... + Pull member(s) up to new base class... + + Quantifier {x,y} following nothing Nic nie występuje przed kwantyfikatorem {x,y} diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf index ae80e4950c962..df653ed8af8e7 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf @@ -675,6 +675,11 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Efetuar pull de membros até o tipo base... + + Pull member(s) up to new base class... + Pull member(s) up to new base class... + + Quantifier {x,y} following nothing Nada precede o quantificador {x,y} diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf index be1d527d0a3af..e907a1d9b377d 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf @@ -675,6 +675,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Извлечь элементы до базового типа... + + Pull member(s) up to new base class... + Pull member(s) up to new base class... + + Quantifier {x,y} following nothing Отсутствуют элементы перед квантификатором {x,y} diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf index 1e2ab10df06af..1a7f8d2b16f53 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf @@ -675,6 +675,11 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Üyeleri temel türe çek... + + Pull member(s) up to new base class... + Pull member(s) up to new base class... + + Quantifier {x,y} following nothing Niceleyici {x, y} hiçbir şeyi takip etmiyor diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf index a1ca9f8e9482e..30c30b11e2b60 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf @@ -675,6 +675,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 将成员拉到基本类型..。 + + Pull member(s) up to new base class... + Pull member(s) up to new base class... + + Quantifier {x,y} following nothing 限定符 {x,y} 前没有任何内容 diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf index a3d5efa9a0aa4..665d6cea0947e 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf @@ -675,6 +675,11 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 將成員提取直到基底類型... + + Pull member(s) up to new base class... + Pull member(s) up to new base class... + + Quantifier {x,y} following nothing 數量詞 {x,y} 前面沒有任何項目 From 5921941518a63760972e623ff58f2804e83698e1 Mon Sep 17 00:00:00 2001 From: Rikki Gibson Date: Tue, 15 Sep 2020 16:19:13 -0700 Subject: [PATCH 016/295] Resolve remaining conflict --- eng/Versions.props | 5 ----- 1 file changed, 5 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 36d06c1611179..753f208a52fcf 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -110,13 +110,8 @@ 2.0.0-alpha-20170405-2 0.1.0 0.1.2-dev -<<<<<<< HEAD 2.7.7-alpha 2.7.7-alpha -======= - 2.7.69-alpha - 2.7.69-alpha ->>>>>>> upstream/master 10.1.0 15.8.27812-alpha 15.8.27812-alpha From b92dff27a337fc82231b35b73063566cc888d581 Mon Sep 17 00:00:00 2001 From: tmat Date: Wed, 16 Sep 2020 10:33:15 -0700 Subject: [PATCH 017/295] Update RpcContracts to 16.7.50 --- eng/Versions.props | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 753f208a52fcf..55e84ef4978da 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -57,7 +57,7 @@ 5.7.0 - 16.6.74 + 16.7.50 12.0.2 - 2.6.86-alpha + 2.6.104 5.0.0-preview.8.20407.11 5.0.0-preview.8.20407.11 1.1.1 From 4e4820e904576870550bff62686de8170261fdbb Mon Sep 17 00:00:00 2001 From: David Barbet Date: Mon, 21 Sep 2020 19:07:24 -0700 Subject: [PATCH 029/295] Update shell package versions --- eng/Versions.props | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 77695c73f9910..99edbd0257cca 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -35,7 +35,7 @@ 16.8.39 5.0.0-alpha1.19409.1 16.8.52 - 16.8.30323.125 + 16.8.30406.65-pre - - - - - - - diff --git a/eng/publish-assets.ps1 b/eng/publish-assets.ps1 index 198def8764174..bbc2bd2cae301 100644 --- a/eng/publish-assets.ps1 +++ b/eng/publish-assets.ps1 @@ -1,11 +1,11 @@ # Publishes our build assets to nuget, myget, dotnet/versions, etc .. # -# The publish operation is best visioned as an optional yet repeatable post build operation. It can be -# run anytime after build or automatically as a post build step. But it is an operation that focuses on +# The publish operation is best visioned as an optional yet repeatable post build operation. It can be +# run anytime after build or automatically as a post build step. But it is an operation that focuses on # build outputs and hence can't rely on source code from the build being available # -# Repeatable is important here because we have to assume that publishes can and will fail with some -# degree of regularity. +# Repeatable is important here because we have to assume that publishes can and will fail with some +# degree of regularity. [CmdletBinding(PositionalBinding=$false)] Param( # Standard options @@ -14,7 +14,7 @@ Param( [string]$releaseName = "", [switch]$test, - # Credentials + # Credentials [string]$gitHubUserName = "", [string]$gitHubToken = "", [string]$gitHubEmail = "", @@ -52,7 +52,7 @@ function Publish-Nuget($publishData, [string]$packageDir) { if (-not (Test-Path $nupkg)) { throw "$nupkg does not exist" } - + # Lookup the feed name from the packages map using the package name without the version or extension. $nupkgWithoutVersion = $nupkg -replace '(\.\d){3}-.*.nupkg', '' if (-not (Get-Member -InputObject $packagesData -Name $nupkgWithoutVersion)) { @@ -66,12 +66,12 @@ function Publish-Nuget($publishData, [string]$packageDir) { Write-Host " Skipping publishing for $nupkg as it is published by arcade" continue } - + # Use the feed name to get the source to upload the package to. if (-not (Get-Member -InputObject $feedData -Name $feedName)) { throw "$feedName has no configured source feed" } - + $uploadUrl = $feedData.$feedName $apiKey = Get-PublishKey $uploadUrl @@ -85,38 +85,18 @@ function Publish-Nuget($publishData, [string]$packageDir) { } } -function Publish-Vsix([string]$uploadUrl) { - Write-Host "Publishing VSIX to $uploadUrl" - $apiKey = Get-PublishKey $uploadUrl - $extensions = [xml](Get-Content (Join-Path $EngRoot "config\PublishVsix.MyGet.config")) - foreach ($extension in $extensions.extensions.extension) { - $vsix = Join-Path $VSSetupDir ($extension.id + ".vsix") - if (-not (Test-Path $vsix)) { - throw "VSIX $vsix does not exist" - } - - Write-Host " Publishing '$vsix'" - if (-not $test) { - $response = Invoke-WebRequest -Uri $uploadUrl -Headers @{"X-NuGet-ApiKey"=$apiKey} -ContentType 'multipart/form-data' -InFile $vsix -Method Post -UseBasicParsing - if ($response.StatusCode -ne 201) { - throw "Failed to upload VSIX extension: $vsix. Upload failed with Status code: $response.StatusCode" - } - } - } -} - function Publish-Channel([string]$packageDir, [string]$name) { $publish = GetProjectOutputBinary "RoslynPublish.exe" $args = "-nugetDir `"$packageDir`" -channel $name -gu $gitHubUserName -gt $gitHubToken -ge $githubEmail" Write-Host "Publishing $packageDir to channel $name" - if (-not $test) { + if (-not $test) { Exec-Console $publish $args } } # Do basic verification on the values provided in the publish configuration -function Test-Entry($publishData, [switch]$isBranch) { - if ($isBranch) { +function Test-Entry($publishData, [switch]$isBranch) { + if ($isBranch) { foreach ($nugetKind in $publishData.nugetKind) { if ($nugetKind -ne "PerBuildPreRelease" -and $nugetKind -ne "Shipping" -and $nugetKind -ne "NonShipping") { throw "Branches are only allowed to publish Shipping, NonShipping, or PerBuildPreRelease" @@ -125,8 +105,8 @@ function Test-Entry($publishData, [switch]$isBranch) { } } -# Publish a given entry: branch or release. -function Publish-Entry($publishData, [switch]$isBranch) { +# Publish a given entry: branch or release. +function Publish-Entry($publishData, [switch]$isBranch) { Test-Entry $publishData -isBranch:$isBranch # First publish the NuGet packages to the specified feeds @@ -134,12 +114,6 @@ function Publish-Entry($publishData, [switch]$isBranch) { Publish-NuGet $publishData (Join-Path $PackagesDir $nugetKind) } - # Next publish the VSIX to the specified feeds - $vsixData = $publishData.vsix - if ($vsixData -ne $null) { - Publish-Vsix $vsixData - } - # Finally get our channels uploaded to versions foreach ($channel in $publishData.channels) { foreach ($nugetKind in $publishData.nugetKind) { From 42f02a6f1a660c2566c18c6115cfbad160ce045c Mon Sep 17 00:00:00 2001 From: Fred Silberberg Date: Mon, 5 Oct 2020 11:13:58 -0700 Subject: [PATCH 128/295] Ensure initial binding always binds to natural type (#48205) --- .../Portable/Binder/Binder_Expressions.cs | 4 + .../Portable/Binder/Binder_Statements.cs | 2 +- ...perationTests_IObjectCreationExpression.cs | 126 ++++++++++++++++++ .../Semantics/ConditionalOperatorTests.cs | 19 +++ 4 files changed, 150 insertions(+), 1 deletion(-) diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs index 50c5af5d3838b..926e76fb7742c 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs @@ -3165,6 +3165,10 @@ private BoundExpression BindArrayDimension(ExpressionSyntax dimension, Diagnosti hasErrors = true; } } + else + { + size = BindToTypeForErrorRecovery(size); + } return size; } diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs index 4f55ba78ef4b5..9406b9fa4e8cc 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs @@ -2354,7 +2354,7 @@ internal BoundExpression BindBooleanExpression(ExpressionSyntax node, Diagnostic // The expression could not be bound. Insert a fake conversion // around it to bool and keep on going. // NOTE: no user-defined conversion candidates. - return BoundConversion.Synthesized(node, expr, Conversion.NoConversion, false, explicitCastInCode: false, conversionGroupOpt: null, ConstantValue.NotAvailable, boolean, hasErrors: true); + return BoundConversion.Synthesized(node, BindToTypeForErrorRecovery(expr), Conversion.NoConversion, false, explicitCastInCode: false, conversionGroupOpt: null, ConstantValue.NotAvailable, boolean, hasErrors: true); } // Oddly enough, "if(dyn)" is bound not as a dynamic conversion to bool, but as a dynamic diff --git a/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IObjectCreationExpression.cs b/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IObjectCreationExpression.cs index 5a80651cfa5ca..8774cef88cb28 100644 --- a/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IObjectCreationExpression.cs +++ b/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IObjectCreationExpression.cs @@ -793,6 +793,132 @@ public void M1() VerifyOperationTreeAndDiagnosticsForTest(source, expectedOperationTree, expectedDiagnostics, parseOptions: ImplicitObjectCreationOptions); } + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(1198816, "https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1198816/")] + public void ImplicitObjectCreationUnconverted_ArrayIndex() + { + var comp = CreateCompilation("_ = new int[/**/new(bad)/**/];", options: TestOptions.ReleaseExe); + + var expectedDiagnostics = new DiagnosticDescription[] { + // (1,27): error CS0103: The name 'bad' does not exist in the current context + // _ = new int[/**/new(bad)/**/]; + Diagnostic(ErrorCode.ERR_NameNotInContext, "bad").WithArguments("bad").WithLocation(1, 27) + }; + + VerifyOperationTreeAndDiagnosticsForTest(comp, @" +IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'new(bad)') + Children(1): + IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'bad') + Children(0) + ", expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(1198816, "https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1198816/")] + public void ImplicitObjectCreationUnconverted_IfCondition() + { + var comp = CreateCompilation(@" +if (/**/new(bad)/**/) {} +", options: TestOptions.UnsafeReleaseExe); + + var expectedDiagnostics = new DiagnosticDescription[] { + // (2,19): error CS0103: The name 'bad' does not exist in the current context + // if (/**/new(bad)/**/) {} + Diagnostic(ErrorCode.ERR_NameNotInContext, "bad").WithArguments("bad").WithLocation(2, 19) + }; + + VerifyOperationTreeAndDiagnosticsForTest(comp, @" +IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'new(bad)') + Children(1): + IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'bad') + Children(0) + ", expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(1198816, "https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1198816/")] + public void ImplicitObjectCreationUnconverted_ConditionalOperator() + { + var source = +@"class Program +{ + static void Main() + { + _ = /**/new(bad)/**/ ? null : new object(); + } +}"; + var comp = CreateCompilation(source); + + var expectedDiagnostics = new DiagnosticDescription[] { + // (5,27): error CS0103: The name 'bad' does not exist in the current context + // _ = /**/new(bad)/**/ ? null : new object(); + Diagnostic(ErrorCode.ERR_NameNotInContext, "bad").WithArguments("bad").WithLocation(5, 27) + }; + + VerifyOperationTreeAndDiagnosticsForTest(comp, @" +IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'new(bad)') + Children(1): + IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'bad') + Children(0) + ", expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(1198816, "https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1198816/")] + public void ImplicitObjectCreationUnconverted_ConditionalOperator_Nested1() + { + var source = +@"class Program +{ + static void Main() + { + _ = (/**/new(bad)/**/, null) ? null : new object(); + } +}"; + var comp = CreateCompilation(source); + + var expectedDiagnostics = new DiagnosticDescription[] { + // (5,28): error CS0103: The name 'bad' does not exist in the current context + // _ = (/**/new(bad)/**/, null) ? null : new object(); + Diagnostic(ErrorCode.ERR_NameNotInContext, "bad").WithArguments("bad").WithLocation(5, 28) + }; + + VerifyOperationTreeAndDiagnosticsForTest(comp, @" +IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'new(bad)') + Children(1): + IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'bad') + Children(0) + ", expectedDiagnostics); + } + + [CompilerTrait(CompilerFeature.IOperation)] + [Fact, WorkItem(1198816, "https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1198816/")] + public void ImplicitObjectCreationUnconverted_ConditionalOperator_Nested2() + { + var source = +@"class Program +{ + static void Main(int i) + { + _ = i switch { 1 => /**/new(bad)/**/, _ => null } ? null : new object(); + } +}"; + var comp = CreateCompilation(source); + + var expectedDiagnostics = new DiagnosticDescription[] { + // (5,43): error CS0103: The name 'bad' does not exist in the current context + // _ = i switch { 1 => /**/new(bad)/**/, _ => null } ? null : new object(); + Diagnostic(ErrorCode.ERR_NameNotInContext, "bad").WithArguments("bad").WithLocation(5, 43) + }; + + VerifyOperationTreeAndDiagnosticsForTest(comp, @" +IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'new(bad)') + Children(1): + IInvalidOperation (OperationKind.Invalid, Type: ?, IsInvalid) (Syntax: 'bad') + Children(0) + ", expectedDiagnostics); + } + [CompilerTrait(CompilerFeature.IOperation)] [Fact] public void ImplicitObjectCreationWithDynamicMemberInitializer_01() diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/ConditionalOperatorTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/ConditionalOperatorTests.cs index a2948049f8e80..6d8a5a0ac5dc8 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/ConditionalOperatorTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/ConditionalOperatorTests.cs @@ -1499,5 +1499,24 @@ public TestClass Self() CompileAndVerify(compilation, expectedOutput: "---"); } + + [Fact, WorkItem(1198816, "https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1198816/")] + public void DefiniteAssignment_UnconvertedConditionalOperator() + { + var source = +@"class Program +{ + static void Main() + { + _ = new(bad) ? null : new object(); + } +}"; + var comp = CreateCompilation(source); + comp.VerifyDiagnostics( + // (5,17): error CS0103: The name 'bad' does not exist in the current context + // _ = new(bad) ? null : new object(); + Diagnostic(ErrorCode.ERR_NameNotInContext, "bad").WithArguments("bad").WithLocation(5, 17) + ); + } } } From eea231341c259b8d80b702733510ba626d041575 Mon Sep 17 00:00:00 2001 From: Fred Silberberg Date: Mon, 5 Oct 2020 11:14:15 -0700 Subject: [PATCH 129/295] Handle indexers in nested object initializers (#48168) --- .../Portable/Binder/Binder_Expressions.cs | 2 +- .../CSharp/Portable/BoundTree/BoundNodes.xml | 4 +- .../Generated/BoundNodes.xml.Generated.cs | 21 ++--- ...ocalRewriter_CompoundAssignmentOperator.cs | 1 + .../LocalRewriter_IndexerAccess.cs | 4 +- ...ObjectOrCollectionInitializerExpression.cs | 2 +- .../Lowering/MethodToClassRewriter.cs | 2 +- .../Operations/CSharpOperationFactory.cs | 2 +- .../CSharpOperationFactory_Methods.cs | 15 +++- .../Symbols/PropertySymbolExtensions.cs | 16 ++-- ...ationTests_IPropertyReferenceExpression.cs | 90 +++++++++++++++++++ 11 files changed, 128 insertions(+), 31 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs index 926e76fb7742c..3be1bb7b69305 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs @@ -4732,7 +4732,7 @@ private BoundExpression BindObjectInitializerMember( argsToParamsOpt, resultKind, implicitReceiver.Type, - binderOpt: this, + binder: this, type: boundMember.Type, hasErrors: hasErrors); } diff --git a/src/Compilers/CSharp/Portable/BoundTree/BoundNodes.xml b/src/Compilers/CSharp/Portable/BoundTree/BoundNodes.xml index 29edac8e49da1..7b22c8f71193f 100644 --- a/src/Compilers/CSharp/Portable/BoundTree/BoundNodes.xml +++ b/src/Compilers/CSharp/Portable/BoundTree/BoundNodes.xml @@ -1744,9 +1744,9 @@ - + - + diff --git a/src/Compilers/CSharp/Portable/Generated/BoundNodes.xml.Generated.cs b/src/Compilers/CSharp/Portable/Generated/BoundNodes.xml.Generated.cs index 572f643d906c5..ecfb26a2912f6 100644 --- a/src/Compilers/CSharp/Portable/Generated/BoundNodes.xml.Generated.cs +++ b/src/Compilers/CSharp/Portable/Generated/BoundNodes.xml.Generated.cs @@ -6113,12 +6113,13 @@ public BoundObjectInitializerExpression Update(BoundObjectOrCollectionValuePlace internal sealed partial class BoundObjectInitializerMember : BoundExpression { - public BoundObjectInitializerMember(SyntaxNode syntax, Symbol? memberSymbol, ImmutableArray arguments, ImmutableArray argumentNamesOpt, ImmutableArray argumentRefKindsOpt, bool expanded, ImmutableArray argsToParamsOpt, LookupResultKind resultKind, TypeSymbol receiverType, Binder? binderOpt, TypeSymbol type, bool hasErrors = false) + public BoundObjectInitializerMember(SyntaxNode syntax, Symbol? memberSymbol, ImmutableArray arguments, ImmutableArray argumentNamesOpt, ImmutableArray argumentRefKindsOpt, bool expanded, ImmutableArray argsToParamsOpt, LookupResultKind resultKind, TypeSymbol receiverType, Binder binder, TypeSymbol type, bool hasErrors = false) : base(BoundKind.ObjectInitializerMember, syntax, type, hasErrors || arguments.HasErrors()) { RoslynDebug.Assert(!arguments.IsDefault, "Field 'arguments' cannot be null (use Null=\"allow\" in BoundNodes.xml to remove this check)"); RoslynDebug.Assert(receiverType is object, "Field 'receiverType' cannot be null (make the type nullable in BoundNodes.xml to remove this check)"); + RoslynDebug.Assert(binder is object, "Field 'binder' cannot be null (make the type nullable in BoundNodes.xml to remove this check)"); RoslynDebug.Assert(type is object, "Field 'type' cannot be null (make the type nullable in BoundNodes.xml to remove this check)"); this.MemberSymbol = memberSymbol; @@ -6129,7 +6130,7 @@ public BoundObjectInitializerMember(SyntaxNode syntax, Symbol? memberSymbol, Imm this.ArgsToParamsOpt = argsToParamsOpt; this._ResultKind = resultKind; this.ReceiverType = receiverType; - this.BinderOpt = binderOpt; + this.Binder = binder; } @@ -6152,15 +6153,15 @@ public BoundObjectInitializerMember(SyntaxNode syntax, Symbol? memberSymbol, Imm public TypeSymbol ReceiverType { get; } - public Binder? BinderOpt { get; } + public Binder Binder { get; } [DebuggerStepThrough] public override BoundNode? Accept(BoundTreeVisitor visitor) => visitor.VisitObjectInitializerMember(this); - public BoundObjectInitializerMember Update(Symbol? memberSymbol, ImmutableArray arguments, ImmutableArray argumentNamesOpt, ImmutableArray argumentRefKindsOpt, bool expanded, ImmutableArray argsToParamsOpt, LookupResultKind resultKind, TypeSymbol receiverType, Binder? binderOpt, TypeSymbol type) + public BoundObjectInitializerMember Update(Symbol? memberSymbol, ImmutableArray arguments, ImmutableArray argumentNamesOpt, ImmutableArray argumentRefKindsOpt, bool expanded, ImmutableArray argsToParamsOpt, LookupResultKind resultKind, TypeSymbol receiverType, Binder binder, TypeSymbol type) { - if (!Symbols.SymbolEqualityComparer.ConsiderEverything.Equals(memberSymbol, this.MemberSymbol) || arguments != this.Arguments || argumentNamesOpt != this.ArgumentNamesOpt || argumentRefKindsOpt != this.ArgumentRefKindsOpt || expanded != this.Expanded || argsToParamsOpt != this.ArgsToParamsOpt || resultKind != this.ResultKind || !TypeSymbol.Equals(receiverType, this.ReceiverType, TypeCompareKind.ConsiderEverything) || binderOpt != this.BinderOpt || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) + if (!Symbols.SymbolEqualityComparer.ConsiderEverything.Equals(memberSymbol, this.MemberSymbol) || arguments != this.Arguments || argumentNamesOpt != this.ArgumentNamesOpt || argumentRefKindsOpt != this.ArgumentRefKindsOpt || expanded != this.Expanded || argsToParamsOpt != this.ArgsToParamsOpt || resultKind != this.ResultKind || !TypeSymbol.Equals(receiverType, this.ReceiverType, TypeCompareKind.ConsiderEverything) || binder != this.Binder || !TypeSymbol.Equals(type, this.Type, TypeCompareKind.ConsiderEverything)) { - var result = new BoundObjectInitializerMember(this.Syntax, memberSymbol, arguments, argumentNamesOpt, argumentRefKindsOpt, expanded, argsToParamsOpt, resultKind, receiverType, binderOpt, type, this.HasErrors); + var result = new BoundObjectInitializerMember(this.Syntax, memberSymbol, arguments, argumentNamesOpt, argumentRefKindsOpt, expanded, argsToParamsOpt, resultKind, receiverType, binder, type, this.HasErrors); result.CopyAttributes(this); return result; } @@ -10570,7 +10571,7 @@ internal abstract partial class BoundTreeRewriter : BoundTreeVisitor ImmutableArray arguments = this.VisitList(node.Arguments); TypeSymbol? receiverType = this.VisitType(node.ReceiverType); TypeSymbol? type = this.VisitType(node.Type); - return node.Update(node.MemberSymbol, arguments, node.ArgumentNamesOpt, node.ArgumentRefKindsOpt, node.Expanded, node.ArgsToParamsOpt, node.ResultKind, receiverType, node.BinderOpt, type); + return node.Update(node.MemberSymbol, arguments, node.ArgumentNamesOpt, node.ArgumentRefKindsOpt, node.Expanded, node.ArgsToParamsOpt, node.ResultKind, receiverType, node.Binder, type); } public override BoundNode? VisitDynamicObjectInitializerMember(BoundDynamicObjectInitializerMember node) { @@ -12555,12 +12556,12 @@ public NullabilityRewriter(ImmutableDictionary DeriveArguments(BoundNode containingExpression, bool isObjectOrCollectionInitializer) { switch (containingExpression.Kind) @@ -215,11 +216,12 @@ internal ImmutableArray DeriveArguments(BoundNode containing case BoundKind.ObjectInitializerMember: { var boundObjectInitializerMember = (BoundObjectInitializerMember)containingExpression; - var property = (PropertySymbol)boundObjectInitializerMember.MemberSymbol; - MethodSymbol accessor = isObjectOrCollectionInitializer ? property.GetOwnOrInheritedGetMethod() : property.GetOwnOrInheritedSetMethod(); + var property = (PropertySymbol?)boundObjectInitializerMember.MemberSymbol; + Debug.Assert(property is not null); + MethodSymbol? accessor = isObjectOrCollectionInitializer ? property.GetOwnOrInheritedGetMethod() : property.GetOwnOrInheritedSetMethod(); return DeriveArguments( boundObjectInitializerMember, - boundObjectInitializerMember.BinderOpt, + boundObjectInitializerMember.Binder, property, accessor, boundObjectInitializerMember.Arguments, @@ -235,6 +237,7 @@ internal ImmutableArray DeriveArguments(BoundNode containing return DeriveArguments(containingExpression); } } +#nullable disable internal ImmutableArray DeriveArguments(BoundNode containingExpression) { @@ -309,11 +312,12 @@ internal ImmutableArray DeriveArguments(BoundNode containing } } +#nullable enable private ImmutableArray DeriveArguments( BoundNode boundNode, Binder binder, Symbol methodOrIndexer, - MethodSymbol optionalParametersMethod, + MethodSymbol? optionalParametersMethod, ImmutableArray boundArguments, ImmutableArray argumentNamesOpt, ImmutableArray argumentsToParametersOpt, @@ -331,6 +335,8 @@ private ImmutableArray DeriveArguments( return ImmutableArray.Empty; } + Debug.Assert(optionalParametersMethod is not null); + return LocalRewriter.MakeArgumentsInEvaluationOrder( operationFactory: this, binder: binder, @@ -342,6 +348,7 @@ private ImmutableArray DeriveArguments( argsToParamsOpt: argumentsToParametersOpt, invokedAsExtensionMethod: invokedAsExtensionMethod); } +#nullable disable internal static ImmutableArray CreateInvalidChildrenFromArgumentsExpression(BoundNode receiverOpt, ImmutableArray arguments, BoundExpression additionalNodeOpt = null) { diff --git a/src/Compilers/CSharp/Portable/Symbols/PropertySymbolExtensions.cs b/src/Compilers/CSharp/Portable/Symbols/PropertySymbolExtensions.cs index 5b1f50ddfa488..1e171d8e7fbef 100644 --- a/src/Compilers/CSharp/Portable/Symbols/PropertySymbolExtensions.cs +++ b/src/Compilers/CSharp/Portable/Symbols/PropertySymbolExtensions.cs @@ -2,9 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.CodeAnalysis.CSharp.Symbols; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using Microsoft.CodeAnalysis.Text; +#nullable enable namespace Microsoft.CodeAnalysis.CSharp.Symbols { @@ -14,12 +12,12 @@ internal static class PropertySymbolExtensions /// If the property has a GetMethod, return that. Otherwise check the overridden /// property, if any. Repeat for each overridden property. /// - public static MethodSymbol GetOwnOrInheritedGetMethod(this PropertySymbol property) + public static MethodSymbol? GetOwnOrInheritedGetMethod(this PropertySymbol? property) { - while ((object)property != null) + while ((object?)property != null) { MethodSymbol getMethod = property.GetMethod; - if ((object)getMethod != null) + if ((object?)getMethod != null) { return getMethod; } @@ -34,12 +32,12 @@ public static MethodSymbol GetOwnOrInheritedGetMethod(this PropertySymbol proper /// If the property has a SetMethod, return that. Otherwise check the overridden /// property, if any. Repeat for each overridden property. /// - public static MethodSymbol GetOwnOrInheritedSetMethod(this PropertySymbol property) + public static MethodSymbol? GetOwnOrInheritedSetMethod(this PropertySymbol? property) { - while ((object)property != null) + while ((object?)property != null) { MethodSymbol setMethod = property.SetMethod; - if ((object)setMethod != null) + if ((object?)setMethod != null) { return setMethod; } diff --git a/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IPropertyReferenceExpression.cs b/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IPropertyReferenceExpression.cs index 5880482232d4d..42caa020de157 100644 --- a/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IPropertyReferenceExpression.cs +++ b/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IPropertyReferenceExpression.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.Test.Utilities; using Roslyn.Test.Utilities; using Xunit; @@ -1003,5 +1004,94 @@ void M(C c1, C c2, int? i1, int i2, int? i3, int i4, int p) VerifyFlowGraphAndDiagnosticsForTest(source, expectedFlowGraph, expectedDiagnostics); } + + [Fact, WorkItem(45692, "https://github.com/dotnet/roslyn/issues/45692")] + public void NestedObjectInitializerMissingGet() + { + var comp = CreateCompilation(@" +_ = new C { Prop1 = /**/new C { [0] = 1 }/**/ }; + +class C +{ + public object Prop1 { get; set; } + public object this[int i] { set { } } + +} +", options: TestOptions.ReleaseExe); + + VerifyOperationTreeAndDiagnosticsForTest(comp, @" +IObjectCreationOperation (Constructor: C..ctor()) (OperationKind.ObjectCreation, Type: C) (Syntax: 'new C { [0] = 1 }') + Arguments(0) + Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: C) (Syntax: '{ [0] = 1 }') + Initializers(1): + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Object) (Syntax: '[0] = 1') + Left: + IPropertyReferenceOperation: System.Object C.this[System.Int32 i] { set; } (OperationKind.PropertyReference, Type: System.Object) (Syntax: '[0]') + Instance Receiver: + IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: '[0]') + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '0') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Right: + IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + ", DiagnosticDescription.None); + } + + [Fact, WorkItem(45692, "https://github.com/dotnet/roslyn/issues/45692")] + public void NestedObjectInitializerMissingGet_NestedInitializer() + { + var comp = CreateCompilation(@" +_ = new C { Prop1 = /**/new C { [0] = new C { Prop1 = 1 } }/**/ }; + +class C +{ + public object Prop1 { get; set; } + public object this[int i] { set { } } +} +", options: TestOptions.ReleaseExe); + + VerifyOperationTreeAndDiagnosticsForTest(comp, @" +IObjectCreationOperation (Constructor: C..ctor()) (OperationKind.ObjectCreation, Type: C) (Syntax: 'new C { [0] ... op1 = 1 } }') + Arguments(0) + Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: C) (Syntax: '{ [0] = new ... op1 = 1 } }') + Initializers(1): + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Object) (Syntax: '[0] = new C ... Prop1 = 1 }') + Left: + IPropertyReferenceOperation: System.Object C.this[System.Int32 i] { set; } (OperationKind.PropertyReference, Type: System.Object) (Syntax: '[0]') + Instance Receiver: + IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: '[0]') + Arguments(1): + IArgumentOperation (ArgumentKind.Explicit, Matching Parameter: i) (OperationKind.Argument, Type: null) (Syntax: '0') + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 0) (Syntax: '0') + InConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + OutConversion: CommonConversion (Exists: True, IsIdentity: True, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Right: + IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: 'new C { Prop1 = 1 }') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: True, IsUserDefined: False) (MethodSymbol: null) + Operand: + IObjectCreationOperation (Constructor: C..ctor()) (OperationKind.ObjectCreation, Type: C) (Syntax: 'new C { Prop1 = 1 }') + Arguments(0) + Initializer: + IObjectOrCollectionInitializerOperation (OperationKind.ObjectOrCollectionInitializer, Type: C) (Syntax: '{ Prop1 = 1 }') + Initializers(1): + ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: System.Object) (Syntax: 'Prop1 = 1') + Left: + IPropertyReferenceOperation: System.Object C.Prop1 { get; set; } (OperationKind.PropertyReference, Type: System.Object) (Syntax: 'Prop1') + Instance Receiver: + IInstanceReferenceOperation (ReferenceKind: ImplicitReceiver) (OperationKind.InstanceReference, Type: C, IsImplicit) (Syntax: 'Prop1') + Right: + IConversionOperation (TryCast: False, Unchecked) (OperationKind.Conversion, Type: System.Object, IsImplicit) (Syntax: '1') + Conversion: CommonConversion (Exists: True, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null) + Operand: + ILiteralOperation (OperationKind.Literal, Type: System.Int32, Constant: 1) (Syntax: '1') + ", DiagnosticDescription.None); + } } } From 947b601339f7c015510525e0ca651aa3ddf3ad82 Mon Sep 17 00:00:00 2001 From: Youssef Victor <31348972+Youssef1313@users.noreply.github.com> Date: Mon, 5 Oct 2020 21:28:03 +0200 Subject: [PATCH 130/295] Improve error when named argument is used with function pointer (#48081) --- .../OverloadResolutionResult.cs | 12 +++++- .../CSharp/Portable/CSharpResources.resx | 5 ++- .../CSharp/Portable/Errors/ErrorCode.cs | 2 + .../Portable/xlf/CSharpResources.cs.xlf | 5 +++ .../Portable/xlf/CSharpResources.de.xlf | 5 +++ .../Portable/xlf/CSharpResources.es.xlf | 5 +++ .../Portable/xlf/CSharpResources.fr.xlf | 5 +++ .../Portable/xlf/CSharpResources.it.xlf | 5 +++ .../Portable/xlf/CSharpResources.ja.xlf | 5 +++ .../Portable/xlf/CSharpResources.ko.xlf | 5 +++ .../Portable/xlf/CSharpResources.pl.xlf | 5 +++ .../Portable/xlf/CSharpResources.pt-BR.xlf | 5 +++ .../Portable/xlf/CSharpResources.ru.xlf | 5 +++ .../Portable/xlf/CSharpResources.tr.xlf | 5 +++ .../Portable/xlf/CSharpResources.zh-Hans.xlf | 5 +++ .../Portable/xlf/CSharpResources.zh-Hant.xlf | 5 +++ .../Semantics/FunctionPointerTests.cs | 38 +++++++++++++++++++ 17 files changed, 119 insertions(+), 3 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Binder/Semantics/OverloadResolution/OverloadResolutionResult.cs b/src/Compilers/CSharp/Portable/Binder/Semantics/OverloadResolution/OverloadResolutionResult.cs index 304c3b26c0743..010dec9111236 100644 --- a/src/Compilers/CSharp/Portable/Binder/Semantics/OverloadResolution/OverloadResolutionResult.cs +++ b/src/Compilers/CSharp/Portable/Binder/Semantics/OverloadResolution/OverloadResolutionResult.cs @@ -472,13 +472,21 @@ internal void ReportDiagnostics( // If there are any supported candidates, we don't care about unsupported candidates. if (firstSupported.IsNotNull) { + if (firstSupported.Member is FunctionPointerMethodSymbol + && firstSupported.Result.Kind == MemberResolutionKind.NoCorrespondingNamedParameter) + { + int badArg = firstSupported.Result.BadArgumentsOpt[0]; + IdentifierNameSyntax badName = arguments.Names[badArg]; + diagnostics.Add(ErrorCode.ERR_FunctionPointersCannotBeCalledWithNamedArguments, badName.Location); + return; + } // If there are multiple supported candidates, we don't have a good way to choose the best // one so we report a general diagnostic (below). - if (!(firstSupported.Result.Kind == MemberResolutionKind.RequiredParameterMissing && supportedRequiredParameterMissingConflicts) + else if (!(firstSupported.Result.Kind == MemberResolutionKind.RequiredParameterMissing && supportedRequiredParameterMissingConflicts) && !isMethodGroupConversion // Function pointer type symbols don't have named parameters, so we just want to report a general mismatched parameter // count instead of name errors. - && !(firstSupported.Member is FunctionPointerMethodSymbol _)) + && (firstSupported.Member is not FunctionPointerMethodSymbol)) { switch (firstSupported.Result.Kind) { diff --git a/src/Compilers/CSharp/Portable/CSharpResources.resx b/src/Compilers/CSharp/Portable/CSharpResources.resx index 4b2fba6d7ac65..cc05a789ad16a 100644 --- a/src/Compilers/CSharp/Portable/CSharpResources.resx +++ b/src/Compilers/CSharp/Portable/CSharpResources.resx @@ -6563,4 +6563,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ variance safety for static interface members - + + A function pointer cannot be called with named arguments. + + \ No newline at end of file diff --git a/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs b/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs index d547a9d66ae85..b96fd1af317dd 100644 --- a/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs +++ b/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs @@ -1918,6 +1918,8 @@ internal enum ErrorCode ERR_InitCannotBeReadonly = 8903, + ERR_FunctionPointersCannotBeCalledWithNamedArguments = 8904, + #endregion diagnostics introduced for C# 9.0 ERR_UnexpectedVarianceStaticMember = 9100, diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf index eef8cd25b0768..997c8a5447f31 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf @@ -412,6 +412,11 @@ Ref mismatch between '{0}' and function pointer '{1}' + + A function pointer cannot be called with named arguments. + A function pointer cannot be called with named arguments. + + A goto cannot jump to a location before a using declaration within the same block. Příkaz goto nemůže přejít na místo před deklarací using ve stejném bloku. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf index 38a263ec52c76..b8d8af61982ef 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf @@ -412,6 +412,11 @@ Ref mismatch between '{0}' and function pointer '{1}' + + A function pointer cannot be called with named arguments. + A function pointer cannot be called with named arguments. + + A goto cannot jump to a location before a using declaration within the same block. Mit "goto" kann nicht an eine Position vor einer using-Deklaration im selben Block gesprungen werden. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf index 66355f3e0433e..0c6defc759eaf 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf @@ -412,6 +412,11 @@ Ref mismatch between '{0}' and function pointer '{1}' + + A function pointer cannot be called with named arguments. + A function pointer cannot be called with named arguments. + + A goto cannot jump to a location before a using declaration within the same block. Una instrucción goto no puede saltar a una ubicación antes que una declaración using dentro del mismo bloque. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf index 8d91d6666ee17..ae0e77fd04077 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf @@ -412,6 +412,11 @@ Ref mismatch between '{0}' and function pointer '{1}' + + A function pointer cannot be called with named arguments. + A function pointer cannot be called with named arguments. + + A goto cannot jump to a location before a using declaration within the same block. Un goto ne peut pas accéder à un emplacement avant une déclaration using dans le même bloc. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf index f614f05806bf9..f2e55d1954733 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf @@ -412,6 +412,11 @@ Ref mismatch between '{0}' and function pointer '{1}' + + A function pointer cannot be called with named arguments. + A function pointer cannot be called with named arguments. + + A goto cannot jump to a location before a using declaration within the same block. Un'istruzione goto non può passare a una posizione che precede una dichiarazione using all'interno dello stesso blocco. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf index b06da2cd4221d..aaad9d29d0988 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf @@ -412,6 +412,11 @@ Ref mismatch between '{0}' and function pointer '{1}' + + A function pointer cannot be called with named arguments. + A function pointer cannot be called with named arguments. + + A goto cannot jump to a location before a using declaration within the same block. goto は同じブロック内の using 宣言より前の位置にはジャンプできません。 diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf index 1c67585f8d3d4..73c02193237e0 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf @@ -412,6 +412,11 @@ Ref mismatch between '{0}' and function pointer '{1}' + + A function pointer cannot be called with named arguments. + A function pointer cannot be called with named arguments. + + A goto cannot jump to a location before a using declaration within the same block. goto는 동일한 블록 내의 using 선언 앞 위치로 이동할 수 없습니다. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf index d624e042fe2d2..5244a0bd172bb 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf @@ -412,6 +412,11 @@ Ref mismatch between '{0}' and function pointer '{1}' + + A function pointer cannot be called with named arguments. + A function pointer cannot be called with named arguments. + + A goto cannot jump to a location before a using declaration within the same block. Instrukcja goto nie może przechodzić do lokalizacji występującej przed deklaracją using w tym samym bloku. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf index 782d2e3dd1052..2152a0a213e07 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf @@ -412,6 +412,11 @@ Ref mismatch between '{0}' and function pointer '{1}' + + A function pointer cannot be called with named arguments. + A function pointer cannot be called with named arguments. + + A goto cannot jump to a location before a using declaration within the same block. Um goto não pode saltar para um local antes de uma declaração using no mesmo bloco. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf index 8f6114faba155..19d831daf2730 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf @@ -412,6 +412,11 @@ Ref mismatch between '{0}' and function pointer '{1}' + + A function pointer cannot be called with named arguments. + A function pointer cannot be called with named arguments. + + A goto cannot jump to a location before a using declaration within the same block. Оператор goto не может переходить к расположению раньше объявления using в том же блоке. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf index 0d6c679c3158f..0c265f649f34d 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf @@ -412,6 +412,11 @@ Ref mismatch between '{0}' and function pointer '{1}' + + A function pointer cannot be called with named arguments. + A function pointer cannot be called with named arguments. + + A goto cannot jump to a location before a using declaration within the same block. Bir goto, aynı blok içinde yer alan using bildiriminden önceki bir konuma atlayamaz. diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf index 7a6508f359ece..c4dd6456e973f 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf @@ -412,6 +412,11 @@ Ref mismatch between '{0}' and function pointer '{1}' + + A function pointer cannot be called with named arguments. + A function pointer cannot be called with named arguments. + + A goto cannot jump to a location before a using declaration within the same block. goto 无法跳转到同一块中 using 声明之前的某个位置。 diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf index a92aada5ce198..e1ab9f224a25f 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf @@ -412,6 +412,11 @@ Ref mismatch between '{0}' and function pointer '{1}' + + A function pointer cannot be called with named arguments. + A function pointer cannot be called with named arguments. + + A goto cannot jump to a location before a using declaration within the same block. 在相同區塊內,goto 不可跳到 using 宣告前的位置。 diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/FunctionPointerTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/FunctionPointerTests.cs index f66b08046f824..b0bd4eb738a35 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/FunctionPointerTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/FunctionPointerTests.cs @@ -3090,5 +3090,43 @@ void M2() Diagnostic(ErrorCode.ERR_UnsafeTypeInObjectCreation, "new()").WithArguments("delegate*").WithLocation(11, 31) ); } + + [Fact, WorkItem(48071, "https://github.com/dotnet/roslyn/issues/48071")] + public void FunctionPointerCalledWithNamedArguments() + { + var comp = CreateCompilationWithFunctionPointers(@" +public class C +{ + public unsafe void M(delegate* ptr) + { + ptr(""a"", arg1: 1); + } +} +"); + comp.VerifyDiagnostics( + // (6,18): error CS8904: A function pointer cannot be called with named arguments. + // ptr("a", arg1: 1); + Diagnostic(ErrorCode.ERR_FunctionPointersCannotBeCalledWithNamedArguments, "arg1").WithLocation(6, 18) + ); + } + + [Fact, WorkItem(48071, "https://github.com/dotnet/roslyn/issues/48071")] + public void FunctionPointerCalledWithNamedArguments2() + { + var comp = CreateCompilationWithFunctionPointers(@" +public class C +{ + public unsafe void M(delegate* ptr) + { + ptr(arg0: ""a"", arg1: 1); + } +} +"); + comp.VerifyDiagnostics( + // (6,13): error CS8904: A function pointer cannot be called with named arguments. + // ptr(arg0: "a", arg1: 1); + Diagnostic(ErrorCode.ERR_FunctionPointersCannotBeCalledWithNamedArguments, "arg0").WithLocation(6, 13) + ); + } } } From fb88fd6cd0c5765730fca2d0411768064b204b85 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 5 Oct 2020 12:32:23 -0700 Subject: [PATCH 131/295] Fix tests --- .../Test/Diagnostics/IDEDiagnosticIDConfigurationTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/EditorFeatures/Test/Diagnostics/IDEDiagnosticIDConfigurationTests.cs b/src/EditorFeatures/Test/Diagnostics/IDEDiagnosticIDConfigurationTests.cs index f576bf5786ceb..31260e5ba9f32 100644 --- a/src/EditorFeatures/Test/Diagnostics/IDEDiagnosticIDConfigurationTests.cs +++ b/src/EditorFeatures/Test/Diagnostics/IDEDiagnosticIDConfigurationTests.cs @@ -265,7 +265,7 @@ public void CSharp_VerifyIDEDiagnosticSeveritiesAreConfigurable() dotnet_diagnostic.IDE0037.severity = %value% # IDE0038 -dotnet_diagnostic.IDE0038.severity = %value% +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion # IDE0039 csharp_style_pattern_local_over_anonymous_function = true:suggestion @@ -807,7 +807,7 @@ No editorconfig based code style option dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion # IDE0038 -No editorconfig based code style option +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion # IDE0039, PreferLocalOverAnonymousFunction csharp_style_pattern_local_over_anonymous_function = true:suggestion From 8280a0f492c064ff7d855279d26a4a381748af72 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 5 Oct 2020 12:32:23 -0700 Subject: [PATCH 132/295] Fix tests --- .../Test/Diagnostics/IDEDiagnosticIDConfigurationTests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/EditorFeatures/Test/Diagnostics/IDEDiagnosticIDConfigurationTests.cs b/src/EditorFeatures/Test/Diagnostics/IDEDiagnosticIDConfigurationTests.cs index f576bf5786ceb..ae25354ec66bb 100644 --- a/src/EditorFeatures/Test/Diagnostics/IDEDiagnosticIDConfigurationTests.cs +++ b/src/EditorFeatures/Test/Diagnostics/IDEDiagnosticIDConfigurationTests.cs @@ -265,7 +265,7 @@ public void CSharp_VerifyIDEDiagnosticSeveritiesAreConfigurable() dotnet_diagnostic.IDE0037.severity = %value% # IDE0038 -dotnet_diagnostic.IDE0038.severity = %value% +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion # IDE0039 csharp_style_pattern_local_over_anonymous_function = true:suggestion @@ -806,8 +806,8 @@ No editorconfig based code style option # IDE0037, PreferInferredAnonymousTypeMemberNames dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion -# IDE0038 -No editorconfig based code style option +# IDE0038, PreferPatternMatchingOverIsWithCastCheck +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion # IDE0039, PreferLocalOverAnonymousFunction csharp_style_pattern_local_over_anonymous_function = true:suggestion From 6f74c2477facf644ddb2a318756c4b15385abc15 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 6 Oct 2020 08:35:11 +1100 Subject: [PATCH 133/295] Don't crash on nullable value types (#48316) --- .../RemoveRedundantEqualityTests.cs | 16 ++++++++++++++++ ...tRemoveRedundantEqualityDiagnosticAnalyzer.cs | 10 +++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/Analyzers/CSharp/Tests/RemoveRedundantEquality/RemoveRedundantEqualityTests.cs b/src/Analyzers/CSharp/Tests/RemoveRedundantEquality/RemoveRedundantEqualityTests.cs index abd712d43894e..83436415c6fed 100644 --- a/src/Analyzers/CSharp/Tests/RemoveRedundantEquality/RemoveRedundantEqualityTests.cs +++ b/src/Analyzers/CSharp/Tests/RemoveRedundantEquality/RemoveRedundantEqualityTests.cs @@ -6,6 +6,7 @@ using Microsoft.CodeAnalysis.CSharp.RemoveRedundantEquality; using Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions; using Microsoft.CodeAnalysis.RemoveRedundantEquality; +using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.RemoveRedundantEquality @@ -220,5 +221,20 @@ public bool M3(bool x) }"; await VerifyCS.VerifyCodeFixAsync(code, fixedCode); } + + [Fact] + [WorkItem(48236, "https://github.com/dotnet/roslyn/issues/48236")] + public async Task TestNullableValueTypes_DoesntCrash() + { + var code = @" +public class C +{ + public bool M1(int? x) + { + return x == null; + } +}"; + await VerifyCS.VerifyAnalyzerAsync(code); + } } } diff --git a/src/Analyzers/Core/Analyzers/RemoveRedundantEquality/AbstractRemoveRedundantEqualityDiagnosticAnalyzer.cs b/src/Analyzers/Core/Analyzers/RemoveRedundantEquality/AbstractRemoveRedundantEqualityDiagnosticAnalyzer.cs index 49c647ee3e831..26e63b2f0b684 100644 --- a/src/Analyzers/Core/Analyzers/RemoveRedundantEquality/AbstractRemoveRedundantEqualityDiagnosticAnalyzer.cs +++ b/src/Analyzers/Core/Analyzers/RemoveRedundantEquality/AbstractRemoveRedundantEqualityDiagnosticAnalyzer.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System.Collections.Immutable; using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.Diagnostics; @@ -52,6 +50,12 @@ private void AnalyzeBinaryOperator(OperationAnalysisContext context) var rightOperand = operation.RightOperand; var leftOperand = operation.LeftOperand; + + if (rightOperand.Type is null || leftOperand.Type is null) + { + return; + } + if (rightOperand.Type.SpecialType != SpecialType.System_Boolean || leftOperand.Type.SpecialType != SpecialType.System_Boolean) { @@ -60,7 +64,7 @@ private void AnalyzeBinaryOperator(OperationAnalysisContext context) var isOperatorEquals = operation.OperatorKind == BinaryOperatorKind.Equals; _syntaxFacts.GetPartsOfBinaryExpression(operation.Syntax, out _, out var operatorToken, out _); - var properties = ImmutableDictionary.CreateBuilder(); + var properties = ImmutableDictionary.CreateBuilder(); if (TryGetLiteralValue(rightOperand) == isOperatorEquals) { properties.Add(RedundantEqualityConstants.RedundantSide, RedundantEqualityConstants.Right); From b3d38c0fe34c60a87acd0344f93fe746e2f3b761 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 5 Oct 2020 14:39:16 -0700 Subject: [PATCH 134/295] Switch to immutable arrays. --- .../CSharpInlineParameterNameHintsService.cs | 22 +++++++------------ ...AbstractInlineParameterNameHintsService.cs | 15 ++++++++----- .../IInlineParameterNameHintsService.cs | 11 +++++----- ...ualBasicInlineParameterNameHintsService.vb | 18 ++++++++------- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/Features/CSharp/Portable/InlineParameterNameHints/CSharpInlineParameterNameHintsService.cs b/src/Features/CSharp/Portable/InlineParameterNameHints/CSharpInlineParameterNameHintsService.cs index 03412b1e5762d..7b8ba7b4eed5e 100644 --- a/src/Features/CSharp/Portable/InlineParameterNameHints/CSharpInlineParameterNameHintsService.cs +++ b/src/Features/CSharp/Portable/InlineParameterNameHints/CSharpInlineParameterNameHintsService.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.Composition; using System.Threading; using System.Threading.Tasks; @@ -11,6 +12,7 @@ using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.InlineParameterNameHints; +using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; @@ -30,16 +32,13 @@ public CSharpInlineParameterNameHintsService() { } - protected override IEnumerable AddAllParameterNameHintLocations( - SemanticModel semanticModel, IEnumerable nodes, CancellationToken cancellationToken) + protected override void AddAllParameterNameHintLocations( + SemanticModel semanticModel, IEnumerable nodes, + ArrayBuilder result, CancellationToken cancellationToken) { - var spans = new List(); foreach (var node in nodes) { - if (cancellationToken.IsCancellationRequested) - { - return SpecializedCollections.EmptyEnumerable(); - } + cancellationToken.ThrowIfCancellationRequested(); if (node is ArgumentSyntax argument) { @@ -47,9 +46,7 @@ protected override IEnumerable AddAllParameterNameHintLocat { var param = argument.DetermineParameter(semanticModel, cancellationToken: cancellationToken); if (param != null && param.Name != "") - { - spans.Add(new InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, argument.Span.Start)); - } + result.Add(new InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, argument.Span.Start)); } } else if (node is AttributeArgumentSyntax attribute) @@ -58,13 +55,10 @@ protected override IEnumerable AddAllParameterNameHintLocat { var param = attribute.DetermineParameter(semanticModel, cancellationToken: cancellationToken); if (param != null && param.Name != "") - { - spans.Add(new InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, attribute.SpanStart)); - } + result.Add(new InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, attribute.SpanStart)); } } } - return spans; } /// diff --git a/src/Features/Core/Portable/InlineParameterNameHints/AbstractInlineParameterNameHintsService.cs b/src/Features/Core/Portable/InlineParameterNameHints/AbstractInlineParameterNameHintsService.cs index 3e97ac61fe787..f20454463e943 100644 --- a/src/Features/Core/Portable/InlineParameterNameHints/AbstractInlineParameterNameHintsService.cs +++ b/src/Features/Core/Portable/InlineParameterNameHints/AbstractInlineParameterNameHintsService.cs @@ -5,8 +5,10 @@ #nullable disable using System.Collections.Generic; +using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; @@ -14,18 +16,19 @@ namespace Microsoft.CodeAnalysis.InlineParameterNameHints { internal abstract class AbstractInlineParameterNameHintsService : IInlineParameterNameHintsService { - public async Task> GetInlineParameterNameHintsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken) + public async Task> GetInlineParameterNameHintsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken) { var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); - var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); var nodes = root.DescendantNodes(textSpan); - var spans = AddAllParameterNameHintLocations(semanticModel, nodes, cancellationToken); - return spans; + + using var _ = ArrayBuilder.GetInstance(out var result); + AddAllParameterNameHintLocations(semanticModel, nodes, result, cancellationToken); + return result.ToImmutable(); } - protected abstract IEnumerable AddAllParameterNameHintLocations( - SemanticModel semanticModel, IEnumerable nodes, CancellationToken cancellationToken); + protected abstract void AddAllParameterNameHintLocations( + SemanticModel semanticModel, IEnumerable nodes, ArrayBuilder result, CancellationToken cancellationToken); } } diff --git a/src/Features/Core/Portable/InlineParameterNameHints/IInlineParameterNameHintsService.cs b/src/Features/Core/Portable/InlineParameterNameHints/IInlineParameterNameHintsService.cs index 01d14a45738b8..34b6ed20ba82e 100644 --- a/src/Features/Core/Portable/InlineParameterNameHints/IInlineParameterNameHintsService.cs +++ b/src/Features/Core/Portable/InlineParameterNameHints/IInlineParameterNameHintsService.cs @@ -5,6 +5,7 @@ #nullable disable using System.Collections.Generic; +using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host; @@ -14,20 +15,20 @@ namespace Microsoft.CodeAnalysis.InlineParameterNameHints { internal readonly struct InlineParameterHint { + public readonly SymbolKey ParameterSymbolKey; + public readonly string Name; + public readonly int Position; + public InlineParameterHint(SymbolKey parameterSymbolKey, string name, int position) { ParameterSymbolKey = parameterSymbolKey; Name = name; Position = position; } - - public readonly SymbolKey ParameterSymbolKey { get; } - public readonly string Name { get; } - public readonly int Position { get; } } internal interface IInlineParameterNameHintsService : ILanguageService { - Task> GetInlineParameterNameHintsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken); + Task> GetInlineParameterNameHintsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken); } } diff --git a/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb b/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb index 3f3ca43625b19..b40a5540a8a6e 100644 --- a/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb +++ b/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb @@ -6,7 +6,7 @@ Imports System.Composition Imports System.Threading Imports Microsoft.CodeAnalysis.Host.Mef Imports Microsoft.CodeAnalysis.InlineParameterNameHints -Imports Microsoft.CodeAnalysis.Text +Imports Microsoft.CodeAnalysis.PooledObjects Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Namespace Microsoft.CodeAnalysis.VisualBasic.InlineParameterNameHints @@ -19,23 +19,25 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.InlineParameterNameHints Public Sub New() End Sub - Protected Overrides Function AddAllParameterNameHintLocations(semanticModel As SemanticModel, nodes As IEnumerable(Of SyntaxNode), cancellationToken As CancellationToken) As IEnumerable(Of InlineParameterHint) - Dim spans = New List(Of InlineParameterHint) + Protected Overrides Sub AddAllParameterNameHintLocations( + semanticModel As SemanticModel, + nodes As IEnumerable(Of SyntaxNode), + result As ArrayBuilder(Of InlineParameterHint), + cancellationToken As CancellationToken) + For Each node In nodes cancellationToken.ThrowIfCancellationRequested() Dim simpleArgument = TryCast(node, SimpleArgumentSyntax) - If Not simpleArgument Is Nothing Then + If simpleArgument IsNot Nothing Then If Not simpleArgument.IsNamed AndAlso simpleArgument.NameColonEquals Is Nothing AndAlso IsExpressionWithNoName(simpleArgument.Expression) Then Dim param = simpleArgument.DetermineParameter(semanticModel, allowParamArray:=False, cancellationToken) If param IsNot Nothing AndAlso param.Name.Length > 0 Then - spans.Add(New InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, simpleArgument.Span.Start)) + result.Add(New InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, simpleArgument.Span.Start)) End If End If End If Next - - Return spans - End Function + End Sub Private Function IsExpressionWithNoName(arg As ExpressionSyntax) As Boolean If TypeOf arg Is LiteralExpressionSyntax Then From 7e582d4c6d035052a9b42c493a73198fbc9776ca Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 5 Oct 2020 15:04:48 -0700 Subject: [PATCH 135/295] Extract options to their own type --- ...ineParameterNameHintsDataTaggerProvider.cs | 2 +- .../Shared/Options/FeatureOnOffOptions.cs | 4 -- .../IInlineParameterNameHintsService.cs | 1 + .../InlineParameterNameHintsOptions.cs | 37 +++++++++++++++++++ .../Options/AdvancedOptionPageControl.xaml.cs | 3 +- .../Options/AdvancedOptionPageControl.xaml.vb | 3 +- 6 files changed, 43 insertions(+), 7 deletions(-) create mode 100644 src/Features/Core/Portable/InlineParameterNameHints/InlineParameterNameHintsOptions.cs diff --git a/src/EditorFeatures/Core/InlineParameterNameHints/InlineParameterNameHintsDataTaggerProvider.cs b/src/EditorFeatures/Core/InlineParameterNameHints/InlineParameterNameHintsDataTaggerProvider.cs index c463bcd9e3cea..67de39516fd79 100644 --- a/src/EditorFeatures/Core/InlineParameterNameHints/InlineParameterNameHintsDataTaggerProvider.cs +++ b/src/EditorFeatures/Core/InlineParameterNameHints/InlineParameterNameHintsDataTaggerProvider.cs @@ -35,7 +35,7 @@ internal class InlineParameterNameHintsDataTaggerProvider : AsynchronousViewTagg { private readonly IAsynchronousOperationListener _listener; - protected override IEnumerable> PerLanguageOptions => SpecializedCollections.SingletonEnumerable(FeatureOnOffOptions.InlineParameterNameHints); + protected override IEnumerable> PerLanguageOptions => SpecializedCollections.SingletonEnumerable(InlineParameterNameHintsOptions.Enabled); protected override SpanTrackingMode SpanTrackingMode => SpanTrackingMode.EdgeInclusive; [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] diff --git a/src/EditorFeatures/Core/Shared/Options/FeatureOnOffOptions.cs b/src/EditorFeatures/Core/Shared/Options/FeatureOnOffOptions.cs index b8548c86e50ee..160adaf051d0a 100644 --- a/src/EditorFeatures/Core/Shared/Options/FeatureOnOffOptions.cs +++ b/src/EditorFeatures/Core/Shared/Options/FeatureOnOffOptions.cs @@ -44,9 +44,6 @@ internal static class FeatureOnOffOptions public static readonly PerLanguageOption2 PrettyListing = new(nameof(FeatureOnOffOptions), nameof(PrettyListing), defaultValue: true, storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.PrettyListing")); - public static readonly PerLanguageOption2 InlineParameterNameHints = new(nameof(FeatureOnOffOptions), nameof(InlineParameterNameHints), defaultValue: false, - storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.InlineParameterNameHints")); - public static readonly PerLanguageOption2 AutoFormattingOnTyping = new( nameof(FeatureOnOffOptions), nameof(AutoFormattingOnTyping), defaultValue: true, storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.Auto Formatting On Typing")); @@ -111,7 +108,6 @@ public FeatureOnOffOptionsProvider() FeatureOnOffOptions.AutoXmlDocCommentGeneration, FeatureOnOffOptions.AutoInsertBlockCommentStartString, FeatureOnOffOptions.PrettyListing, - FeatureOnOffOptions.InlineParameterNameHints, FeatureOnOffOptions.AutoFormattingOnTyping, FeatureOnOffOptions.AutoFormattingOnCloseBrace, FeatureOnOffOptions.AutoFormattingOnSemicolon, diff --git a/src/Features/Core/Portable/InlineParameterNameHints/IInlineParameterNameHintsService.cs b/src/Features/Core/Portable/InlineParameterNameHints/IInlineParameterNameHintsService.cs index 34b6ed20ba82e..2964c8e045453 100644 --- a/src/Features/Core/Portable/InlineParameterNameHints/IInlineParameterNameHintsService.cs +++ b/src/Features/Core/Portable/InlineParameterNameHints/IInlineParameterNameHintsService.cs @@ -9,6 +9,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.InlineParameterNameHints diff --git a/src/Features/Core/Portable/InlineParameterNameHints/InlineParameterNameHintsOptions.cs b/src/Features/Core/Portable/InlineParameterNameHints/InlineParameterNameHintsOptions.cs new file mode 100644 index 0000000000000..2576b46f0d66d --- /dev/null +++ b/src/Features/Core/Portable/InlineParameterNameHints/InlineParameterNameHintsOptions.cs @@ -0,0 +1,37 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#nullable disable + +using System; +using System.Collections.Immutable; +using System.Composition; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.Options; +using Microsoft.CodeAnalysis.Options.Providers; + +namespace Microsoft.CodeAnalysis.InlineParameterNameHints +{ + internal static class InlineParameterNameHintsOptions + { + public static readonly PerLanguageOption2 Enabled = + new(nameof(InlineParameterNameHintsOptions), + nameof(Enabled), + defaultValue: false, + storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.InlineParameterNameHints.Enabled")); + } + + [ExportOptionProvider, Shared] + internal sealed class InlineParameterNameHintsOptionsProvider : IOptionProvider + { + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public InlineParameterNameHintsOptionsProvider() + { + } + + public ImmutableArray Options { get; } = ImmutableArray.Create( + InlineParameterNameHintsOptions.Enabled); + } +} diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs index 9b6cd0d641a1c..72879362c3d11 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs @@ -14,6 +14,7 @@ using Microsoft.CodeAnalysis.ExtractMethod; using Microsoft.CodeAnalysis.Fading; using Microsoft.CodeAnalysis.ImplementType; +using Microsoft.CodeAnalysis.InlineParameterNameHints; using Microsoft.CodeAnalysis.QuickInfo; using Microsoft.CodeAnalysis.Remote; using Microsoft.CodeAnalysis.SolutionCrawler; @@ -64,7 +65,7 @@ public AdvancedOptionPageControl(OptionStore optionStore, IComponentModel compon BindToOption(InsertSlashSlashAtTheStartOfNewLinesWhenWritingSingleLineComments, SplitStringLiteralOptions.Enabled, LanguageNames.CSharp); BindToOption(InsertAsteriskAtTheStartOfNewLinesWhenWritingBlockComments, FeatureOnOffOptions.AutoInsertBlockCommentStartString, LanguageNames.CSharp); - BindToOption(DisplayInlineParameterNameHints, FeatureOnOffOptions.InlineParameterNameHints, LanguageNames.CSharp); + BindToOption(DisplayInlineParameterNameHints, InlineParameterNameHintsOptions.Enabled, LanguageNames.CSharp); BindToOption(ShowRemarksInQuickInfo, QuickInfoOptions.ShowRemarksInQuickInfo, LanguageNames.CSharp); BindToOption(DisplayLineSeparators, FeatureOnOffOptions.LineSeparator, LanguageNames.CSharp); BindToOption(EnableHighlightReferences, FeatureOnOffOptions.ReferenceHighlighting, LanguageNames.CSharp); diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb index 292646d975533..4cd79738ee7b4 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb @@ -12,6 +12,7 @@ Imports Microsoft.CodeAnalysis.EmbeddedLanguages.RegularExpressions Imports Microsoft.CodeAnalysis.ExtractMethod Imports Microsoft.CodeAnalysis.Fading Imports Microsoft.CodeAnalysis.ImplementType +Imports Microsoft.CodeAnalysis.InlineParameterNameHints Imports Microsoft.CodeAnalysis.QuickInfo Imports Microsoft.CodeAnalysis.Remote Imports Microsoft.CodeAnalysis.SolutionCrawler @@ -62,7 +63,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options BindToOption(EnableLineCommit, FeatureOnOffOptions.PrettyListing, LanguageNames.VisualBasic) BindToOption(AutomaticInsertionOfInterfaceAndMustOverrideMembers, FeatureOnOffOptions.AutomaticInsertionOfAbstractOrInterfaceMembers, LanguageNames.VisualBasic) BindToOption(DisplayLineSeparators, FeatureOnOffOptions.LineSeparator, LanguageNames.VisualBasic) - BindToOption(DisplayInlineParameterNameHints, FeatureOnOffOptions.InlineParameterNameHints, LanguageNames.VisualBasic) + BindToOption(DisplayInlineParameterNameHints, InlineParameterNameHintsOptions.Enabled, LanguageNames.VisualBasic) BindToOption(EnableHighlightReferences, FeatureOnOffOptions.ReferenceHighlighting, LanguageNames.VisualBasic) BindToOption(EnableHighlightKeywords, FeatureOnOffOptions.KeywordHighlighting, LanguageNames.VisualBasic) BindToOption(RenameTrackingPreview, FeatureOnOffOptions.RenameTrackingPreview, LanguageNames.VisualBasic) From dba2f78ac461e89833235a0413519efc905f5106 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 5 Oct 2020 15:26:18 -0700 Subject: [PATCH 136/295] indent --- .../Options/AdvancedOptionPageControl.xaml | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml index 3eeabeda6cad6..ca2ce55f739ca 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml @@ -121,19 +121,19 @@ - - - - - - - - + + + + + + + + From 13a7f3719176c668776298a3ca3aaad6992d84ad Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 5 Oct 2020 15:34:20 -0700 Subject: [PATCH 137/295] Move inline hints options into their own group --- .../Impl/Options/AdvancedOptionPageControl.xaml | 12 ++++++++++-- .../Impl/Options/AdvancedOptionPageStrings.cs | 3 +++ .../Core/Def/ServicesVSResources.resx | 5 ++++- .../Core/Def/xlf/ServicesVSResources.cs.xlf | 9 +++++++-- .../Core/Def/xlf/ServicesVSResources.de.xlf | 9 +++++++-- .../Core/Def/xlf/ServicesVSResources.es.xlf | 9 +++++++-- .../Core/Def/xlf/ServicesVSResources.fr.xlf | 9 +++++++-- .../Core/Def/xlf/ServicesVSResources.it.xlf | 9 +++++++-- .../Core/Def/xlf/ServicesVSResources.ja.xlf | 9 +++++++-- .../Core/Def/xlf/ServicesVSResources.ko.xlf | 9 +++++++-- .../Core/Def/xlf/ServicesVSResources.pl.xlf | 9 +++++++-- .../Core/Def/xlf/ServicesVSResources.pt-BR.xlf | 9 +++++++-- .../Core/Def/xlf/ServicesVSResources.ru.xlf | 9 +++++++-- .../Core/Def/xlf/ServicesVSResources.tr.xlf | 9 +++++++-- .../Def/xlf/ServicesVSResources.zh-Hans.xlf | 9 +++++++-- .../Def/xlf/ServicesVSResources.zh-Hant.xlf | 9 +++++++-- .../Impl/Options/AdvancedOptionPageControl.xaml | 12 ++++++++++-- .../Impl/Options/AdvancedOptionPageStrings.vb | 17 +++++++---------- 18 files changed, 125 insertions(+), 41 deletions(-) diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml index ca2ce55f739ca..622926e35a6eb 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml @@ -94,6 +94,7 @@ Content="{x:Static local:AdvancedOptionPageStrings.Option_Show_guides_for_code_level_constructs}" /> + @@ -105,11 +106,18 @@ Content="{x:Static local:AdvancedOptionPageStrings.Option_InsertAsteriskAtTheStartOfNewLinesWhenWritingBlockComments}"/> - + + + + + + + ServicesVSResources.Use_64_bit_process_for_code_analysis_requires_restart; + public static string Option_Inline_Hints_experimental + => ServicesVSResources.Inline_Hints_experimental; + public static string Option_Display_inline_parameter_name_hints => ServicesVSResources.Display_inline_parameter_name_hints; diff --git a/src/VisualStudio/Core/Def/ServicesVSResources.resx b/src/VisualStudio/Core/Def/ServicesVSResources.resx index c41ff6e3126a1..0c099936f7459 100644 --- a/src/VisualStudio/Core/Def/ServicesVSResources.resx +++ b/src/VisualStudio/Core/Def/ServicesVSResources.resx @@ -1521,7 +1521,7 @@ I agree to all of the foregoing: Warning: type does not bind - Disp_lay inline parameter name hints (experimental) + Disp_lay inline parameter name hints Current parameter @@ -1557,4 +1557,7 @@ I agree to all of the foregoing: Comments + + Inline Hints (experimental) + \ No newline at end of file diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf index 255e57733cec5..bf7a1633fa9ca 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf @@ -178,8 +178,8 @@ - Disp_lay inline parameter name hints (experimental) - Zobrazovat nápovědy k názvům v_ložených parametrů (experimentální) + Disp_lay inline parameter name hints + Zobrazovat nápovědy k názvům v_ložených parametrů (experimentální) @@ -272,6 +272,11 @@ Indexováno v úložišti + + Inline Hints (experimental) + Inline Hints (experimental) + + Inserting call site value '{0}' Vkládá se hodnota lokality volání {0}. diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf index 6039c28ff88b9..abf2fe48f7948 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf @@ -178,8 +178,8 @@ - Disp_lay inline parameter name hints (experimental) - Disp_lay inline parameter name hints (experimental) + Disp_lay inline parameter name hints + Disp_lay inline parameter name hints @@ -272,6 +272,11 @@ In Repository indiziert + + Inline Hints (experimental) + Inline Hints (experimental) + + Inserting call site value '{0}' Der Wert der Aufrufsite "{0}" wird eingefügt. diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf index da89369e50c61..d190a33d0d23b 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf @@ -178,8 +178,8 @@ - Disp_lay inline parameter name hints (experimental) - Disp_lay inline parameter name hints (experimental) + Disp_lay inline parameter name hints + Disp_lay inline parameter name hints @@ -272,6 +272,11 @@ Indexado en el repositorio + + Inline Hints (experimental) + Inline Hints (experimental) + + Inserting call site value '{0}' Insertando el valor del sitio de llamada "{0}" diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf index 9c1dc4830c8d3..a82d364e74ab6 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf @@ -178,8 +178,8 @@ - Disp_lay inline parameter name hints (experimental) - Disp_lay inline parameter name hints (experimental) + Disp_lay inline parameter name hints + Disp_lay inline parameter name hints @@ -272,6 +272,11 @@ Indexé dans le dépôt + + Inline Hints (experimental) + Inline Hints (experimental) + + Inserting call site value '{0}' Insertion de la valeur de site d'appel '{0}' diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf index d7c894418c3f9..40fcbfc5aab56 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf @@ -178,8 +178,8 @@ - Disp_lay inline parameter name hints (experimental) - Disp_lay inline parameter name hints (experimental) + Disp_lay inline parameter name hints + Disp_lay inline parameter name hints @@ -272,6 +272,11 @@ Indicizzata nel repository + + Inline Hints (experimental) + Inline Hints (experimental) + + Inserting call site value '{0}' Inserimento del valore '{0}' del sito di chiamata diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf index d64bf44754cce..9ce8ef7fcf7da 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf @@ -178,8 +178,8 @@ - Disp_lay inline parameter name hints (experimental) - Disp_lay inline parameter name hints (experimental) + Disp_lay inline parameter name hints + Disp_lay inline parameter name hints @@ -272,6 +272,11 @@ リポジトリ内でインデックス付け + + Inline Hints (experimental) + Inline Hints (experimental) + + Inserting call site value '{0}' 呼び出しサイトの値 "{0}" を挿入しています diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf index 1062cf819a788..205bfc414792d 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf @@ -178,8 +178,8 @@ - Disp_lay inline parameter name hints (experimental) - Disp_lay inline parameter name hints (experimental) + Disp_lay inline parameter name hints + Disp_lay inline parameter name hints @@ -272,6 +272,11 @@ 리포지토리에서 인덱싱됨 + + Inline Hints (experimental) + Inline Hints (experimental) + + Inserting call site value '{0}' 호출 사이트 값 '{0}'을(를) 삽입하는 중 diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf index 82c65cf60f6c0..d33b11b81838b 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf @@ -178,8 +178,8 @@ - Disp_lay inline parameter name hints (experimental) - Disp_lay inline parameter name hints (experimental) + Disp_lay inline parameter name hints + Disp_lay inline parameter name hints @@ -272,6 +272,11 @@ Indeksowane w repozytorium + + Inline Hints (experimental) + Inline Hints (experimental) + + Inserting call site value '{0}' Wstawianie wartości miejsca wywołania „{0}” diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf index 3885f00ae4922..8e7f8a1203ec5 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf @@ -178,8 +178,8 @@ - Disp_lay inline parameter name hints (experimental) - Disp_lay inline parameter name hints (experimental) + Disp_lay inline parameter name hints + Disp_lay inline parameter name hints @@ -272,6 +272,11 @@ Indexado no repositório + + Inline Hints (experimental) + Inline Hints (experimental) + + Inserting call site value '{0}' Inserindo o valor do site de chamada '{0}' diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf index 1f049fd0fa5e4..8f778c603ee33 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf @@ -178,8 +178,8 @@ - Disp_lay inline parameter name hints (experimental) - Disp_lay inline parameter name hints (experimental) + Disp_lay inline parameter name hints + Disp_lay inline parameter name hints @@ -272,6 +272,11 @@ Индексированный в репозитории + + Inline Hints (experimental) + Inline Hints (experimental) + + Inserting call site value '{0}' Вставка значения "{0}" места вызова diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf index ab9a2aeb9e81b..ecf0a27571ee2 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf @@ -178,8 +178,8 @@ - Disp_lay inline parameter name hints (experimental) - Disp_lay inline parameter name hints (experimental) + Disp_lay inline parameter name hints + Disp_lay inline parameter name hints @@ -272,6 +272,11 @@ Depo içinde dizini oluşturulmuş + + Inline Hints (experimental) + Inline Hints (experimental) + + Inserting call site value '{0}' Çağırma yeri değeri '{0}' ekleniyor diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf index 5a5f095b3cd76..521a31f8cd9b0 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf @@ -178,8 +178,8 @@ - Disp_lay inline parameter name hints (experimental) - 显示内联参数名称提示(实验)(_L) + Disp_lay inline parameter name hints + 显示内联参数名称提示(实验)(_L) @@ -272,6 +272,11 @@ 已在存储库中编入索引 + + Inline Hints (experimental) + Inline Hints (experimental) + + Inserting call site value '{0}' 正在插入调用站点值 "{0}" diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf index 8c0e91c66878d..739183975537a 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf @@ -178,8 +178,8 @@ - Disp_lay inline parameter name hints (experimental) - Disp_lay inline parameter name hints (experimental) + Disp_lay inline parameter name hints + Disp_lay inline parameter name hints @@ -272,6 +272,11 @@ 已在存放庫中編制索引 + + Inline Hints (experimental) + Inline Hints (experimental) + + Inserting call site value '{0}' 正在插入呼叫網站值 '{0}' diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml index 3f15c7b6034ea..871211183d44b 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml @@ -100,11 +100,18 @@ Content="{x:Static local:AdvancedOptionPageStrings.Option_InsertApostropheAtTheStartOfNewLinesWhenWritingApostropheComments}" /> - + + + + + + + + diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb index ee913aba72741..19d60c7b9b201 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb @@ -30,17 +30,14 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options Public ReadOnly Property Option_use_64bit_analysis_process As String = ServicesVSResources.Use_64_bit_process_for_code_analysis_requires_restart - Public ReadOnly Property Option_DisplayLineSeparators As String - Get - Return BasicVSResources.Show_procedure_line_separators - End Get - End Property + Public ReadOnly Property Option_DisplayLineSeparators As String = + BasicVSResources.Show_procedure_line_separators - Public ReadOnly Property Option_Display_inline_parameter_name_hints As String - Get - Return ServicesVSResources.Display_inline_parameter_name_hints - End Get - End Property + Public ReadOnly Property Option_Inline_Hints_experimental As String = + ServicesVSResources.Inline_Hints_experimental + + Public ReadOnly Property Option_Display_inline_parameter_name_hints As String = + ServicesVSResources.Display_inline_parameter_name_hints Public ReadOnly Property Option_DontPutOutOrRefOnStruct As String Get From 852da6ddfd2228cf2da01aef8e064bc6985aef1d Mon Sep 17 00:00:00 2001 From: Gen Lu Date: Mon, 5 Oct 2020 12:10:15 -0700 Subject: [PATCH 138/295] Remove infra for legacy OptProf --- azure-pipelines-official.yml | 49 ---------------------------------- eng/Versions.props | 2 -- eng/build.ps1 | 31 --------------------- eng/test-build-correctness.ps1 | 13 +-------- 4 files changed, 1 insertion(+), 94 deletions(-) diff --git a/azure-pipelines-official.yml b/azure-pipelines-official.yml index ae9d147d90a71..048c0e4dfbe58 100644 --- a/azure-pipelines-official.yml +++ b/azure-pipelines-official.yml @@ -88,17 +88,6 @@ stages: zipSources: false condition: and(succeeded(), in(variables['SignType'], 'test', 'real')) - - task: MicroBuildOptProfPlugin@5 - inputs: - ShouldSkipOptimize: true - displayName: 'Install OptProf Plugin' - - # Required by MicroBuildBuildVSBootstrapper - - task: MicroBuildSwixPlugin@2 - inputs: - dropName: $(VisualStudio.DropName) - feedSource: 'https://devdiv.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json' - - script: eng\cibuild.cmd -configuration $(BuildConfiguration) -officialBuildId $(Build.BuildNumber) @@ -149,37 +138,6 @@ stages: ArtifactName: 'OptProf Data Files' condition: succeeded() - # Build VS bootstrapper - # Generates $(Build.StagingDirectory)\MicroBuild\Output\BootstrapperInfo.json - - task: ms-vseng.MicroBuildTasks.0e9d0d4d-71ec-4e4e-ae40-db9896f1ae74.MicroBuildBuildVSBootstrapper@2 - inputs: - vsMajorVersion: $(VisualStudio.MajorVersion) - channelName: $(VisualStudio.ChannelName) - manifests: $(VisualStudio.SetupManifestList) - outputFolder: '$(Build.SourcesDirectory)\artifacts\VSSetup\$(BuildConfiguration)\Insertion' - displayName: 'OptProf - Build VS bootstrapper' - condition: succeeded() - - # Publish run settings - - task: PowerShell@2 - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -configuration $(BuildConfiguration) - -task VisualStudio.BuildIbcTrainingSettings - /p:VisualStudioDropName=$(VisualStudio.DropName) - /p:BootstrapperInfoPath=$(Build.StagingDirectory)\MicroBuild\Output\BootstrapperInfo.json - displayName: 'OptProf - Build IBC training settings' - condition: succeeded() - - # Publish bootstrapper info - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.StagingDirectory)\MicroBuild\Output - ArtifactName: MicroBuildOutputs - ArtifactType: Container - displayName: 'OptProf - Publish Artifact: MicroBuildOutputs' - condition: succeeded() - - task: PublishBuildArtifacts@1 displayName: Publish Logs inputs: @@ -252,13 +210,6 @@ stages: ArtifactName: AssetManifests condition: succeeded() - # Tag the build at the very end when we know it's been successful. - - task: colinsalmcorner.colinsalmcorner-buildtasks.tag-build-task.tagBuildOrRelease@0 - displayName: Tag build as ready for optimization training - inputs: - tags: 'ready-for-training' - condition: succeeded() - - task: ms-vseng.MicroBuildTasks.521a94ea-9e68-468a-8167-6dcf361ea776.MicroBuildCleanup@1 displayName: Perform Cleanup Tasks condition: succeededOrFailed() diff --git a/eng/Versions.props b/eng/Versions.props index 4a028f9e1add8..7397647e19bd3 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -194,8 +194,6 @@ 3.0.0-beta2-19053-01 $(RoslynDiagnosticsNugetPackageVersion) 1.1.0-beta3.20374.2 - 1.0.0-beta3.19057.1 - 1.0.0-beta3.19057.1 0.0.4 1.0.21 4.5.1 diff --git a/eng/build.ps1 b/eng/build.ps1 index 79a6027fde0c9..5cc4247067be8 100644 --- a/eng/build.ps1 +++ b/eng/build.ps1 @@ -310,33 +310,6 @@ function GetIbcDropName() { return $drop.Name } -# Set VSO variables used by MicroBuildBuildVSBootstrapper pipeline task -function SetVisualStudioBootstrapperBuildArgs() { - $fallbackBranch = "master-vs-deps" - - $branchName = if ($officialSourceBranchName) { $officialSourceBranchName } else { $fallbackBranch } - $branchData = GetBranchPublishData $branchName - - if ($branchData -eq $null) { - Write-LogIssue -Type warning -Message "Branch $officialSourceBranchName is not listed in PublishData.json. Using VS bootstrapper for branch '$fallbackBranch'. " - $branchData = GetBranchPublishData $fallbackBranch - } - - # VS branch name is e.g. "lab/d16.0stg", "rel/d15.9", "lab/ml", etc. - $vsBranchSimpleName = $branchData.vsBranch.Split('/')[-1] - $vsMajorVersion = $branchData.vsMajorVersion - $vsChannel = "int.$vsBranchSimpleName" - - Write-Host "##vso[task.setvariable variable=VisualStudio.MajorVersion;]$vsMajorVersion" - Write-Host "##vso[task.setvariable variable=VisualStudio.ChannelName;]$vsChannel" - - $insertionDir = Join-Path $VSSetupDir "Insertion" - if (Test-Path $insertionDir) { - $manifestList = [string]::Join(',', (Get-ChildItem "$insertionDir\*.vsman")) - Write-Host "##vso[task.setvariable variable=VisualStudio.SetupManifestList;]$manifestList" - } -} - # Core function for running our unit / integration tests tests function TestUsingOptimizedRunner() { @@ -669,10 +642,6 @@ try { BuildSolution } - if ($ci -and $build -and $msbuildEngine -eq "vs") { - SetVisualStudioBootstrapperBuildArgs - } - try { if ($testDesktop -or $testVsi -or $testIOperation) { diff --git a/eng/test-build-correctness.ps1 b/eng/test-build-correctness.ps1 index bde82e62f0b49..e57f1907a6816 100644 --- a/eng/test-build-correctness.ps1 +++ b/eng/test-build-correctness.ps1 @@ -57,18 +57,7 @@ try { Write-Host "Checking generated compiler files" Exec-Block { & (Join-Path $PSScriptRoot "generate-compiler-code.ps1") -test -configuration:$configuration } Exec-Console dotnet "format . --include-generated --include src/Compilers/CSharp/Portable/Generated/ src/Compilers/VisualBasic/Portable/Generated/ src/ExpressionEvaluator/VisualBasic/Source/ResultProvider/Generated/ --check -f" - Write-Host "" - - # Verify the state of creating run settings for OptProf - Write-Host "Checking OptProf run settings generation" - - # create a fake BootstrapperInfo.json file - $bootstrapperInfoPath = Join-Path $TempDir "BootstrapperInfo.json" - $bootstrapperInfoContent = "[{""BuildDrop"": ""https://vsdrop.corp.microsoft.com/file/v1/Products/42.42.42.42/42.42.42.42""}]" - $bootstrapperInfoContent | Set-Content $bootstrapperInfoPath - - # generate run settings - Exec-Block { & (Join-Path $PSScriptRoot "common\sdk-task.ps1") -configuration:$configuration -task VisualStudio.BuildIbcTrainingSettings /p:VisualStudioDropName="Products/DummyDrop" /p:BootstrapperInfoPath=$bootstrapperInfoPath } + Write-Host "" exit 0 } From fbfb499e4be6263514d0b44f589df987bde8e540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Matou=C5=A1ek?= Date: Mon, 5 Oct 2020 16:18:44 -0700 Subject: [PATCH 139/295] Fix net5.0 Windows TFMs (#48336) * Fix net5.0 Windows TFMs * Remove unnecessary overrides --- src/Interactive/HostProcess/InteractiveHost64.csproj | 2 +- src/Interactive/HostTest/InteractiveHost.UnitTests.csproj | 2 +- src/VisualStudio/Setup/Roslyn.VisualStudio.Setup.csproj | 2 +- .../CoreTestUtilities/Remote/InProcRemostHostClient.cs | 8 -------- .../Roslyn.Services.UnitTests.Utilities.csproj | 2 +- 5 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/Interactive/HostProcess/InteractiveHost64.csproj b/src/Interactive/HostProcess/InteractiveHost64.csproj index 78d5253ea799c..db4710f3a78ee 100644 --- a/src/Interactive/HostProcess/InteractiveHost64.csproj +++ b/src/Interactive/HostProcess/InteractiveHost64.csproj @@ -5,7 +5,7 @@ false Exe - net472;net5.0 + net472;net5.0-windows win10-x64 true diff --git a/src/Interactive/HostTest/InteractiveHost.UnitTests.csproj b/src/Interactive/HostTest/InteractiveHost.UnitTests.csproj index 0808e3174338d..b60b76a252d6b 100644 --- a/src/Interactive/HostTest/InteractiveHost.UnitTests.csproj +++ b/src/Interactive/HostTest/InteractiveHost.UnitTests.csproj @@ -40,7 +40,7 @@ - TargetFramework=net5.0 + TargetFramework=net5.0-windows InteractiveHostFiles_Core diff --git a/src/VisualStudio/Setup/Roslyn.VisualStudio.Setup.csproj b/src/VisualStudio/Setup/Roslyn.VisualStudio.Setup.csproj index 9f06a0e91b7c4..bd80e1adfb702 100644 --- a/src/VisualStudio/Setup/Roslyn.VisualStudio.Setup.csproj +++ b/src/VisualStudio/Setup/Roslyn.VisualStudio.Setup.csproj @@ -269,7 +269,7 @@ InteractiveHost.Core64 - TargetFramework=net5.0 + TargetFramework=net5.0-windows true false diff --git a/src/Workspaces/CoreTestUtilities/Remote/InProcRemostHostClient.cs b/src/Workspaces/CoreTestUtilities/Remote/InProcRemostHostClient.cs index 29f96859e8b70..30b1ff55a6670 100644 --- a/src/Workspaces/CoreTestUtilities/Remote/InProcRemostHostClient.cs +++ b/src/Workspaces/CoreTestUtilities/Remote/InProcRemostHostClient.cs @@ -384,14 +384,6 @@ public override int WriteTimeout public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken) => _stream.CopyToAsync(destination, bufferSize, cancellationToken); - public override object InitializeLifetimeService() - => throw new NotSupportedException(); - -#if !NETCOREAPP - public override ObjRef CreateObjRef(Type requestedType) - => throw new NotSupportedException(); -#endif - public override void Close() { _service.Dispose(); diff --git a/src/Workspaces/CoreTestUtilities/Roslyn.Services.UnitTests.Utilities.csproj b/src/Workspaces/CoreTestUtilities/Roslyn.Services.UnitTests.Utilities.csproj index 5568fca7e29ef..60924499fd231 100644 --- a/src/Workspaces/CoreTestUtilities/Roslyn.Services.UnitTests.Utilities.csproj +++ b/src/Workspaces/CoreTestUtilities/Roslyn.Services.UnitTests.Utilities.csproj @@ -4,7 +4,7 @@ Library Microsoft.CodeAnalysis.UnitTests - net5.0;netcoreapp3.1;net472 + net5.0-windows;netcoreapp3.1;net472 true false true From 573c300c95cfbbd52d51c510499415135dce4ca4 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 5 Oct 2020 16:21:54 -0700 Subject: [PATCH 140/295] Update code to match groups --- .../CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs | 1 + .../VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs index 72879362c3d11..06b8bdcd52721 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs @@ -66,6 +66,7 @@ public AdvancedOptionPageControl(OptionStore optionStore, IComponentModel compon BindToOption(InsertAsteriskAtTheStartOfNewLinesWhenWritingBlockComments, FeatureOnOffOptions.AutoInsertBlockCommentStartString, LanguageNames.CSharp); BindToOption(DisplayInlineParameterNameHints, InlineParameterNameHintsOptions.Enabled, LanguageNames.CSharp); + BindToOption(ShowRemarksInQuickInfo, QuickInfoOptions.ShowRemarksInQuickInfo, LanguageNames.CSharp); BindToOption(DisplayLineSeparators, FeatureOnOffOptions.LineSeparator, LanguageNames.CSharp); BindToOption(EnableHighlightReferences, FeatureOnOffOptions.ReferenceHighlighting, LanguageNames.CSharp); diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb index 4cd79738ee7b4..e67fa5cac27e0 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb @@ -59,11 +59,12 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options BindToOption(GenerateXmlDocCommentsForTripleApostrophes, FeatureOnOffOptions.AutoXmlDocCommentGeneration, LanguageNames.VisualBasic) BindToOption(InsertApostropheAtTheStartOfNewLinesWhenWritingApostropheComments, SplitCommentOptions.Enabled, LanguageNames.VisualBasic) + BindToOption(DisplayInlineParameterNameHints, InlineParameterNameHintsOptions.Enabled, LanguageNames.VisualBasic) + BindToOption(EnableEndConstruct, FeatureOnOffOptions.EndConstruct, LanguageNames.VisualBasic) BindToOption(EnableLineCommit, FeatureOnOffOptions.PrettyListing, LanguageNames.VisualBasic) BindToOption(AutomaticInsertionOfInterfaceAndMustOverrideMembers, FeatureOnOffOptions.AutomaticInsertionOfAbstractOrInterfaceMembers, LanguageNames.VisualBasic) BindToOption(DisplayLineSeparators, FeatureOnOffOptions.LineSeparator, LanguageNames.VisualBasic) - BindToOption(DisplayInlineParameterNameHints, InlineParameterNameHintsOptions.Enabled, LanguageNames.VisualBasic) BindToOption(EnableHighlightReferences, FeatureOnOffOptions.ReferenceHighlighting, LanguageNames.VisualBasic) BindToOption(EnableHighlightKeywords, FeatureOnOffOptions.KeywordHighlighting, LanguageNames.VisualBasic) BindToOption(RenameTrackingPreview, FeatureOnOffOptions.RenameTrackingPreview, LanguageNames.VisualBasic) From d9a93e4c4d5dde1d7e849687188312d034679b6a Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 5 Oct 2020 16:24:03 -0700 Subject: [PATCH 141/295] Rename option --- .../InlineParameterNameHintsDataTaggerProvider.cs | 2 +- .../InlineParameterNameHintsOptions.cs | 8 ++++---- .../CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs | 2 +- .../Impl/Options/AdvancedOptionPageControl.xaml.vb | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/EditorFeatures/Core/InlineParameterNameHints/InlineParameterNameHintsDataTaggerProvider.cs b/src/EditorFeatures/Core/InlineParameterNameHints/InlineParameterNameHintsDataTaggerProvider.cs index 67de39516fd79..556bee6fc26a7 100644 --- a/src/EditorFeatures/Core/InlineParameterNameHints/InlineParameterNameHintsDataTaggerProvider.cs +++ b/src/EditorFeatures/Core/InlineParameterNameHints/InlineParameterNameHintsDataTaggerProvider.cs @@ -35,7 +35,7 @@ internal class InlineParameterNameHintsDataTaggerProvider : AsynchronousViewTagg { private readonly IAsynchronousOperationListener _listener; - protected override IEnumerable> PerLanguageOptions => SpecializedCollections.SingletonEnumerable(InlineParameterNameHintsOptions.Enabled); + protected override IEnumerable> PerLanguageOptions => SpecializedCollections.SingletonEnumerable(InlineParameterNameHintsOptions.EnabledForParameters); protected override SpanTrackingMode SpanTrackingMode => SpanTrackingMode.EdgeInclusive; [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] diff --git a/src/Features/Core/Portable/InlineParameterNameHints/InlineParameterNameHintsOptions.cs b/src/Features/Core/Portable/InlineParameterNameHints/InlineParameterNameHintsOptions.cs index 2576b46f0d66d..8c5e83a780d21 100644 --- a/src/Features/Core/Portable/InlineParameterNameHints/InlineParameterNameHintsOptions.cs +++ b/src/Features/Core/Portable/InlineParameterNameHints/InlineParameterNameHintsOptions.cs @@ -15,11 +15,11 @@ namespace Microsoft.CodeAnalysis.InlineParameterNameHints { internal static class InlineParameterNameHintsOptions { - public static readonly PerLanguageOption2 Enabled = + public static readonly PerLanguageOption2 EnabledForParameters = new(nameof(InlineParameterNameHintsOptions), - nameof(Enabled), + nameof(EnabledForParameters), defaultValue: false, - storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.InlineParameterNameHints.Enabled")); + storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.InlineParameterNameHints.EnabledForParameters")); } [ExportOptionProvider, Shared] @@ -32,6 +32,6 @@ public InlineParameterNameHintsOptionsProvider() } public ImmutableArray Options { get; } = ImmutableArray.Create( - InlineParameterNameHintsOptions.Enabled); + InlineParameterNameHintsOptions.EnabledForParameters); } } diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs index 06b8bdcd52721..2d77d0817d327 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs @@ -65,7 +65,7 @@ public AdvancedOptionPageControl(OptionStore optionStore, IComponentModel compon BindToOption(InsertSlashSlashAtTheStartOfNewLinesWhenWritingSingleLineComments, SplitStringLiteralOptions.Enabled, LanguageNames.CSharp); BindToOption(InsertAsteriskAtTheStartOfNewLinesWhenWritingBlockComments, FeatureOnOffOptions.AutoInsertBlockCommentStartString, LanguageNames.CSharp); - BindToOption(DisplayInlineParameterNameHints, InlineParameterNameHintsOptions.Enabled, LanguageNames.CSharp); + BindToOption(DisplayInlineParameterNameHints, InlineParameterNameHintsOptions.EnabledForParameters, LanguageNames.CSharp); BindToOption(ShowRemarksInQuickInfo, QuickInfoOptions.ShowRemarksInQuickInfo, LanguageNames.CSharp); BindToOption(DisplayLineSeparators, FeatureOnOffOptions.LineSeparator, LanguageNames.CSharp); diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb index e67fa5cac27e0..3c69f109a7db6 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb @@ -59,7 +59,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options BindToOption(GenerateXmlDocCommentsForTripleApostrophes, FeatureOnOffOptions.AutoXmlDocCommentGeneration, LanguageNames.VisualBasic) BindToOption(InsertApostropheAtTheStartOfNewLinesWhenWritingApostropheComments, SplitCommentOptions.Enabled, LanguageNames.VisualBasic) - BindToOption(DisplayInlineParameterNameHints, InlineParameterNameHintsOptions.Enabled, LanguageNames.VisualBasic) + BindToOption(DisplayInlineParameterNameHints, InlineParameterNameHintsOptions.EnabledForParameters, LanguageNames.VisualBasic) BindToOption(EnableEndConstruct, FeatureOnOffOptions.EndConstruct, LanguageNames.VisualBasic) BindToOption(EnableLineCommit, FeatureOnOffOptions.PrettyListing, LanguageNames.VisualBasic) From 4cfb875281ef82b25a750598bb1ca4c7bca5d358 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 5 Oct 2020 16:43:37 -0700 Subject: [PATCH 142/295] Rename namespaces --- .../InlineParameterNameHintsFormatDefinition.cs | 2 +- .../InlineParameterNameHintsTag.cs | 10 +++++++--- .../InlineParameterNameHintsTagger.cs | 3 ++- .../InlineParameterNameHintsTaggerProvider.cs | 3 ++- .../InlineParameterNameHintDataTag.cs | 2 +- .../InlineParameterNameHintsDataTaggerProvider.cs | 7 +++---- .../AbstractInlineParameterNameHintsTests.vb | 12 ++---------- .../CSharpInlineParameterNameHintsTests.vb | 2 +- .../VisualBasicInlineParameterNameHintsTests.vb | 2 +- .../CSharpInlineParameterNameHintsService.cs | 9 ++------- .../AbstractInlineParameterNameHintsService.cs | 2 +- .../IInlineParameterNameHintsService.cs | 2 +- .../InlineHintsOptions.cs} | 12 ++++++------ .../VisualBasicInlineParameterNameHintsService.vb | 2 +- .../Impl/Options/AdvancedOptionPageControl.xaml.cs | 4 ++-- .../Impl/Options/AdvancedOptionPageControl.xaml.vb | 3 ++- 16 files changed, 35 insertions(+), 42 deletions(-) rename src/EditorFeatures/Core.Wpf/{InlineParameterNameHints => InlineHints}/InlineParameterNameHintsFormatDefinition.cs (95%) rename src/EditorFeatures/Core.Wpf/{InlineParameterNameHints => InlineHints}/InlineParameterNameHintsTag.cs (97%) rename src/EditorFeatures/Core.Wpf/{InlineParameterNameHints => InlineHints}/InlineParameterNameHintsTagger.cs (98%) rename src/EditorFeatures/Core.Wpf/{InlineParameterNameHints => InlineHints}/InlineParameterNameHintsTaggerProvider.cs (97%) rename src/EditorFeatures/Core/{InlineParameterNameHints => InlineHints}/InlineParameterNameHintDataTag.cs (93%) rename src/EditorFeatures/Core/{InlineParameterNameHints => InlineHints}/InlineParameterNameHintsDataTaggerProvider.cs (95%) rename src/EditorFeatures/Test2/{InlineParameterNameHints => InlineHints}/AbstractInlineParameterNameHintsTests.vb (79%) rename src/EditorFeatures/Test2/{InlineParameterNameHints => InlineHints}/CSharpInlineParameterNameHintsTests.vb (99%) rename src/EditorFeatures/Test2/{InlineParameterNameHints => InlineHints}/VisualBasicInlineParameterNameHintsTests.vb (99%) rename src/Features/CSharp/Portable/{InlineParameterNameHints => InlineHints}/CSharpInlineParameterNameHintsService.cs (93%) rename src/Features/Core/Portable/{InlineParameterNameHints => InlineHints}/AbstractInlineParameterNameHintsService.cs (96%) rename src/Features/Core/Portable/{InlineParameterNameHints => InlineHints}/IInlineParameterNameHintsService.cs (95%) rename src/Features/Core/Portable/{InlineParameterNameHints/InlineParameterNameHintsOptions.cs => InlineHints/InlineHintsOptions.cs} (72%) diff --git a/src/EditorFeatures/Core.Wpf/InlineParameterNameHints/InlineParameterNameHintsFormatDefinition.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsFormatDefinition.cs similarity index 95% rename from src/EditorFeatures/Core.Wpf/InlineParameterNameHints/InlineParameterNameHintsFormatDefinition.cs rename to src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsFormatDefinition.cs index 3eb01c904c512..19c70996bb9fd 100644 --- a/src/EditorFeatures/Core.Wpf/InlineParameterNameHints/InlineParameterNameHintsFormatDefinition.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsFormatDefinition.cs @@ -12,7 +12,7 @@ using Microsoft.VisualStudio.Text.Classification; using Microsoft.VisualStudio.Utilities; -namespace Microsoft.CodeAnalysis.Editor.InlineParameterNameHints +namespace Microsoft.CodeAnalysis.Editor.InlineHints { internal sealed class ClassificationTypeDefinitions { diff --git a/src/EditorFeatures/Core.Wpf/InlineParameterNameHints/InlineParameterNameHintsTag.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTag.cs similarity index 97% rename from src/EditorFeatures/Core.Wpf/InlineParameterNameHints/InlineParameterNameHintsTag.cs rename to src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTag.cs index 8a7123b2f1d8a..b2ae66d9e45f7 100644 --- a/src/EditorFeatures/Core.Wpf/InlineParameterNameHints/InlineParameterNameHintsTag.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTag.cs @@ -23,7 +23,7 @@ using Microsoft.VisualStudio.Text.Editor; using Microsoft.VisualStudio.Text.Formatting; -namespace Microsoft.CodeAnalysis.Editor.InlineParameterNameHints +namespace Microsoft.CodeAnalysis.Editor.InlineHints { /// /// This is the tag which implements the IntraTextAdornmentTag and is meant to create the UIElements that get shown @@ -39,8 +39,12 @@ internal class InlineParameterNameHintsTag : IntraTextAdornmentTag private readonly IThreadingContext _threadingContext; private readonly Lazy _streamingPresenter; - private InlineParameterNameHintsTag(FrameworkElement adornment, ITextView textView, SnapshotSpan span, - SymbolKey key, InlineParameterNameHintsTaggerProvider taggerProvider) + private InlineParameterNameHintsTag( + FrameworkElement adornment, + ITextView textView, + SnapshotSpan span, + SymbolKey key, + InlineParameterNameHintsTaggerProvider taggerProvider) : base(adornment, removalCallback: null, PositionAffinity.Predecessor) { _textView = textView; diff --git a/src/EditorFeatures/Core.Wpf/InlineParameterNameHints/InlineParameterNameHintsTagger.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTagger.cs similarity index 98% rename from src/EditorFeatures/Core.Wpf/InlineParameterNameHints/InlineParameterNameHintsTagger.cs rename to src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTagger.cs index b7cdd773bf9da..2dea3edd91734 100644 --- a/src/EditorFeatures/Core.Wpf/InlineParameterNameHints/InlineParameterNameHintsTagger.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTagger.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; +using Microsoft.CodeAnalysis.Editor.InlineHints; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Classification; @@ -11,7 +12,7 @@ using Microsoft.VisualStudio.Text.Formatting; using Microsoft.VisualStudio.Text.Tagging; -namespace Microsoft.CodeAnalysis.Editor.InlineParameterNameHints +namespace Microsoft.CodeAnalysis.Editor.InlineHints { /// /// The purpose of this tagger is to convert the to diff --git a/src/EditorFeatures/Core.Wpf/InlineParameterNameHints/InlineParameterNameHintsTaggerProvider.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTaggerProvider.cs similarity index 97% rename from src/EditorFeatures/Core.Wpf/InlineParameterNameHints/InlineParameterNameHintsTaggerProvider.cs rename to src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTaggerProvider.cs index e959f085e5f41..32cfcc0fe7dec 100644 --- a/src/EditorFeatures/Core.Wpf/InlineParameterNameHints/InlineParameterNameHintsTaggerProvider.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTaggerProvider.cs @@ -7,6 +7,7 @@ using System; using System.ComponentModel.Composition; using Microsoft.CodeAnalysis.Editor.Host; +using Microsoft.CodeAnalysis.Editor.InlineHints; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.VisualStudio.Text; @@ -16,7 +17,7 @@ using Microsoft.VisualStudio.Text.Tagging; using Microsoft.VisualStudio.Utilities; -namespace Microsoft.CodeAnalysis.Editor.InlineParameterNameHints +namespace Microsoft.CodeAnalysis.Editor.InlineHints { /// /// The provider that is used as a middleman to create the tagger so that the data tag diff --git a/src/EditorFeatures/Core/InlineParameterNameHints/InlineParameterNameHintDataTag.cs b/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintDataTag.cs similarity index 93% rename from src/EditorFeatures/Core/InlineParameterNameHints/InlineParameterNameHintDataTag.cs rename to src/EditorFeatures/Core/InlineHints/InlineParameterNameHintDataTag.cs index 3ac60cdf32c70..226b065bc3ec1 100644 --- a/src/EditorFeatures/Core/InlineParameterNameHints/InlineParameterNameHintDataTag.cs +++ b/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintDataTag.cs @@ -5,7 +5,7 @@ using System; using Microsoft.VisualStudio.Text.Tagging; -namespace Microsoft.CodeAnalysis.Editor.InlineParameterNameHints +namespace Microsoft.CodeAnalysis.Editor.InlineHints { /// /// The simple tag that only holds information regarding the associated parameter name diff --git a/src/EditorFeatures/Core/InlineParameterNameHints/InlineParameterNameHintsDataTaggerProvider.cs b/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs similarity index 95% rename from src/EditorFeatures/Core/InlineParameterNameHints/InlineParameterNameHintsDataTaggerProvider.cs rename to src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs index 556bee6fc26a7..8014c868120f8 100644 --- a/src/EditorFeatures/Core/InlineParameterNameHints/InlineParameterNameHintsDataTaggerProvider.cs +++ b/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs @@ -7,12 +7,11 @@ using System.ComponentModel.Composition; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; -using Microsoft.CodeAnalysis.Editor.Shared.Options; using Microsoft.CodeAnalysis.Editor.Shared.Tagging; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Editor.Tagging; using Microsoft.CodeAnalysis.Host.Mef; -using Microsoft.CodeAnalysis.InlineParameterNameHints; +using Microsoft.CodeAnalysis.InlineHints; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Shared.TestHooks; @@ -22,7 +21,7 @@ using Microsoft.VisualStudio.Utilities; using Roslyn.Utilities; -namespace Microsoft.CodeAnalysis.Editor.InlineParameterNameHints +namespace Microsoft.CodeAnalysis.Editor.InlineHints { /// /// The TaggerProvider that calls upon the service in order to locate the spans and names @@ -35,7 +34,7 @@ internal class InlineParameterNameHintsDataTaggerProvider : AsynchronousViewTagg { private readonly IAsynchronousOperationListener _listener; - protected override IEnumerable> PerLanguageOptions => SpecializedCollections.SingletonEnumerable(InlineParameterNameHintsOptions.EnabledForParameters); + protected override IEnumerable> PerLanguageOptions => SpecializedCollections.SingletonEnumerable(InlineHintsOptions.EnabledForParameters); protected override SpanTrackingMode SpanTrackingMode => SpanTrackingMode.EdgeInclusive; [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] diff --git a/src/EditorFeatures/Test2/InlineParameterNameHints/AbstractInlineParameterNameHintsTests.vb b/src/EditorFeatures/Test2/InlineHints/AbstractInlineParameterNameHintsTests.vb similarity index 79% rename from src/EditorFeatures/Test2/InlineParameterNameHints/AbstractInlineParameterNameHintsTests.vb rename to src/EditorFeatures/Test2/InlineHints/AbstractInlineParameterNameHintsTests.vb index 9305666cecd89..48d40b53d4e98 100644 --- a/src/EditorFeatures/Test2/InlineParameterNameHints/AbstractInlineParameterNameHintsTests.vb +++ b/src/EditorFeatures/Test2/InlineHints/AbstractInlineParameterNameHintsTests.vb @@ -3,18 +3,10 @@ ' See the LICENSE file in the project root for more information. Imports System.Threading -Imports Microsoft.CodeAnalysis.CSharp.InlineParameterNameHints -Imports Microsoft.CodeAnalysis.Editor.InlineParameterNameHints -Imports Microsoft.CodeAnalysis.Editor.Shared.Extensions -Imports Microsoft.CodeAnalysis.Editor.Shared.Utilities -Imports Microsoft.CodeAnalysis.Editor.Tagging Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces -Imports Microsoft.CodeAnalysis.InlineParameterNameHints -Imports Microsoft.CodeAnalysis.Shared.TestHooks -Imports Microsoft.VisualStudio.Text -Imports Microsoft.VisualStudio.Text.Tagging +Imports Microsoft.CodeAnalysis.InlineHints -Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineParameterNameHints +Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints <[UseExportProvider]> Public MustInherit Class AbstractInlineParameterNameHintsTests diff --git a/src/EditorFeatures/Test2/InlineParameterNameHints/CSharpInlineParameterNameHintsTests.vb b/src/EditorFeatures/Test2/InlineHints/CSharpInlineParameterNameHintsTests.vb similarity index 99% rename from src/EditorFeatures/Test2/InlineParameterNameHints/CSharpInlineParameterNameHintsTests.vb rename to src/EditorFeatures/Test2/InlineHints/CSharpInlineParameterNameHintsTests.vb index aff6133bab44e..b02dc559df88f 100644 --- a/src/EditorFeatures/Test2/InlineParameterNameHints/CSharpInlineParameterNameHintsTests.vb +++ b/src/EditorFeatures/Test2/InlineHints/CSharpInlineParameterNameHintsTests.vb @@ -2,7 +2,7 @@ ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. -Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineParameterNameHints +Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Public Class CSharpInlineParameterNameHintsTests Inherits AbstractInlineParameterNameHintsTests diff --git a/src/EditorFeatures/Test2/InlineParameterNameHints/VisualBasicInlineParameterNameHintsTests.vb b/src/EditorFeatures/Test2/InlineHints/VisualBasicInlineParameterNameHintsTests.vb similarity index 99% rename from src/EditorFeatures/Test2/InlineParameterNameHints/VisualBasicInlineParameterNameHintsTests.vb rename to src/EditorFeatures/Test2/InlineHints/VisualBasicInlineParameterNameHintsTests.vb index 98e3132e3e3cb..4556ad97b8a40 100644 --- a/src/EditorFeatures/Test2/InlineParameterNameHints/VisualBasicInlineParameterNameHintsTests.vb +++ b/src/EditorFeatures/Test2/InlineHints/VisualBasicInlineParameterNameHintsTests.vb @@ -2,7 +2,7 @@ ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. -Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineParameterNameHints +Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Public Class VisualBasicInlineParameterNameHintsTests Inherits AbstractInlineParameterNameHintsTests diff --git a/src/Features/CSharp/Portable/InlineParameterNameHints/CSharpInlineParameterNameHintsService.cs b/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs similarity index 93% rename from src/Features/CSharp/Portable/InlineParameterNameHints/CSharpInlineParameterNameHintsService.cs rename to src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs index 7b8ba7b4eed5e..d8abbe6ead549 100644 --- a/src/Features/CSharp/Portable/InlineParameterNameHints/CSharpInlineParameterNameHintsService.cs +++ b/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs @@ -4,20 +4,15 @@ using System; using System.Collections.Generic; -using System.Collections.Immutable; using System.Composition; using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Host.Mef; -using Microsoft.CodeAnalysis.InlineParameterNameHints; +using Microsoft.CodeAnalysis.InlineHints; using Microsoft.CodeAnalysis.PooledObjects; -using Microsoft.CodeAnalysis.Shared.Extensions; -using Microsoft.CodeAnalysis.Text; -using Roslyn.Utilities; -namespace Microsoft.CodeAnalysis.CSharp.InlineParameterNameHints +namespace Microsoft.CodeAnalysis.CSharp.InlineHints { /// /// The service to locate the positions in which the adornments should appear diff --git a/src/Features/Core/Portable/InlineParameterNameHints/AbstractInlineParameterNameHintsService.cs b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs similarity index 96% rename from src/Features/Core/Portable/InlineParameterNameHints/AbstractInlineParameterNameHintsService.cs rename to src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs index f20454463e943..37579cdc27836 100644 --- a/src/Features/Core/Portable/InlineParameterNameHints/AbstractInlineParameterNameHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs @@ -12,7 +12,7 @@ using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; -namespace Microsoft.CodeAnalysis.InlineParameterNameHints +namespace Microsoft.CodeAnalysis.InlineHints { internal abstract class AbstractInlineParameterNameHintsService : IInlineParameterNameHintsService { diff --git a/src/Features/Core/Portable/InlineParameterNameHints/IInlineParameterNameHintsService.cs b/src/Features/Core/Portable/InlineHints/IInlineParameterNameHintsService.cs similarity index 95% rename from src/Features/Core/Portable/InlineParameterNameHints/IInlineParameterNameHintsService.cs rename to src/Features/Core/Portable/InlineHints/IInlineParameterNameHintsService.cs index 2964c8e045453..9e9a9225aa07b 100644 --- a/src/Features/Core/Portable/InlineParameterNameHints/IInlineParameterNameHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/IInlineParameterNameHintsService.cs @@ -12,7 +12,7 @@ using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Text; -namespace Microsoft.CodeAnalysis.InlineParameterNameHints +namespace Microsoft.CodeAnalysis.InlineHints { internal readonly struct InlineParameterHint { diff --git a/src/Features/Core/Portable/InlineParameterNameHints/InlineParameterNameHintsOptions.cs b/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs similarity index 72% rename from src/Features/Core/Portable/InlineParameterNameHints/InlineParameterNameHintsOptions.cs rename to src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs index 8c5e83a780d21..262b4c53147b2 100644 --- a/src/Features/Core/Portable/InlineParameterNameHints/InlineParameterNameHintsOptions.cs +++ b/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs @@ -11,27 +11,27 @@ using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Options.Providers; -namespace Microsoft.CodeAnalysis.InlineParameterNameHints +namespace Microsoft.CodeAnalysis.InlineHints { - internal static class InlineParameterNameHintsOptions + internal static class InlineHintsOptions { public static readonly PerLanguageOption2 EnabledForParameters = - new(nameof(InlineParameterNameHintsOptions), + new(nameof(InlineHintsOptions), nameof(EnabledForParameters), defaultValue: false, storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.InlineParameterNameHints.EnabledForParameters")); } [ExportOptionProvider, Shared] - internal sealed class InlineParameterNameHintsOptionsProvider : IOptionProvider + internal sealed class InlineHintsOptionsProvider : IOptionProvider { [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public InlineParameterNameHintsOptionsProvider() + public InlineHintsOptionsProvider() { } public ImmutableArray Options { get; } = ImmutableArray.Create( - InlineParameterNameHintsOptions.EnabledForParameters); + InlineHintsOptions.EnabledForParameters); } } diff --git a/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb b/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb index b40a5540a8a6e..1cd420d094cf9 100644 --- a/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb +++ b/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb @@ -5,7 +5,7 @@ Imports System.Composition Imports System.Threading Imports Microsoft.CodeAnalysis.Host.Mef -Imports Microsoft.CodeAnalysis.InlineParameterNameHints +Imports Microsoft.CodeAnalysis.InlineHints Imports Microsoft.CodeAnalysis.PooledObjects Imports Microsoft.CodeAnalysis.VisualBasic.Syntax diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs index 2d77d0817d327..b2a0ae32b30b3 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs @@ -14,7 +14,7 @@ using Microsoft.CodeAnalysis.ExtractMethod; using Microsoft.CodeAnalysis.Fading; using Microsoft.CodeAnalysis.ImplementType; -using Microsoft.CodeAnalysis.InlineParameterNameHints; +using Microsoft.CodeAnalysis.InlineHints; using Microsoft.CodeAnalysis.QuickInfo; using Microsoft.CodeAnalysis.Remote; using Microsoft.CodeAnalysis.SolutionCrawler; @@ -65,7 +65,7 @@ public AdvancedOptionPageControl(OptionStore optionStore, IComponentModel compon BindToOption(InsertSlashSlashAtTheStartOfNewLinesWhenWritingSingleLineComments, SplitStringLiteralOptions.Enabled, LanguageNames.CSharp); BindToOption(InsertAsteriskAtTheStartOfNewLinesWhenWritingBlockComments, FeatureOnOffOptions.AutoInsertBlockCommentStartString, LanguageNames.CSharp); - BindToOption(DisplayInlineParameterNameHints, InlineParameterNameHintsOptions.EnabledForParameters, LanguageNames.CSharp); + BindToOption(DisplayInlineParameterNameHints, InlineHintsOptions.EnabledForParameters, LanguageNames.CSharp); BindToOption(ShowRemarksInQuickInfo, QuickInfoOptions.ShowRemarksInQuickInfo, LanguageNames.CSharp); BindToOption(DisplayLineSeparators, FeatureOnOffOptions.LineSeparator, LanguageNames.CSharp); diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb index 3c69f109a7db6..f0a26ef5c4245 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb @@ -12,6 +12,7 @@ Imports Microsoft.CodeAnalysis.EmbeddedLanguages.RegularExpressions Imports Microsoft.CodeAnalysis.ExtractMethod Imports Microsoft.CodeAnalysis.Fading Imports Microsoft.CodeAnalysis.ImplementType +Imports Microsoft.CodeAnalysis.InlineHints Imports Microsoft.CodeAnalysis.InlineParameterNameHints Imports Microsoft.CodeAnalysis.QuickInfo Imports Microsoft.CodeAnalysis.Remote @@ -59,7 +60,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options BindToOption(GenerateXmlDocCommentsForTripleApostrophes, FeatureOnOffOptions.AutoXmlDocCommentGeneration, LanguageNames.VisualBasic) BindToOption(InsertApostropheAtTheStartOfNewLinesWhenWritingApostropheComments, SplitCommentOptions.Enabled, LanguageNames.VisualBasic) - BindToOption(DisplayInlineParameterNameHints, InlineParameterNameHintsOptions.EnabledForParameters, LanguageNames.VisualBasic) + BindToOption(DisplayInlineParameterNameHints, InlineHintsOptions.EnabledForParameters, LanguageNames.VisualBasic) BindToOption(EnableEndConstruct, FeatureOnOffOptions.EndConstruct, LanguageNames.VisualBasic) BindToOption(EnableLineCommit, FeatureOnOffOptions.PrettyListing, LanguageNames.VisualBasic) From f4189a2d3c22fb3e0fe1d75b7b7484dae56c802b Mon Sep 17 00:00:00 2001 From: Youssef Victor <31348972+Youssef1313@users.noreply.github.com> Date: Tue, 6 Oct 2020 01:51:44 +0200 Subject: [PATCH 143/295] Fix obsolete warning for delegate creation (#47332) Co-authored-by: Fred Silberberg --- .../Portable/Binder/Binder_Conversions.cs | 11 ++- .../Test/Emit/Attributes/AttributeTests.cs | 91 +++++++++++++++++++ 2 files changed, 97 insertions(+), 5 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs index 28e324bf398fe..02a8bf26cbf11 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs @@ -84,13 +84,14 @@ protected BoundExpression CreateConversion( } } - ReportDiagnosticsIfObsolete(diagnostics, conversion, syntax, hasBaseReceiver: false); - if (conversion.IsMethodGroup) { return CreateMethodGroupConversion(syntax, source, conversion, isCast: isCast, conversionGroupOpt, destination, diagnostics); } + // Obsolete diagnostics for method group are reported as part of creating the method group conversion. + ReportDiagnosticsIfObsolete(diagnostics, conversion, syntax, hasBaseReceiver: false); + if (conversion.IsAnonymousFunction && source.Kind == BoundKind.UnboundLambda) { return CreateAnonymousFunctionConversion(syntax, source, conversion, isCast: isCast, conversionGroupOpt, destination, diagnostics); @@ -1113,15 +1114,15 @@ private bool MethodGroupConversionHasErrors( return true; } - if (selectedMethod.HasUnsafeParameter() || selectedMethod.ReturnType.IsUnsafe()) + if ((selectedMethod.HasUnsafeParameter() || selectedMethod.ReturnType.IsUnsafe()) && ReportUnsafeIfNotAllowed(syntax, diagnostics)) { - return ReportUnsafeIfNotAllowed(syntax, diagnostics); + return true; } - if (!isAddressOf) { ReportDiagnosticsIfUnmanagedCallersOnly(diagnostics, selectedMethod, location, isDelegateConversion: true); } + ReportDiagnosticsIfObsolete(diagnostics, selectedMethod, syntax, hasBaseReceiver: false); // No use site errors, but there could be use site warnings. // If there are use site warnings, they were reported during the overload resolution process diff --git a/src/Compilers/CSharp/Test/Emit/Attributes/AttributeTests.cs b/src/Compilers/CSharp/Test/Emit/Attributes/AttributeTests.cs index b26d83c36e565..6b79e45d80099 100644 --- a/src/Compilers/CSharp/Test/Emit/Attributes/AttributeTests.cs +++ b/src/Compilers/CSharp/Test/Emit/Attributes/AttributeTests.cs @@ -9112,6 +9112,97 @@ public class C2 Diagnostic(ErrorCode.ERR_BadAttributeArgument, "C.M(null)").WithLocation(20, 6)); } + [Fact] + [WorkItem(47308, "https://github.com/dotnet/roslyn/issues/47308")] + public void ObsoleteAttribute_Delegate() + { + string source = @" +using System; +public class C +{ + [Obsolete] + public void M() + { + } + + void M2() + { + Action a = M; + a = new Action(M); + } +}"; + var comp = CreateCompilation(source); + comp.VerifyDiagnostics( + // (12,20): warning CS0612: 'C.M()' is obsolete + // Action a = M; + Diagnostic(ErrorCode.WRN_DeprecatedSymbol, "M").WithArguments("C.M()").WithLocation(12, 20), + // (13,24): warning CS0612: 'C.M()' is obsolete + // a = new Action(M); + Diagnostic(ErrorCode.WRN_DeprecatedSymbol, "M").WithArguments("C.M()").WithLocation(13, 24) + ); + } + + [Fact] + [WorkItem(47308, "https://github.com/dotnet/roslyn/issues/47308")] + public void ObsoleteAttributeWithUnsafeError() + { + string source = @" +using System; +unsafe delegate byte* D(); +class C +{ + [Obsolete(null, true)] unsafe static byte* F() => default; + unsafe static D M1() => new D(F); + static D M2() => new D(F); +}"; + var comp = CreateCompilation(source, options: TestOptions.UnsafeDebugDll); + comp.VerifyDiagnostics( + // (7,35): warning CS0612: 'C.F()' is obsolete + // unsafe static D M1() => new D(F); + Diagnostic(ErrorCode.WRN_DeprecatedSymbol, "F").WithArguments("C.F()").WithLocation(7, 35), + // (8,28): error CS0214: Pointers and fixed size buffers may only be used in an unsafe context + // static D M2() => new D(F); + Diagnostic(ErrorCode.ERR_UnsafeNeeded, "F").WithLocation(8, 28) + ); + } + + [Fact] + [WorkItem(47308, "https://github.com/dotnet/roslyn/issues/47308")] + public void UnmanagedAttributeWithUnsafeError() + { + string source = @" +using System.Runtime.InteropServices; +unsafe delegate byte* D(); +class C +{ + [UnmanagedCallersOnly] + unsafe static byte* F() => default; + unsafe static D M1() => new D(F); + static D M2() => new D(F); +} + +namespace System.Runtime.InteropServices +{ + [AttributeUsage(AttributeTargets.Method, Inherited = false)] + public sealed class UnmanagedCallersOnlyAttribute : Attribute + { + public UnmanagedCallersOnlyAttribute() + { + } + public Type[] CallConvs; + public string EntryPoint; + } +}"; + var comp = CreateCompilation(source, options: TestOptions.UnsafeDebugDll); + comp.VerifyDiagnostics( + // (8,35): error CS8902: 'C.F()' is attributed with 'UnmanagedCallersOnly' and cannot be converted to a delegate type. Obtain a function pointer to this method. + // unsafe static D M1() => new D(F); + Diagnostic(ErrorCode.ERR_UnmanagedCallersOnlyMethodsCannotBeConvertedToDelegate, "F").WithArguments("C.F()").WithLocation(8, 35), + // (9,28): error CS0214: Pointers and fixed size buffers may only be used in an unsafe context + // static D M2() => new D(F); + Diagnostic(ErrorCode.ERR_UnsafeNeeded, "F").WithLocation(9, 28) + ); + } #endregion } } From 0f09454e5725a9737dcca46eb180d1279e13070b Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 6 Oct 2020 11:11:43 +1100 Subject: [PATCH 144/295] Handle completion in line with the LSP spec --- .../AbstractLanguageServerProtocolTests.cs | 4 +-- .../Extensions/ProtocolConversions.cs | 29 ++++++++++++------- .../Handler/Completion/CompletionHandler.cs | 26 +++++++---------- 3 files changed, 31 insertions(+), 28 deletions(-) diff --git a/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs b/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs index 84ecfcdf28267..e164d469eafb3 100644 --- a/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs +++ b/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs @@ -250,9 +250,7 @@ protected static LSP.VSCompletionItem CreateCompletionItem( DisplayText = insertText, TextDocument = requestParameters.TextDocument, Position = requestParameters.Position, - CompletionTrigger = requestParameters.Context == null - ? new CompletionTrigger() - : new CompletionTrigger(ProtocolConversions.LSPToRoslynCompletionTriggerKind(requestParameters.Context.TriggerKind), char.Parse(requestParameters.Context.TriggerCharacter)) + CompletionTrigger = ProtocolConversions.LSPToRoslynCompletionTrigger(requestParameters.Context) }), Preselect = preselect }; diff --git a/src/Features/LanguageServer/Protocol/Extensions/ProtocolConversions.cs b/src/Features/LanguageServer/Protocol/Extensions/ProtocolConversions.cs index 3626bbaedccd3..00d171feea389 100644 --- a/src/Features/LanguageServer/Protocol/Extensions/ProtocolConversions.cs +++ b/src/Features/LanguageServer/Protocol/Extensions/ProtocolConversions.cs @@ -71,18 +71,27 @@ internal static class ProtocolConversions // TO-DO: More LSP.CompletionTriggerKind mappings are required to properly map to Roslyn CompletionTriggerKinds. // https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1178726 - public static Completion.CompletionTriggerKind LSPToRoslynCompletionTriggerKind(LSP.CompletionTriggerKind triggerKind) + public static Completion.CompletionTrigger LSPToRoslynCompletionTrigger(LSP.CompletionContext? context) { - switch (triggerKind) + if (context == null) { - case LSP.CompletionTriggerKind.Invoked: - return Completion.CompletionTriggerKind.Invoke; - case LSP.CompletionTriggerKind.TriggerCharacter: - return Completion.CompletionTriggerKind.Insertion; - default: - // LSP added a TriggerKind that we need to support. - Logger.Log(FunctionId.LSPCompletion_MissingLSPCompletionTriggerKind); - return Completion.CompletionTriggerKind.Invoke; + // Some LSP clients don't support sending extra context, so all we can do is invoke + return Completion.CompletionTrigger.Invoke; + } + else if (context.TriggerKind == LSP.CompletionTriggerKind.Invoked) + { + return Completion.CompletionTrigger.Invoke; + } + else if (context.TriggerKind == LSP.CompletionTriggerKind.TriggerCharacter) + { + Contract.ThrowIfNull(context.TriggerCharacter); + return Completion.CompletionTrigger.CreateInsertionTrigger(char.Parse(context.TriggerCharacter)); + } + else + { + // LSP added a TriggerKind that we need to support. + Logger.Log(FunctionId.LSPCompletion_MissingLSPCompletionTriggerKind); + return Completion.CompletionTrigger.Invoke; } } diff --git a/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionHandler.cs index 88242bdb30aaa..3e63795b18b9d 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionHandler.cs @@ -27,8 +27,8 @@ namespace Microsoft.CodeAnalysis.LanguageServer.Handler [ExportLspMethod(LSP.Methods.TextDocumentCompletionName, mutatesSolutionState: false)] internal class CompletionHandler : IRequestHandler { - private readonly ImmutableHashSet _csharpTriggerCharacters; - private readonly ImmutableHashSet _vbTriggerCharacters; + private readonly ImmutableHashSet _csharpTriggerCharacters; + private readonly ImmutableHashSet _vbTriggerCharacters; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] @@ -36,9 +36,9 @@ public CompletionHandler( [ImportMany] IEnumerable> completionProviders) { _csharpTriggerCharacters = completionProviders.Where(lz => lz.Metadata.Language == LanguageNames.CSharp).SelectMany( - lz => GetTriggerCharacters(lz.Value)).Select(c => c.ToString()).ToImmutableHashSet(); + lz => GetTriggerCharacters(lz.Value)).ToImmutableHashSet(); _vbTriggerCharacters = completionProviders.Where(lz => lz.Metadata.Language == LanguageNames.VisualBasic).SelectMany( - lz => GetTriggerCharacters(lz.Value)).Select(c => c.ToString()).ToImmutableHashSet(); + lz => GetTriggerCharacters(lz.Value)).ToImmutableHashSet(); } public LSP.TextDocumentIdentifier? GetTextDocumentIdentifier(LSP.CompletionParams request) => request.TextDocument; @@ -51,17 +51,14 @@ public CompletionHandler( return null; } - if (request.Context?.TriggerCharacter == null) - { - return null; - } - // C# and VB share the same LSP language server, and thus share the same default trigger characters. // We need to ensure the trigger character is valid in the document's language. For example, the '{' // character, while a trigger character in VB, is not a trigger character in C#. - var triggerCharacter = char.Parse(request.Context.TriggerCharacter); - if (request.Context.TriggerKind == LSP.CompletionTriggerKind.TriggerCharacter && !char.IsLetterOrDigit(triggerCharacter) && - !IsValidTriggerCharacterForDocument(document, request.Context.TriggerCharacter)) + if (request.Context != null && + request.Context.TriggerKind == LSP.CompletionTriggerKind.TriggerCharacter && + !char.TryParse(request.Context.TriggerCharacter, out var triggerCharacter) && + !char.IsLetterOrDigit(triggerCharacter) && + !IsValidTriggerCharacterForDocument(document, triggerCharacter)) { return null; } @@ -87,8 +84,7 @@ public CompletionHandler( // TO-DO: More LSP.CompletionTriggerKind mappings are required to properly map to Roslyn CompletionTriggerKinds. // https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1178726 - var triggerKind = ProtocolConversions.LSPToRoslynCompletionTriggerKind(request.Context.TriggerKind); - var completionTrigger = new CompletionTrigger(triggerKind, triggerCharacter); + var completionTrigger = ProtocolConversions.LSPToRoslynCompletionTrigger(request.Context); var list = await completionService.GetCompletionsAsync(document, position, completionTrigger, options: completionOptions, cancellationToken: cancellationToken).ConfigureAwait(false); if (list == null) @@ -106,7 +102,7 @@ public CompletionHandler( }; // Local functions - bool IsValidTriggerCharacterForDocument(Document document, string triggerCharacter) + bool IsValidTriggerCharacterForDocument(Document document, char triggerCharacter) { if (document.Project.Language == LanguageNames.CSharp) { From f27ad7b11a2f14fc41609a14536c0c7dbf1a6f59 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Sun, 4 Oct 2020 22:18:18 -0700 Subject: [PATCH 145/295] Fix identifier completion exploding. - This is an interesting issue because the VS LSP platform violates the LSP spec whereas Razor does not violate the spec and translates VS LSP platform requests into spec abiding messages; however, this in turn breaks Roslyn. So for instance, when typing an identifier to trigger completion the trigger kind should be `invoked` and the trigger character should be `null`; however, the LSP platform passes `CompletionTriggerKind.TriggerCharacter` and either a `\0` trigger character or the actual identifier. Because of this difference in behavior prior to this change you'd run `char.Parse` on `null` which would of course explode. --- .../Protocol/Handler/Completion/CompletionHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionHandler.cs index 45d0521ba83d4..42cc916dbd99b 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionHandler.cs @@ -54,7 +54,7 @@ public CompletionHandler( // C# and VB share the same LSP language server, and thus share the same default trigger characters. // We need to ensure the trigger character is valid in the document's language. For example, the '{' // character, while a trigger character in VB, is not a trigger character in C#. - var triggerCharacter = char.Parse(request.Context.TriggerCharacter); + char.TryParse(request.Context.TriggerCharacter, out var triggerCharacter); if (request.Context.TriggerKind == LSP.CompletionTriggerKind.TriggerCharacter && !char.IsLetterOrDigit(triggerCharacter) && !IsValidTriggerCharacterForDocument(document, request.Context.TriggerCharacter)) { From da04905459c14d4d73cff0a40360e6b4ef06ebbe Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Mon, 5 Oct 2020 17:17:32 -0700 Subject: [PATCH 146/295] Fix Go to Definition to a source-generated file https://github.com/dotnet/roslyn/pull/47047 changed the logic for the file name and path we generate, but we were no longer ensuring the temporary directory existed prior to trying to create the file within it. --- .../Workspace/SourceGeneratedFileManager.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/VisualStudio/Core/Def/Implementation/Workspace/SourceGeneratedFileManager.cs b/src/VisualStudio/Core/Def/Implementation/Workspace/SourceGeneratedFileManager.cs index 98115b9c2df83..f032bb71b8b46 100644 --- a/src/VisualStudio/Core/Def/Implementation/Workspace/SourceGeneratedFileManager.cs +++ b/src/VisualStudio/Core/Def/Implementation/Workspace/SourceGeneratedFileManager.cs @@ -95,14 +95,18 @@ public void NavigateToSourceGeneratedFile(Project project, ISourceGenerator gene // but most URIs are blocked other than file:// and http://; they also get extra handling to attempt to download the file so // those aren't really usable anyways. - // We put all the files related to the same project in a single directory var generatorType = generator.GetType(); - var projectDirectory = Path.Combine(_temporaryDirectory, project.Id.Id.ToString()); - Directory.CreateDirectory(projectDirectory); // The file name we generate here is chosen to match the compiler's choice, so the debugger can recognize the files should match. // This can only be changed if the compiler changes the algorithm as well. - var temporaryFilePath = Path.Combine(projectDirectory, generatorType.Assembly.GetName().Name ?? string.Empty, generatorType.FullName, generatedSourceHintName); + var temporaryFilePath = Path.Combine( + _temporaryDirectory, + project.Id.Id.ToString(), + generatorType.Assembly.GetName().Name ?? string.Empty, + generatorType.FullName, + generatedSourceHintName); + + Directory.CreateDirectory(Path.GetDirectoryName(temporaryFilePath)); // Don't write to the file if it's already there, as that potentially triggers a file reload if (!File.Exists(temporaryFilePath)) From 3263a2f7c724582d4cc39a602d0fc832570330ee Mon Sep 17 00:00:00 2001 From: Youssef Victor <31348972+Youssef1313@users.noreply.github.com> Date: Tue, 6 Oct 2020 02:28:44 +0200 Subject: [PATCH 147/295] Fix F1 help link for error messages (#46850) --- .../CSharp/Portable/Errors/ErrorFacts.cs | 135 ++++++++---------- .../CommandLine/SarifV1ErrorLoggerTests.cs | 4 + .../CommandLine/SarifV2ErrorLoggerTests.cs | 4 + .../AttributeTests_WellKnownAttributes.cs | 16 +-- .../Portable/Errors/ErrorFactories.vb | 17 +-- .../CommandLine/SarifV1ErrorLoggerTests.vb | 4 + .../CommandLine/SarifV2ErrorLoggerTests.vb | 4 + .../AttributeTests_ObsoleteAttribute.vb | 38 ++--- .../Squiggles/ErrorSquiggleProducerTests.cs | 2 +- .../Squiggles/ErrorSquiggleProducerTests.vb | 3 +- 10 files changed, 107 insertions(+), 120 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Errors/ErrorFacts.cs b/src/Compilers/CSharp/Portable/Errors/ErrorFacts.cs index 904b2fe253759..1390d6987ccd3 100644 --- a/src/Compilers/CSharp/Portable/Errors/ErrorFacts.cs +++ b/src/Compilers/CSharp/Portable/Errors/ErrorFacts.cs @@ -17,7 +17,6 @@ internal static partial class ErrorFacts { private const string s_titleSuffix = "_Title"; private const string s_descriptionSuffix = "_Description"; - private static readonly Lazy> s_helpLinksMap = new Lazy>(CreateHelpLinks); private static readonly Lazy> s_categoriesMap = new Lazy>(CreateCategoriesMap); public static readonly ImmutableHashSet NullableWarnings; @@ -25,79 +24,69 @@ static ErrorFacts() { ImmutableHashSet.Builder nullableWarnings = ImmutableHashSet.CreateBuilder(); - nullableWarnings.Add(getId(ErrorCode.WRN_NullReferenceAssignment)); - nullableWarnings.Add(getId(ErrorCode.WRN_NullReferenceReceiver)); - nullableWarnings.Add(getId(ErrorCode.WRN_NullReferenceReturn)); - nullableWarnings.Add(getId(ErrorCode.WRN_NullReferenceArgument)); - nullableWarnings.Add(getId(ErrorCode.WRN_UninitializedNonNullableField)); - nullableWarnings.Add(getId(ErrorCode.WRN_NullabilityMismatchInAssignment)); - nullableWarnings.Add(getId(ErrorCode.WRN_NullabilityMismatchInArgument)); - nullableWarnings.Add(getId(ErrorCode.WRN_NullabilityMismatchInArgumentForOutput)); - nullableWarnings.Add(getId(ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate)); - nullableWarnings.Add(getId(ErrorCode.WRN_NullabilityMismatchInParameterTypeOfTargetDelegate)); - nullableWarnings.Add(getId(ErrorCode.WRN_NullAsNonNullable)); - nullableWarnings.Add(getId(ErrorCode.WRN_NullableValueTypeMayBeNull)); - nullableWarnings.Add(getId(ErrorCode.WRN_NullabilityMismatchInTypeParameterConstraint)); - nullableWarnings.Add(getId(ErrorCode.WRN_NullabilityMismatchInTypeParameterReferenceTypeConstraint)); - nullableWarnings.Add(getId(ErrorCode.WRN_NullabilityMismatchInTypeParameterNotNullConstraint)); - nullableWarnings.Add(getId(ErrorCode.WRN_ThrowPossibleNull)); - nullableWarnings.Add(getId(ErrorCode.WRN_UnboxPossibleNull)); - nullableWarnings.Add(getId(ErrorCode.WRN_SwitchExpressionNotExhaustiveForNull)); - nullableWarnings.Add(getId(ErrorCode.WRN_SwitchExpressionNotExhaustiveForNullWithWhen)); - - nullableWarnings.Add(getId(ErrorCode.WRN_ConvertingNullableToNonNullable)); - nullableWarnings.Add(getId(ErrorCode.WRN_DisallowNullAttributeForbidsMaybeNullAssignment)); - nullableWarnings.Add(getId(ErrorCode.WRN_ParameterConditionallyDisallowsNull)); - nullableWarnings.Add(getId(ErrorCode.WRN_ShouldNotReturn)); - - nullableWarnings.Add(getId(ErrorCode.WRN_NullabilityMismatchInTypeOnOverride)); - nullableWarnings.Add(getId(ErrorCode.WRN_NullabilityMismatchInReturnTypeOnOverride)); - nullableWarnings.Add(getId(ErrorCode.WRN_NullabilityMismatchInReturnTypeOnPartial)); - nullableWarnings.Add(getId(ErrorCode.WRN_NullabilityMismatchInParameterTypeOnOverride)); - nullableWarnings.Add(getId(ErrorCode.WRN_NullabilityMismatchInParameterTypeOnPartial)); - nullableWarnings.Add(getId(ErrorCode.WRN_NullabilityMismatchInTypeOnImplicitImplementation)); - nullableWarnings.Add(getId(ErrorCode.WRN_NullabilityMismatchInReturnTypeOnImplicitImplementation)); - nullableWarnings.Add(getId(ErrorCode.WRN_NullabilityMismatchInParameterTypeOnImplicitImplementation)); - nullableWarnings.Add(getId(ErrorCode.WRN_NullabilityMismatchInTypeOnExplicitImplementation)); - nullableWarnings.Add(getId(ErrorCode.WRN_NullabilityMismatchInReturnTypeOnExplicitImplementation)); - nullableWarnings.Add(getId(ErrorCode.WRN_NullabilityMismatchInParameterTypeOnExplicitImplementation)); - nullableWarnings.Add(getId(ErrorCode.WRN_NullabilityMismatchInConstraintsOnImplicitImplementation)); - nullableWarnings.Add(getId(ErrorCode.WRN_NullabilityMismatchInExplicitlyImplementedInterface)); - nullableWarnings.Add(getId(ErrorCode.WRN_NullabilityMismatchInInterfaceImplementedByBase)); - nullableWarnings.Add(getId(ErrorCode.WRN_DuplicateInterfaceWithNullabilityMismatchInBaseList)); - nullableWarnings.Add(getId(ErrorCode.WRN_NullabilityMismatchInConstraintsOnPartialImplementation)); - nullableWarnings.Add(getId(ErrorCode.WRN_NullReferenceInitializer)); - nullableWarnings.Add(getId(ErrorCode.WRN_ShouldNotReturn)); - nullableWarnings.Add(getId(ErrorCode.WRN_DoesNotReturnMismatch)); - nullableWarnings.Add(getId(ErrorCode.WRN_TopLevelNullabilityMismatchInParameterTypeOnExplicitImplementation)); - nullableWarnings.Add(getId(ErrorCode.WRN_TopLevelNullabilityMismatchInParameterTypeOnImplicitImplementation)); - nullableWarnings.Add(getId(ErrorCode.WRN_TopLevelNullabilityMismatchInParameterTypeOnOverride)); - nullableWarnings.Add(getId(ErrorCode.WRN_TopLevelNullabilityMismatchInReturnTypeOnExplicitImplementation)); - nullableWarnings.Add(getId(ErrorCode.WRN_TopLevelNullabilityMismatchInReturnTypeOnImplicitImplementation)); - nullableWarnings.Add(getId(ErrorCode.WRN_TopLevelNullabilityMismatchInReturnTypeOnOverride)); - nullableWarnings.Add(getId(ErrorCode.WRN_MemberNotNull)); - nullableWarnings.Add(getId(ErrorCode.WRN_MemberNotNullBadMember)); - nullableWarnings.Add(getId(ErrorCode.WRN_MemberNotNullWhen)); - nullableWarnings.Add(getId(ErrorCode.WRN_ParameterDisallowsNull)); - nullableWarnings.Add(getId(ErrorCode.WRN_ParameterNotNullIfNotNull)); - nullableWarnings.Add(getId(ErrorCode.WRN_ReturnNotNullIfNotNull)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullReferenceAssignment)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullReferenceReceiver)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullReferenceReturn)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullReferenceArgument)); + nullableWarnings.Add(GetId(ErrorCode.WRN_UninitializedNonNullableField)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullabilityMismatchInAssignment)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullabilityMismatchInArgument)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullabilityMismatchInArgumentForOutput)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullabilityMismatchInReturnTypeOfTargetDelegate)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullabilityMismatchInParameterTypeOfTargetDelegate)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullAsNonNullable)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullableValueTypeMayBeNull)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullabilityMismatchInTypeParameterConstraint)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullabilityMismatchInTypeParameterReferenceTypeConstraint)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullabilityMismatchInTypeParameterNotNullConstraint)); + nullableWarnings.Add(GetId(ErrorCode.WRN_ThrowPossibleNull)); + nullableWarnings.Add(GetId(ErrorCode.WRN_UnboxPossibleNull)); + nullableWarnings.Add(GetId(ErrorCode.WRN_SwitchExpressionNotExhaustiveForNull)); + nullableWarnings.Add(GetId(ErrorCode.WRN_SwitchExpressionNotExhaustiveForNullWithWhen)); + + nullableWarnings.Add(GetId(ErrorCode.WRN_ConvertingNullableToNonNullable)); + nullableWarnings.Add(GetId(ErrorCode.WRN_DisallowNullAttributeForbidsMaybeNullAssignment)); + nullableWarnings.Add(GetId(ErrorCode.WRN_ParameterConditionallyDisallowsNull)); + nullableWarnings.Add(GetId(ErrorCode.WRN_ShouldNotReturn)); + + nullableWarnings.Add(GetId(ErrorCode.WRN_NullabilityMismatchInTypeOnOverride)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullabilityMismatchInReturnTypeOnOverride)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullabilityMismatchInReturnTypeOnPartial)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullabilityMismatchInParameterTypeOnOverride)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullabilityMismatchInParameterTypeOnPartial)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullabilityMismatchInTypeOnImplicitImplementation)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullabilityMismatchInReturnTypeOnImplicitImplementation)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullabilityMismatchInParameterTypeOnImplicitImplementation)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullabilityMismatchInTypeOnExplicitImplementation)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullabilityMismatchInReturnTypeOnExplicitImplementation)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullabilityMismatchInParameterTypeOnExplicitImplementation)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullabilityMismatchInConstraintsOnImplicitImplementation)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullabilityMismatchInExplicitlyImplementedInterface)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullabilityMismatchInInterfaceImplementedByBase)); + nullableWarnings.Add(GetId(ErrorCode.WRN_DuplicateInterfaceWithNullabilityMismatchInBaseList)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullabilityMismatchInConstraintsOnPartialImplementation)); + nullableWarnings.Add(GetId(ErrorCode.WRN_NullReferenceInitializer)); + nullableWarnings.Add(GetId(ErrorCode.WRN_ShouldNotReturn)); + nullableWarnings.Add(GetId(ErrorCode.WRN_DoesNotReturnMismatch)); + nullableWarnings.Add(GetId(ErrorCode.WRN_TopLevelNullabilityMismatchInParameterTypeOnExplicitImplementation)); + nullableWarnings.Add(GetId(ErrorCode.WRN_TopLevelNullabilityMismatchInParameterTypeOnImplicitImplementation)); + nullableWarnings.Add(GetId(ErrorCode.WRN_TopLevelNullabilityMismatchInParameterTypeOnOverride)); + nullableWarnings.Add(GetId(ErrorCode.WRN_TopLevelNullabilityMismatchInReturnTypeOnExplicitImplementation)); + nullableWarnings.Add(GetId(ErrorCode.WRN_TopLevelNullabilityMismatchInReturnTypeOnImplicitImplementation)); + nullableWarnings.Add(GetId(ErrorCode.WRN_TopLevelNullabilityMismatchInReturnTypeOnOverride)); + nullableWarnings.Add(GetId(ErrorCode.WRN_MemberNotNull)); + nullableWarnings.Add(GetId(ErrorCode.WRN_MemberNotNullBadMember)); + nullableWarnings.Add(GetId(ErrorCode.WRN_MemberNotNullWhen)); + nullableWarnings.Add(GetId(ErrorCode.WRN_ParameterDisallowsNull)); + nullableWarnings.Add(GetId(ErrorCode.WRN_ParameterNotNullIfNotNull)); + nullableWarnings.Add(GetId(ErrorCode.WRN_ReturnNotNullIfNotNull)); NullableWarnings = nullableWarnings.ToImmutable(); - - static string getId(ErrorCode errorCode) - { - return MessageProvider.Instance.GetIdForErrorCode((int)errorCode); - } } - private static ImmutableDictionary CreateHelpLinks() + private static string GetId(ErrorCode errorCode) { - var map = new Dictionary() - { - // { ERROR_CODE, HELP_LINK } - }; - - return map.ToImmutableDictionary(); + return MessageProvider.Instance.GetIdForErrorCode((int)errorCode); } private static ImmutableDictionary CreateCategoriesMap() @@ -171,13 +160,7 @@ public static LocalizableResourceString GetDescription(ErrorCode code) public static string GetHelpLink(ErrorCode code) { - string helpLink; - if (s_helpLinksMap.Value.TryGetValue(code, out helpLink)) - { - return helpLink; - } - - return string.Empty; + return $"https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k({GetId(code)})"; } public static string GetCategory(ErrorCode code) diff --git a/src/Compilers/CSharp/Test/CommandLine/SarifV1ErrorLoggerTests.cs b/src/Compilers/CSharp/Test/CommandLine/SarifV1ErrorLoggerTests.cs index 1c5eb73d02106..ac56d3158275a 100644 --- a/src/Compilers/CSharp/Test/CommandLine/SarifV1ErrorLoggerTests.cs +++ b/src/Compilers/CSharp/Test/CommandLine/SarifV1ErrorLoggerTests.cs @@ -73,6 +73,7 @@ internal override string GetExpectedOutputForSimpleCompilerDiagnostics(CommonCom ""id"": ""CS0169"", ""shortDescription"": ""Field is never used"", ""defaultLevel"": ""warning"", + ""helpUri"": ""https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS0169)"", ""properties"": {{ ""category"": ""Compiler"", ""isEnabledByDefault"": true, @@ -85,6 +86,7 @@ internal override string GetExpectedOutputForSimpleCompilerDiagnostics(CommonCom ""CS5001"": {{ ""id"": ""CS5001"", ""defaultLevel"": ""error"", + ""helpUri"": ""https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS5001)"", ""properties"": {{ ""category"": ""Compiler"", ""isEnabledByDefault"": true, @@ -149,6 +151,7 @@ internal override string GetExpectedOutputForSimpleCompilerDiagnosticsSuppressed ""id"": ""CS0169"", ""shortDescription"": ""Field is never used"", ""defaultLevel"": ""warning"", + ""helpUri"": ""https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS0169)"", ""properties"": {{ ""category"": ""Compiler"", ""isEnabledByDefault"": true, @@ -161,6 +164,7 @@ internal override string GetExpectedOutputForSimpleCompilerDiagnosticsSuppressed ""CS5001"": {{ ""id"": ""CS5001"", ""defaultLevel"": ""error"", + ""helpUri"": ""https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS5001)"", ""properties"": {{ ""category"": ""Compiler"", ""isEnabledByDefault"": true, diff --git a/src/Compilers/CSharp/Test/CommandLine/SarifV2ErrorLoggerTests.cs b/src/Compilers/CSharp/Test/CommandLine/SarifV2ErrorLoggerTests.cs index 6e33a86faf3e9..b55997674a8a0 100644 --- a/src/Compilers/CSharp/Test/CommandLine/SarifV2ErrorLoggerTests.cs +++ b/src/Compilers/CSharp/Test/CommandLine/SarifV2ErrorLoggerTests.cs @@ -108,6 +108,7 @@ internal override string GetExpectedOutputForSimpleCompilerDiagnostics(CommonCom ""defaultConfiguration"": {{ ""level"": ""error"" }}, + ""helpUri"": ""https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS5001)"", ""properties"": {{ ""category"": ""Compiler"", ""tags"": [ @@ -122,6 +123,7 @@ internal override string GetExpectedOutputForSimpleCompilerDiagnostics(CommonCom ""shortDescription"": {{ ""text"": ""Field is never used"" }}, + ""helpUri"": ""https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS0169)"", ""properties"": {{ ""category"": ""Compiler"", ""tags"": [ @@ -213,6 +215,7 @@ internal override string GetExpectedOutputForSimpleCompilerDiagnosticsSuppressed ""defaultConfiguration"": {{ ""level"": ""error"" }}, + ""helpUri"": ""https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS5001)"", ""properties"": {{ ""category"": ""Compiler"", ""tags"": [ @@ -227,6 +230,7 @@ internal override string GetExpectedOutputForSimpleCompilerDiagnosticsSuppressed ""shortDescription"": {{ ""text"": ""Field is never used"" }}, + ""helpUri"": ""https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS0169)"", ""properties"": {{ ""category"": ""Compiler"", ""tags"": [ diff --git a/src/Compilers/CSharp/Test/Emit/Attributes/AttributeTests_WellKnownAttributes.cs b/src/Compilers/CSharp/Test/Emit/Attributes/AttributeTests_WellKnownAttributes.cs index e557c5839936c..e77bf3c130c91 100644 --- a/src/Compilers/CSharp/Test/Emit/Attributes/AttributeTests_WellKnownAttributes.cs +++ b/src/Compilers/CSharp/Test/Emit/Attributes/AttributeTests_WellKnownAttributes.cs @@ -8199,7 +8199,7 @@ void M2() var diag = diags.Single(); Assert.Equal("TEST1", diag.Id); Assert.Equal(ErrorCode.WRN_DeprecatedSymbol, (ErrorCode)diag.Code); - Assert.Equal(string.Empty, diag.Descriptor.HelpLinkUri); + Assert.Equal("https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS0612)", diag.Descriptor.HelpLinkUri); diags.Verify( // (12,9): warning TEST1: 'C.M1()' is obsolete @@ -8261,7 +8261,7 @@ void M2() var diags = comp.GetDiagnostics(); var diag = diags.Single(); - Assert.Equal("", diag.Descriptor.HelpLinkUri); + Assert.Equal("https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS0612)", diag.Descriptor.HelpLinkUri); diags.Verify( // (12,9): warning CS0612: 'C.M1()' is obsolete @@ -8651,7 +8651,7 @@ void verify(MetadataReference reference) var diags = comp2.GetDiagnostics(); var diag = diags.Single(); - Assert.Equal("", diag.Descriptor.HelpLinkUri); + Assert.Equal("https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS0612)", diag.Descriptor.HelpLinkUri); diags.Verify( // (6,9): warning CS0612: 'C1.M1()' is obsolete @@ -8857,7 +8857,7 @@ void verify(MetadataReference reference) Diagnostic(ErrorCode.WRN_DeprecatedSymbol, "M1()").WithArguments("C1.M1()").WithLocation(6, 9)); var diag = diags.Single(); - Assert.Equal("", diag.Descriptor.HelpLinkUri); + Assert.Equal("https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS0612)", diag.Descriptor.HelpLinkUri); } } @@ -9040,7 +9040,7 @@ void verify(MetadataReference reference) Diagnostic(ErrorCode.WRN_DeprecatedSymbol, "M1()").WithArguments("C1.M1()").WithLocation(6, 9)); var diag = diags.Single(); - Assert.Equal("", diag.Descriptor.HelpLinkUri); + Assert.Equal($"https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS0612)", diag.Descriptor.HelpLinkUri); } } @@ -9091,7 +9091,7 @@ void verify(MetadataReference reference) Diagnostic(ErrorCode.WRN_DeprecatedSymbol, "M1()").WithArguments("C1.M1()").WithLocation(6, 9)); var diag = diags.Single(); - Assert.Equal("", diag.Descriptor.HelpLinkUri); + Assert.Equal("https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS0612)", diag.Descriptor.HelpLinkUri); } } @@ -9370,7 +9370,7 @@ void M2() Diagnostic("A", "M1()").WithArguments("C1.M1()").WithLocation(6, 9)); var diag = diags.Single(); - Assert.Equal("", diag.Descriptor.HelpLinkUri); + Assert.Equal("https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS0612)", diag.Descriptor.HelpLinkUri); } [Fact, WorkItem(42119, "https://github.com/dotnet/roslyn/issues/42119")] @@ -9420,7 +9420,7 @@ void verify(MetadataReference reference) Diagnostic(ErrorCode.WRN_DeprecatedSymbol, "M1()").WithArguments("C1.M1()").WithLocation(6, 9)); var diag = diags.Single(); - Assert.Equal("", diag.Descriptor.HelpLinkUri); + Assert.Equal("https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS0612)", diag.Descriptor.HelpLinkUri); } } diff --git a/src/Compilers/VisualBasic/Portable/Errors/ErrorFactories.vb b/src/Compilers/VisualBasic/Portable/Errors/ErrorFactories.vb index 065bf8badbec4..e7b85fec49235 100644 --- a/src/Compilers/VisualBasic/Portable/Errors/ErrorFactories.vb +++ b/src/Compilers/VisualBasic/Portable/Errors/ErrorFactories.vb @@ -15,17 +15,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Private Const s_titleSuffix As String = "_Title" Private Const s_descriptionSuffix As String = "_Description" - Private Shared ReadOnly s_helpLinksMap As Lazy(Of ImmutableDictionary(Of ERRID, String)) = New Lazy(Of ImmutableDictionary(Of ERRID, String))(AddressOf CreateHelpLinks) Private Shared ReadOnly s_categoriesMap As Lazy(Of ImmutableDictionary(Of ERRID, String)) = New Lazy(Of ImmutableDictionary(Of ERRID, String))(AddressOf CreateCategoriesMap) - Private Shared Function CreateHelpLinks() As ImmutableDictionary(Of ERRID, String) - Dim map = New Dictionary(Of ERRID, String) From - { ' { ERROR_CODE, HELP_LINK } - } - - Return map.ToImmutableDictionary - End Function - Private Shared Function CreateCategoriesMap() As ImmutableDictionary(Of ERRID, String) Dim map = New Dictionary(Of ERRID, String) From { ' { ERROR_CODE, CATEGORY } @@ -127,12 +118,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic End Function Public Shared Function GetHelpLink(id As ERRID) As String - Dim helpLink As String = Nothing - If s_helpLinksMap.Value.TryGetValue(id, helpLink) Then - Return helpLink - End If - - Return String.Empty + Dim idWithLanguagePrefix As String = MessageProvider.Instance.GetIdForErrorCode(CInt(id)) + Return $"https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k({idWithLanguagePrefix})" End Function Public Shared Function GetCategory(id As ERRID) As String diff --git a/src/Compilers/VisualBasic/Test/CommandLine/SarifV1ErrorLoggerTests.vb b/src/Compilers/VisualBasic/Test/CommandLine/SarifV1ErrorLoggerTests.vb index c81352515bd77..5edd37fc00b3f 100644 --- a/src/Compilers/VisualBasic/Test/CommandLine/SarifV1ErrorLoggerTests.vb +++ b/src/Compilers/VisualBasic/Test/CommandLine/SarifV1ErrorLoggerTests.vb @@ -78,6 +78,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests ""BC30420"": {{ ""id"": ""BC30420"", ""defaultLevel"": ""error"", + ""helpUri"": ""https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC30420)"", ""properties"": {{ ""category"": ""Compiler"", ""isEnabledByDefault"": true, @@ -92,6 +93,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests ""id"": ""BC42024"", ""shortDescription"": ""Unused local variable"", ""defaultLevel"": ""warning"", + ""helpUri"": ""https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC42024)"", ""properties"": {{ ""category"": ""Compiler"", ""isEnabledByDefault"": true, @@ -155,6 +157,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests ""BC30420"": {{ ""id"": ""BC30420"", ""defaultLevel"": ""error"", + ""helpUri"": ""https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC30420)"", ""properties"": {{ ""category"": ""Compiler"", ""isEnabledByDefault"": true, @@ -169,6 +172,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests ""id"": ""BC42024"", ""shortDescription"": ""Unused local variable"", ""defaultLevel"": ""warning"", + ""helpUri"": ""https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC42024)"", ""properties"": {{ ""category"": ""Compiler"", ""isEnabledByDefault"": true, diff --git a/src/Compilers/VisualBasic/Test/CommandLine/SarifV2ErrorLoggerTests.vb b/src/Compilers/VisualBasic/Test/CommandLine/SarifV2ErrorLoggerTests.vb index 61069bffe9a60..7edd02223ce99 100644 --- a/src/Compilers/VisualBasic/Test/CommandLine/SarifV2ErrorLoggerTests.vb +++ b/src/Compilers/VisualBasic/Test/CommandLine/SarifV2ErrorLoggerTests.vb @@ -111,6 +111,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests ""shortDescription"": {{ ""text"": ""Unused local variable"" }}, + ""helpUri"": ""https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC42024)"", ""properties"": {{ ""category"": ""Compiler"", ""tags"": [ @@ -124,6 +125,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests ""defaultConfiguration"": {{ ""level"": ""error"" }}, + ""helpUri"": ""https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC30420)"", ""properties"": {{ ""category"": ""Compiler"", ""tags"": [ @@ -216,6 +218,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests ""shortDescription"": {{ ""text"": ""Unused local variable"" }}, + ""helpUri"": ""https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC42024)"", ""properties"": {{ ""category"": ""Compiler"", ""tags"": [ @@ -229,6 +232,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests ""defaultConfiguration"": {{ ""level"": ""error"" }}, + ""helpUri"": ""https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC30420)"", ""properties"": {{ ""category"": ""Compiler"", ""tags"": [ diff --git a/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_ObsoleteAttribute.vb b/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_ObsoleteAttribute.vb index 7d6bef33360dc..f89a51dc947c6 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_ObsoleteAttribute.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Attributes/AttributeTests_ObsoleteAttribute.vb @@ -1193,7 +1193,7 @@ End Class diags.Verify(Diagnostic("TEST1", "M1()").WithArguments("Public Sub M1()").WithLocation(9, 9)) Dim diag = diags.Single() - Assert.Equal("", diag.Descriptor.HelpLinkUri) + Assert.Equal("https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC40008)", diag.Descriptor.HelpLinkUri) End Sub @@ -1253,7 +1253,7 @@ End Class diags.Verify(Diagnostic(ERRID.WRN_UseOfObsoleteSymbolNoMessage1, "M1()").WithArguments("Public Sub M1()").WithLocation(9, 9)) Dim diag = diags.Single() - Assert.Equal("", diag.Descriptor.HelpLinkUri) + Assert.Equal("https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC40008)", diag.Descriptor.HelpLinkUri) End Sub @@ -1635,7 +1635,7 @@ End Class diags.Verify(Diagnostic(ERRID.WRN_UseOfObsoleteSymbolNoMessage1, "M1()").WithArguments("Public Sub M1()").WithLocation(5, 9)) Dim diag = diags.Single() - Assert.Equal("", diag.Descriptor.HelpLinkUri) + Assert.Equal("https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC40008)", diag.Descriptor.HelpLinkUri) comp2 = CreateCompilationWithMscorlib40(source2, references:={comp1.EmitToImageReference()}) @@ -1643,7 +1643,7 @@ End Class diags.Verify(Diagnostic(ERRID.WRN_UseOfObsoleteSymbolNoMessage1, "M1()").WithArguments("Public Sub M1()").WithLocation(5, 9)) diag = diags.Single() - Assert.Equal("", diag.Descriptor.HelpLinkUri) + Assert.Equal("https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC40008)", diag.Descriptor.HelpLinkUri) End Sub @@ -1693,7 +1693,7 @@ End Class diags.Verify(Diagnostic("TEST1", "M1()").WithArguments("Public Sub M1()").WithLocation(5, 9)) Dim diag = diags.Single() - Assert.Equal("", diag.Descriptor.HelpLinkUri) + Assert.Equal("https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC40008)", diag.Descriptor.HelpLinkUri) comp2 = CreateCompilationWithMscorlib40(source2, references:={comp1.EmitToImageReference()}) @@ -1701,7 +1701,7 @@ End Class diags.Verify(Diagnostic("TEST1", "M1()").WithArguments("Public Sub M1()").WithLocation(5, 9)) diag = diags.Single() - Assert.Equal("", diag.Descriptor.HelpLinkUri) + Assert.Equal("https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC40008)", diag.Descriptor.HelpLinkUri) End Sub @@ -1751,7 +1751,7 @@ End Class diags.Verify(Diagnostic(ERRID.WRN_UseOfObsoleteSymbolNoMessage1, "M1()").WithArguments("Public Sub M1()").WithLocation(5, 9)) Dim diag = diags.Single() - Assert.Equal("", diag.Descriptor.HelpLinkUri) + Assert.Equal("https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC40008)", diag.Descriptor.HelpLinkUri) comp2 = CreateCompilationWithMscorlib40(source2, references:={comp1.EmitToImageReference()}) @@ -1759,7 +1759,7 @@ End Class diags.Verify(Diagnostic(ERRID.WRN_UseOfObsoleteSymbolNoMessage1, "M1()").WithArguments("Public Sub M1()").WithLocation(5, 9)) diag = diags.Single() - Assert.Equal("", diag.Descriptor.HelpLinkUri) + Assert.Equal("https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC40008)", diag.Descriptor.HelpLinkUri) End Sub @@ -1839,7 +1839,7 @@ End Class diags.Verify(Diagnostic("TEST1", "M1()").WithArguments("Public Sub M1()").WithLocation(5, 9)) Dim diag = diags.Single() - Assert.Equal("", diag.Descriptor.HelpLinkUri) + Assert.Equal("https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC40008)", diag.Descriptor.HelpLinkUri) comp2 = CreateCompilationWithMscorlib40(source2, references:={comp1.EmitToImageReference()}) @@ -1847,7 +1847,7 @@ End Class diags.Verify(Diagnostic("TEST1", "M1()").WithArguments("Public Sub M1()").WithLocation(5, 9)) diag = diags.Single() - Assert.Equal("", diag.Descriptor.HelpLinkUri) + Assert.Equal("https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC40008)", diag.Descriptor.HelpLinkUri) End Sub @@ -1905,7 +1905,7 @@ End Class diags.Verify(Diagnostic("TEST1", "M1()").WithArguments("Public Sub M1()").WithLocation(5, 9)) Dim diag = diags.Single() - Assert.Equal("", diag.Descriptor.HelpLinkUri) + Assert.Equal("https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC40008)", diag.Descriptor.HelpLinkUri) comp2 = CreateCompilationWithMscorlib40(source2, references:={comp1.EmitToImageReference()}) @@ -1913,7 +1913,7 @@ End Class diags.Verify(Diagnostic("TEST1", "M1()").WithArguments("Public Sub M1()").WithLocation(5, 9)) diag = diags.Single() - Assert.Equal("", diag.Descriptor.HelpLinkUri) + Assert.Equal("https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC40008)", diag.Descriptor.HelpLinkUri) End Sub @@ -1969,7 +1969,7 @@ End Class diags.Verify(Diagnostic(ERRID.WRN_UseOfObsoleteSymbolNoMessage1, "M1()").WithArguments("Public Sub M1()").WithLocation(5, 9)) Dim diag = diags.Single() - Assert.Equal("", diag.Descriptor.HelpLinkUri) + Assert.Equal("https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC40008)", diag.Descriptor.HelpLinkUri) comp2 = CreateCompilationWithMscorlib40(source2, references:={comp1.EmitToImageReference()}) @@ -1977,7 +1977,7 @@ End Class diags.Verify(Diagnostic(ERRID.WRN_UseOfObsoleteSymbolNoMessage1, "M1()").WithArguments("Public Sub M1()").WithLocation(5, 9)) diag = diags.Single() - Assert.Equal("", diag.Descriptor.HelpLinkUri) + Assert.Equal("https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC40008)", diag.Descriptor.HelpLinkUri) End Sub @@ -2033,7 +2033,7 @@ End Class diags.Verify(Diagnostic(ERRID.WRN_UseOfObsoleteSymbolNoMessage1, "M1()").WithArguments("Public Sub M1()").WithLocation(5, 9)) Dim diag = diags.Single() - Assert.Equal("", diag.Descriptor.HelpLinkUri) + Assert.Equal("https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC40008)", diag.Descriptor.HelpLinkUri) comp2 = CreateCompilationWithMscorlib40(source2, references:={comp1.EmitToImageReference()}) @@ -2041,7 +2041,7 @@ End Class diags.Verify(Diagnostic(ERRID.WRN_UseOfObsoleteSymbolNoMessage1, "M1()").WithArguments("Public Sub M1()").WithLocation(5, 9)) diag = diags.Single() - Assert.Equal("", diag.Descriptor.HelpLinkUri) + Assert.Equal("https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC40008)", diag.Descriptor.HelpLinkUri) End Sub @@ -2325,7 +2325,7 @@ End Class diags.Verify(Diagnostic("A", "M1()").WithArguments("Public Overloads Sub M1()").WithLocation(5, 9)) Dim diag = diags.Single() - Assert.Equal("", diag.Descriptor.HelpLinkUri) + Assert.Equal("https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC40008)", diag.Descriptor.HelpLinkUri) End Sub @@ -2381,7 +2381,7 @@ End Class diags.Verify(Diagnostic(ERRID.WRN_UseOfObsoleteSymbolNoMessage1, "M1()").WithArguments("Public Sub M1()").WithLocation(5, 9)) Dim diag = diags.Single() - Assert.Equal("", diag.Descriptor.HelpLinkUri) + Assert.Equal("https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC40008)", diag.Descriptor.HelpLinkUri) comp2 = CreateCompilationWithMscorlib40(source2, references:={comp1.EmitToImageReference()}) @@ -2389,7 +2389,7 @@ End Class diags.Verify(Diagnostic(ERRID.WRN_UseOfObsoleteSymbolNoMessage1, "M1()").WithArguments("Public Sub M1()").WithLocation(5, 9)) diag = diags.Single() - Assert.Equal("", diag.Descriptor.HelpLinkUri) + Assert.Equal("https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC40008)", diag.Descriptor.HelpLinkUri) End Sub diff --git a/src/EditorFeatures/CSharpTest/Squiggles/ErrorSquiggleProducerTests.cs b/src/EditorFeatures/CSharpTest/Squiggles/ErrorSquiggleProducerTests.cs index ae87302964722..07789b1c515e9 100644 --- a/src/EditorFeatures/CSharpTest/Squiggles/ErrorSquiggleProducerTests.cs +++ b/src/EditorFeatures/CSharpTest/Squiggles/ErrorSquiggleProducerTests.cs @@ -215,7 +215,7 @@ public async Task SemanticErrorReported() var expectedToolTip = new ContainerElement( ContainerElementStyle.Wrapped, new ClassifiedTextElement( - new ClassifiedTextRun(ClassificationTypeNames.Text, "CS0246"), + new ClassifiedTextRun(ClassificationTypeNames.Text, "CS0246", QuickInfoHyperLink.TestAccessor.CreateNavigationAction(new Uri("https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS0246)", UriKind.Absolute)), "https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(CS0246)"), new ClassifiedTextRun(ClassificationTypeNames.Punctuation, ":"), new ClassifiedTextRun(ClassificationTypeNames.WhiteSpace, " "), new ClassifiedTextRun(ClassificationTypeNames.Text, firstDiagnostic.Message))); diff --git a/src/EditorFeatures/VisualBasicTest/Squiggles/ErrorSquiggleProducerTests.vb b/src/EditorFeatures/VisualBasicTest/Squiggles/ErrorSquiggleProducerTests.vb index 1bfbb815530c1..77b7a4f1604f5 100644 --- a/src/EditorFeatures/VisualBasicTest/Squiggles/ErrorSquiggleProducerTests.vb +++ b/src/EditorFeatures/VisualBasicTest/Squiggles/ErrorSquiggleProducerTests.vb @@ -8,6 +8,7 @@ Imports Microsoft.CodeAnalysis.Classification Imports Microsoft.CodeAnalysis.CodeStyle Imports Microsoft.CodeAnalysis.Diagnostics Imports Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics +Imports Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.QuickInfo Imports Microsoft.CodeAnalysis.Editor.UnitTests.Extensions Imports Microsoft.CodeAnalysis.Editor.UnitTests.Squiggles Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces @@ -78,7 +79,7 @@ End Class") Dim expectedToolTip = New ContainerElement( ContainerElementStyle.Wrapped, New ClassifiedTextElement( - New ClassifiedTextRun(ClassificationTypeNames.Text, "BC30002"), + New ClassifiedTextRun(ClassificationTypeNames.Text, "BC30002", QuickInfoHyperLink.TestAccessor.CreateNavigationAction(New Uri("https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC30002)", UriKind.Absolute)), "https://msdn.microsoft.com/query/roslyn.query?appId=roslyn&k=k(BC30002)"), New ClassifiedTextRun(ClassificationTypeNames.Punctuation, ":"), New ClassifiedTextRun(ClassificationTypeNames.WhiteSpace, " "), New ClassifiedTextRun(ClassificationTypeNames.Text, firstSpan.diagostic.Message))) From 59682c559a9f0ff94830056a98b28ff847f19f32 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Mon, 5 Oct 2020 15:27:10 -0700 Subject: [PATCH 148/295] Make sure GlobalHubClientPackage is loaded IServiceBroker requires the UI thread to initialize a ServiceHub service if it is not already loaded before GetProxyAsync is called. This change loads GlobalHubClientPackage as part of WaitUntilFullyLoadedAsync to ensure this condition is met. --- src/VisualStudio/Core/Def/Guids.cs | 5 +++ ...sualStudioWorkspaceStatusServiceFactory.cs | 39 +++++++++++++++++-- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/src/VisualStudio/Core/Def/Guids.cs b/src/VisualStudio/Core/Def/Guids.cs index d7d0e86d34efb..dde102011fe5b 100644 --- a/src/VisualStudio/Core/Def/Guids.cs +++ b/src/VisualStudio/Core/Def/Guids.cs @@ -133,5 +133,10 @@ internal static class Guids // Interactive guids public const string InteractiveCommandSetIdString = "00B8868B-F9F5-4970-A048-410B05508506"; public static readonly Guid InteractiveCommandSetId = new(InteractiveCommandSetIdString); + + /// + /// The package GUID for GlobalHubClientPackage, which proffers ServiceHub brokered services in Visual Studio. + /// + public static readonly Guid GlobalHubClientPackageGuid = new("11AD60FC-6D87-4674-8F88-9ABE79176CBE"); } } diff --git a/src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioWorkspaceStatusServiceFactory.cs b/src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioWorkspaceStatusServiceFactory.cs index 44b250daffbe8..608a38ccf340a 100644 --- a/src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioWorkspaceStatusServiceFactory.cs +++ b/src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioWorkspaceStatusServiceFactory.cs @@ -5,17 +5,19 @@ #nullable disable using System; -using System.ComponentModel; using System.Composition; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Experiments; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Internal.Log; using Microsoft.CodeAnalysis.Shared.TestHooks; +using Microsoft.ServiceHub.Framework; using Microsoft.VisualStudio.OperationProgress; using Microsoft.VisualStudio.Shell; +using Microsoft.VisualStudio.Shell.Interop; using Microsoft.VisualStudio.Threading; using Roslyn.Utilities; using Task = System.Threading.Tasks.Task; @@ -26,14 +28,16 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation internal class VisualStudioWorkspaceStatusServiceFactory : IWorkspaceServiceFactory { private readonly IAsyncServiceProvider2 _serviceProvider; + private readonly IThreadingContext _threadingContext; private readonly IAsynchronousOperationListener _listener; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public VisualStudioWorkspaceStatusServiceFactory( - SVsServiceProvider serviceProvider, IAsynchronousOperationListenerProvider listenerProvider) + SVsServiceProvider serviceProvider, IThreadingContext threadingContext, IAsynchronousOperationListenerProvider listenerProvider) { _serviceProvider = (IAsyncServiceProvider2)serviceProvider; + _threadingContext = threadingContext; // for now, we use workspace so existing tests can automatically wait for full solution load event // subscription done in test @@ -53,7 +57,7 @@ public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) } // only VSWorkspace supports partial load mode - return new Service(_serviceProvider, _listener); + return new Service(_serviceProvider, _threadingContext, _listener); } return new WorkspaceStatusService(); @@ -67,14 +71,23 @@ private class Service : IWorkspaceStatusService { private readonly SemaphoreSlim _initializationGate = new(initialCount: 1); private readonly IAsyncServiceProvider2 _serviceProvider; + private readonly IThreadingContext _threadingContext; private bool _initialized = false; + /// + /// A task indicating that the package has loaded. Calls to + /// may have a main thread dependency if the proffering package + /// is not loaded prior to the call. + /// + private JoinableTask _loadHubClientPackage; + public event EventHandler StatusChanged; - public Service(IAsyncServiceProvider2 serviceProvider, IAsynchronousOperationListener listener) + public Service(IAsyncServiceProvider2 serviceProvider, IThreadingContext threadingContext, IAsynchronousOperationListener listener) { _serviceProvider = serviceProvider; + _threadingContext = threadingContext; // pre-emptively make sure event is subscribed. if APIs are called before it is done, calls will be blocked // until event subscription is done @@ -85,6 +98,9 @@ public Service(IAsyncServiceProvider2 serviceProvider, IAsynchronousOperationLis // unfortunately, IVsOperationProgressStatusService requires UI thread to let project system to proceed to next stages. // this method should only be used with either await or JTF.Run, it should be never used with Task.Wait otherwise, it can // deadlock + // + // This method also ensures the GlobalHubClientPackage package is loaded, since brokered services in Visual + // Studio require this package to provide proxy interfaces for invoking out-of-process services. public async Task WaitUntilFullyLoadedAsync(CancellationToken cancellationToken) { using (Logger.LogBlock(FunctionId.PartialLoad_FullyLoaded, KeyValueLogMessage.NoProperty, cancellationToken)) @@ -103,6 +119,8 @@ public async Task WaitUntilFullyLoadedAsync(CancellationToken cancellationToken) // TODO: WaitForCompletionAsync should accept cancellation directly. // for now, use WithCancellation to indirectly add cancellation await completionTask.WithCancellation(cancellationToken).ConfigureAwait(false); + + await _loadHubClientPackage.JoinAsync(cancellationToken).ConfigureAwait(false); } } @@ -141,6 +159,19 @@ private async Task EnsureInitializationAsync(CancellationToken cancellationToken _initialized = true; + _loadHubClientPackage = _threadingContext.JoinableTaskFactory.RunAsync(async () => + { + // Use the disposal token, since the caller's cancellation token will apply instead to the + // JoinAsync operation. + await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(_threadingContext.DisposalToken); + + // Make sure the HubClient package is loaded, since we rely on it for proffered OOP services + var shell = await _serviceProvider.GetServiceAsync().ConfigureAwait(true); + Assumes.Present(shell); + + await shell.LoadPackageAsync(Guids.GlobalHubClientPackageGuid); + }); + // with IAsyncServiceProvider, to get a service from BG, there is not much else // we can do to avoid this pattern to subscribe to events var status = await GetProgressStageStatusAsync(cancellationToken).ConfigureAwait(false); From e89f5c2c8be4fae0bca59be8d71d6c3fa895f121 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 6 Oct 2020 08:30:26 -0700 Subject: [PATCH 149/295] Add options for different kinds of arguments --- ...ineParameterNameHintsDataTaggerProvider.cs | 5 +- .../CSharpInlineParameterNameHintsService.cs | 58 +++++------------- ...AbstractInlineParameterNameHintsService.cs | 35 ++++++++++- .../IInlineParameterNameHintsService.cs | 13 ---- .../InlineHints/InlineHintsOptions.cs | 23 ++++++- .../InlineHints/InlineParameterHint.cs | 24 ++++++++ .../InlineHints/InlineParameterHintKind.cs | 16 +++++ ...ualBasicInlineParameterNameHintsService.vb | 60 ++++++------------- .../Options/AdvancedOptionPageControl.xaml.vb | 1 - 9 files changed, 132 insertions(+), 103 deletions(-) create mode 100644 src/Features/Core/Portable/InlineHints/InlineParameterHint.cs create mode 100644 src/Features/Core/Portable/InlineHints/InlineParameterHintKind.cs diff --git a/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs b/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs index 8014c868120f8..7a31ff3030bad 100644 --- a/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs +++ b/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs @@ -53,7 +53,10 @@ protected override ITaggerEventSource CreateEventSource(ITextView textViewOpt, I // TaggerDelay is NearImmediate because we want the renaming and tag creation to be instantaneous return TaggerEventSources.Compose( TaggerEventSources.OnViewSpanChanged(ThreadingContext, textViewOpt, textChangeDelay: TaggerDelay.Short, scrollChangeDelay: TaggerDelay.NearImmediate), - TaggerEventSources.OnWorkspaceChanged(subjectBuffer, TaggerDelay.NearImmediate, _listener)); + TaggerEventSources.OnWorkspaceChanged(subjectBuffer, TaggerDelay.NearImmediate, _listener), + TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.ForLiteralParameters, TaggerDelay.NearImmediate), + TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.ForObjectCreationParameters, TaggerDelay.NearImmediate), + TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.ForOtherParameters, TaggerDelay.NearImmediate)); } protected override IEnumerable GetSpansToTag(ITextView textView, ITextBuffer subjectBuffer) diff --git a/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs b/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs index d8abbe6ead549..9df4363feac1b 100644 --- a/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs +++ b/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs @@ -37,63 +37,33 @@ protected override void AddAllParameterNameHintLocations( if (node is ArgumentSyntax argument) { - if (argument.NameColon == null && IsExpressionWithNoName(argument.Expression)) + if (argument.NameColon == null) { var param = argument.DetermineParameter(semanticModel, cancellationToken: cancellationToken); - if (param != null && param.Name != "") - result.Add(new InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, argument.Span.Start)); + if (!string.IsNullOrEmpty(param?.Name)) + result.Add(new InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, argument.Span.Start, GetKind(argument.Expression))); } } else if (node is AttributeArgumentSyntax attribute) { - if (attribute.NameEquals == null && attribute.NameColon == null && IsExpressionWithNoName(attribute.Expression)) + if (attribute.NameEquals == null && attribute.NameColon == null) { var param = attribute.DetermineParameter(semanticModel, cancellationToken: cancellationToken); - if (param != null && param.Name != "") - result.Add(new InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, attribute.SpanStart)); + if (!string.IsNullOrEmpty(param?.Name)) + result.Add(new InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, attribute.SpanStart, GetKind(attribute.Expression))); } } } } - /// - /// Determines if the argument is of a type that should have an adornment appended - /// - /// The argument that is being looked at - /// true when the adornment should be added - private static bool IsExpressionWithNoName(ExpressionSyntax arg) - { - if (arg is LiteralExpressionSyntax) - { - // We want to adorn literals no matter what - return true; - } - if (arg is InterpolatedStringExpressionSyntax) - { - // We want to adorn all types of strings - return true; - } - if (arg is ObjectCreationExpressionSyntax) - { - // We want to adorn object invocations that exist as arguments because they are not declared anywhere - // else in the file - // Example: testMethod(^new Object()); should show the adornment at the caret - return true; - } - if (arg is CastExpressionSyntax cast) - { - // Recurse until we find a literal - // If so, then we should add the adornment - return IsExpressionWithNoName(cast.Expression); - } - if (arg is PrefixUnaryExpressionSyntax negation) + private static InlineParameterHintKind GetKind(ExpressionSyntax arg) + => arg switch { - // Recurse until we find a literal - // If so, then we should add the adornment - return IsExpressionWithNoName(negation.Operand); - } - - return false; - } + LiteralExpressionSyntax or InterpolatedStringExpressionSyntax => InlineParameterHintKind.Literal, + ObjectCreationExpressionSyntax => InlineParameterHintKind.ObjectCreation, + CastExpressionSyntax cast => GetKind(cast.Expression), + PrefixUnaryExpressionSyntax prefix => GetKind(prefix.Operand), + _ => InlineParameterHintKind.Other, + }; } } diff --git a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs index 37579cdc27836..51da63df1164d 100644 --- a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs @@ -11,6 +11,7 @@ using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; +using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.InlineHints { @@ -18,16 +19,46 @@ internal abstract class AbstractInlineParameterNameHintsService : IInlineParamet { public async Task> GetInlineParameterNameHintsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken) { + var options = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); + + var forParameters = options.GetOption(InlineHintsOptions.EnabledForParameters); + if (!forParameters) + return ImmutableArray.Empty; + + var literalParameters = options.GetOption(InlineHintsOptions.ForLiteralParameters); + var objectCreationParameters = options.GetOption(InlineHintsOptions.ForObjectCreationParameters); + var otherParameters = options.GetOption(InlineHintsOptions.ForOtherParameters); + if (!literalParameters && !objectCreationParameters && !otherParameters) + return ImmutableArray.Empty; + var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); var nodes = root.DescendantNodes(textSpan); - using var _ = ArrayBuilder.GetInstance(out var result); - AddAllParameterNameHintLocations(semanticModel, nodes, result, cancellationToken); + using var _1 = ArrayBuilder.GetInstance(out var buffer); + AddAllParameterNameHintLocations(semanticModel, nodes, buffer, cancellationToken); + + using var _2 = ArrayBuilder.GetInstance(out var result); + + foreach (var hint in buffer) + { + if (HintMatches(hint, literalParameters, objectCreationParameters, otherParameters)) + result.Add(hint); + } + return result.ToImmutable(); } + private static bool HintMatches(InlineParameterHint hint, bool literalParameters, bool objectCreationParameters, bool otherParameters) + => hint.Kind switch + { + InlineParameterHintKind.Literal => literalParameters, + InlineParameterHintKind.ObjectCreation => objectCreationParameters, + InlineParameterHintKind.Other => otherParameters, + _ => throw ExceptionUtilities.UnexpectedValue(hint.Kind), + }; + protected abstract void AddAllParameterNameHintLocations( SemanticModel semanticModel, IEnumerable nodes, ArrayBuilder result, CancellationToken cancellationToken); } diff --git a/src/Features/Core/Portable/InlineHints/IInlineParameterNameHintsService.cs b/src/Features/Core/Portable/InlineHints/IInlineParameterNameHintsService.cs index 9e9a9225aa07b..4a5cbd5688f58 100644 --- a/src/Features/Core/Portable/InlineHints/IInlineParameterNameHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/IInlineParameterNameHintsService.cs @@ -14,19 +14,6 @@ namespace Microsoft.CodeAnalysis.InlineHints { - internal readonly struct InlineParameterHint - { - public readonly SymbolKey ParameterSymbolKey; - public readonly string Name; - public readonly int Position; - - public InlineParameterHint(SymbolKey parameterSymbolKey, string name, int position) - { - ParameterSymbolKey = parameterSymbolKey; - Name = name; - Position = position; - } - } internal interface IInlineParameterNameHintsService : ILanguageService { diff --git a/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs b/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs index 262b4c53147b2..5e668ea39270c 100644 --- a/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs +++ b/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs @@ -20,6 +20,24 @@ internal static class InlineHintsOptions nameof(EnabledForParameters), defaultValue: false, storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.InlineParameterNameHints.EnabledForParameters")); + + public static readonly PerLanguageOption2 ForLiteralParameters = + new(nameof(InlineHintsOptions), + nameof(ForLiteralParameters), + defaultValue: true, + storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.InlineParameterNameHints.ForLiteralParameters")); + + public static readonly PerLanguageOption2 ForObjectCreationParameters = + new(nameof(InlineHintsOptions), + nameof(ForObjectCreationParameters), + defaultValue: true, + storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.InlineParameterNameHints.ForObjectCreationParameters")); + + public static readonly PerLanguageOption2 ForOtherParameters = + new(nameof(InlineHintsOptions), + nameof(ForOtherParameters), + defaultValue: false, + storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.InlineParameterNameHints.ForOtherParameters")); } [ExportOptionProvider, Shared] @@ -32,6 +50,9 @@ public InlineHintsOptionsProvider() } public ImmutableArray Options { get; } = ImmutableArray.Create( - InlineHintsOptions.EnabledForParameters); + InlineHintsOptions.EnabledForParameters, + InlineHintsOptions.ForLiteralParameters, + InlineHintsOptions.ForObjectCreationParameters, + InlineHintsOptions.ForOtherParameters); } } diff --git a/src/Features/Core/Portable/InlineHints/InlineParameterHint.cs b/src/Features/Core/Portable/InlineHints/InlineParameterHint.cs new file mode 100644 index 0000000000000..877d56c1487a9 --- /dev/null +++ b/src/Features/Core/Portable/InlineHints/InlineParameterHint.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#nullable disable + +namespace Microsoft.CodeAnalysis.InlineHints +{ + internal readonly struct InlineParameterHint + { + public readonly SymbolKey ParameterSymbolKey; + public readonly string Name; + public readonly int Position; + public readonly InlineParameterHintKind Kind; + + public InlineParameterHint(SymbolKey parameterSymbolKey, string name, int position, InlineParameterHintKind kind) + { + ParameterSymbolKey = parameterSymbolKey; + Name = name; + Position = position; + Kind = kind; + } + } +} diff --git a/src/Features/Core/Portable/InlineHints/InlineParameterHintKind.cs b/src/Features/Core/Portable/InlineHints/InlineParameterHintKind.cs new file mode 100644 index 0000000000000..95543505831e2 --- /dev/null +++ b/src/Features/Core/Portable/InlineHints/InlineParameterHintKind.cs @@ -0,0 +1,16 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#nullable disable + + +namespace Microsoft.CodeAnalysis.InlineHints +{ + internal enum InlineParameterHintKind + { + Literal, + ObjectCreation, + Other + } +} diff --git a/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb b/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb index 1cd420d094cf9..40dafc7e2597f 100644 --- a/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb +++ b/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb @@ -28,71 +28,49 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.InlineParameterNameHints For Each node In nodes cancellationToken.ThrowIfCancellationRequested() Dim simpleArgument = TryCast(node, SimpleArgumentSyntax) - If simpleArgument IsNot Nothing Then - If Not simpleArgument.IsNamed AndAlso simpleArgument.NameColonEquals Is Nothing AndAlso IsExpressionWithNoName(simpleArgument.Expression) Then + If simpleArgument?.Expression IsNot Nothing Then + If Not simpleArgument.IsNamed AndAlso simpleArgument.NameColonEquals Is Nothing Then Dim param = simpleArgument.DetermineParameter(semanticModel, allowParamArray:=False, cancellationToken) - If param IsNot Nothing AndAlso param.Name.Length > 0 Then - result.Add(New InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, simpleArgument.Span.Start)) + If Not String.IsNullOrEmpty(param?.Name) Then + result.Add(New InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, simpleArgument.Span.Start, GetKind(simpleArgument.Expression))) End If End If End If Next End Sub - Private Function IsExpressionWithNoName(arg As ExpressionSyntax) As Boolean - If TypeOf arg Is LiteralExpressionSyntax Then - ' We want to adorn literals no matter what - Return True - End If - - If TypeOf arg Is InterpolatedStringExpressionSyntax Then - ' We want to adorn all types of strings - Return True + Private Function GetKind(arg As ExpressionSyntax) As InlineParameterHintKind + If TypeOf arg Is LiteralExpressionSyntax OrElse + TypeOf arg Is InterpolatedStringExpressionSyntax Then + Return InlineParameterHintKind.Literal End If If TypeOf arg Is ObjectCreationExpressionSyntax Then - ' We want to adorn object invocations that exist as arguments because they are Not declared anywhere - ' else in the file - ' Example: testMethod(^ New Object()); should show the adornment at the caret - Return True - End If - - If TypeOf arg Is PredefinedCastExpressionSyntax Then - Dim cast = DirectCast(arg, PredefinedCastExpressionSyntax) - ' Recurse until we find a literal - ' If so, then we should add the adornment - Return IsExpressionWithNoName(cast.Expression) - End If - - If TypeOf arg Is TryCastExpressionSyntax Then - Dim cast = DirectCast(arg, TryCastExpressionSyntax) - ' Recurse until we find a literal - ' If so, then we should add the adornment - Return IsExpressionWithNoName(cast.Expression) + Return InlineParameterHintKind.ObjectCreation End If - If TypeOf arg Is CTypeExpressionSyntax Then - Dim cast = DirectCast(arg, CTypeExpressionSyntax) + Dim predefinedCast = TryCast(arg, PredefinedCastExpressionSyntax) + If predefinedCast IsNot Nothing Then ' Recurse until we find a literal ' If so, then we should add the adornment - Return IsExpressionWithNoName(cast.Expression) + Return GetKind(predefinedCast.Expression) End If - If TypeOf arg Is DirectCastExpressionSyntax Then - Dim cast = DirectCast(arg, DirectCastExpressionSyntax) + Dim cast = TryCast(arg, CastExpressionSyntax) + If cast IsNot Nothing Then ' Recurse until we find a literal ' If so, then we should add the adornment - Return IsExpressionWithNoName(cast.Expression) + Return GetKind(cast.Expression) End If - If TypeOf arg Is UnaryExpressionSyntax Then - Dim negation = DirectCast(arg, UnaryExpressionSyntax) + Dim unary = TryCast(arg, UnaryExpressionSyntax) + If unary IsNot Nothing Then ' Recurse until we find a literal ' If so, then we should add the adornment - Return IsExpressionWithNoName(negation.Operand) + Return GetKind(unary.Operand) End If - Return False + Return InlineParameterHintKind.Other End Function End Class End Namespace diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb index f0a26ef5c4245..551d619e79a58 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb @@ -13,7 +13,6 @@ Imports Microsoft.CodeAnalysis.ExtractMethod Imports Microsoft.CodeAnalysis.Fading Imports Microsoft.CodeAnalysis.ImplementType Imports Microsoft.CodeAnalysis.InlineHints -Imports Microsoft.CodeAnalysis.InlineParameterNameHints Imports Microsoft.CodeAnalysis.QuickInfo Imports Microsoft.CodeAnalysis.Remote Imports Microsoft.CodeAnalysis.SolutionCrawler From c5e011fa83ea4b568a80bb58643eccbfb0c49a3d Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Tue, 6 Oct 2020 17:16:21 +0000 Subject: [PATCH 150/295] Update IDE0044 to ignore ThreadStaticAttribute --- .../MakeFieldReadonlyTests.cs | 14 ++++++++++++++ .../MakeFieldReadonlyDiagnosticAnalyzer.cs | 18 +++++++++++------- .../Core/Extensions/ICompilationExtensions.cs | 3 +++ 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/Analyzers/CSharp/Tests/MakeFieldReadonly/MakeFieldReadonlyTests.cs b/src/Analyzers/CSharp/Tests/MakeFieldReadonly/MakeFieldReadonlyTests.cs index ffd4a8f8fcdf0..f9cba9c2c59c3 100644 --- a/src/Analyzers/CSharp/Tests/MakeFieldReadonly/MakeFieldReadonlyTests.cs +++ b/src/Analyzers/CSharp/Tests/MakeFieldReadonly/MakeFieldReadonlyTests.cs @@ -1730,6 +1730,20 @@ public bool M() ref var myVar = ref x; return myVar is null; } +}"); + } + + [WorkItem(42760, "https://github.com/dotnet/roslyn/issues/42760")] + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsMakeFieldReadonly)] + public async Task WithThreadStaticAttribute_NoDiagnostic() + { + await TestMissingInRegularAndScriptAsync( +@"using System; + +class Program +{ + [ThreadStatic] + private static object t_obj; }"); } } diff --git a/src/Analyzers/Core/Analyzers/MakeFieldReadonly/MakeFieldReadonlyDiagnosticAnalyzer.cs b/src/Analyzers/Core/Analyzers/MakeFieldReadonly/MakeFieldReadonlyDiagnosticAnalyzer.cs index 0841390b0e69c..6af0c17aff124 100644 --- a/src/Analyzers/Core/Analyzers/MakeFieldReadonly/MakeFieldReadonlyDiagnosticAnalyzer.cs +++ b/src/Analyzers/Core/Analyzers/MakeFieldReadonly/MakeFieldReadonlyDiagnosticAnalyzer.cs @@ -6,6 +6,7 @@ using System.Collections.Concurrent; using System.Diagnostics; +using System.Linq; using System.Threading; using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.Diagnostics; @@ -38,6 +39,8 @@ protected override void InitializeWorker(AnalysisContext context) // 'written' : Indicates if there are any writes to the field outside the constructor and field initializer. var fieldStateMap = new ConcurrentDictionary(); + var threadStaticAttribute = compilationStartContext.Compilation.ThreadStaticAttributeType(); + // We register following actions in the compilation: // 1. A symbol action for field symbols to ensure the field state is initialized for every field in // the compilation. @@ -104,19 +107,20 @@ void OnSymbolEnd(SymbolAnalysisContext symbolEndContext) } } - static bool IsCandidateField(IFieldSymbol symbol) => + static bool IsCandidateField(IFieldSymbol symbol, INamedTypeSymbol threadStaticAttribute) => symbol.DeclaredAccessibility == Accessibility.Private && !symbol.IsReadOnly && !symbol.IsConst && !symbol.IsImplicitlyDeclared && symbol.Locations.Length == 1 && symbol.Type.IsMutableValueType() == false && - !symbol.IsFixedSizeBuffer; + !symbol.IsFixedSizeBuffer && + !symbol.GetAttributes().Any(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, threadStaticAttribute)); // Method to update the field state for a candidate field written outside constructor and field initializer. void UpdateFieldStateOnWrite(IFieldSymbol field) { - Debug.Assert(IsCandidateField(field)); + Debug.Assert(IsCandidateField(field, threadStaticAttribute)); Debug.Assert(fieldStateMap.ContainsKey(field)); fieldStateMap[field] = (isCandidate: true, written: true); @@ -125,7 +129,7 @@ void UpdateFieldStateOnWrite(IFieldSymbol field) // Method to get or initialize the field state. (bool isCandidate, bool written) TryGetOrInitializeFieldState(IFieldSymbol fieldSymbol, AnalyzerOptions options, CancellationToken cancellationToken) { - if (!IsCandidateField(fieldSymbol)) + if (!IsCandidateField(fieldSymbol, threadStaticAttribute)) { return default; } @@ -135,14 +139,14 @@ void UpdateFieldStateOnWrite(IFieldSymbol field) return result; } - result = ComputeInitialFieldState(fieldSymbol, options, cancellationToken); + result = ComputeInitialFieldState(fieldSymbol, options, threadStaticAttribute, cancellationToken); return fieldStateMap.GetOrAdd(fieldSymbol, result); } // Method to compute the initial field state. - static (bool isCandidate, bool written) ComputeInitialFieldState(IFieldSymbol field, AnalyzerOptions options, CancellationToken cancellationToken) + static (bool isCandidate, bool written) ComputeInitialFieldState(IFieldSymbol field, AnalyzerOptions options, INamedTypeSymbol threadStaticAttribute, CancellationToken cancellationToken) { - Debug.Assert(IsCandidateField(field)); + Debug.Assert(IsCandidateField(field, threadStaticAttribute)); var option = GetCodeStyleOption(field, options, cancellationToken); if (option == null || !option.Value) diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ICompilationExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ICompilationExtensions.cs index 6c4bcec67604e..4de3db5e271a4 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ICompilationExtensions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ICompilationExtensions.cs @@ -83,6 +83,9 @@ public static ImmutableArray GetReferencedAssemblySymbols(this public static INamedTypeSymbol? HideModuleNameAttribute(this Compilation compilation) => compilation.GetTypeByMetadataName("Microsoft.VisualBasic.HideModuleNameAttribute"); + public static INamedTypeSymbol? ThreadStaticAttributeType(this Compilation compilation) + => compilation.GetTypeByMetadataName(typeof(ThreadStaticAttribute).FullName!); + public static INamedTypeSymbol? EventArgsType(this Compilation compilation) => compilation.GetTypeByMetadataName(typeof(EventArgs).FullName!); From 88302e51f1b9116d762a1e89d94d7a3045488cb9 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 6 Oct 2020 10:32:59 -0700 Subject: [PATCH 151/295] Add options in tools|options --- .../Core/Def/ServicesVSResources.resx | 6 ++++++ .../Core/Def/xlf/ServicesVSResources.cs.xlf | 10 +++++++++ .../Core/Def/xlf/ServicesVSResources.de.xlf | 10 +++++++++ .../Core/Def/xlf/ServicesVSResources.es.xlf | 10 +++++++++ .../Core/Def/xlf/ServicesVSResources.fr.xlf | 10 +++++++++ .../Core/Def/xlf/ServicesVSResources.it.xlf | 10 +++++++++ .../Core/Def/xlf/ServicesVSResources.ja.xlf | 10 +++++++++ .../Core/Def/xlf/ServicesVSResources.ko.xlf | 10 +++++++++ .../Core/Def/xlf/ServicesVSResources.pl.xlf | 10 +++++++++ .../Def/xlf/ServicesVSResources.pt-BR.xlf | 10 +++++++++ .../Core/Def/xlf/ServicesVSResources.ru.xlf | 10 +++++++++ .../Core/Def/xlf/ServicesVSResources.tr.xlf | 10 +++++++++ .../Def/xlf/ServicesVSResources.zh-Hans.xlf | 10 +++++++++ .../Def/xlf/ServicesVSResources.zh-Hant.xlf | 10 +++++++++ .../VisualBasic/Impl/BasicVSResources.resx | 3 +++ .../Options/AdvancedOptionPageControl.xaml | 15 ++++++++++++- .../Options/AdvancedOptionPageControl.xaml.vb | 21 +++++++++++++++++++ .../Impl/Options/AdvancedOptionPageStrings.vb | 9 ++++++++ .../Impl/xlf/BasicVSResources.cs.xlf | 5 +++++ .../Impl/xlf/BasicVSResources.de.xlf | 5 +++++ .../Impl/xlf/BasicVSResources.es.xlf | 5 +++++ .../Impl/xlf/BasicVSResources.fr.xlf | 5 +++++ .../Impl/xlf/BasicVSResources.it.xlf | 5 +++++ .../Impl/xlf/BasicVSResources.ja.xlf | 5 +++++ .../Impl/xlf/BasicVSResources.ko.xlf | 5 +++++ .../Impl/xlf/BasicVSResources.pl.xlf | 5 +++++ .../Impl/xlf/BasicVSResources.pt-BR.xlf | 5 +++++ .../Impl/xlf/BasicVSResources.ru.xlf | 5 +++++ .../Impl/xlf/BasicVSResources.tr.xlf | 5 +++++ .../Impl/xlf/BasicVSResources.zh-Hans.xlf | 5 +++++ .../Impl/xlf/BasicVSResources.zh-Hant.xlf | 5 +++++ 31 files changed, 248 insertions(+), 1 deletion(-) diff --git a/src/VisualStudio/Core/Def/ServicesVSResources.resx b/src/VisualStudio/Core/Def/ServicesVSResources.resx index 0c099936f7459..30a9c6464a4bf 100644 --- a/src/VisualStudio/Core/Def/ServicesVSResources.resx +++ b/src/VisualStudio/Core/Def/ServicesVSResources.resx @@ -1560,4 +1560,10 @@ I agree to all of the foregoing: Inline Hints (experimental) + + Show hints for everything else + + + Show hints for literals + \ No newline at end of file diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf index bf7a1633fa9ca..b758f55e35498 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf @@ -777,6 +777,16 @@ Zobrazit seznam pro doplňování + + Show hints for everything else + Show hints for everything else + + + + Show hints for literals + Show hints for literals + + Some color scheme colors are being overridden by changes made in the Environment > Fonts and Colors options page. Choose `Use Defaults` in the Fonts and Colors page to revert all customizations. Některé barvy barevného schématu se přepsaly změnami na stránce možností Prostředí > Písma a barvy. Pokud chcete zrušit všechna přizpůsobení, vyberte na stránce Písma a barvy možnost Použít výchozí. diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf index abf2fe48f7948..36e9a2245f243 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf @@ -777,6 +777,16 @@ Vervollständigungsliste anzeigen + + Show hints for everything else + Show hints for everything else + + + + Show hints for literals + Show hints for literals + + Some color scheme colors are being overridden by changes made in the Environment > Fonts and Colors options page. Choose `Use Defaults` in the Fonts and Colors page to revert all customizations. Einige Farbschemafarben werden durch Änderungen überschrieben, die auf der Optionsseite "Umgebung" > "Schriftarten und Farben" vorgenommen wurden. Wählen Sie auf der Seite "Schriftarten und Farben" die Option "Standardwerte verwenden" aus, um alle Anpassungen rückgängig zu machen. diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf index d190a33d0d23b..42ccccc4ddddf 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf @@ -777,6 +777,16 @@ Mostrar lista de finalización + + Show hints for everything else + Show hints for everything else + + + + Show hints for literals + Show hints for literals + + Some color scheme colors are being overridden by changes made in the Environment > Fonts and Colors options page. Choose `Use Defaults` in the Fonts and Colors page to revert all customizations. Algunos de los colores de la combinación se reemplazan por los cambios realizados en la página de opciones de Entorno > Fuentes y colores. Elija "Usar valores predeterminados" en la página Fuentes y colores para revertir todas las personalizaciones. diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf index a82d364e74ab6..4debe1a56b7d8 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf @@ -777,6 +777,16 @@ Afficher la liste de saisie semi-automatique + + Show hints for everything else + Show hints for everything else + + + + Show hints for literals + Show hints for literals + + Some color scheme colors are being overridden by changes made in the Environment > Fonts and Colors options page. Choose `Use Defaults` in the Fonts and Colors page to revert all customizations. Certaines couleurs du modèle de couleurs sont substituées à la suite des changements apportés dans la page d'options Environnement > Polices et couleurs. Choisissez Utiliser les valeurs par défaut dans la page Polices et couleurs pour restaurer toutes les personnalisations. diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf index 40fcbfc5aab56..77af5d3facece 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf @@ -777,6 +777,16 @@ Mostra l'elenco di completamento + + Show hints for everything else + Show hints for everything else + + + + Show hints for literals + Show hints for literals + + Some color scheme colors are being overridden by changes made in the Environment > Fonts and Colors options page. Choose `Use Defaults` in the Fonts and Colors page to revert all customizations. Alcuni colori della combinazione colori sono sostituiti dalle modifiche apportate nella pagina di opzioni Ambiente > Tipi di carattere e colori. Scegliere `Usa impostazioni predefinite` nella pagina Tipi di carattere e colori per ripristinare tutte le personalizzazioni. diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf index 9ce8ef7fcf7da..793a2af34717e 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf @@ -777,6 +777,16 @@ 入力候補一覧の表示 + + Show hints for everything else + Show hints for everything else + + + + Show hints for literals + Show hints for literals + + Some color scheme colors are being overridden by changes made in the Environment > Fonts and Colors options page. Choose `Use Defaults` in the Fonts and Colors page to revert all customizations. 一部の配色パターンの色は、[環境] > [フォントおよび色] オプション ページで行われた変更によって上書きされます。[フォントおよび色] オプション ページで [既定値を使用] を選択すると、すべてのカスタマイズが元に戻ります。 diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf index 205bfc414792d..c25aa3c113757 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf @@ -777,6 +777,16 @@ 완성 목록 표시 + + Show hints for everything else + Show hints for everything else + + + + Show hints for literals + Show hints for literals + + Some color scheme colors are being overridden by changes made in the Environment > Fonts and Colors options page. Choose `Use Defaults` in the Fonts and Colors page to revert all customizations. 색 구성표의 일부 색이 [환경] > [글꼴 및 색] 옵션 페이지에서 변경한 내용에 따라 재정의됩니다. 모든 사용자 지정을 되돌리려면 [글꼴 및 색] 페이지에서 '기본값 사용'을 선택하세요. diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf index d33b11b81838b..f58fb1b99a580 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf @@ -777,6 +777,16 @@ Pokaż listę uzupełniania + + Show hints for everything else + Show hints for everything else + + + + Show hints for literals + Show hints for literals + + Some color scheme colors are being overridden by changes made in the Environment > Fonts and Colors options page. Choose `Use Defaults` in the Fonts and Colors page to revert all customizations. Niektóre kolory w schemacie kolorów są przesłaniane przez zmiany wprowadzone na stronie opcji Środowisko > Czcionki i kolory. Wybierz pozycję „Użyj ustawień domyślnych” na stronie Czcionki i kolory, aby wycofać wszystkie dostosowania. diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf index 8e7f8a1203ec5..fd9134f158a09 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf @@ -777,6 +777,16 @@ Mostrar a lista de conclusão + + Show hints for everything else + Show hints for everything else + + + + Show hints for literals + Show hints for literals + + Some color scheme colors are being overridden by changes made in the Environment > Fonts and Colors options page. Choose `Use Defaults` in the Fonts and Colors page to revert all customizations. Algumas cores do esquema de cores estão sendo substituídas pelas alterações feitas na página de Ambiente > Opções de Fontes e Cores. Escolha 'Usar Padrões' na página Fontes e Cores para reverter todas as personalizações. diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf index 8f778c603ee33..640fbb205e3fe 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf @@ -777,6 +777,16 @@ Показать список завершения + + Show hints for everything else + Show hints for everything else + + + + Show hints for literals + Show hints for literals + + Some color scheme colors are being overridden by changes made in the Environment > Fonts and Colors options page. Choose `Use Defaults` in the Fonts and Colors page to revert all customizations. Некоторые цвета цветовой схемы переопределяются изменениями, сделанными на странице "Среда" > "Шрифты и цвета". Выберите "Использовать значения по умолчанию" на странице "Шрифты и цвета", чтобы отменить все настройки. diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf index ecf0a27571ee2..198314cfca7c3 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf @@ -777,6 +777,16 @@ Tamamlama listesini göster + + Show hints for everything else + Show hints for everything else + + + + Show hints for literals + Show hints for literals + + Some color scheme colors are being overridden by changes made in the Environment > Fonts and Colors options page. Choose `Use Defaults` in the Fonts and Colors page to revert all customizations. Bazı renk düzeni renkleri, Ortam > Yazı Tipleri ve Renkler seçenek sayfasında yapılan değişiklikler tarafından geçersiz kılınıyor. Tüm özelleştirmeleri geri döndürmek için Yazı Tipleri ve Renkler sayfasında `Varsayılanları Kullan` seçeneğini belirleyin. diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf index 521a31f8cd9b0..b5a33d82ba5d4 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf @@ -777,6 +777,16 @@ 显示完成列表 + + Show hints for everything else + Show hints for everything else + + + + Show hints for literals + Show hints for literals + + Some color scheme colors are being overridden by changes made in the Environment > Fonts and Colors options page. Choose `Use Defaults` in the Fonts and Colors page to revert all customizations. 在“环境”>“字体和颜色”选项页中所做的更改将替代某些配色方案颜色。在“字体和颜色”页中选择“使用默认值”,还原所有自定义项。 diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf index 739183975537a..310befb1996fe 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf @@ -777,6 +777,16 @@ 顯示自動完成清單 + + Show hints for everything else + Show hints for everything else + + + + Show hints for literals + Show hints for literals + + Some color scheme colors are being overridden by changes made in the Environment > Fonts and Colors options page. Choose `Use Defaults` in the Fonts and Colors page to revert all customizations. [環境] > [字型和色彩選項] 頁面中所做的變更覆寫了某些色彩配置的色彩。請選擇 [字型和色彩] 頁面中的 [使用預設] 來還原所有自訂。 diff --git a/src/VisualStudio/VisualBasic/Impl/BasicVSResources.resx b/src/VisualStudio/VisualBasic/Impl/BasicVSResources.resx index e2fb068f9e82a..68d56673db587 100644 --- a/src/VisualStudio/VisualBasic/Impl/BasicVSResources.resx +++ b/src/VisualStudio/VisualBasic/Impl/BasicVSResources.resx @@ -307,4 +307,7 @@ Insert ' at the start of new lines when writing ' comments + + Show hints for 'New' expressions + \ No newline at end of file diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml index 871211183d44b..658c84224b421 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml @@ -105,7 +105,20 @@ Header="{x:Static local:AdvancedOptionPageStrings.Option_Inline_Hints_experimental}"> + Content="{x:Static local:AdvancedOptionPageStrings.Option_Display_inline_parameter_name_hints}" + Checked="DisplayInlineParameterNameHints_Checked" + Unchecked="DisplayInlineParameterNameHints_Unchecked"/> + + + + + diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb index 551d619e79a58..ab76d488d7319 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb @@ -60,6 +60,10 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options BindToOption(InsertApostropheAtTheStartOfNewLinesWhenWritingApostropheComments, SplitCommentOptions.Enabled, LanguageNames.VisualBasic) BindToOption(DisplayInlineParameterNameHints, InlineHintsOptions.EnabledForParameters, LanguageNames.VisualBasic) + BindToOption(ShowHintsForLiterals, InlineHintsOptions.ForLiteralParameters, LanguageNames.VisualBasic) + BindToOption(ShowHintsForNewExpressions, InlineHintsOptions.ForObjectCreationParameters, LanguageNames.VisualBasic) + BindToOption(ShowHintsForEverythingElse, InlineHintsOptions.ForOtherParameters, LanguageNames.VisualBasic) + UpdateInlineHintsOptions() BindToOption(EnableEndConstruct, FeatureOnOffOptions.EndConstruct, LanguageNames.VisualBasic) BindToOption(EnableLineCommit, FeatureOnOffOptions.PrettyListing, LanguageNames.VisualBasic) @@ -101,5 +105,22 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options MyBase.OnLoad() End Sub + + Private Sub UpdateInlineHintsOptions() + Dim enabledForParameters = Me.OptionStore.GetOption(InlineHintsOptions.EnabledForParameters, LanguageNames.VisualBasic) <> False + ShowHintsForLiterals.IsEnabled = enabledForParameters + ShowHintsForNewExpressions.IsEnabled = enabledForParameters + ShowHintsForEverythingElse.IsEnabled = enabledForParameters + End Sub + + Private Sub DisplayInlineParameterNameHints_Checked() + Me.OptionStore.SetOption(InlineHintsOptions.EnabledForParameters, LanguageNames.VisualBasic, True) + UpdateInlineHintsOptions() + End Sub + + Private Sub DisplayInlineParameterNameHints_Unchecked() + Me.OptionStore.SetOption(InlineHintsOptions.EnabledForParameters, LanguageNames.VisualBasic, False) + UpdateInlineHintsOptions() + End Sub End Class End Namespace diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb index 19d60c7b9b201..89d261bb32428 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb @@ -39,6 +39,15 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options Public ReadOnly Property Option_Display_inline_parameter_name_hints As String = ServicesVSResources.Display_inline_parameter_name_hints + Public ReadOnly Property Option_Show_hints_for_literals As String = + ServicesVSResources.Show_hints_for_literals + + Public ReadOnly Property Option_Show_hints_for_New_expressions As String = + BasicVSResources.Show_hints_for_New_expressions + + Public ReadOnly Property Option_Show_hints_for_everything_else As String = + ServicesVSResources.Show_hints_for_everything_else + Public ReadOnly Property Option_DontPutOutOrRefOnStruct As String Get Return BasicVSResources.Don_t_put_ByRef_on_custom_structure diff --git a/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.cs.xlf b/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.cs.xlf index f8a43ddf615b8..039a498362c0c 100644 --- a/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.cs.xlf +++ b/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.cs.xlf @@ -47,6 +47,11 @@ U kontrol rovnosti odkazů dávat přednost možnosti Is Nothing + + Show hints for 'New' expressions + Show hints for 'New' expressions + + Show items from unimported namespaces (experimental) Zobrazit položky z neimportovaných oborů názvů (experimentální) diff --git a/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.de.xlf b/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.de.xlf index cd419f99dd00e..d2bd1e2ee7c5d 100644 --- a/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.de.xlf +++ b/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.de.xlf @@ -47,6 +47,11 @@ "Is Nothing" für Verweisübereinstimmungsprüfungen vorziehen + + Show hints for 'New' expressions + Show hints for 'New' expressions + + Show items from unimported namespaces (experimental) Elemente aus nicht importierten Namespaces anzeigen (experimentell) diff --git a/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.es.xlf b/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.es.xlf index 8977fcb3edf47..900daab7142e1 100644 --- a/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.es.xlf +++ b/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.es.xlf @@ -47,6 +47,11 @@ Preferir “Is Nothing” para comprobaciones de igualdad de referencias + + Show hints for 'New' expressions + Show hints for 'New' expressions + + Show items from unimported namespaces (experimental) Mostrar elementos de espacios de nombres no importados (experimental) diff --git a/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.fr.xlf b/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.fr.xlf index e9292ecf43bdd..833e35c65c960 100644 --- a/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.fr.xlf +++ b/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.fr.xlf @@ -47,6 +47,11 @@ Préférer 'Is Nothing' pour les vérifications d'égalité de référence + + Show hints for 'New' expressions + Show hints for 'New' expressions + + Show items from unimported namespaces (experimental) Afficher les éléments des espaces de noms qui ne sont pas importés (expérimental) diff --git a/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.it.xlf b/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.it.xlf index 63b8976047a8a..5409011ffb102 100644 --- a/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.it.xlf +++ b/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.it.xlf @@ -47,6 +47,11 @@ Preferisci 'Is Nothing' per i controlli di uguaglianza dei riferimenti + + Show hints for 'New' expressions + Show hints for 'New' expressions + + Show items from unimported namespaces (experimental) Mostra elementi da spazi dei nomi non importati (sperimentale) diff --git a/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.ja.xlf b/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.ja.xlf index cab47439790f4..deb6a6d0b6919 100644 --- a/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.ja.xlf +++ b/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.ja.xlf @@ -47,6 +47,11 @@ 参照の等値性のチェックには 'Is Nothing' を優先する + + Show hints for 'New' expressions + Show hints for 'New' expressions + + Show items from unimported namespaces (experimental) インポートされていない名前空間の項目を表示する (試験段階) diff --git a/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.ko.xlf b/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.ko.xlf index 00bfd709cee82..0a385fe2e4e3c 100644 --- a/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.ko.xlf +++ b/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.ko.xlf @@ -47,6 +47,11 @@ 참조 같음 검사에 대해 'Is Nothing' 선호 + + Show hints for 'New' expressions + Show hints for 'New' expressions + + Show items from unimported namespaces (experimental) 가져오지 않은 네임스페이스의 항목 표시(실험적) diff --git a/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.pl.xlf b/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.pl.xlf index cd8a17c1f8e15..c20e6ed64cf3d 100644 --- a/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.pl.xlf +++ b/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.pl.xlf @@ -47,6 +47,11 @@ Preferuj wyrażenie „Is Nothing” w przypadku sprawdzeń odwołań pod kątem równości + + Show hints for 'New' expressions + Show hints for 'New' expressions + + Show items from unimported namespaces (experimental) Pokaż elementy z nieimportowanych przestrzeni nazw (eksperymentalne) diff --git a/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.pt-BR.xlf b/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.pt-BR.xlf index 5571a5f022f30..5f33df5d42e9b 100644 --- a/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.pt-BR.xlf +++ b/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.pt-BR.xlf @@ -47,6 +47,11 @@ Prefira 'Is Nothing' para as verificações de igualdade de referência + + Show hints for 'New' expressions + Show hints for 'New' expressions + + Show items from unimported namespaces (experimental) Mostrar itens de namespaces não importados (experimental) diff --git a/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.ru.xlf b/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.ru.xlf index f5f365e46d234..34388dfd7b682 100644 --- a/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.ru.xlf +++ b/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.ru.xlf @@ -47,6 +47,11 @@ Предпочитать Is Nothing для проверок равенства ссылок + + Show hints for 'New' expressions + Show hints for 'New' expressions + + Show items from unimported namespaces (experimental) Показать элементы из неимпортированных пространств имен (экспериментальная функция) diff --git a/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.tr.xlf b/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.tr.xlf index d658cf343ceb8..be1953574df2e 100644 --- a/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.tr.xlf +++ b/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.tr.xlf @@ -47,6 +47,11 @@ Başvuru eşitliği denetimleri için 'Is Nothing'i tercih et + + Show hints for 'New' expressions + Show hints for 'New' expressions + + Show items from unimported namespaces (experimental) İçeri aktarılmayan ad alanlarındaki öğeleri göster (deneysel) diff --git a/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.zh-Hans.xlf b/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.zh-Hans.xlf index 0d54b642f412f..66c04dc0135aa 100644 --- a/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.zh-Hans.xlf +++ b/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.zh-Hans.xlf @@ -47,6 +47,11 @@ 引用相等检查偏好 “Is Nothing” + + Show hints for 'New' expressions + Show hints for 'New' expressions + + Show items from unimported namespaces (experimental) 显示 unimported 命名空间中的项(实验) diff --git a/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.zh-Hant.xlf b/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.zh-Hant.xlf index 06d03c3cf2bdb..09c4764f4683e 100644 --- a/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.zh-Hant.xlf +++ b/src/VisualStudio/VisualBasic/Impl/xlf/BasicVSResources.zh-Hant.xlf @@ -47,6 +47,11 @@ 參考相等檢查最好使用 'Is Nothing' + + Show hints for 'New' expressions + Show hints for 'New' expressions + + Show items from unimported namespaces (experimental) 顯示來自未匯入命名空間的項目 (實驗性) From 4cedee7683da9dc6bd197b9358f68cfd7a42a698 Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Tue, 6 Oct 2020 10:40:26 -0700 Subject: [PATCH 152/295] Separate build and test into separate jobs (#47249) This makes several changes to our primary CI pipeline: 1. Build and Test now occur on different machines. The test artifacts necessary to run tests are passed as pipeline artifacts between the jobs. 1. Every Job is now broken down into finer grained parts. For example Restore and Build will now run as separate tasks. This makes it easier to track certain analytical elements in our pipeline: what tasks are most flaky, when there are large time shifts in tasks, etc ... Today that is possible but requires digging through log files, now it will be evident in the UI in most cases. 1. Removes four redundant builds from the job. 1. Makes test retry faster because now it is just retrying tests, not lumping build in with it. This will be important as we embraced structured retries across the .NET infrastructure. While this change does reduce our throughput slightly, that is not the goal here. The goal of this change is to get our workflow to be multi-machine, as well as getting us used to a multi-machine workflow, so that we can transition into Helix in the near future. This PR doesn't actually change much about how we build and test. The same commands of `-build, `-restore` and `-test` are being used to run the workflow. That means our workflow isn't optimal: we're still checking out sources and restoring on the test machines (wasted time). I will be changing that over the next week. Felt this was a significant milestone though and wanted to get it merged and then start the work of making this approach much more efficient. This PR does change the emphasis of certain actions. For example the build jobs which feed into our test jobs are now about simply building the code as fast as possible. This means we don't run analyzers, bootstrap, etc ... Those actions are about validating the correctness of our build and are all covered in the correctness leg. The goal of building for unit tests is to do it as fast as possible so we can get the tests running. --- Compilers.sln | 7 + Roslyn.sln | 7 + azure-pipelines.yml | 312 ++++++++------------- eng/build.cmd | 2 + eng/cibuild.cmd | 2 +- eng/dev-rehydrate-tests.ps1 | 29 ++ eng/pipelines/build-unix-job.yml | 46 +++ eng/pipelines/build-windows-job.yml | 40 +++ eng/pipelines/publish-logs.yml | 18 ++ eng/pipelines/test-unix-job.yml | 67 +++++ eng/pipelines/test-windows-job.yml | 56 ++++ eng/prepare-tests.cmd | 3 + eng/prepare-tests.ps1 | 21 ++ eng/rehydrate-tests.cmd | 2 + eng/rehydrate-tests.ps1 | 24 ++ src/Tools/PrepareTests/MinimizeUtil.cs | 156 +++++++++++ src/Tools/PrepareTests/PrepareTests.csproj | 11 + src/Tools/PrepareTests/Program.cs | 24 ++ src/Tools/PrepareTests/README.md | 67 +++++ 19 files changed, 704 insertions(+), 190 deletions(-) create mode 100644 eng/build.cmd create mode 100644 eng/dev-rehydrate-tests.ps1 create mode 100644 eng/pipelines/build-unix-job.yml create mode 100644 eng/pipelines/build-windows-job.yml create mode 100644 eng/pipelines/publish-logs.yml create mode 100644 eng/pipelines/test-unix-job.yml create mode 100644 eng/pipelines/test-windows-job.yml create mode 100644 eng/prepare-tests.cmd create mode 100644 eng/prepare-tests.ps1 create mode 100644 eng/rehydrate-tests.cmd create mode 100644 eng/rehydrate-tests.ps1 create mode 100644 src/Tools/PrepareTests/MinimizeUtil.cs create mode 100644 src/Tools/PrepareTests/PrepareTests.csproj create mode 100644 src/Tools/PrepareTests/Program.cs create mode 100644 src/Tools/PrepareTests/README.md diff --git a/Compilers.sln b/Compilers.sln index 636d6cf107be5..27940a112af40 100644 --- a/Compilers.sln +++ b/Compilers.sln @@ -156,6 +156,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Net.Compilers.Too EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "vbi", "src\Interactive\vbi\vbi.vbproj", "{706CFC25-B6E0-4DAA-BCC4-F6FAAFEEDF87}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PrepareTests", "src\Tools\PrepareTests\PrepareTests.csproj", "{9B25E472-DF94-4E24-9F5D-E487CE5A91FB}" +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution src\Analyzers\VisualBasic\CodeFixes\VisualBasicCodeFixes.projitems*{0141285d-8f6c-42c7-baf3-3c0ccd61c716}*SharedItemsImports = 5 @@ -439,6 +441,10 @@ Global {706CFC25-B6E0-4DAA-BCC4-F6FAAFEEDF87}.Debug|Any CPU.Build.0 = Debug|Any CPU {706CFC25-B6E0-4DAA-BCC4-F6FAAFEEDF87}.Release|Any CPU.ActiveCfg = Release|Any CPU {706CFC25-B6E0-4DAA-BCC4-F6FAAFEEDF87}.Release|Any CPU.Build.0 = Release|Any CPU + {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -510,6 +516,7 @@ Global {8A02AFAF-F622-4E3E-9E1A-8CFDACC7C7E1} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {6D407402-CC4A-4125-9B00-C70562A636A5} = {274B96B7-F815-47E3-9CA4-4024A57A478F} {706CFC25-B6E0-4DAA-BCC4-F6FAAFEEDF87} = {3FF38FD4-DF16-44B0-924F-0D5AE155495B} + {9B25E472-DF94-4E24-9F5D-E487CE5A91FB} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {6F599E08-A9EA-4FAA-897F-5D824B0210E6} diff --git a/Roslyn.sln b/Roslyn.sln index 063ae9d8da5d6..7150215f42caf 100644 --- a/Roslyn.sln +++ b/Roslyn.sln @@ -467,6 +467,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IdeCoreBenchmarks", "src\To EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BuildActionTelemetryTable", "src\Tools\BuildActionTelemetryTable\BuildActionTelemetryTable.csproj", "{2801F82B-78CE-4BAE-B06F-537574751E2E}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PrepareTests", "src\Tools\PrepareTests\PrepareTests.csproj", "{9B25E472-DF94-4E24-9F5D-E487CE5A91FB}" +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution src\Analyzers\VisualBasic\CodeFixes\VisualBasicCodeFixes.projitems*{0141285d-8f6c-42c7-baf3-3c0ccd61c716}*SharedItemsImports = 5 @@ -1876,6 +1878,10 @@ Global {2801F82B-78CE-4BAE-B06F-537574751E2E}.Release|Any CPU.ActiveCfg = Release|x86 {2801F82B-78CE-4BAE-B06F-537574751E2E}.Release|x86.ActiveCfg = Release|x86 {2801F82B-78CE-4BAE-B06F-537574751E2E}.Release|x86.Build.0 = Release|x86 + {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2091,6 +2097,7 @@ Global {2D5E2DE4-5DA8-41C1-A14F-49855DCCE9C5} = {DC014586-8D07-4DE6-B28E-C0540C59C085} {CEA80C83-5848-4FF6-B4E8-CEEE9482E4AA} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} {2801F82B-78CE-4BAE-B06F-537574751E2E} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} + {9B25E472-DF94-4E24-9F5D-E487CE5A91FB} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {604E6B91-7BC0-4126-AE07-D4D2FEFC3D29} diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9a8ff7d66f027..5fdc875609ce5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -14,113 +14,115 @@ pr: - features/* - demos/* +# Windows Build and Test Jobs jobs: -- job: Windows_Desktop_Unit_Tests - pool: - name: NetCorePublic-Pool - queue: BuildPool.Windows.10.Amd64.Open - strategy: - maxParallel: 4 - matrix: - debug_32: - _configuration: Debug - _testKind: Test32 - debug_64: - _configuration: Debug - _testKind: Test64 - release_32: - _configuration: Release - _testKind: Test32 - release_64: - _configuration: Release - _testKind: Test64 - timeoutInMinutes: 120 - - steps: - - script: eng/cibuild.cmd -configuration $(_configuration) -prepareMachine -testDesktop -$(_testKind) -procdump - displayName: Build and Test - - - task: PublishTestResults@2 - displayName: Publish xUnit Test Results - inputs: - testRunner: XUnit - testResultsFiles: '$(Build.SourcesDirectory)\artifacts\TestResults\$(_configuration)\*.xml' - mergeTestResults: true - testRunTitle: 'Windows Desktop $(_configuration) $(_testKind)' - condition: always() - - - task: PublishBuildArtifacts@1 - displayName: Publish Logs - inputs: - PathtoPublish: '$(Build.SourcesDirectory)\artifacts\log\$(_configuration)' - ArtifactName: 'Windows Desktop $(_configuration) $(_testKind)' - publishLocation: Container - continueOnError: true - condition: not(succeeded()) - -- job: Windows_Desktop_Spanish_Unit_Tests - pool: - name: NetCorePublic-Pool - queue: BuildPool.Windows.10.Amd64.ES.VS2017.Open - timeoutInMinutes: 120 - - steps: - - script: eng/cibuild.cmd -configuration Debug -prepareMachine -testDesktop - displayName: Build and Test - - - task: PublishTestResults@2 - displayName: Publish xUnit Test Results - inputs: - testRunner: XUnit - testResultsFiles: '$(Build.SourcesDirectory)\artifacts\TestResults\Debug\*.xml' - mergeTestResults: true - testRunTitle: 'Windows Desktop Spanish' - condition: always() - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: '$(Build.SourcesDirectory)\artifacts\log\Debug' - ArtifactName: 'Windows Desktop Spanish' - publishLocation: Container - continueOnError: true - condition: not(succeeded()) - -- job: Windows_CoreClr_Unit_Tests - pool: - name: NetCorePublic-Pool - queue: BuildPool.Windows.10.Amd64.VS2017.Open - strategy: - maxParallel: 2 - matrix: - debug: - _configuration: Debug - release: - _configuration: Release - timeoutInMinutes: 90 - - steps: - - script: eng/cibuild.cmd -configuration $(_configuration) -prepareMachine -msbuildEngine:dotnet -testCoreClr - displayName: Build and Test - - - task: PublishTestResults@2 - displayName: Publish xUnit Test Results - inputs: - testRunner: XUnit - testResultsFiles: '$(Build.SourcesDirectory)\artifacts\TestResults\$(_configuration)\*.xml' - mergeTestResults: true - testRunTitle: 'Windows CoreClr $(_configuration)' - condition: always() - - - task: PublishBuildArtifacts@1 - displayName: Publish Logs - inputs: - PathtoPublish: '$(Build.SourcesDirectory)\artifacts\log\$(_configuration)' - ArtifactName: 'Windows CoreClr $(_configuration)' - publishLocation: Container - continueOnError: true - condition: not(succeeded()) - -- job: Windows_Determinism_Test +- template: eng/pipelines/build-windows-job.yml + parameters: + jobName: Build_Windows_Debug + testArtifactName: Test_Windows_Debug + configuration: Debug + +- template: eng/pipelines/build-windows-job.yml + parameters: + jobName: Build_Windows_Release + testArtifactName: Test_Windows_Release + configuration: Release + +- template: eng/pipelines/test-windows-job.yml + parameters: + testRunName: 'Test Windows Desktop Debug 32' + jobName: Test_Windows_Desktop_Debug_32 + buildJobName: Build_Windows_Debug + testArtifactName: Test_Windows_Debug + configuration: Debug + testArguments: -testDesktop -test32 + +- template: eng/pipelines/test-windows-job.yml + parameters: + testRunName: 'Test Windows Desktop Spanish Debug 32' + jobName: Test_Windows_Desktop_Spanish_Debug_32 + buildJobName: Build_Windows_Debug + testArtifactName: Test_Windows_Debug + configuration: Debug + testArguments: -testDesktop -test32 + queueName: 'BuildPool.Windows.10.Amd64.ES.VS2017.Open' + +- template: eng/pipelines/test-windows-job.yml + parameters: + testRunName: 'Test Windows Desktop Debug 64' + jobName: Test_Windows_Desktop_Debug_64 + buildJobName: Build_Windows_Debug + testArtifactName: Test_Windows_Debug + configuration: Debug + testArguments: -testDesktop -test64 + +- template: eng/pipelines/test-windows-job.yml + parameters: + testRunName: 'Test Windows CoreClr Debug' + jobName: Test_Windows_CoreClr_Debug + buildJobName: Build_Windows_Debug + testArtifactName: Test_Windows_Debug + configuration: Debug + testArguments: -testCoreClr + +- template: eng/pipelines/test-windows-job.yml + parameters: + testRunName: 'Test Windows Desktop Release 32' + jobName: Test_Windows_Desktop_Release_32 + buildJobName: Build_Windows_Release + testArtifactName: Test_Windows_Release + configuration: Release + testArguments: -testDesktop -test32 + +- template: eng/pipelines/test-windows-job.yml + parameters: + testRunName: 'Test Windows Desktop Release 64' + jobName: Test_Windows_Desktop_Release_64 + buildJobName: Build_Windows_Release + testArtifactName: Test_Windows_Release + configuration: Release + testArguments: -testDesktop -test64 + +- template: eng/pipelines/test-windows-job.yml + parameters: + testRunName: 'Test Windows CoreClr Release' + jobName: Test_Windows_CoreClr_Release + buildJobName: Build_Windows_Release + testArtifactName: Test_Windows_Release + configuration: Release + testArguments: -testCoreClr + +# Unix Build and Test Jobs +- template: eng/pipelines/build-unix-job.yml + parameters: + jobName: Build_Unix_Debug + testArtifactName: Test_Unix_Debug + configuration: Debug + vmImageName: 'ubuntu-16.04' + +- template: eng/pipelines/test-unix-job.yml + parameters: + testRunName: 'Test Linux Debug' + jobName: Test_Linux_Debug + buildJobName: Build_Unix_Debug + testArtifactName: Test_Unix_Debug + configuration: Debug + testArguments: --testCoreClr + queueName: 'BuildPool.Ubuntu.1604.amd64.Open' + +- template: eng/pipelines/test-unix-job.yml + parameters: + testRunName: 'Test OSX Debug' + jobName: Test_OSX_Debug + buildJobName: Build_Unix_Debug + testArtifactName: Test_Unix_Debug + configuration: Debug + testArguments: --testCoreClr + vmImageName: 'macOS-10.14' + +# Build Correctness Jobs + +- job: Correctness_Determinism pool: name: NetCorePublic-Pool queue: BuildPool.Windows.10.Amd64.VS2017.Open @@ -129,16 +131,12 @@ jobs: - script: eng/test-determinism.cmd -configuration Debug displayName: Build - Validate determinism - - task: PublishBuildArtifacts@1 - displayName: Publish Logs - inputs: - PathtoPublish: '$(Build.SourcesDirectory)\artifacts\log\Debug' - ArtifactName: 'Build Determinism Files' - publishLocation: Container - continueOnError: true - condition: not(succeeded()) + - template: eng/pipelines/publish-logs.yml + parameters: + jobName: Correctness_Determinism + configuration: Debug -- job: Windows_Correctness_Test +- job: Correctness_Build pool: name: NetCorePublic-Pool queue: BuildPool.Windows.10.Amd64.VS2017.Open @@ -147,14 +145,10 @@ jobs: - script: eng/test-build-correctness.cmd -configuration Release displayName: Build - Validate correctness - - task: PublishBuildArtifacts@1 - displayName: Publish Logs - inputs: - PathtoPublish: '$(Build.SourcesDirectory)\artifacts\log\Release' - ArtifactName: 'Build Correctness Files' - publishLocation: Container - continueOnError: true - condition: not(succeeded()) + - template: eng/pipelines/publish-logs.yml + parameters: + jobName: Correctness_Build + configuration: Release - task: PublishBuildArtifacts@1 displayName: Publish Artifact Packages @@ -172,45 +166,7 @@ jobs: publishLocation: Container condition: succeeded() -- job: Linux_Test - pool: - name: NetCorePublic-Pool - queue: BuildPool.Ubuntu.1604.amd64.Open - strategy: - maxParallel: 2 - matrix: - coreclr: - _args: --testCoreClr --docker - _name: CoreClr - _configuration: Debug -# Disabling Mono while https://github.com/mono/mono/issues/16373 is worked out -# mono: -# _args: --testMono --docker -# _name: Mono -# _configuration: Debug - timeoutInMinutes: 90 - steps: - - script: ./eng/cibuild.sh --configuration $(_configuration) --prepareMachine $(_args) - displayName: Build and Test - - task: PublishTestResults@2 - displayName: Publish xUnit Test Results - inputs: - testRunner: XUnit - testResultsFiles: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_configuration)/*.xml' - mergeTestResults: true - testRunTitle: 'Linux $(_name)' - condition: always() - - - task: PublishBuildArtifacts@1 - displayName: Publish Logs - inputs: - PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_configuration)' - ArtifactName: 'Linux $(_name)' - publishLocation: Container - continueOnError: true - condition: not(succeeded()) - -- job: SourceBuild_Test +- job: Correctness_SourceBuild pool: name: NetCorePublic-Pool queue: BuildPool.Ubuntu.1604.amd64.Open @@ -218,38 +174,16 @@ jobs: steps: - script: ./eng/cibuild.sh --configuration Debug --prepareMachine --docker --sourceBuild displayName: Build - - task: PublishBuildArtifacts@1 - displayName: Publish Logs - inputs: - PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/Debug' - ArtifactName: 'SourceBuild_Test' - publishLocation: Container - continueOnError: true - condition: not(succeeded()) - -- job: macOS_Test - pool: - vmImage: 'macOS-10.14' - timeoutInMinutes: 120 - - steps: - - script: ./eng/cibuild.sh --configuration Debug --prepareMachine --testCoreClr - displayName: Build and Test - - - task: PublishTestResults@2 - displayName: Publish xUnit Test Results - inputs: - testRunner: XUnit - testResultsFiles: '$(Build.SourcesDirectory)/artifacts/TestResults/Debug/*.xml' - mergeTestResults: true - testRunTitle: 'macOS CoreClr' - condition: always() + - template: eng/pipelines/publish-logs.yml + parameters: + jobName: Correctness_SourceBuild + configuration: Release - task: PublishBuildArtifacts@1 displayName: Publish Logs inputs: PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/Debug' - ArtifactName: 'macOS CoreClr' + ArtifactName: 'SourceBuild_Test' publishLocation: Container continueOnError: true condition: not(succeeded()) diff --git a/eng/build.cmd b/eng/build.cmd new file mode 100644 index 0000000000000..fd1f85219fea5 --- /dev/null +++ b/eng/build.cmd @@ -0,0 +1,2 @@ +@echo off +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0build.ps1""" %*" diff --git a/eng/cibuild.cmd b/eng/cibuild.cmd index 26ade929598e8..832f531137de7 100644 --- a/eng/cibuild.cmd +++ b/eng/cibuild.cmd @@ -1,2 +1,2 @@ @echo off -powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0build.ps1""" -ci -restore -build -bootstrap -pack -sign -publish -binaryLog %*" +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0build.ps1""" -ci -restore -build -pack -sign -publish -binaryLog %*" diff --git a/eng/dev-rehydrate-tests.ps1 b/eng/dev-rehydrate-tests.ps1 new file mode 100644 index 0000000000000..ef669abb560e7 --- /dev/null +++ b/eng/dev-rehydrate-tests.ps1 @@ -0,0 +1,29 @@ +# This is meant as a script for testing the rehydrate behavior on a local +# dev machine. +[CmdletBinding(PositionalBinding=$false)] +param () + +Set-StrictMode -version 2.0 +$ErrorActionPreference="Stop" + +try { + . (Join-Path $PSScriptRoot "build-utils.ps1") + Push-Location $RepoRoot + + Write-Host "Removing artifacts\bin" + Remove-Item -Recurse -Force -Path artifacts\bin -ErrorAction SilentlyContinue + + Write-Host "Copying testPayload to artifacts\bin" + Create-Directory -Recurse -Force -Path artifacts\bin + Copy-Item -Recurse artifacts\testPayload\* artifacts\bin + + Write-Host "Calling rehydrate-tests" + & eng\rehydrate-tests.ps1 +} +catch { + Write-Host $_ + exit 1 +} +finally { + Pop-Location +} diff --git a/eng/pipelines/build-unix-job.yml b/eng/pipelines/build-unix-job.yml new file mode 100644 index 0000000000000..6a26e8017f869 --- /dev/null +++ b/eng/pipelines/build-unix-job.yml @@ -0,0 +1,46 @@ +# Build on Unix +parameters: +- name: jobName + type: string + default: '' +- name: testArtifactName + type: string + default: '' +- name: configuration + type: string + default: 'Debug' +- name: queueName + type: string + default: '' +- name: vmImageName + type: string + default: '' + +jobs: +- job: ${{ parameters.jobName }} + pool: + ${{ if ne(parameters.queueName, '') }}: + name: NetCorePublic-Pool + queue: ${{ parameters.queueName }} + + ${{ if ne(parameters.vmImageName, '') }}: + vmImage: ${{ parameters.vmImageName }} + timeoutInMinutes: 40 + + steps: + - script: ./eng/build.sh --ci --restore --prepareMachine --binaryLog --configuration ${{ parameters.configuration }} + displayName: Restore + + - script: ./eng/build.sh --ci --build --publish --pack --prepareMachine --binaryLog --configuration ${{ parameters.configuration }} + displayName: Build + + - task: PublishPipelineArtifact@1 + displayName: 'Publish Build' + inputs: + targetPath: '$(Build.SourcesDirectory)/artifacts/bin' + artifactName: ${{ parameters.testArtifactName }} + + - template: publish-logs.yml + parameters: + configuration: ${{ parameters.configuration }} + jobName: ${{ parameters.jobName }} diff --git a/eng/pipelines/build-windows-job.yml b/eng/pipelines/build-windows-job.yml new file mode 100644 index 0000000000000..1fbbaa59a1610 --- /dev/null +++ b/eng/pipelines/build-windows-job.yml @@ -0,0 +1,40 @@ +# Build on windows desktop +parameters: +- name: jobName + type: string + default: '' +- name: testArtifactName + type: string + default: '' +- name: configuration + type: string + default: 'Debug' + +jobs: +- job: ${{ parameters.jobName }} + pool: + name: NetCorePublic-Pool + queue: BuildPool.Windows.10.Amd64.Open + timeoutInMinutes: 40 + + steps: + - script: eng/build.cmd -configuration ${{ parameters.configuration }} -prepareMachine -ci -restore -binaryLog + displayName: Restore + + - script: eng/build.cmd -configuration ${{ parameters.configuration }} -prepareMachine -ci -build -pack -sign -publish -binaryLog + displayName: Build + + - script: eng/prepare-tests.cmd -configuration ${{ parameters.configuration }} + displayName: Prepare Unit Tests + + - task: PublishPipelineArtifact@1 + displayName: Publish Test Payload + inputs: + targetPath: '$(Build.SourcesDirectory)\artifacts\testPayload' + artifactName: ${{ parameters.testArtifactName }} + + - template: publish-logs.yml + parameters: + configuration: ${{ parameters.configuration }} + jobName: ${{ parameters.jobName }} + diff --git a/eng/pipelines/publish-logs.yml b/eng/pipelines/publish-logs.yml new file mode 100644 index 0000000000000..287ce6ed15b08 --- /dev/null +++ b/eng/pipelines/publish-logs.yml @@ -0,0 +1,18 @@ +# Build on windows desktop +parameters: +- name: jobName + type: string + default: '' +- name: configuration + type: string + default: 'Debug' + +steps: + - task: PublishPipelineArtifact@1 + displayName: Publish Logs + inputs: + targetPath: '$(Build.SourcesDirectory)/artifacts/log/${{ parameters.configuration }}' + artifactName: '${{ parameters.jobName }} Logs' + continueOnError: true + condition: not(succeeded()) + diff --git a/eng/pipelines/test-unix-job.yml b/eng/pipelines/test-unix-job.yml new file mode 100644 index 0000000000000..43d8622b97490 --- /dev/null +++ b/eng/pipelines/test-unix-job.yml @@ -0,0 +1,67 @@ +parameters: +- name: testRunName + type: string + default: '' +- name: jobName + type: string + default: '' +- name: buildJobName + type: string + default: '' +- name: testArtifactName + type: string + default: '' +- name: configuration + type: string + default: 'Debug' +- name: testArguments + type: string + default: '' +- name: queueName + type: string + default: '' +- name: vmImageName + type: string + default: '' + +jobs: +- job: ${{ parameters.jobName }} + dependsOn: ${{ parameters.buildJobName }} + pool: + ${{ if ne(parameters.queueName, '') }}: + name: NetCorePublic-Pool + queue: ${{ parameters.queueName }} + + ${{ if ne(parameters.vmImageName, '') }}: + vmImage: ${{ parameters.vmImageName }} + timeoutInMinutes: 40 + steps: + - script: ./eng/build.sh --ci --restore --prepareMachine --binaryLog --configuration ${{ parameters.configuration }} + displayName: Restore + + - task: DownloadPipelineArtifact@2 + inputs: + artifact: ${{ parameters.testArtifactName }} + path: '$(Build.SourcesDirectory)/artifacts/bin' + + # Work around for files not maintaining permissions after pipeline download + # https://github.com/microsoft/azure-pipelines-tasks/issues/6364 + - bash: find . -name ilasm | xargs chmod 755 + workingDirectory: '$(Build.SourcesDirectory)/artifacts/bin' + + - script: ./eng/build.sh --ci --binaryLog --configuration ${{ parameters.configuration }} ${{ parameters.testArguments }} + displayName: Test + + - task: PublishTestResults@2 + displayName: Publish xUnit Test Results + inputs: + testRunner: XUnit + testResultsFiles: '$(Build.SourcesDirectory)/artifacts/TestResults/${{ parameters.configuration }}/*.xml' + mergeTestResults: true + testRunTitle: ${{ parameters.testRunName }} + condition: always() + + - template: publish-logs.yml + parameters: + configuration: ${{ parameters.configuration }} + jobName: ${{ parameters.jobName }} \ No newline at end of file diff --git a/eng/pipelines/test-windows-job.yml b/eng/pipelines/test-windows-job.yml new file mode 100644 index 0000000000000..e4b0b71de689c --- /dev/null +++ b/eng/pipelines/test-windows-job.yml @@ -0,0 +1,56 @@ +# Test on Windows Desktop +parameters: +- name: testRunName + type: string + default: '' +- name: jobName + type: string + default: '' +- name: buildJobName + type: string + default: '' +- name: testArtifactName + type: string + default: '' +- name: configuration + type: string + default: 'Debug' +- name: testArguments + type: string + default: '' +- name: queueName + type: string + default: 'BuildPool.Windows.10.Amd64.Open' + +jobs: +- job: ${{ parameters.jobName }} + dependsOn: ${{ parameters.buildJobName }} + pool: + name: NetCorePublic-Pool + queue: ${{ parameters.queueName }} + timeoutInMinutes: 120 + steps: + - task: DownloadPipelineArtifact@2 + inputs: + artifact: ${{ parameters.testArtifactName }} + path: '$(Build.SourcesDirectory)\artifacts\bin' + + - script: eng/rehydrate-tests.cmd + displayName: Rehydrate unit tests environment + + - script: eng/build.cmd -ci -configuration ${{ parameters.configuration }} ${{ parameters.testArguments }} + displayName: Run Unit Tests + + - task: PublishTestResults@2 + displayName: Publish xUnit Test Results + inputs: + testRunner: XUnit + testResultsFiles: '$(Build.SourcesDirectory)\artifacts\TestResults\${{ parameters.configuration }}\*.xml' + mergeTestResults: true + testRunTitle: '${{ parameters.testRunName }}' + condition: always() + + - template: publish-logs.yml + parameters: + configuration: ${{ parameters.configuration }} + jobName: ${{ parameters.jobName }} \ No newline at end of file diff --git a/eng/prepare-tests.cmd b/eng/prepare-tests.cmd new file mode 100644 index 0000000000000..f2501af2fa48d --- /dev/null +++ b/eng/prepare-tests.cmd @@ -0,0 +1,3 @@ +@echo off +powershell -noprofile -executionPolicy RemoteSigned -file "%~dp0\prepare-tests.ps1" %* + diff --git a/eng/prepare-tests.ps1 b/eng/prepare-tests.ps1 new file mode 100644 index 0000000000000..e9bd213b5f1c6 --- /dev/null +++ b/eng/prepare-tests.ps1 @@ -0,0 +1,21 @@ +[CmdletBinding(PositionalBinding=$false)] +param ([string]$configuration = "Debug") + +Set-StrictMode -version 2.0 +$ErrorActionPreference="Stop" + +try { + . (Join-Path $PSScriptRoot "build-utils.ps1") + Push-Location $RepoRoot + + $dotnet = Ensure-DotnetSdk + Exec-Console $dotnet "run --project src\Tools\PrepareTests\PrepareTests.csproj $RepoRoot\artifacts\bin $RepoRoot\artifacts\testPayload" + exit 0 +} +catch { + Write-Host $_ + exit 1 +} +finally { + Pop-Location +} diff --git a/eng/rehydrate-tests.cmd b/eng/rehydrate-tests.cmd new file mode 100644 index 0000000000000..68904a4cd4d7f --- /dev/null +++ b/eng/rehydrate-tests.cmd @@ -0,0 +1,2 @@ +@echo off +powershell -noprofile -executionPolicy RemoteSigned -file "%~dp0\rehydrate-tests.ps1" %* \ No newline at end of file diff --git a/eng/rehydrate-tests.ps1 b/eng/rehydrate-tests.ps1 new file mode 100644 index 0000000000000..33206d752116e --- /dev/null +++ b/eng/rehydrate-tests.ps1 @@ -0,0 +1,24 @@ +[CmdletBinding(PositionalBinding=$false)] +param () + +Set-StrictMode -version 2.0 +$ErrorActionPreference="Stop" + +try { + . (Join-Path $PSScriptRoot "build-utils.ps1") + Push-Location $RepoRoot + + Push-Location artifacts\bin + & .\rehydrate.cmd + Pop-Location + + Ensure-DotNetSdk + & eng\build.ps1 -restore +} +catch { + Write-Host $_ + exit 1 +} +finally { + Pop-Location +} diff --git a/src/Tools/PrepareTests/MinimizeUtil.cs b/src/Tools/PrepareTests/MinimizeUtil.cs new file mode 100644 index 0000000000000..bb168b8ad0370 --- /dev/null +++ b/src/Tools/PrepareTests/MinimizeUtil.cs @@ -0,0 +1,156 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection.Metadata; +using System.Reflection.PortableExecutable; +using System.Runtime.InteropServices; +using System.Text; + +internal static class MinimizeUtil +{ + internal record FilePathInfo(string RelativeDirectory, string Directory, string RelativePath, string FullPath); + + internal static void Run(string sourceDirectory, string destinationDirectory) + { + // Map of all PE files MVID to the path information + var idToFilePathMap = new Dictionary>(); + + const string duplicateDirectoryName = ".duplicate"; + var duplicateDirectory = Path.Combine(destinationDirectory, duplicateDirectoryName); + Directory.CreateDirectory(duplicateDirectory); + + initialWalk(); + resolveDuplicates(); + writeHydrateFile(); + + // The goal of initial walk is to + // 1. Record any PE files as they are eligable for de-dup + // 2. Hard link all other files into destination directory + void initialWalk() + { + var directories = Directory.EnumerateDirectories(sourceDirectory, "*.UnitTests"); + directories = directories.Concat(Directory.EnumerateDirectories(sourceDirectory, "RunTests")); + + foreach (var unitDirPath in directories) + { + foreach (var sourceFilePath in Directory.EnumerateFiles(unitDirPath, "*", SearchOption.AllDirectories)) + { + var currentDirName = Path.GetDirectoryName(sourceFilePath)!; + var currentRelativeDirectory = Path.GetRelativePath(sourceDirectory, currentDirName); + var currentOutputDirectory = Path.Combine(destinationDirectory, currentRelativeDirectory); + Directory.CreateDirectory(currentOutputDirectory); + var fileName = Path.GetFileName(sourceFilePath); + + if (fileName.EndsWith(".dll") && TryGetMvid(sourceFilePath, out var mvid)) + { + if (!idToFilePathMap.TryGetValue(mvid, out var list)) + { + list = new List(); + idToFilePathMap[mvid] = list; + } + + var filePathInfo = new FilePathInfo( + RelativeDirectory: currentRelativeDirectory, + Directory: currentDirName, + RelativePath: Path.Combine(currentRelativeDirectory, fileName), + FullPath: sourceFilePath); + list.Add(filePathInfo); + } + else + { + var destFilePath = Path.Combine(currentOutputDirectory, fileName); + CreateHardLink(destFilePath, sourceFilePath, IntPtr.Zero); + } + } + } + } + + // Now that we have a complete list of PE files, determine which are duplicates + void resolveDuplicates() + { + foreach (var pair in idToFilePathMap) + { + if (pair.Value.Count > 1) + { + CreateHardLink(getPeFilePath(pair.Key), pair.Value[0].FullPath, IntPtr.Zero); + } + else + { + var item = pair.Value[0]; + var destFilePath = Path.Combine(destinationDirectory, item.RelativePath); + CreateHardLink(destFilePath, item.FullPath, IntPtr.Zero); + } + } + } + + string getPeFileName(Guid mvid) => mvid.ToString(); + + string getPeFilePath(Guid mvid) => Path.Combine(duplicateDirectory, getPeFileName(mvid)); + + void writeHydrateFile() + { + var fileList = new List(); + var grouping = idToFilePathMap + .Where(x => x.Value.Count > 1) + .SelectMany(pair => pair.Value.Select(fp => (Id: pair.Key, FilePath: fp))) + .GroupBy(fp => fp.FilePath.RelativeDirectory); + var builder = new StringBuilder(); + builder.AppendLine("@echo off"); + var count = 0; + foreach (var group in grouping) + { + foreach (var tuple in group) + { + var source = Path.Combine(duplicateDirectoryName, getPeFileName(tuple.Id)); + var destFileName = Path.Combine(group.Key, Path.GetFileName(tuple.FilePath.FullPath)); + builder.AppendLine($@" +mklink /h {destFileName} {source} > nul +if %errorlevel% neq 0 ( + echo %errorlevel% + echo Cmd failed: mklink /h {destFileName} {source} > nul + exit 1 +)"); + + count++; + if (count % 1_000 == 0) + { + builder.AppendLine($"echo {count:n0} hydrated"); + } + } + } + + File.WriteAllText(Path.Combine(destinationDirectory, "rehydrate.cmd"), builder.ToString()); + } + } + + [DllImport("Kernel32.dll", CharSet = CharSet.Unicode)] + private static extern bool CreateHardLink(string lpFileName, string lpExistingFileName, IntPtr lpSecurityAttributes); + + private static bool TryGetMvid(string filePath, out Guid mvid) + { + try + { + using var stream = File.OpenRead(filePath); + var reader = new PEReader(stream); + if (!reader.HasMetadata) + { + mvid = default; + return false; + } + var metadataReader = reader.GetMetadataReader(); + var mvidHandle = metadataReader.GetModuleDefinition().Mvid; + mvid = metadataReader.GetGuid(mvidHandle); + return true; + } + catch + { + mvid = default; + return false; + } + } +} diff --git a/src/Tools/PrepareTests/PrepareTests.csproj b/src/Tools/PrepareTests/PrepareTests.csproj new file mode 100644 index 0000000000000..e2c2a2e0ac9d8 --- /dev/null +++ b/src/Tools/PrepareTests/PrepareTests.csproj @@ -0,0 +1,11 @@ + + + + + Exe + net5.0 + false + false + false + + diff --git a/src/Tools/PrepareTests/Program.cs b/src/Tools/PrepareTests/Program.cs new file mode 100644 index 0000000000000..d51b42d424e43 --- /dev/null +++ b/src/Tools/PrepareTests/Program.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Threading.Tasks; + +internal static class Program +{ + internal const int ExitFailure = 1; + internal const int ExitSuccess = 0; + + public static int Main(string[] args) + { + if (args.Length != 2) + { + Console.WriteLine("preparetests "); + return ExitFailure; + } + + MinimizeUtil.Run(args[0], args[1]); + return ExitSuccess; + } +} diff --git a/src/Tools/PrepareTests/README.md b/src/Tools/PrepareTests/README.md new file mode 100644 index 0000000000000..110bd4f1abdc8 --- /dev/null +++ b/src/Tools/PrepareTests/README.md @@ -0,0 +1,67 @@ +# Prepare Tests + +## Usage +This tool is meant to prepare our unit tests for efficient upload and download +in our CI pipeline. Our build and test legs run on different machines and hence +they must go through a single upload cycle and many download cycles (per test +scenario). + +The output of our build is ~11GB and that does not really lend itself to being +uploaded and downloaded as often as is needed in our tests. Some amount of +curation is needed to make that a practical experience. Even if it's as simple +as deleting all of the non-unit test directories from our `bin` folder and +using the results as the payload. + +Our eventual goal though is to be running on Helix and that environment is +optimized for a specific payload structure. Helix consists of Jobs which have +a collection of associated Work Items attached to it. Helix will fan out +Work Items to a series of machines but it will attempt to schedule many +Work Items for the same Job in sequence on the same machine. + +To support that scheduling Helix wants the payloads structured in the following +manner: + +1. Correlated payload: there is one per job and that is on disk for every +Work Item in the Job. Given that the schedule attempts to re-use the same machine +for Work Items in a Job this means the correlated payload is only downloaded +based on the number of machines used, not the number of Work Items scheduled. +1. Work Item payload: this is downloaded whenever a work item is executed. There +is no re-use here hence this should be as small as possible. + +In Roslyn terms the Job is effectively a single unit test DLL and the Work Items +are the partitions that RunTests creates over them. Although in Helix there will +be a lot more partitions. + +This tool effectively optimizes our payload for the Helix case. All of the +duplicate files in our build are structured into a single payload. That will +eventually become our correlation payload. What is left in the unit test +directory is unique to that test and hence is about as minimum as it can get. + +Given that the end goal is Helix, and we need some sort of test data +manipulation now, I thought it best to just insert that tool here rather than +having an intermediate step. + +## Implementation +This tool recognizes that a large number of the artifacts in our output +directory are duplicates. For example consider how many times +Microsoft.CodeAnalysis.dll gets copied around during our build (quite a bit). + +The tool uses that information to the following effect: + +1. Create a payload directory, `testPayload`, that the tool will populate +1. Crack every DLL in the `bin` directory, read it's MVID, and keep a list +of all file paths which are this MVID +1. Create a directory, `.duplicates`, in `testPayload` +1. For each MVID that has multiple copies create a hard link in `.duplicates` +where the name is the MVID. +1. For every other file in `bin` which is not a duplicate create a hard link +in `.duplicates` with the same relative path. +1. Create a file, `rehydrate.cmd`, that will restore all the duplicate files +by creating a hard link into `.duplicates`. This file will be run on the test +machine. + +This reduces our test payload size to ~1.5GB. + +*Note*: yes in many ways this is similar to hard linking during build. The +difference being that this is much more effective because build hard linking +isn't perfect and also it creates a handy correlation payload for us. \ No newline at end of file From e577a60793f6703e34beb3441e98359217c5ef3b Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 6 Oct 2020 10:47:16 -0700 Subject: [PATCH 153/295] Add C# options --- .../CSharp/Impl/CSharpVSResources.resx | 3 +++ .../Options/AdvancedOptionPageControl.xaml | 15 +++++++++++- .../Options/AdvancedOptionPageControl.xaml.cs | 24 +++++++++++++++++++ .../Impl/Options/AdvancedOptionPageStrings.cs | 13 +++++++--- .../CSharp/Impl/xlf/CSharpVSResources.cs.xlf | 5 ++++ .../CSharp/Impl/xlf/CSharpVSResources.de.xlf | 5 ++++ .../CSharp/Impl/xlf/CSharpVSResources.es.xlf | 5 ++++ .../CSharp/Impl/xlf/CSharpVSResources.fr.xlf | 5 ++++ .../CSharp/Impl/xlf/CSharpVSResources.it.xlf | 5 ++++ .../CSharp/Impl/xlf/CSharpVSResources.ja.xlf | 5 ++++ .../CSharp/Impl/xlf/CSharpVSResources.ko.xlf | 5 ++++ .../CSharp/Impl/xlf/CSharpVSResources.pl.xlf | 5 ++++ .../Impl/xlf/CSharpVSResources.pt-BR.xlf | 5 ++++ .../CSharp/Impl/xlf/CSharpVSResources.ru.xlf | 5 ++++ .../CSharp/Impl/xlf/CSharpVSResources.tr.xlf | 5 ++++ .../Impl/xlf/CSharpVSResources.zh-Hans.xlf | 5 ++++ .../Impl/xlf/CSharpVSResources.zh-Hant.xlf | 5 ++++ 17 files changed, 116 insertions(+), 4 deletions(-) diff --git a/src/VisualStudio/CSharp/Impl/CSharpVSResources.resx b/src/VisualStudio/CSharp/Impl/CSharpVSResources.resx index d7adf4800ad88..2af97a6f65870 100644 --- a/src/VisualStudio/CSharp/Impl/CSharpVSResources.resx +++ b/src/VisualStudio/CSharp/Impl/CSharpVSResources.resx @@ -626,4 +626,7 @@ Insert // at the start of new lines when writing // comments + + Show hints for 'new' expressions + \ No newline at end of file diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml index 622926e35a6eb..b909bec9d4435 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml @@ -111,7 +111,20 @@ Header="{x:Static local:AdvancedOptionPageStrings.Option_Inline_Hints_experimental}"> + Content="{x:Static local:AdvancedOptionPageStrings.Option_Display_inline_parameter_name_hints}" + Checked="DisplayInlineParameterNameHints_Checked" + Unchecked="DisplayInlineParameterNameHints_Unchecked"/> + + + + + diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs index b2a0ae32b30b3..c18e9c0a65018 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs @@ -66,6 +66,10 @@ public AdvancedOptionPageControl(OptionStore optionStore, IComponentModel compon BindToOption(InsertAsteriskAtTheStartOfNewLinesWhenWritingBlockComments, FeatureOnOffOptions.AutoInsertBlockCommentStartString, LanguageNames.CSharp); BindToOption(DisplayInlineParameterNameHints, InlineHintsOptions.EnabledForParameters, LanguageNames.CSharp); + BindToOption(ShowHintsForLiterals, InlineHintsOptions.ForLiteralParameters, LanguageNames.CSharp); + BindToOption(ShowHintsForNewExpressions, InlineHintsOptions.ForObjectCreationParameters, LanguageNames.CSharp); + BindToOption(ShowHintsForEverythingElse, InlineHintsOptions.ForOtherParameters, LanguageNames.CSharp); + UpdateInlineHintsOptions(); BindToOption(ShowRemarksInQuickInfo, QuickInfoOptions.ShowRemarksInQuickInfo, LanguageNames.CSharp); BindToOption(DisplayLineSeparators, FeatureOnOffOptions.LineSeparator, LanguageNames.CSharp); @@ -104,5 +108,25 @@ internal override void OnLoad() base.OnLoad(); } + + private void UpdateInlineHintsOptions() + { + var enabledForParameters = this.OptionStore.GetOption(InlineHintsOptions.EnabledForParameters, LanguageNames.CSharp); + ShowHintsForLiterals.IsEnabled = enabledForParameters; + ShowHintsForNewExpressions.IsEnabled = enabledForParameters; + ShowHintsForEverythingElse.IsEnabled = enabledForParameters; + } + + private void DisplayInlineParameterNameHints_Checked(object sender, RoutedEventArgs e) + { + this.OptionStore.SetOption(InlineHintsOptions.EnabledForParameters, LanguageNames.CSharp, true); + UpdateInlineHintsOptions(); + } + + private void DisplayInlineParameterNameHints_Unchecked(object sender, RoutedEventArgs e) + { + this.OptionStore.SetOption(InlineHintsOptions.EnabledForParameters, LanguageNames.CSharp, false); + UpdateInlineHintsOptions(); + } } } diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs index 8a86f4eca4245..5799bd8fd7ae9 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs @@ -37,6 +37,15 @@ public static string Option_Inline_Hints_experimental public static string Option_Display_inline_parameter_name_hints => ServicesVSResources.Display_inline_parameter_name_hints; + public static string Option_Show_hints_for_literals + => ServicesVSResources.Show_hints_for_literals; + + public static string Option_Show_hints_for_new_expressions + => CSharpVSResources.Show_hints_for_new_expressions; + + public static string Option_Show_hints_for_everything_else + => ServicesVSResources.Show_hints_for_everything_else; + public static string Option_RenameTrackingPreview => CSharpVSResources.Show_preview_for_rename_tracking; public static string Option_Split_string_literals_on_enter => CSharpVSResources.Split_string_literals_on_enter; @@ -170,9 +179,7 @@ public static string Option_Fade_out_unreachable_code => ServicesVSResources.Fade_out_unreachable_code; public static string Option_Performance - { - get { return CSharpVSResources.Performance; } - } + => CSharpVSResources.Performance; public static string Option_PlaceSystemNamespaceFirst => CSharpVSResources.Place_System_directives_first_when_sorting_usings; diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.cs.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.cs.xlf index 2c39463961c80..11170fd8031f2 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.cs.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.cs.xlf @@ -122,6 +122,11 @@ Odebrat nepotřebné direktivy using + + Show hints for 'new' expressions + Show hints for 'new' expressions + + Show items from unimported namespaces (experimental) Zobrazit položky z neimportovaných oborů názvů (experimentální) diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.de.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.de.xlf index c5bdd3b290a2d..656e21ad2cc8b 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.de.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.de.xlf @@ -122,6 +122,11 @@ Nicht benötigte Using-Direktiven entfernen + + Show hints for 'new' expressions + Show hints for 'new' expressions + + Show items from unimported namespaces (experimental) Elemente aus nicht importierten Namespaces anzeigen (experimentell) diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.es.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.es.xlf index b0b731032363b..5018768973e71 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.es.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.es.xlf @@ -122,6 +122,11 @@ Eliminar instrucciones Using innecesarias + + Show hints for 'new' expressions + Show hints for 'new' expressions + + Show items from unimported namespaces (experimental) Mostrar elementos de espacios de nombres no importados (experimental) diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.fr.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.fr.xlf index 83e386ceea70b..02e49f719a1ca 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.fr.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.fr.xlf @@ -122,6 +122,11 @@ Supprimer les Usings inutiles + + Show hints for 'new' expressions + Show hints for 'new' expressions + + Show items from unimported namespaces (experimental) Afficher les éléments des espaces de noms qui ne sont pas importés (expérimental) diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.it.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.it.xlf index 91eb01fb9e0f7..55f3e9295e626 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.it.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.it.xlf @@ -122,6 +122,11 @@ Rimuovi istruzioni using non necessarie + + Show hints for 'new' expressions + Show hints for 'new' expressions + + Show items from unimported namespaces (experimental) Mostra elementi da spazi dei nomi non importati (sperimentale) diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ja.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ja.xlf index 9b9d5401f296d..c9adbb0a26977 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ja.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ja.xlf @@ -122,6 +122,11 @@ 不要な using の削除 + + Show hints for 'new' expressions + Show hints for 'new' expressions + + Show items from unimported namespaces (experimental) インポートされていない名前空間の項目を表示する (試験段階) diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ko.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ko.xlf index bbe4c291990bf..62f39ec5d477d 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ko.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ko.xlf @@ -122,6 +122,11 @@ 불필요한 Using 제거 + + Show hints for 'new' expressions + Show hints for 'new' expressions + + Show items from unimported namespaces (experimental) 가져오지 않은 네임스페이스의 항목 표시(실험적) diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.pl.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.pl.xlf index 7bd2d1a1272a8..580a09dd78aec 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.pl.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.pl.xlf @@ -122,6 +122,11 @@ Usuń niepotrzebne użycia + + Show hints for 'new' expressions + Show hints for 'new' expressions + + Show items from unimported namespaces (experimental) Pokaż elementy z nieimportowanych przestrzeni nazw (eksperymentalne) diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.pt-BR.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.pt-BR.xlf index 61df75060653d..9b58fda3405ba 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.pt-BR.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.pt-BR.xlf @@ -122,6 +122,11 @@ Remover Usos Desnecessários + + Show hints for 'new' expressions + Show hints for 'new' expressions + + Show items from unimported namespaces (experimental) Mostrar itens de namespaces não importados (experimental) diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ru.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ru.xlf index 064dc2d3ef111..5cb450b09a611 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ru.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.ru.xlf @@ -122,6 +122,11 @@ Удалить ненужные директивы using + + Show hints for 'new' expressions + Show hints for 'new' expressions + + Show items from unimported namespaces (experimental) Показать элементы из неимпортированных пространств имен (экспериментальная функция) diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.tr.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.tr.xlf index b7ba8a396d1a9..91fa8b502244d 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.tr.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.tr.xlf @@ -122,6 +122,11 @@ Gereksiz Kullanımları Kaldır + + Show hints for 'new' expressions + Show hints for 'new' expressions + + Show items from unimported namespaces (experimental) İçeri aktarılmayan ad alanlarındaki öğeleri göster (deneysel) diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.zh-Hans.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.zh-Hans.xlf index d6df9aa51aa5e..8637d5d4cad94 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.zh-Hans.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.zh-Hans.xlf @@ -122,6 +122,11 @@ 删除不必要的 Using + + Show hints for 'new' expressions + Show hints for 'new' expressions + + Show items from unimported namespaces (experimental) 显示 unimported 命名空间中的项(实验) diff --git a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.zh-Hant.xlf b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.zh-Hant.xlf index 0b111b7aca573..7467b95fc3604 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.zh-Hant.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/CSharpVSResources.zh-Hant.xlf @@ -122,6 +122,11 @@ 移除不必要的 Using + + Show hints for 'new' expressions + Show hints for 'new' expressions + + Show items from unimported namespaces (experimental) 顯示來自未匯入命名空間的項目 (實驗性) From 835ac0e3c3a5ea6fca76e19342905125eef52d80 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Mon, 5 Oct 2020 07:25:37 -0700 Subject: [PATCH 154/295] Avoid lambda allocation in FindReferenceCache.GetSymbolInfo --- .../ConcurrentDictionaryExtensionsTests.cs | 39 +++++++++++++++++++ .../ConcurrentDictionaryExtensions.cs | 18 ++++++++- .../FindReferences/FindReferenceCache.cs | 2 +- .../Core/CompilerExtensions.projitems | 1 + 4 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 src/Compilers/Core/CodeAnalysisTest/InternalUtilities/ConcurrentDictionaryExtensionsTests.cs diff --git a/src/Compilers/Core/CodeAnalysisTest/InternalUtilities/ConcurrentDictionaryExtensionsTests.cs b/src/Compilers/Core/CodeAnalysisTest/InternalUtilities/ConcurrentDictionaryExtensionsTests.cs new file mode 100644 index 0000000000000..44ac3b7d4e0f3 --- /dev/null +++ b/src/Compilers/Core/CodeAnalysisTest/InternalUtilities/ConcurrentDictionaryExtensionsTests.cs @@ -0,0 +1,39 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Concurrent; +using Roslyn.Utilities; +using Xunit; + +namespace Microsoft.CodeAnalysis.UnitTests.InternalUtilities +{ + public class ConcurrentDictionaryExtensionsTests + { + [Fact] + public void TestAdd() + { + var dictionary = new ConcurrentDictionary(); + dictionary.Add(0, 0); + Assert.Equal(0, dictionary[0]); + + Assert.Throws(() => dictionary.Add(0, 0)); + } + + [Fact] + public void TestGetOrAdd() + { + var first = new object(); + var second = new object(); + + var dictionary = new ConcurrentDictionary(); + Assert.Same(first, dictionary.GetOrAdd(0, static (key, arg) => arg, first)); + Assert.Same(first, dictionary[0]); + Assert.Single(dictionary); + Assert.Same(first, dictionary.GetOrAdd(0, static (key, arg) => arg, second)); + Assert.Same(first, dictionary[0]); + Assert.Single(dictionary); + } + } +} diff --git a/src/Compilers/Core/Portable/InternalUtilities/ConcurrentDictionaryExtensions.cs b/src/Compilers/Core/Portable/InternalUtilities/ConcurrentDictionaryExtensions.cs index d6b4dd115f948..061b7394c93f3 100644 --- a/src/Compilers/Core/Portable/InternalUtilities/ConcurrentDictionaryExtensions.cs +++ b/src/Compilers/Core/Portable/InternalUtilities/ConcurrentDictionaryExtensions.cs @@ -2,7 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; using System.Collections.Concurrent; +using Microsoft.CodeAnalysis.PooledObjects; namespace Roslyn.Utilities { @@ -19,8 +21,22 @@ public static void Add(this ConcurrentDictionary dict, K key, V valu { if (!dict.TryAdd(key, value)) { - throw new System.ArgumentException("adding a duplicate"); + throw new ArgumentException("adding a duplicate", nameof(key)); } } + + public static TValue GetOrAdd(this ConcurrentDictionary dictionary, TKey key, Func valueFactory, TArg factoryArgument) + where TKey : notnull + { +#if NETCOREAPP + return dictionary.GetOrAdd(key, valueFactory, factoryArgument); +#else + if (dictionary.TryGetValue(key, out var value)) + return value; + + using var _ = PooledDelegates.GetPooledFunction(valueFactory, factoryArgument, out var boundFunction); + return dictionary.GetOrAdd(key, boundFunction); +#endif + } } } diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/FindReferenceCache.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/FindReferenceCache.cs index 83645967285ba..6d7f7a1e9624e 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/FindReferenceCache.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/FindReferenceCache.cs @@ -32,7 +32,7 @@ public static SymbolInfo GetSymbolInfo(SemanticModel model, SyntaxNode node, Can return model.GetSymbolInfo(node, cancellationToken); } - return nodeCache.GetOrAdd(node, n => model.GetSymbolInfo(n, cancellationToken)); + return nodeCache.GetOrAdd(node, static (n, arg) => arg.model.GetSymbolInfo(n, arg.cancellationToken), (model, cancellationToken)); } public static IAliasSymbol GetAliasInfo( diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CompilerExtensions.projitems b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CompilerExtensions.projitems index 7e8add9bbc239..28ef23ac9d37b 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CompilerExtensions.projitems +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CompilerExtensions.projitems @@ -9,6 +9,7 @@ Microsoft.CodeAnalysis.Shared + From c7bbf2f0902d6d6c8a4dd91457ccd41f983acd1d Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Mon, 5 Oct 2020 08:10:55 -0700 Subject: [PATCH 155/295] Avoid Task allocation on GetInfoForMetadataReferenceAsync fast path --- ...dImportCompletionHelper.ExtensionMethodSymbolComputer.cs | 6 +++--- .../IncrementalCaches/SymbolTreeInfoCacheService.cs | 2 +- .../FindSymbols/SymbolTree/ISymbolTreeInfoCacheService.cs | 2 +- .../FindSymbols/SymbolTree/SymbolTreeInfo_Metadata.cs | 5 +++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/ExtensionMethodImportCompletionHelper.ExtensionMethodSymbolComputer.cs b/src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/ExtensionMethodImportCompletionHelper.ExtensionMethodSymbolComputer.cs index 9e44b34adf2c8..cf98d70292ea1 100644 --- a/src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/ExtensionMethodImportCompletionHelper.ExtensionMethodSymbolComputer.cs +++ b/src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/ExtensionMethodImportCompletionHelper.ExtensionMethodSymbolComputer.cs @@ -84,7 +84,7 @@ public Task PopulateIndicesAsync(CancellationToken cancellationToken) foreach (var peReference in GetAllRelevantPeReferences()) { tasks.Add(Task.Run(() - => SymbolTreeInfo.GetInfoForMetadataReferenceAsync(Solution, peReference, loadOnly: false, cancellationToken), cancellationToken)); + => SymbolTreeInfo.GetInfoForMetadataReferenceAsync(Solution, peReference, loadOnly: false, cancellationToken).AsTask(), cancellationToken)); } return Task.WhenAll(tasks.ToImmutable()); @@ -100,7 +100,7 @@ public Task PopulateIndicesAsync(CancellationToken cancellationToken) tasks.Add(Task.Run(() => GetExtensionMethodSymbolsFromPeReferenceAsync( peReference, forceIndexCreation, - cancellationToken), cancellationToken)); + cancellationToken).AsTask(), cancellationToken)); } foreach (var project in GetAllRelevantProjects()) @@ -184,7 +184,7 @@ private ImmutableArray GetAllRelevantPeReferences() : GetExtensionMethodsForSymbolsFromDifferentCompilation(matchingMethodSymbols, cancellationToken); } - private async Task?> GetExtensionMethodSymbolsFromPeReferenceAsync( + private async ValueTask?> GetExtensionMethodSymbolsFromPeReferenceAsync( PortableExecutableReference peReference, bool forceIndexCreation, CancellationToken cancellationToken) diff --git a/src/Features/Core/Portable/IncrementalCaches/SymbolTreeInfoCacheService.cs b/src/Features/Core/Portable/IncrementalCaches/SymbolTreeInfoCacheService.cs index 7c883aa931f82..5b5a10165c9a2 100644 --- a/src/Features/Core/Portable/IncrementalCaches/SymbolTreeInfoCacheService.cs +++ b/src/Features/Core/Portable/IncrementalCaches/SymbolTreeInfoCacheService.cs @@ -29,7 +29,7 @@ public SymbolTreeInfoCacheService( _metadataIdToInfo = metadataIdToInfo; } - public async Task TryGetMetadataSymbolTreeInfoAsync( + public async ValueTask TryGetMetadataSymbolTreeInfoAsync( Solution solution, PortableExecutableReference reference, CancellationToken cancellationToken) diff --git a/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/ISymbolTreeInfoCacheService.cs b/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/ISymbolTreeInfoCacheService.cs index fdcc018b8f4bf..c05a5b5774a8a 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/ISymbolTreeInfoCacheService.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/ISymbolTreeInfoCacheService.cs @@ -20,6 +20,6 @@ internal interface ISymbolTreeInfoCacheService : IWorkspaceService /// /// Returns null if the info cannot be retrieved from the cache. /// - Task TryGetMetadataSymbolTreeInfoAsync(Solution solution, PortableExecutableReference reference, CancellationToken cancellationToken); + ValueTask TryGetMetadataSymbolTreeInfoAsync(Solution solution, PortableExecutableReference reference, CancellationToken cancellationToken); } } diff --git a/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Metadata.cs b/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Metadata.cs index 453318c58176d..c028a29a28f65 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Metadata.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Metadata.cs @@ -65,7 +65,7 @@ private static Metadata GetMetadataNoThrow(PortableExecutableReference reference } } - public static Task GetInfoForMetadataReferenceAsync( + public static ValueTask GetInfoForMetadataReferenceAsync( Solution solution, PortableExecutableReference reference, bool loadOnly, CancellationToken cancellationToken) { @@ -79,7 +79,8 @@ public static Task GetInfoForMetadataReferenceAsync( /// Produces a for a given . /// Note: will never return null; /// - public static async Task GetInfoForMetadataReferenceAsync( + [PerformanceSensitive("https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1224834", OftenCompletesSynchronously = true)] + public static async ValueTask GetInfoForMetadataReferenceAsync( Solution solution, PortableExecutableReference reference, Checksum checksum, From 20090a794974f68d0b6b9fff60a83c50b6ac07fa Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Mon, 5 Oct 2020 08:35:09 -0700 Subject: [PATCH 156/295] Avoid Task allocation on GetIndexAsync fast path --- .../Core/Portable/FindSymbols/SyntaxTree/SyntaxTreeIndex.cs | 5 +++-- .../Core/Portable/Shared/Extensions/DocumentExtensions.cs | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Workspaces/Core/Portable/FindSymbols/SyntaxTree/SyntaxTreeIndex.cs b/src/Workspaces/Core/Portable/FindSymbols/SyntaxTree/SyntaxTreeIndex.cs index 4451267c00e56..02910a1c751a2 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/SyntaxTree/SyntaxTreeIndex.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/SyntaxTree/SyntaxTreeIndex.cs @@ -64,10 +64,11 @@ public static async Task PrecalculateAsync(Document document, CancellationToken } } - public static Task GetIndexAsync(Document document, CancellationToken cancellationToken) + public static ValueTask GetIndexAsync(Document document, CancellationToken cancellationToken) => GetIndexAsync(document, loadOnly: false, cancellationToken); - public static async Task GetIndexAsync( + [PerformanceSensitive("https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1224834", OftenCompletesSynchronously = true)] + public static async ValueTask GetIndexAsync( Document document, bool loadOnly, CancellationToken cancellationToken) diff --git a/src/Workspaces/Core/Portable/Shared/Extensions/DocumentExtensions.cs b/src/Workspaces/Core/Portable/Shared/Extensions/DocumentExtensions.cs index 857dc57d092e5..9f17d75602e5b 100644 --- a/src/Workspaces/Core/Portable/Shared/Extensions/DocumentExtensions.cs +++ b/src/Workspaces/Core/Portable/Shared/Extensions/DocumentExtensions.cs @@ -43,10 +43,10 @@ public static async Task IsForkedDocumentWithSyntaxChangesAsync(this Docum } } - public static Task GetSyntaxTreeIndexAsync(this Document document, CancellationToken cancellationToken) + public static ValueTask GetSyntaxTreeIndexAsync(this Document document, CancellationToken cancellationToken) => SyntaxTreeIndex.GetIndexAsync(document, loadOnly: false, cancellationToken); - public static Task GetSyntaxTreeIndexAsync(this Document document, bool loadOnly, CancellationToken cancellationToken) + public static ValueTask GetSyntaxTreeIndexAsync(this Document document, bool loadOnly, CancellationToken cancellationToken) => SyntaxTreeIndex.GetIndexAsync(document, loadOnly, cancellationToken); /// From f69f347622be69f7c3db85cfd60254ef2e0d31da Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Mon, 5 Oct 2020 11:26:28 -0700 Subject: [PATCH 157/295] Avoid captures in GetIdentifierOrGlobalNamespaceTokensWithText --- .../FindReferences/FindReferenceCache.cs | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/FindReferenceCache.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/FindReferenceCache.cs index 6d7f7a1e9624e..307e6066438da 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/FindReferenceCache.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/FindReferenceCache.cs @@ -12,6 +12,7 @@ using System.Linq; using System.Threading; using Microsoft.CodeAnalysis.LanguageServices; +using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; @@ -84,25 +85,34 @@ public static ImmutableArray GetIdentifierOrGlobalNamespaceTokensWi syntaxFacts, root, sourceText, key, cancellationToken)); } + [PerformanceSensitive("https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1224834", AllowCaptures = false)] private static ImmutableArray GetIdentifierOrGlobalNamespaceTokensWithText( ISyntaxFactsService syntaxFacts, SyntaxNode root, SourceText sourceText, string text, CancellationToken cancellationToken) { - // identifier is not escaped if (sourceText != null) { - return GetTokensFromText(syntaxFacts, root, sourceText, text, IsCandidate, cancellationToken); + // identifier is not escaped + Func isCandidate = static (t, syntaxFacts, text) => IsCandidate(t, syntaxFacts, text); + return GetTokensFromText(syntaxFacts, root, sourceText, text, isCandidate, cancellationToken); } + else + { + // identifier is escaped + using var _ = PooledDelegates.GetPooledFunction( + static (t, arg) => IsCandidate(t, arg.syntaxFacts, arg.text), + (syntaxFacts, text), + out var isCandidate); - // identifier is escaped - return root.DescendantTokens(descendIntoTrivia: true).Where(IsCandidate).ToImmutableArray(); + return root.DescendantTokens(descendIntoTrivia: true).Where(isCandidate).ToImmutableArray(); + } - bool IsCandidate(SyntaxToken t) + static bool IsCandidate(SyntaxToken t, ISyntaxFactsService syntaxFacts, string text) => syntaxFacts.IsGlobalNamespaceKeyword(t) || (syntaxFacts.IsIdentifier(t) && syntaxFacts.TextMatch(t.ValueText, text)); } private static ImmutableArray GetTokensFromText( - ISyntaxFactsService syntaxFacts, SyntaxNode root, SourceText content, string text, Func candidate, CancellationToken cancellationToken) + ISyntaxFactsService syntaxFacts, SyntaxNode root, SourceText content, string text, Func candidate, CancellationToken cancellationToken) { if (text.Length == 0) { @@ -120,7 +130,7 @@ private static ImmutableArray GetTokensFromText( var token = root.FindToken(index, findInsideTrivia: true); var span = token.Span; - if (!token.IsMissing && span.Start == index && span.Length == text.Length && candidate(token)) + if (!token.IsMissing && span.Start == index && span.Length == text.Length && candidate(token, syntaxFacts, text)) { result.Add(token); } From 15c471d1d1fd092ec0378cd1e1007e889b475591 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Mon, 5 Oct 2020 21:36:52 -0700 Subject: [PATCH 158/295] Avoid costly Regex-based parsing in AbstractReferenceFinder --- ...tractReferenceFinder_GlobalSuppressions.cs | 146 ++++++++++++------ 1 file changed, 101 insertions(+), 45 deletions(-) diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder_GlobalSuppressions.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder_GlobalSuppressions.cs index a1d72d7dddaa6..46393023ed530 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder_GlobalSuppressions.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder_GlobalSuppressions.cs @@ -2,37 +2,21 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; using System.Collections.Immutable; using System.Diagnostics.CodeAnalysis; -using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; +using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.FindSymbols.Finders { internal abstract partial class AbstractReferenceFinder : IReferenceFinder { - /// - /// Regex for symbol documentation comment ID. - /// For example, "~M:C.X(System.String)" represents the documentation comment ID of a method named 'X' - /// that takes a single string typed parameter and is contained in a type named 'C'. - /// - /// We divide the regex it into 3 groups: - /// 1. Prefix: - /// - Starts with an optional '~' - /// - Followed by a single capital letter indicating the symbol kind (for example, 'M' indicates method symbol) - /// - Followed by ':' - /// 2. Core symbol ID, which is its fully qualified name before the optional parameter list and return type (i.e. before the '(' or '[' tokens) - /// 3. Optional parameter list and/or return type that begins with a '(' or '[' tokens. - /// - /// For the above example, "~M:" is the prefix, "C.X" is the core symbol ID and "(System.String)" is the parameter list. - /// - private static readonly Regex s_docCommentIdPattern = new(@"(~?[A-Z]:)([^([]*)(.*)"); - protected static bool ShouldFindReferencesInGlobalSuppressions(ISymbol symbol, [NotNullWhen(returnValue: true)] out string? documentationCommentId) { if (!SupportsGlobalSuppression(symbol)) @@ -100,7 +84,7 @@ protected static async Task> FindReferencesInDocu using var _ = ArrayBuilder.GetInstance(out var locations); foreach (var token in root.DescendantTokens()) { - if (IsCandidate(token, expectedDocCommentId, semanticModel, syntaxFacts, suppressMessageAttribute, cancellationToken, out var offsetOfReferenceInToken)) + if (IsCandidate(token, expectedDocCommentId.Span, semanticModel, syntaxFacts, suppressMessageAttribute, cancellationToken, out var offsetOfReferenceInToken)) { var referenceLocation = CreateReferenceLocation(offsetOfReferenceInToken, token, root, document, syntaxFacts); locations.Add(new FinderLocation(token.GetRequiredParent(), referenceLocation)); @@ -111,7 +95,7 @@ protected static async Task> FindReferencesInDocu // Local functions static bool IsCandidate( - SyntaxToken token, string expectedDocCommentId, SemanticModel semanticModel, ISyntaxFacts syntaxFacts, + SyntaxToken token, ReadOnlySpan expectedDocCommentId, SemanticModel semanticModel, ISyntaxFacts syntaxFacts, INamedTypeSymbol suppressMessageAttribute, CancellationToken cancellationToken, out int offsetOfReferenceInToken) { offsetOfReferenceInToken = -1; @@ -123,7 +107,7 @@ static bool IsCandidate( } // Target string must contain a valid symbol DocumentationCommentId. - if (!ValidateAndSplitDocumentationCommentId(token.ValueText, out var prefix, out var idPartBeforeArguments, out var arguments)) + if (!ValidateAndSplitDocumentationCommentId(token.ValueText, out var prefix, out var docCommentId)) { return false; } @@ -139,8 +123,7 @@ static bool IsCandidate( // When doing a FAR query on 'Field', we would return true from case 1. // When doing a FAR query on 'C', we would return true from case 2. - var docCommentId = idPartBeforeArguments + arguments; - if (!docCommentId.StartsWith(expectedDocCommentId)) + if (!docCommentId.Span.StartsWith(expectedDocCommentId)) { return false; } @@ -152,7 +135,7 @@ static bool IsCandidate( { // Expected doc comment ID belongs to a containing symbol of the symbol referenced in suppression's target doc comment ID. // Verify the next character in suppression doc comment ID is the '.' separator for its member. - if (docCommentId[expectedDocCommentId.Length] != '.') + if (docCommentId.Span[expectedDocCommentId.Length] != '.') return false; offsetOfReferenceInToken += expectedDocCommentId.LastIndexOf('.') + 1; @@ -160,7 +143,8 @@ static bool IsCandidate( else { // Expected doc comment ID matches the suppression's target doc comment ID. - offsetOfReferenceInToken += idPartBeforeArguments.LastIndexOf('.') + 1; + SplitIdAndArguments(docCommentId, out var idPartBeforeArguments, out var _); + offsetOfReferenceInToken += idPartBeforeArguments.Span.LastIndexOf('.') + 1; } return true; @@ -254,42 +238,114 @@ static ReferenceLocation CreateReferenceLocation( private static bool TryGetExpectedDocumentationCommentId( string id, - [NotNullWhen(true)] out string? docCommentId) + out ReadOnlyMemory docCommentId) { - if (!ValidateAndSplitDocumentationCommentId(id, out _, out var idPartBeforeArguments, out var arguments)) + return ValidateAndSplitDocumentationCommentId(id, out _, out docCommentId); + } + + /// + /// Validate and split a documentation comment ID into a prefix and complete symbol ID. For the + /// ~M:C.X(System.String), the would be + /// ~M: and would be C.X(System.String). + /// + [PerformanceSensitive("https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1224834", Constraint = "Avoid Regex splitting due to high allocation costs.")] + private static bool ValidateAndSplitDocumentationCommentId( + [NotNullWhen(true)] string? docCommentId, + out ReadOnlyMemory prefix, + out ReadOnlyMemory id) + { + prefix = ReadOnlyMemory.Empty; + id = ReadOnlyMemory.Empty; + if (docCommentId is null) + { + return false; + } + + // Parse the prefix + if (docCommentId.StartsWith("~")) + { + if (docCommentId.Length < 3) + return false; + + prefix = docCommentId.AsMemory()[0..3]; + } + else + { + if (docCommentId.Length < 2) + return false; + + prefix = docCommentId.AsMemory()[0..2]; + } + + if (prefix.Span[^2] is < 'A' or > 'Z') + { + return false; + } + + if (prefix.Span[^1] is not ':') { - docCommentId = null; return false; } - docCommentId = idPartBeforeArguments + arguments; + // The rest of the ID is returned without splitting + id = docCommentId.AsMemory()[prefix.Length..]; return true; } - private static bool ValidateAndSplitDocumentationCommentId( - string docCommentId, - [NotNullWhen(true)] out string? prefix, - [NotNullWhen(true)] out string? idPartBeforeArguments, - [NotNullWhen(true)] out string? arguments) + /// + /// Split a full documentation symbol ID into the core symbol ID and optional parameter list. For the + /// C.X(System.String), the would be + /// C.X and would be (System.String). + /// + private static void SplitIdAndArguments( + ReadOnlyMemory id, + out ReadOnlyMemory idPartBeforeArguments, + out ReadOnlyMemory arguments) { - prefix = null; - idPartBeforeArguments = null; - arguments = null; - if (docCommentId == null) + ReadOnlySpan argumentSeparators = stackalloc[] { '(', '[' }; + var indexOfArguments = id.Span.IndexOfAny(argumentSeparators); + if (indexOfArguments < 0) { - return false; + idPartBeforeArguments = id; + arguments = ReadOnlyMemory.Empty; + } + else + { + idPartBeforeArguments = id[0..indexOfArguments]; + arguments = id[indexOfArguments..]; } + } - // Match the documentation comment ID with the regex - var match = s_docCommentIdPattern.Match(docCommentId); - if (!match.Success) + /// + /// Validate and split symbol documentation comment ID. + /// For example, "~M:C.X(System.String)" represents the documentation comment ID of a method named 'X' + /// that takes a single string-typed parameter and is contained in a type named 'C'. + /// + /// We divide the ID into 3 groups: + /// 1. Prefix: + /// - Starts with an optional '~' + /// - Followed by a single capital letter indicating the symbol kind (for example, 'M' indicates method symbol) + /// - Followed by ':' + /// 2. Core symbol ID, which is its fully qualified name before the optional parameter list and return type (i.e. before the '(' or '[' tokens) + /// 3. Optional parameter list and/or return type that begins with a '(' or '[' tokens. + /// + /// For the above example, "~M:" is the prefix, "C.X" is the core symbol ID and "(System.String)" is the parameter list. + /// + private static bool ValidateAndSplitDocumentationCommentId( + [NotNullWhen(true)] string? docCommentId, + out ReadOnlyMemory prefix, + out ReadOnlyMemory idPartBeforeArguments, + out ReadOnlyMemory arguments) + { + idPartBeforeArguments = ReadOnlyMemory.Empty; + arguments = ReadOnlyMemory.Empty; + if (!ValidateAndSplitDocumentationCommentId(docCommentId, out prefix, out var id)) { return false; } - prefix = match.Groups[1].Value; - idPartBeforeArguments = match.Groups[2].Value; - arguments = match.Groups[3].Value; + // Parse the id part and arguments + SplitIdAndArguments(id, out idPartBeforeArguments, out arguments); return true; } } From 6344c7ae3bb68efb7e64b7519709dc206ff148b9 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Mon, 5 Oct 2020 21:59:16 -0700 Subject: [PATCH 159/295] Avoid Task allocations in reference finders --- .../DelegateInvokeMethodReferenceFinder.cs | 2 +- .../AbstractMemberScopedReferenceFinder.cs | 2 +- .../Finders/AbstractReferenceFinder.cs | 25 ++++++++++--------- ...tractReferenceFinder_GlobalSuppressions.cs | 3 ++- ...tructorInitializerSymbolReferenceFinder.cs | 2 +- .../ConstructorSymbolReferenceFinder.cs | 14 +++++------ .../DestructorSymbolReferenceFinder.cs | 4 +-- .../Finders/EventSymbolReferenceFinder.cs | 2 +- .../ExplicitInterfaceMethodReferenceFinder.cs | 4 +-- .../Finders/FieldSymbolReferenceFinder.cs | 2 +- .../Finders/IReferenceFinder.cs | 2 +- .../Finders/LinkedFileReferenceFinder.cs | 4 +-- ...ethodTypeParameterSymbolReferenceFinder.cs | 2 +- .../Finders/NamedTypeSymbolReferenceFinder.cs | 14 +++++------ .../Finders/NamespaceSymbolReferenceFinder.cs | 2 +- .../Finders/OperatorSymbolReferenceFinder.cs | 2 +- .../Finders/OrdinaryMethodReferenceFinder.cs | 2 +- .../Finders/ParameterSymbolReferenceFinder.cs | 2 +- .../PropertyAccessorSymbolReferenceFinder.cs | 2 +- .../Finders/PropertySymbolReferenceFinder.cs | 2 +- .../TypeParameterSymbolReferenceFinder.cs | 2 +- 21 files changed, 49 insertions(+), 47 deletions(-) diff --git a/src/Features/Core/Portable/ChangeSignature/DelegateInvokeMethodReferenceFinder.cs b/src/Features/Core/Portable/ChangeSignature/DelegateInvokeMethodReferenceFinder.cs index 48fbd0c8f2c42..8ad3929ab6a06 100644 --- a/src/Features/Core/Portable/ChangeSignature/DelegateInvokeMethodReferenceFinder.cs +++ b/src/Features/Core/Portable/ChangeSignature/DelegateInvokeMethodReferenceFinder.cs @@ -71,7 +71,7 @@ protected override Task> DetermineDocumentsToSearchAsyn return Task.FromResult(project.Documents.ToImmutableArray()); } - protected override async Task> FindReferencesInDocumentAsync( + protected override async ValueTask> FindReferencesInDocumentAsync( IMethodSymbol methodSymbol, Document document, SemanticModel semanticModel, diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractMemberScopedReferenceFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractMemberScopedReferenceFinder.cs index 4100c34127ca2..3bebad027df09 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractMemberScopedReferenceFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractMemberScopedReferenceFinder.cs @@ -47,7 +47,7 @@ protected override Task> DetermineDocumentsToSearchAsyn return Task.FromResult(ImmutableArray.Create(document)); } - protected override async Task> FindReferencesInDocumentAsync( + protected override async ValueTask> FindReferencesInDocumentAsync( TSymbol symbol, Document document, SemanticModel semanticModel, diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder.cs index a55c72e95512f..da3b22e55c747 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder.cs @@ -34,7 +34,7 @@ public abstract Task> DetermineCascadedSymbolsAsync( public abstract Task> DetermineDocumentsToSearchAsync( ISymbol symbol, Project project, IImmutableSet documents, FindReferencesSearchOptions options, CancellationToken cancellationToken); - public abstract Task> FindReferencesInDocumentAsync( + public abstract ValueTask> FindReferencesInDocumentAsync( ISymbol symbol, Document document, SemanticModel semanticModel, FindReferencesSearchOptions options, CancellationToken cancellationToken); protected static bool TryGetNameWithoutAttributeSuffix( @@ -149,7 +149,7 @@ protected static Task> FindDocumentsAsync( protected static bool IdentifiersMatch(ISyntaxFactsService syntaxFacts, string name, SyntaxToken token) => syntaxFacts.IsIdentifier(token) && syntaxFacts.TextMatch(token.ValueText, name); - protected static Task> FindReferencesInDocumentUsingIdentifierAsync( + protected static ValueTask> FindReferencesInDocumentUsingIdentifierAsync( ISymbol symbol, string identifier, Document document, @@ -161,7 +161,7 @@ protected static Task> FindReferencesInDocumentUs cancellationToken: cancellationToken); } - protected static Task> FindReferencesInDocumentUsingIdentifierAsync( + protected static ValueTask> FindReferencesInDocumentUsingIdentifierAsync( ISymbol symbol, string identifier, Document document, @@ -174,7 +174,7 @@ protected static Task> FindReferencesInDocumentUs symbol, identifier, document, semanticModel, symbolsMatch, cancellationToken); } - protected static Task> FindReferencesInDocumentUsingIdentifierAsync( + protected static ValueTask> FindReferencesInDocumentUsingIdentifierAsync( ISymbol symbol, string identifier, Document document, @@ -188,7 +188,8 @@ protected static Task> FindReferencesInDocumentUs docCommentId, findInGlobalSuppressions, cancellationToken); } - protected static async Task> FindReferencesInDocumentUsingIdentifierAsync( + [PerformanceSensitive("https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1224834", OftenCompletesSynchronously = true)] + protected static async ValueTask> FindReferencesInDocumentUsingIdentifierAsync( string identifier, Document document, SemanticModel semanticModel, @@ -900,7 +901,7 @@ protected abstract Task> DetermineDocumentsToSearchAsyn TSymbol symbol, Project project, IImmutableSet documents, FindReferencesSearchOptions options, CancellationToken cancellationToken); - protected abstract Task> FindReferencesInDocumentAsync( + protected abstract ValueTask> FindReferencesInDocumentAsync( TSymbol symbol, Document document, SemanticModel semanticModel, FindReferencesSearchOptions options, CancellationToken cancellationToken); @@ -920,13 +921,13 @@ public override Task> DetermineDocumentsToSearchAsync( : SpecializedTasks.EmptyImmutableArray(); } - public override Task> FindReferencesInDocumentAsync( + public override ValueTask> FindReferencesInDocumentAsync( ISymbol symbol, Document document, SemanticModel semanticModel, FindReferencesSearchOptions options, CancellationToken cancellationToken) { return symbol is TSymbol typedSymbol && CanFind(typedSymbol) ? FindReferencesInDocumentAsync(typedSymbol, document, semanticModel, options, cancellationToken) - : SpecializedTasks.EmptyImmutableArray(); + : new ValueTask>(ImmutableArray.Empty); } public override Task> DetermineCascadedSymbolsAsync( @@ -959,7 +960,7 @@ protected virtual Task> DetermineCascadedSymbolsAsync( return SpecializedTasks.EmptyImmutableArray(); } - protected static Task> FindReferencesInDocumentUsingSymbolNameAsync( + protected static ValueTask> FindReferencesInDocumentUsingSymbolNameAsync( TSymbol symbol, Document document, SemanticModel semanticModel, @@ -1002,7 +1003,7 @@ protected static ValueTask> FindReferencesInToken cancellationToken); } - protected static Task> FindReferencesInDocumentAsync( + protected static ValueTask> FindReferencesInDocumentAsync( TSymbol symbol, Document document, SemanticModel semanticModel, @@ -1014,7 +1015,7 @@ protected static Task> FindReferencesInDocumentAs findParentNode: null, cancellationToken: cancellationToken); } - protected static Task> FindReferencesInDocumentAsync( + protected static ValueTask> FindReferencesInDocumentAsync( TSymbol symbol, Document document, SemanticModel semanticModel, @@ -1028,7 +1029,7 @@ protected static Task> FindReferencesInDocumentAs symbolsMatchAsync, docCommentId, findInGlobalSuppressions, cancellationToken); } - protected static async Task> FindReferencesInDocumentAsync( + protected static async ValueTask> FindReferencesInDocumentAsync( Document document, SemanticModel semanticModel, Func tokensMatch, diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder_GlobalSuppressions.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder_GlobalSuppressions.cs index 46393023ed530..254812a3fb3e5 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder_GlobalSuppressions.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder_GlobalSuppressions.cs @@ -50,7 +50,8 @@ static bool SupportsGlobalSuppression(ISymbol symbol) /// A reference to this field inside a global suppression would be as following: /// [assembly: SuppressMessage("RuleCategory", "RuleId', Scope = "member", Target = "~F:C.Field")] /// - protected static async Task> FindReferencesInDocumentInsideGlobalSuppressionsAsync( + [PerformanceSensitive("https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1224834", OftenCompletesSynchronously = true)] + protected static async ValueTask> FindReferencesInDocumentInsideGlobalSuppressionsAsync( Document document, SemanticModel semanticModel, ISyntaxFacts syntaxFacts, diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/ConstructorInitializerSymbolReferenceFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/ConstructorInitializerSymbolReferenceFinder.cs index e72226e22af8f..230a6287561d9 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/ConstructorInitializerSymbolReferenceFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/ConstructorInitializerSymbolReferenceFinder.cs @@ -49,7 +49,7 @@ protected override Task> DetermineDocumentsToSearchAsyn }, cancellationToken); } - protected override async Task> FindReferencesInDocumentAsync( + protected override async ValueTask> FindReferencesInDocumentAsync( IMethodSymbol methodSymbol, Document document, SemanticModel semanticModel, diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/ConstructorSymbolReferenceFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/ConstructorSymbolReferenceFinder.cs index 28be0b19a63df..4f080112a777b 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/ConstructorSymbolReferenceFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/ConstructorSymbolReferenceFinder.cs @@ -63,7 +63,7 @@ private static bool IsPotentialReference( predefinedType == actualType; } - protected override Task> FindReferencesInDocumentAsync( + protected override ValueTask> FindReferencesInDocumentAsync( IMethodSymbol methodSymbol, Document document, SemanticModel semanticModel, @@ -73,7 +73,7 @@ protected override Task> FindReferencesInDocument return FindAllReferencesInDocumentAsync(methodSymbol, document, semanticModel, cancellationToken); } - internal async Task> FindAllReferencesInDocumentAsync( + internal async ValueTask> FindAllReferencesInDocumentAsync( IMethodSymbol methodSymbol, Document document, SemanticModel semanticModel, @@ -104,7 +104,7 @@ private async Task> FindReferencesInDocumentWorke return ordinaryRefs.Concat(attributeRefs, predefinedTypeRefs, implicitObjectCreationMatches); } - private static Task> FindOrdinaryReferencesAsync( + private static ValueTask> FindOrdinaryReferencesAsync( IMethodSymbol symbol, Document document, SemanticModel semanticModel, @@ -116,7 +116,7 @@ private static Task> FindOrdinaryReferencesAsync( symbol, name, document, semanticModel, findParentNode, cancellationToken); } - private static Task> FindPredefinedTypeReferencesAsync( + private static ValueTask> FindPredefinedTypeReferencesAsync( IMethodSymbol symbol, Document document, SemanticModel semanticModel, @@ -125,7 +125,7 @@ private static Task> FindPredefinedTypeReferences var predefinedType = symbol.ContainingType.SpecialType.ToPredefinedType(); if (predefinedType == PredefinedType.None) { - return SpecializedTasks.EmptyImmutableArray(); + return new ValueTask>(ImmutableArray.Empty); } var syntaxFacts = document.GetRequiredLanguageService(); @@ -135,7 +135,7 @@ private static Task> FindPredefinedTypeReferences cancellationToken); } - private static Task> FindAttributeReferencesAsync( + private static ValueTask> FindAttributeReferencesAsync( IMethodSymbol symbol, Document document, SemanticModel semanticModel, @@ -144,7 +144,7 @@ private static Task> FindAttributeReferencesAsync var syntaxFacts = document.GetRequiredLanguageService(); return TryGetNameWithoutAttributeSuffix(symbol.ContainingType.Name, syntaxFacts, out var simpleName) ? FindReferencesInDocumentUsingIdentifierAsync(symbol, simpleName, document, semanticModel, cancellationToken) - : SpecializedTasks.EmptyImmutableArray(); + : new ValueTask>(ImmutableArray.Empty); } } } diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/DestructorSymbolReferenceFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/DestructorSymbolReferenceFinder.cs index 139048d7ad1f9..74afe3d0ac627 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/DestructorSymbolReferenceFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/DestructorSymbolReferenceFinder.cs @@ -34,14 +34,14 @@ protected override Task> DetermineDocumentsToSearchAsyn return SpecializedTasks.EmptyImmutableArray(); } - protected override Task> FindReferencesInDocumentAsync( + protected override ValueTask> FindReferencesInDocumentAsync( IMethodSymbol methodSymbol, Document document, SemanticModel semanticModel, FindReferencesSearchOptions options, CancellationToken cancellationToken) { - return SpecializedTasks.EmptyImmutableArray(); + return new ValueTask>(ImmutableArray.Empty); } } } diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/EventSymbolReferenceFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/EventSymbolReferenceFinder.cs index d4657403470a5..9c753414dd96b 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/EventSymbolReferenceFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/EventSymbolReferenceFinder.cs @@ -46,7 +46,7 @@ protected override Task> DetermineDocumentsToSearchAsyn return FindDocumentsAsync(project, documents, findInGlobalSuppressions: true, cancellationToken, symbol.Name); } - protected override Task> FindReferencesInDocumentAsync( + protected override ValueTask> FindReferencesInDocumentAsync( IEventSymbol symbol, Document document, SemanticModel semanticModel, diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/ExplicitInterfaceMethodReferenceFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/ExplicitInterfaceMethodReferenceFinder.cs index 4fd2ec03545f2..b801fa56ebd57 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/ExplicitInterfaceMethodReferenceFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/ExplicitInterfaceMethodReferenceFinder.cs @@ -36,7 +36,7 @@ protected override Task> DetermineDocumentsToSearchAsyn return SpecializedTasks.EmptyImmutableArray(); } - protected override Task> FindReferencesInDocumentAsync( + protected override ValueTask> FindReferencesInDocumentAsync( IMethodSymbol symbol, Document document, SemanticModel semanticModel, @@ -44,7 +44,7 @@ protected override Task> FindReferencesInDocument CancellationToken cancellationToken) { // An explicit method can't be referenced anywhere. - return SpecializedTasks.EmptyImmutableArray(); + return new ValueTask>(ImmutableArray.Empty); } } } diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/FieldSymbolReferenceFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/FieldSymbolReferenceFinder.cs index edd4df5003a27..82e2c70d70a45 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/FieldSymbolReferenceFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/FieldSymbolReferenceFinder.cs @@ -41,7 +41,7 @@ protected override Task> DetermineDocumentsToSearchAsyn return FindDocumentsAsync(project, documents, findInGlobalSuppressions: true, cancellationToken, symbol.Name); } - protected override Task> FindReferencesInDocumentAsync( + protected override ValueTask> FindReferencesInDocumentAsync( IFieldSymbol symbol, Document document, SemanticModel semanticModel, diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/IReferenceFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/IReferenceFinder.cs index 5f41df416d4f1..07cc27c05abc8 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/IReferenceFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/IReferenceFinder.cs @@ -67,7 +67,7 @@ Task> DetermineDocumentsToSearchAsync( /// /// Implementations of this method must be thread-safe. /// - Task> FindReferencesInDocumentAsync( + ValueTask> FindReferencesInDocumentAsync( ISymbol symbol, Document document, SemanticModel semanticModel, FindReferencesSearchOptions options, CancellationToken cancellationToken); } diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/LinkedFileReferenceFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/LinkedFileReferenceFinder.cs index 03c818bc41f3c..3f68cf62efbee 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/LinkedFileReferenceFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/LinkedFileReferenceFinder.cs @@ -28,11 +28,11 @@ public Task> DetermineDocumentsToSearchAsync( public Task> DetermineProjectsToSearchAsync(ISymbol symbol, Solution solution, IImmutableSet? projects = null, CancellationToken cancellationToken = default) => SpecializedTasks.EmptyImmutableArray(); - public Task> FindReferencesInDocumentAsync( + public ValueTask> FindReferencesInDocumentAsync( ISymbol symbol, Document document, SemanticModel semanticModel, FindReferencesSearchOptions options, CancellationToken cancellationToken) { - return SpecializedTasks.EmptyImmutableArray(); + return new ValueTask>(ImmutableArray.Empty); } } } diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/MethodTypeParameterSymbolReferenceFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/MethodTypeParameterSymbolReferenceFinder.cs index 2c0c457f975a1..004801382a9bb 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/MethodTypeParameterSymbolReferenceFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/MethodTypeParameterSymbolReferenceFinder.cs @@ -73,7 +73,7 @@ private static string GetMemberNameWithoutInterfaceName(string fullName) : fullName; } - protected override Task> FindReferencesInDocumentAsync( + protected override ValueTask> FindReferencesInDocumentAsync( ITypeParameterSymbol symbol, Document document, SemanticModel semanticModel, diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/NamedTypeSymbolReferenceFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/NamedTypeSymbolReferenceFinder.cs index 650c33d2e721b..69e03b21f85b0 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/NamedTypeSymbolReferenceFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/NamedTypeSymbolReferenceFinder.cs @@ -75,7 +75,7 @@ private static bool IsPotentialReference( predefinedType == actualType; } - protected override async Task> FindReferencesInDocumentAsync( + protected override async ValueTask> FindReferencesInDocumentAsync( INamedTypeSymbol namedType, Document document, SemanticModel semanticModel, @@ -88,7 +88,7 @@ protected override async Task> FindReferencesInDo return nonAliasReferences.Concat(aliasReferences); } - internal static async Task> FindNonAliasReferencesAsync( + internal static async ValueTask> FindNonAliasReferencesAsync( INamedTypeSymbol symbol, Document document, SemanticModel semanticModel, @@ -100,7 +100,7 @@ internal static async Task> FindNonAliasReference return ordinaryRefs.Concat(attributeRefs).Concat(predefinedTypeRefs); } - private static Task> FindOrdinaryReferencesAsync( + private static ValueTask> FindOrdinaryReferencesAsync( INamedTypeSymbol namedType, Document document, SemanticModel semanticModel, @@ -117,7 +117,7 @@ private static Task> FindOrdinaryReferencesAsync( namedType, namedType.Name, document, semanticModel, symbolsMatch, cancellationToken); } - private static Task> FindPredefinedTypeReferencesAsync( + private static ValueTask> FindPredefinedTypeReferencesAsync( INamedTypeSymbol symbol, Document document, SemanticModel semanticModel, @@ -126,7 +126,7 @@ private static Task> FindPredefinedTypeReferences var predefinedType = symbol.SpecialType.ToPredefinedType(); if (predefinedType == PredefinedType.None) { - return SpecializedTasks.EmptyImmutableArray(); + return new ValueTask>(ImmutableArray.Empty); } var syntaxFacts = document.GetRequiredLanguageService(); @@ -138,7 +138,7 @@ private static Task> FindPredefinedTypeReferences cancellationToken); } - private static Task> FindAttributeReferencesAsync( + private static ValueTask> FindAttributeReferencesAsync( INamedTypeSymbol namedType, Document document, SemanticModel semanticModel, @@ -149,7 +149,7 @@ private static Task> FindAttributeReferencesAsync return TryGetNameWithoutAttributeSuffix(namedType.Name, syntaxFacts, out var simpleName) ? FindReferencesInDocumentUsingIdentifierAsync(simpleName, document, semanticModel, symbolsMatch, docCommentId: null, findInGlobalSuppressions: false, cancellationToken) - : SpecializedTasks.EmptyImmutableArray(); + : new ValueTask>(ImmutableArray.Empty); } } } diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/NamespaceSymbolReferenceFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/NamespaceSymbolReferenceFinder.cs index 465093043b1aa..616370b4c300e 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/NamespaceSymbolReferenceFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/NamespaceSymbolReferenceFinder.cs @@ -34,7 +34,7 @@ private static string GetNamespaceIdentifierName(INamespaceSymbol symbol) : symbol.Name; } - protected override async Task> FindReferencesInDocumentAsync( + protected override async ValueTask> FindReferencesInDocumentAsync( INamespaceSymbol symbol, Document document, SemanticModel semanticModel, diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/OperatorSymbolReferenceFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/OperatorSymbolReferenceFinder.cs index e7adae10cbc1b..11d14c1a0307f 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/OperatorSymbolReferenceFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/OperatorSymbolReferenceFinder.cs @@ -26,7 +26,7 @@ protected override Task> DetermineDocumentsToSearchAsyn return FindDocumentsAsync(project, documents, op, cancellationToken); } - protected override Task> FindReferencesInDocumentAsync( + protected override ValueTask> FindReferencesInDocumentAsync( IMethodSymbol symbol, Document document, SemanticModel semanticModel, diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/OrdinaryMethodReferenceFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/OrdinaryMethodReferenceFinder.cs index 353852a18aefe..e7ee06dd396a6 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/OrdinaryMethodReferenceFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/OrdinaryMethodReferenceFinder.cs @@ -114,7 +114,7 @@ private static bool IsDeconstructMethod(IMethodSymbol methodSymbol) private static bool IsGetAwaiterMethod(IMethodSymbol methodSymbol) => methodSymbol.Name == WellKnownMemberNames.GetAwaiter; - protected override async Task> FindReferencesInDocumentAsync( + protected override async ValueTask> FindReferencesInDocumentAsync( IMethodSymbol symbol, Document document, SemanticModel semanticModel, diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/ParameterSymbolReferenceFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/ParameterSymbolReferenceFinder.cs index b04d1b28dfad8..eb1ff62d846bd 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/ParameterSymbolReferenceFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/ParameterSymbolReferenceFinder.cs @@ -34,7 +34,7 @@ protected override Task> DetermineDocumentsToSearchAsyn return FindDocumentsAsync(project, documents, findInGlobalSuppressions: false, cancellationToken, symbol.Name); } - protected override Task> FindReferencesInDocumentAsync( + protected override ValueTask> FindReferencesInDocumentAsync( IParameterSymbol symbol, Document document, SemanticModel semanticModel, diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/PropertyAccessorSymbolReferenceFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/PropertyAccessorSymbolReferenceFinder.cs index 7a4b0ff9566e0..a6a03d153f9d1 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/PropertyAccessorSymbolReferenceFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/PropertyAccessorSymbolReferenceFinder.cs @@ -65,7 +65,7 @@ protected override async Task> DetermineDocumentsToSear return result; } - protected override async Task> FindReferencesInDocumentAsync( + protected override async ValueTask> FindReferencesInDocumentAsync( IMethodSymbol symbol, Document document, SemanticModel semanticModel, FindReferencesSearchOptions options, CancellationToken cancellationToken) { diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/PropertySymbolReferenceFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/PropertySymbolReferenceFinder.cs index 15c4f6d49876b..325a133b2174b 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/PropertySymbolReferenceFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/PropertySymbolReferenceFinder.cs @@ -81,7 +81,7 @@ protected override async Task> DetermineDocumentsToSear private static bool IsForEachProperty(IPropertySymbol symbol) => symbol.Name == WellKnownMemberNames.CurrentPropertyName; - protected override async Task> FindReferencesInDocumentAsync( + protected override async ValueTask> FindReferencesInDocumentAsync( IPropertySymbol symbol, Document document, SemanticModel semanticModel, FindReferencesSearchOptions options, CancellationToken cancellationToken) { diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/TypeParameterSymbolReferenceFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/TypeParameterSymbolReferenceFinder.cs index d12c260174c0a..5f34a6fb7817b 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/TypeParameterSymbolReferenceFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/TypeParameterSymbolReferenceFinder.cs @@ -30,7 +30,7 @@ protected override Task> DetermineDocumentsToSearchAsyn return FindDocumentsAsync(project, documents, findInGlobalSuppressions: false, cancellationToken, symbol.Name, symbol.ContainingType.Name); } - protected override Task> FindReferencesInDocumentAsync( + protected override ValueTask> FindReferencesInDocumentAsync( ITypeParameterSymbol symbol, Document document, SemanticModel semanticModel, From 4646331dab0b6891224846f1a19d8c8a27a5da93 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Mon, 5 Oct 2020 22:17:35 -0700 Subject: [PATCH 160/295] Avoid Task allocations in common document extensions --- ...ceFactory.SemanticModelWorkspaceService.cs | 2 +- .../AddedParameterOrExistingIndex.cs | 2 +- .../Implementation/AbstractEditorFactory.cs | 2 +- .../AddParameterDialogViewModel.cs | 2 +- .../Pythia/Api/PythiaDocumentExtensions.cs | 2 +- ...ceFactory.SemanticModelWorkspaceService.cs | 2 +- .../Core/Extensions/DocumentExtensions.cs | 28 ++++++++++++------- .../ISemanticModelReuseWorkspaceService.cs | 2 +- 8 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/CodeStyle/Core/CodeFixes/LanguageServices/SemanticModelWorkspaceService/SemanticModelWorkspaceServiceFactory.SemanticModelWorkspaceService.cs b/src/CodeStyle/Core/CodeFixes/LanguageServices/SemanticModelWorkspaceService/SemanticModelWorkspaceServiceFactory.SemanticModelWorkspaceService.cs index c598ebc13f64a..eb6fa32d58975 100644 --- a/src/CodeStyle/Core/CodeFixes/LanguageServices/SemanticModelWorkspaceService/SemanticModelWorkspaceServiceFactory.SemanticModelWorkspaceService.cs +++ b/src/CodeStyle/Core/CodeFixes/LanguageServices/SemanticModelWorkspaceService/SemanticModelWorkspaceServiceFactory.SemanticModelWorkspaceService.cs @@ -17,7 +17,7 @@ public SemanticModelReuseWorkspaceService(Workspace _) { } - public Task ReuseExistingSpeculativeModelAsync(Document document, SyntaxNode node, CancellationToken cancellationToken) + public ValueTask ReuseExistingSpeculativeModelAsync(Document document, SyntaxNode node, CancellationToken cancellationToken) { // TODO: port the GetSemanticModelForNodeAsync implementation from Workspaces layer, // which currently relies on a bunch of internal APIs. diff --git a/src/EditorFeatures/TestUtilities/ChangeSignature/AddedParameterOrExistingIndex.cs b/src/EditorFeatures/TestUtilities/ChangeSignature/AddedParameterOrExistingIndex.cs index c4a70ce2b208d..a54e40efeebf1 100644 --- a/src/EditorFeatures/TestUtilities/ChangeSignature/AddedParameterOrExistingIndex.cs +++ b/src/EditorFeatures/TestUtilities/ChangeSignature/AddedParameterOrExistingIndex.cs @@ -61,7 +61,7 @@ public override string ToString() internal AddedParameter GetAddedParameter(Document document) { - var semanticModel = document.GetRequiredSemanticModelAsync(CancellationToken.None).Result; + var semanticModel = document.GetRequiredSemanticModelAsync(CancellationToken.None).AsTask().Result; var type = document.Project.Language switch { diff --git a/src/VisualStudio/Core/Def/Implementation/AbstractEditorFactory.cs b/src/VisualStudio/Core/Def/Implementation/AbstractEditorFactory.cs index cf79bdf6d20cb..d2270ee55eaa6 100644 --- a/src/VisualStudio/Core/Def/Implementation/AbstractEditorFactory.cs +++ b/src/VisualStudio/Core/Def/Implementation/AbstractEditorFactory.cs @@ -321,7 +321,7 @@ private void FormatDocumentCreatedFromTemplate(IVsHierarchy hierarchy, uint item // Organize using directives addedDocument = ThreadHelper.JoinableTaskFactory.Run(() => OrganizeUsingsCreatedFromTemplateAsync(addedDocument, cancellationToken)); - rootToFormat = ThreadHelper.JoinableTaskFactory.Run(() => addedDocument.GetRequiredSyntaxRootAsync(cancellationToken)); + rootToFormat = ThreadHelper.JoinableTaskFactory.Run(() => addedDocument.GetRequiredSyntaxRootAsync(cancellationToken).AsTask()); // Format document var unformattedText = addedDocument.GetTextSynchronously(cancellationToken); diff --git a/src/VisualStudio/Core/Def/Implementation/ChangeSignature/AddParameterDialogViewModel.cs b/src/VisualStudio/Core/Def/Implementation/ChangeSignature/AddParameterDialogViewModel.cs index 43635dbd02c16..70a5c03791bb0 100644 --- a/src/VisualStudio/Core/Def/Implementation/ChangeSignature/AddParameterDialogViewModel.cs +++ b/src/VisualStudio/Core/Def/Implementation/ChangeSignature/AddParameterDialogViewModel.cs @@ -27,7 +27,7 @@ internal class AddParameterDialogViewModel : AbstractNotifyPropertyChanged public AddParameterDialogViewModel(Document document, int positionForTypeBinding) { _notificationService = document.Project.Solution.Workspace.Services.GetService(); - _semanticModel = document.GetRequiredSemanticModelAsync(CancellationToken.None).WaitAndGetResult_CanCallOnBackground(CancellationToken.None); + _semanticModel = document.GetRequiredSemanticModelAsync(CancellationToken.None).AsTask().WaitAndGetResult_CanCallOnBackground(CancellationToken.None); TypeIsEmptyImage = Visibility.Visible; TypeBindsImage = Visibility.Collapsed; diff --git a/src/Workspaces/Core/Portable/ExternalAccess/Pythia/Api/PythiaDocumentExtensions.cs b/src/Workspaces/Core/Portable/ExternalAccess/Pythia/Api/PythiaDocumentExtensions.cs index c096460e25ec5..677c6648a082f 100644 --- a/src/Workspaces/Core/Portable/ExternalAccess/Pythia/Api/PythiaDocumentExtensions.cs +++ b/src/Workspaces/Core/Portable/ExternalAccess/Pythia/Api/PythiaDocumentExtensions.cs @@ -11,6 +11,6 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.Pythia.Api internal static class PythiaDocumentExtensions { public static Task GetSemanticModelForNodeAsync(this Document document, SyntaxNode? node, CancellationToken cancellationToken) - => DocumentExtensions.ReuseExistingSpeculativeModelAsync(document, node, cancellationToken); + => DocumentExtensions.ReuseExistingSpeculativeModelAsync(document, node, cancellationToken).AsTask(); } } diff --git a/src/Workspaces/Core/Portable/SemanticModelReuse/SemanticModelWorkspaceServiceFactory.SemanticModelWorkspaceService.cs b/src/Workspaces/Core/Portable/SemanticModelReuse/SemanticModelWorkspaceServiceFactory.SemanticModelWorkspaceService.cs index c81912250541b..fe5ea8ca4250e 100644 --- a/src/Workspaces/Core/Portable/SemanticModelReuse/SemanticModelWorkspaceServiceFactory.SemanticModelWorkspaceService.cs +++ b/src/Workspaces/Core/Portable/SemanticModelReuse/SemanticModelWorkspaceServiceFactory.SemanticModelWorkspaceService.cs @@ -90,7 +90,7 @@ public SemanticModelReuseWorkspaceService(Workspace workspace) }; } - public async Task ReuseExistingSpeculativeModelAsync(Document document, SyntaxNode node, CancellationToken cancellationToken) + public async ValueTask ReuseExistingSpeculativeModelAsync(Document document, SyntaxNode node, CancellationToken cancellationToken) { var reuseService = document.GetRequiredLanguageService(); diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Extensions/DocumentExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Extensions/DocumentExtensions.cs index 7fc6063e78325..7cfe442bab5b6 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Extensions/DocumentExtensions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Extensions/DocumentExtensions.cs @@ -9,7 +9,6 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.GeneratedCodeRecognition; using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.SemanticModelReuse; using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; @@ -30,15 +29,21 @@ internal static partial class DocumentExtensions public static TLanguageService GetRequiredLanguageService(this Document document) where TLanguageService : class, ILanguageService => document.Project.GetRequiredLanguageService(); - public static async Task GetRequiredSemanticModelAsync(this Document document, CancellationToken cancellationToken) + public static async ValueTask GetRequiredSemanticModelAsync(this Document document, CancellationToken cancellationToken) { - var semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); + if (document.TryGetSemanticModel(out var semanticModel)) + return semanticModel; + + semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); return semanticModel ?? throw new InvalidOperationException(string.Format(WorkspaceExtensionsResources.SyntaxTree_is_required_to_accomplish_the_task_but_is_not_supported_by_document_0, document.Name)); } - public static async Task GetRequiredSyntaxTreeAsync(this Document document, CancellationToken cancellationToken) + public static async ValueTask GetRequiredSyntaxTreeAsync(this Document document, CancellationToken cancellationToken) { - var syntaxTree = await document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); + if (document.TryGetSyntaxTree(out var syntaxTree)) + return syntaxTree; + + syntaxTree = await document.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); return syntaxTree ?? throw new InvalidOperationException(string.Format(WorkspaceExtensionsResources.SyntaxTree_is_required_to_accomplish_the_task_but_is_not_supported_by_document_0, document.Name)); } @@ -50,9 +55,12 @@ public static SyntaxTree GetRequiredSyntaxTreeSynchronously(this Document docume } #endif - public static async Task GetRequiredSyntaxRootAsync(this Document document, CancellationToken cancellationToken) + public static async ValueTask GetRequiredSyntaxRootAsync(this Document document, CancellationToken cancellationToken) { - var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); + if (document.TryGetSyntaxRoot(out var root)) + return root; + + root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); return root ?? throw new InvalidOperationException(string.Format(WorkspaceExtensionsResources.SyntaxTree_is_required_to_accomplish_the_task_but_is_not_supported_by_document_0, document.Name)); } @@ -76,7 +84,7 @@ public static bool IsOpen(this TextDocument document) /// /// As a speculative semantic model may be returned, location based information provided by it may be innacurate. /// - public static Task ReuseExistingSpeculativeModelAsync(this Document document, int position, CancellationToken cancellationToken) + public static ValueTask ReuseExistingSpeculativeModelAsync(this Document document, int position, CancellationToken cancellationToken) => ReuseExistingSpeculativeModelAsync(document, new TextSpan(position, 0), cancellationToken); /// @@ -93,7 +101,7 @@ public static Task ReuseExistingSpeculativeModelAsync(this Docume /// /// As a speculative semantic model may be returned, location based information provided by it may be innacurate. /// - public static async Task ReuseExistingSpeculativeModelAsync(this Document document, TextSpan span, CancellationToken cancellationToken) + public static async ValueTask ReuseExistingSpeculativeModelAsync(this Document document, TextSpan span, CancellationToken cancellationToken) { Contract.ThrowIfFalse(document.SupportsSemanticModel); @@ -118,7 +126,7 @@ public static async Task ReuseExistingSpeculativeModelAsync(this /// /// As a speculative semantic model may be returned, location based information provided by it may be innacurate. /// - public static Task ReuseExistingSpeculativeModelAsync(this Document document, SyntaxNode? node, CancellationToken cancellationToken) + public static ValueTask ReuseExistingSpeculativeModelAsync(this Document document, SyntaxNode? node, CancellationToken cancellationToken) { if (node == null) return document.GetRequiredSemanticModelAsync(cancellationToken); diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceServices/SemanticModelReuse/ISemanticModelReuseWorkspaceService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceServices/SemanticModelReuse/ISemanticModelReuseWorkspaceService.cs index 2565078829672..95448a2708af2 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceServices/SemanticModelReuse/ISemanticModelReuseWorkspaceService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceServices/SemanticModelReuse/ISemanticModelReuseWorkspaceService.cs @@ -18,6 +18,6 @@ internal interface ISemanticModelReuseWorkspaceService : IWorkspaceService /// /// Don't call this directly. use (or an overload). /// - Task ReuseExistingSpeculativeModelAsync(Document document, SyntaxNode node, CancellationToken cancellationToken); + ValueTask ReuseExistingSpeculativeModelAsync(Document document, SyntaxNode node, CancellationToken cancellationToken); } } From 8917e3a8c2513167edd0affb0e4b72a60dfe400b Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Tue, 6 Oct 2020 18:34:33 +0000 Subject: [PATCH 161/295] Apply feedback --- .../MakeFieldReadonlyDiagnosticAnalyzer.cs | 15 ++++++++++++++- .../MakeFieldReadonlyTests.vb | 12 ++++++++++++ .../Symbol/StaticLocalDeclarationTests.vb | 19 +++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/src/Analyzers/Core/Analyzers/MakeFieldReadonly/MakeFieldReadonlyDiagnosticAnalyzer.cs b/src/Analyzers/Core/Analyzers/MakeFieldReadonly/MakeFieldReadonlyDiagnosticAnalyzer.cs index 6af0c17aff124..46294b6ab9b4f 100644 --- a/src/Analyzers/Core/Analyzers/MakeFieldReadonly/MakeFieldReadonlyDiagnosticAnalyzer.cs +++ b/src/Analyzers/Core/Analyzers/MakeFieldReadonly/MakeFieldReadonlyDiagnosticAnalyzer.cs @@ -115,7 +115,20 @@ static bool IsCandidateField(IFieldSymbol symbol, INamedTypeSymbol threadStaticA symbol.Locations.Length == 1 && symbol.Type.IsMutableValueType() == false && !symbol.IsFixedSizeBuffer && - !symbol.GetAttributes().Any(a => SymbolEqualityComparer.Default.Equals(a.AttributeClass, threadStaticAttribute)); + !ContainsAttribute(symbol, threadStaticAttribute); + + static bool ContainsAttribute(ISymbol symbol, INamedTypeSymbol attributeSymbol) + { + var attributes = symbol.GetAttributes(); + foreach (var attribute in attributes) + { + if (SymbolEqualityComparer.Default.Equals(attribute.AttributeClass, attributeSymbol)) + { + return true; + } + } + return false; + } // Method to update the field state for a candidate field written outside constructor and field initializer. void UpdateFieldStateOnWrite(IFieldSymbol field) diff --git a/src/Analyzers/VisualBasic/Tests/MakeFieldReadonly/MakeFieldReadonlyTests.vb b/src/Analyzers/VisualBasic/Tests/MakeFieldReadonly/MakeFieldReadonlyTests.vb index 65d54d265bd34..29c104d408bbc 100644 --- a/src/Analyzers/VisualBasic/Tests/MakeFieldReadonly/MakeFieldReadonlyTests.vb +++ b/src/Analyzers/VisualBasic/Tests/MakeFieldReadonly/MakeFieldReadonlyTests.vb @@ -965,6 +965,18 @@ End Class", Private Sub M(a() As Integer) Redim a(_goo) End Sub +End Class") + End Function + + + + Public Async Function WithThreadStaticAttribute_NoDiagnostic() As Task + Await TestMissingInRegularAndScriptAsync( +"Imports System + +Class C + + Private Shared t_obj As Object End Class") End Function End Class diff --git a/src/Compilers/VisualBasic/Test/Symbol/StaticLocalDeclarationTests.vb b/src/Compilers/VisualBasic/Test/Symbol/StaticLocalDeclarationTests.vb index a1b6571fa5d54..6d193d7099525 100644 --- a/src/Compilers/VisualBasic/Test/Symbol/StaticLocalDeclarationTests.vb +++ b/src/Compilers/VisualBasic/Test/Symbol/StaticLocalDeclarationTests.vb @@ -735,6 +735,25 @@ End Module Diagnostic(ERRID.ERR_IterationVariableShadowLocal1, "sl").WithArguments("sl"), Diagnostic(ERRID.ERR_IterationVariableShadowLocal1, "sl").WithArguments("sl")) End Sub + + + + Public Sub Bug48307() + Dim compilationDef = + + +Imports System + +Module Module1 + Sub Main() + Dim Length = From s In {""} Select s.Length + End Sub +End Module + + + Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef) + compilation.VerifyDiagnostics() + End Sub End Class End Namespace From 37e64edf3482666f38a022c29f09289c40b05f46 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 6 Oct 2020 12:39:51 -0700 Subject: [PATCH 162/295] Remvoe using. --- .../Core.Wpf/InlineHints/InlineParameterNameHintsTagger.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTagger.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTagger.cs index 2dea3edd91734..459b812c09527 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTagger.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTagger.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; -using Microsoft.CodeAnalysis.Editor.InlineHints; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Classification; From c22441c0c3c8737c5991e46550840e7d0d8797a2 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 6 Oct 2020 12:40:15 -0700 Subject: [PATCH 163/295] Remvoe using. --- .../InlineHints/InlineParameterNameHintsTaggerProvider.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTaggerProvider.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTaggerProvider.cs index 32cfcc0fe7dec..10d949e3823b2 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTaggerProvider.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTaggerProvider.cs @@ -7,7 +7,6 @@ using System; using System.ComponentModel.Composition; using Microsoft.CodeAnalysis.Editor.Host; -using Microsoft.CodeAnalysis.Editor.InlineHints; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.VisualStudio.Text; From 3e5aec83d885a9f03b421b31cba03a28fcfffbc7 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 6 Oct 2020 12:44:06 -0700 Subject: [PATCH 164/295] Add options consistently --- .../InlineParameterNameHintsDataTaggerProvider.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs b/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs index 7a31ff3030bad..bb892b2f987d4 100644 --- a/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs +++ b/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.ComponentModel.Composition; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; @@ -34,7 +35,6 @@ internal class InlineParameterNameHintsDataTaggerProvider : AsynchronousViewTagg { private readonly IAsynchronousOperationListener _listener; - protected override IEnumerable> PerLanguageOptions => SpecializedCollections.SingletonEnumerable(InlineHintsOptions.EnabledForParameters); protected override SpanTrackingMode SpanTrackingMode => SpanTrackingMode.EdgeInclusive; [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] @@ -48,15 +48,18 @@ public InlineParameterNameHintsDataTaggerProvider( _listener = listenerProvider.GetListener(FeatureAttribute.InlineParameterNameHints); } + protected override IEnumerable> PerLanguageOptions + => ImmutableArray.Create( + InlineHintsOptions.EnabledForParameters, + InlineHintsOptions.ForLiteralParameters, + InlineHintsOptions.ForObjectCreationParameters, + InlineHintsOptions.ForOtherParameters); + protected override ITaggerEventSource CreateEventSource(ITextView textViewOpt, ITextBuffer subjectBuffer) { - // TaggerDelay is NearImmediate because we want the renaming and tag creation to be instantaneous return TaggerEventSources.Compose( TaggerEventSources.OnViewSpanChanged(ThreadingContext, textViewOpt, textChangeDelay: TaggerDelay.Short, scrollChangeDelay: TaggerDelay.NearImmediate), - TaggerEventSources.OnWorkspaceChanged(subjectBuffer, TaggerDelay.NearImmediate, _listener), - TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.ForLiteralParameters, TaggerDelay.NearImmediate), - TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.ForObjectCreationParameters, TaggerDelay.NearImmediate), - TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.ForOtherParameters, TaggerDelay.NearImmediate)); + TaggerEventSources.OnWorkspaceChanged(subjectBuffer, TaggerDelay.NearImmediate, _listener)); } protected override IEnumerable GetSpansToTag(ITextView textView, ITextBuffer subjectBuffer) From 8c161b7a582cebea1f5a7d136ae2915a008bf01a Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 6 Oct 2020 12:45:35 -0700 Subject: [PATCH 165/295] Move code --- .../CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs | 3 ++- .../VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs index c18e9c0a65018..13b949a3c2f2e 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs @@ -69,7 +69,6 @@ public AdvancedOptionPageControl(OptionStore optionStore, IComponentModel compon BindToOption(ShowHintsForLiterals, InlineHintsOptions.ForLiteralParameters, LanguageNames.CSharp); BindToOption(ShowHintsForNewExpressions, InlineHintsOptions.ForObjectCreationParameters, LanguageNames.CSharp); BindToOption(ShowHintsForEverythingElse, InlineHintsOptions.ForOtherParameters, LanguageNames.CSharp); - UpdateInlineHintsOptions(); BindToOption(ShowRemarksInQuickInfo, QuickInfoOptions.ShowRemarksInQuickInfo, LanguageNames.CSharp); BindToOption(DisplayLineSeparators, FeatureOnOffOptions.LineSeparator, LanguageNames.CSharp); @@ -106,6 +105,8 @@ internal override void OnLoad() Customized_Theme_Warning.Visibility = isSupportedTheme && isThemeCustomized ? Visibility.Visible : Visibility.Collapsed; Custom_VS_Theme_Warning.Visibility = isSupportedTheme ? Visibility.Collapsed : Visibility.Visible; + UpdateInlineHintsOptions(); + base.OnLoad(); } diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb index ab76d488d7319..c08f5cd60258b 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb @@ -63,7 +63,6 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options BindToOption(ShowHintsForLiterals, InlineHintsOptions.ForLiteralParameters, LanguageNames.VisualBasic) BindToOption(ShowHintsForNewExpressions, InlineHintsOptions.ForObjectCreationParameters, LanguageNames.VisualBasic) BindToOption(ShowHintsForEverythingElse, InlineHintsOptions.ForOtherParameters, LanguageNames.VisualBasic) - UpdateInlineHintsOptions() BindToOption(EnableEndConstruct, FeatureOnOffOptions.EndConstruct, LanguageNames.VisualBasic) BindToOption(EnableLineCommit, FeatureOnOffOptions.PrettyListing, LanguageNames.VisualBasic) @@ -103,6 +102,8 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options Customized_Theme_Warning.Visibility = If(isSupportedTheme AndAlso isCustomized, Visibility.Visible, Visibility.Collapsed) Custom_VS_Theme_Warning.Visibility = If(isSupportedTheme, Visibility.Collapsed, Visibility.Visible) + UpdateInlineHintsOptions() + MyBase.OnLoad() End Sub From 4fa89920a48583ef36cb1a93cae7ccb8fa9fc06c Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 6 Oct 2020 12:48:23 -0700 Subject: [PATCH 166/295] pass lambda --- .../CSharpInlineParameterNameHintsService.cs | 6 +++--- ...AbstractInlineParameterNameHintsService.cs | 21 +++++++++---------- ...ualBasicInlineParameterNameHintsService.vb | 4 ++-- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs b/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs index 9df4363feac1b..7ad9beb053307 100644 --- a/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs +++ b/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs @@ -29,7 +29,7 @@ public CSharpInlineParameterNameHintsService() protected override void AddAllParameterNameHintLocations( SemanticModel semanticModel, IEnumerable nodes, - ArrayBuilder result, CancellationToken cancellationToken) + Action addHint, CancellationToken cancellationToken) { foreach (var node in nodes) { @@ -41,7 +41,7 @@ protected override void AddAllParameterNameHintLocations( { var param = argument.DetermineParameter(semanticModel, cancellationToken: cancellationToken); if (!string.IsNullOrEmpty(param?.Name)) - result.Add(new InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, argument.Span.Start, GetKind(argument.Expression))); + addHint(new InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, argument.Span.Start, GetKind(argument.Expression))); } } else if (node is AttributeArgumentSyntax attribute) @@ -50,7 +50,7 @@ protected override void AddAllParameterNameHintLocations( { var param = attribute.DetermineParameter(semanticModel, cancellationToken: cancellationToken); if (!string.IsNullOrEmpty(param?.Name)) - result.Add(new InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, attribute.SpanStart, GetKind(attribute.Expression))); + addHint(new InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, attribute.SpanStart, GetKind(attribute.Expression))); } } } diff --git a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs index 51da63df1164d..337f4731bdf1b 100644 --- a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs @@ -4,6 +4,7 @@ #nullable disable +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading; @@ -36,16 +37,14 @@ public async Task> GetInlineParameterNameHin var nodes = root.DescendantNodes(textSpan); - using var _1 = ArrayBuilder.GetInstance(out var buffer); - AddAllParameterNameHintLocations(semanticModel, nodes, buffer, cancellationToken); - - using var _2 = ArrayBuilder.GetInstance(out var result); - - foreach (var hint in buffer) - { - if (HintMatches(hint, literalParameters, objectCreationParameters, otherParameters)) - result.Add(hint); - } + using var _1 = ArrayBuilder.GetInstance(out var result); + AddAllParameterNameHintLocations( + semanticModel, nodes, + hint => + { + if (HintMatches(hint, literalParameters, objectCreationParameters, otherParameters)) + result.Add(hint); + }, cancellationToken); return result.ToImmutable(); } @@ -60,6 +59,6 @@ private static bool HintMatches(InlineParameterHint hint, bool literalParameters }; protected abstract void AddAllParameterNameHintLocations( - SemanticModel semanticModel, IEnumerable nodes, ArrayBuilder result, CancellationToken cancellationToken); + SemanticModel semanticModel, IEnumerable nodes, Action addHint, CancellationToken cancellationToken); } } diff --git a/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb b/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb index 40dafc7e2597f..469a82336a10c 100644 --- a/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb +++ b/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb @@ -22,7 +22,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.InlineParameterNameHints Protected Overrides Sub AddAllParameterNameHintLocations( semanticModel As SemanticModel, nodes As IEnumerable(Of SyntaxNode), - result As ArrayBuilder(Of InlineParameterHint), + addHint As Action(Of InlineParameterHint), cancellationToken As CancellationToken) For Each node In nodes @@ -32,7 +32,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.InlineParameterNameHints If Not simpleArgument.IsNamed AndAlso simpleArgument.NameColonEquals Is Nothing Then Dim param = simpleArgument.DetermineParameter(semanticModel, allowParamArray:=False, cancellationToken) If Not String.IsNullOrEmpty(param?.Name) Then - result.Add(New InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, simpleArgument.Span.Start, GetKind(simpleArgument.Expression))) + addHint(New InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, simpleArgument.Span.Start, GetKind(simpleArgument.Expression))) End If End If End If From 40f17ee1b96262b09c64417769d880f1b45a23d4 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 6 Oct 2020 13:03:05 -0700 Subject: [PATCH 167/295] Move node processing higher --- .../CSharpInlineParameterNameHintsService.cs | 31 ++++++++----------- ...AbstractInlineParameterNameHintsService.cs | 28 ++++++++++------- .../InlineHints/InlineHintsOptions.cs | 12 +++++++ ...ualBasicInlineParameterNameHintsService.vb | 19 +++++------- 4 files changed, 49 insertions(+), 41 deletions(-) diff --git a/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs b/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs index 7ad9beb053307..d5c0f1e7cfc44 100644 --- a/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs +++ b/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs @@ -28,30 +28,25 @@ public CSharpInlineParameterNameHintsService() } protected override void AddAllParameterNameHintLocations( - SemanticModel semanticModel, IEnumerable nodes, + SemanticModel semanticModel, SyntaxNode node, Action addHint, CancellationToken cancellationToken) { - foreach (var node in nodes) + if (node is ArgumentSyntax argument) { - cancellationToken.ThrowIfCancellationRequested(); - - if (node is ArgumentSyntax argument) + if (argument.NameColon == null) { - if (argument.NameColon == null) - { - var param = argument.DetermineParameter(semanticModel, cancellationToken: cancellationToken); - if (!string.IsNullOrEmpty(param?.Name)) - addHint(new InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, argument.Span.Start, GetKind(argument.Expression))); - } + var param = argument.DetermineParameter(semanticModel, cancellationToken: cancellationToken); + if (!string.IsNullOrEmpty(param?.Name)) + addHint(new InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, argument.Span.Start, GetKind(argument.Expression))); } - else if (node is AttributeArgumentSyntax attribute) + } + else if (node is AttributeArgumentSyntax attribute) + { + if (attribute.NameEquals == null && attribute.NameColon == null) { - if (attribute.NameEquals == null && attribute.NameColon == null) - { - var param = attribute.DetermineParameter(semanticModel, cancellationToken: cancellationToken); - if (!string.IsNullOrEmpty(param?.Name)) - addHint(new InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, attribute.SpanStart, GetKind(attribute.Expression))); - } + var param = attribute.DetermineParameter(semanticModel, cancellationToken: cancellationToken); + if (!string.IsNullOrEmpty(param?.Name)) + addHint(new InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, attribute.SpanStart, GetKind(attribute.Expression))); } } } diff --git a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs index 337f4731bdf1b..bddd6f8dd2cc2 100644 --- a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs @@ -18,6 +18,9 @@ namespace Microsoft.CodeAnalysis.InlineHints { internal abstract class AbstractInlineParameterNameHintsService : IInlineParameterNameHintsService { + protected abstract void AddAllParameterNameHintLocations( + SemanticModel semanticModel, SyntaxNode node, Action addHint, CancellationToken cancellationToken); + public async Task> GetInlineParameterNameHintsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken) { var options = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); @@ -35,18 +38,22 @@ public async Task> GetInlineParameterNameHin var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); - var nodes = root.DescendantNodes(textSpan); + using var _ = ArrayBuilder.GetInstance(out var result); + Action addHint = AddHint; - using var _1 = ArrayBuilder.GetInstance(out var result); - AddAllParameterNameHintLocations( - semanticModel, nodes, - hint => - { - if (HintMatches(hint, literalParameters, objectCreationParameters, otherParameters)) - result.Add(hint); - }, cancellationToken); + foreach (var node in root.DescendantNodes(textSpan)) + { + cancellationToken.ThrowIfCancellationRequested(); + AddAllParameterNameHintLocations(semanticModel, node, addHint, cancellationToken); + } return result.ToImmutable(); + + void AddHint(InlineParameterHint hint) + { + if (HintMatches(hint, literalParameters, objectCreationParameters, otherParameters)) + result.Add(hint); + } } private static bool HintMatches(InlineParameterHint hint, bool literalParameters, bool objectCreationParameters, bool otherParameters) @@ -57,8 +64,5 @@ private static bool HintMatches(InlineParameterHint hint, bool literalParameters InlineParameterHintKind.Other => otherParameters, _ => throw ExceptionUtilities.UnexpectedValue(hint.Kind), }; - - protected abstract void AddAllParameterNameHintLocations( - SemanticModel semanticModel, IEnumerable nodes, Action addHint, CancellationToken cancellationToken); } } diff --git a/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs b/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs index 5e668ea39270c..626c22ccbb652 100644 --- a/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs +++ b/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs @@ -38,6 +38,18 @@ internal static class InlineHintsOptions nameof(ForOtherParameters), defaultValue: false, storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.InlineParameterNameHints.ForOtherParameters")); + + public static readonly PerLanguageOption2 HideForParametersThatDifferBySuffix = + new(nameof(InlineHintsOptions), + nameof(HideForParametersThatDifferBySuffix), + defaultValue: true, + storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.InlineParameterNameHints.HideForParametersThatDifferBySuffix")); + + public static readonly PerLanguageOption2 HideForParametersThatMatchMethodIntent = + new(nameof(InlineHintsOptions), + nameof(HideForParametersThatMatchMethodIntent), + defaultValue: true, + storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.InlineParameterNameHints.HideForParametersThatMatchMethodIntent")); } [ExportOptionProvider, Shared] diff --git a/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb b/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb index 469a82336a10c..adf4dbb0a9a78 100644 --- a/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb +++ b/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb @@ -21,22 +21,19 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.InlineParameterNameHints Protected Overrides Sub AddAllParameterNameHintLocations( semanticModel As SemanticModel, - nodes As IEnumerable(Of SyntaxNode), + node As SyntaxNode, addHint As Action(Of InlineParameterHint), cancellationToken As CancellationToken) - For Each node In nodes - cancellationToken.ThrowIfCancellationRequested() - Dim simpleArgument = TryCast(node, SimpleArgumentSyntax) - If simpleArgument?.Expression IsNot Nothing Then - If Not simpleArgument.IsNamed AndAlso simpleArgument.NameColonEquals Is Nothing Then - Dim param = simpleArgument.DetermineParameter(semanticModel, allowParamArray:=False, cancellationToken) - If Not String.IsNullOrEmpty(param?.Name) Then - addHint(New InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, simpleArgument.Span.Start, GetKind(simpleArgument.Expression))) - End If + Dim simpleArgument = TryCast(node, SimpleArgumentSyntax) + If simpleArgument?.Expression IsNot Nothing Then + If Not simpleArgument.IsNamed AndAlso simpleArgument.NameColonEquals Is Nothing Then + Dim param = simpleArgument.DetermineParameter(semanticModel, allowParamArray:=False, cancellationToken) + If Not String.IsNullOrEmpty(param?.Name) Then + addHint(New InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, simpleArgument.Span.Start, GetKind(simpleArgument.Expression))) End If End If - Next + End If End Sub Private Function GetKind(arg As ExpressionSyntax) As InlineParameterHintKind From 1791e354e9c31bc473067485c8154002372b5b57 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 6 Oct 2020 13:14:37 -0700 Subject: [PATCH 168/295] Restore original storage location. --- .../InlineHints/CSharpInlineParameterNameHintsService.cs | 2 +- src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs b/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs index 7ad9beb053307..8ace12d588c6f 100644 --- a/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs +++ b/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs @@ -41,7 +41,7 @@ protected override void AddAllParameterNameHintLocations( { var param = argument.DetermineParameter(semanticModel, cancellationToken: cancellationToken); if (!string.IsNullOrEmpty(param?.Name)) - addHint(new InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, argument.Span.Start, GetKind(argument.Expression))); + addHint(new InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, argument.SpanStart, GetKind(argument.Expression))); } } else if (node is AttributeArgumentSyntax attribute) diff --git a/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs b/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs index 5e668ea39270c..cce97233319b1 100644 --- a/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs +++ b/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs @@ -19,7 +19,7 @@ internal static class InlineHintsOptions new(nameof(InlineHintsOptions), nameof(EnabledForParameters), defaultValue: false, - storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.InlineParameterNameHints.EnabledForParameters")); + storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.InlineParameterNameHints")); public static readonly PerLanguageOption2 ForLiteralParameters = new(nameof(InlineHintsOptions), From 60f516e5d42e6d7b1a53c0de25f219f20f5e065e Mon Sep 17 00:00:00 2001 From: Youssef Victor <31348972+Youssef1313@users.noreply.github.com> Date: Tue, 6 Oct 2020 22:27:44 +0200 Subject: [PATCH 169/295] Add missing span in tests --- .../CSharp/Tests/MakeFieldReadonly/MakeFieldReadonlyTests.cs | 2 +- .../Tests/MakeFieldReadonly/MakeFieldReadonlyTests.vb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Analyzers/CSharp/Tests/MakeFieldReadonly/MakeFieldReadonlyTests.cs b/src/Analyzers/CSharp/Tests/MakeFieldReadonly/MakeFieldReadonlyTests.cs index f9cba9c2c59c3..58a279a732dec 100644 --- a/src/Analyzers/CSharp/Tests/MakeFieldReadonly/MakeFieldReadonlyTests.cs +++ b/src/Analyzers/CSharp/Tests/MakeFieldReadonly/MakeFieldReadonlyTests.cs @@ -1743,7 +1743,7 @@ await TestMissingInRegularAndScriptAsync( class Program { [ThreadStatic] - private static object t_obj; + private static object [|t_obj|]; }"); } } diff --git a/src/Analyzers/VisualBasic/Tests/MakeFieldReadonly/MakeFieldReadonlyTests.vb b/src/Analyzers/VisualBasic/Tests/MakeFieldReadonly/MakeFieldReadonlyTests.vb index 29c104d408bbc..eaefcd0c989fe 100644 --- a/src/Analyzers/VisualBasic/Tests/MakeFieldReadonly/MakeFieldReadonlyTests.vb +++ b/src/Analyzers/VisualBasic/Tests/MakeFieldReadonly/MakeFieldReadonlyTests.vb @@ -976,7 +976,7 @@ End Class") Class C - Private Shared t_obj As Object + Private Shared [|t_obj|] As Object End Class") End Function End Class From d53c1f47b526923e1e93d546ae8b11e8d3d708a4 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 6 Oct 2020 13:51:12 -0700 Subject: [PATCH 170/295] Suppress inline hints in certain clear cases. --- .../AbstractInlineParameterNameHintsTests.vb | 8 +- .../CSharpInlineParameterNameHintsTests.vb | 150 ++++++++++++++++++ .../CSharpInlineParameterNameHintsService.cs | 62 ++++++-- ...AbstractInlineParameterNameHintsService.cs | 62 +++++++- ...ualBasicInlineParameterNameHintsService.vb | 8 +- 5 files changed, 264 insertions(+), 26 deletions(-) diff --git a/src/EditorFeatures/Test2/InlineHints/AbstractInlineParameterNameHintsTests.vb b/src/EditorFeatures/Test2/InlineHints/AbstractInlineParameterNameHintsTests.vb index 48d40b53d4e98..a69fbed16a587 100644 --- a/src/EditorFeatures/Test2/InlineHints/AbstractInlineParameterNameHintsTests.vb +++ b/src/EditorFeatures/Test2/InlineHints/AbstractInlineParameterNameHintsTests.vb @@ -10,10 +10,16 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints <[UseExportProvider]> Public MustInherit Class AbstractInlineParameterNameHintsTests - Protected Async Function VerifyParamHints(test As XElement, Optional optionIsEnabled As Boolean = True) As Tasks.Task + Protected Async Function VerifyParamHints(test As XElement, Optional optionIsEnabled As Boolean = True) As Task Using workspace = TestWorkspace.Create(test) WpfTestRunner.RequireWpfFact($"{NameOf(AbstractInlineParameterNameHintsTests)}.{NameOf(Me.VerifyParamHints)} creates asynchronous taggers") + workspace.TryApplyChanges(workspace.CurrentSolution.WithOptions( + workspace.Options.WithChangedOption( + InlineHintsOptions.EnabledForParameters, + workspace.CurrentSolution.Projects.Single().Language, + optionIsEnabled))) + Dim hostDocument = workspace.Documents.Single() Dim snapshot = hostDocument.GetTextBuffer().CurrentSnapshot Dim document = workspace.CurrentSolution.GetDocument(hostDocument.Id) diff --git a/src/EditorFeatures/Test2/InlineHints/CSharpInlineParameterNameHintsTests.vb b/src/EditorFeatures/Test2/InlineHints/CSharpInlineParameterNameHintsTests.vb index b02dc559df88f..b2fc18293a570 100644 --- a/src/EditorFeatures/Test2/InlineHints/CSharpInlineParameterNameHintsTests.vb +++ b/src/EditorFeatures/Test2/InlineHints/CSharpInlineParameterNameHintsTests.vb @@ -398,5 +398,155 @@ class Derived : Base Await VerifyParamHints(input) End Function + + + + Public Async Function TestNotOnEnableDisableBoolean1() As Task + Dim input = + + + +class A +{ + void EnableLogging(bool value) + { + } + + void Main() + { + EnableLogging(true); + } +} + + + + + Await VerifyParamHints(input) + End Function + + + + Public Async Function TestNotOnEnableDisableBoolean2() As Task + Dim input = + + + +class A +{ + void DisableLogging(bool value) + { + } + + void Main() + { + DisableLogging(true); + } +} + + + + + Await VerifyParamHints(input) + End Function + + + + Public Async Function TestOnEnableDisableNonBoolean1() As Task + Dim input = + + + +class A +{ + void EnableLogging(string value) + { + } + + void Main() + { + EnableLogging({|value:"IO"|}); + } +} + + + + + Await VerifyParamHints(input) + End Function + + + + Public Async Function TestOnEnableDisableNonBoolean2() As Task + Dim input = + + + +class A +{ + void DisableLogging(string value) + { + } + + void Main() + { + DisableLogging({|value:"IO"|}); + } +} + + + + + Await VerifyParamHints(input) + End Function + + + + Public Async Function TestOnSetMethodWithClearContext() As Task + Dim input = + + + +class A +{ + void SetClassification(string classification) + { + } + + void Main() + { + SetClassification("IO"); + } +} + + + + + Await VerifyParamHints(input) + End Function + + + + Public Async Function TestOnSetMethodWithUnclearContext() As Task + Dim input = + + + +class A +{ + void SetClassification(string values) + { + } + + void Main() + { + SetClassification({|values:"IO"|}); + } +} + + + + + Await VerifyParamHints(input) + End Function End Class End Namespace diff --git a/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs b/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs index 74ae0b69f32ee..0d07c6d63dced 100644 --- a/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs +++ b/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs @@ -3,14 +3,12 @@ // See the LICENSE file in the project root for more information. using System; -using System.Collections.Generic; using System.Composition; using System.Threading; using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.InlineHints; -using Microsoft.CodeAnalysis.PooledObjects; namespace Microsoft.CodeAnalysis.CSharp.InlineHints { @@ -28,29 +26,61 @@ public CSharpInlineParameterNameHintsService() } protected override void AddAllParameterNameHintLocations( - SemanticModel semanticModel, SyntaxNode node, - Action addHint, CancellationToken cancellationToken) + SemanticModel semanticModel, + SyntaxNode node, + Action addHint, + bool hideForParametersThatDifferBySuffix, + bool hideForParametersThatMatchMethodIntent, + CancellationToken cancellationToken) { if (node is ArgumentSyntax argument) { - if (argument.NameColon == null) - { - var param = argument.DetermineParameter(semanticModel, cancellationToken: cancellationToken); - if (!string.IsNullOrEmpty(param?.Name)) - addHint(new InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, argument.SpanStart, GetKind(argument.Expression))); - } + if (argument.NameColon != null) + return; + + var parameter = argument.DetermineParameter(semanticModel, cancellationToken: cancellationToken); + if (string.IsNullOrEmpty(parameter?.Name)) + return; + + if (hideForParametersThatMatchMethodIntent && MatchesMethodIntent(argument, parameter)) + return; + + addHint(new InlineParameterHint(parameter.GetSymbolKey(cancellationToken), parameter.Name, argument.Span.Start, GetKind(argument.Expression))); } else if (node is AttributeArgumentSyntax attribute) { - if (attribute.NameEquals == null && attribute.NameColon == null) - { - var param = attribute.DetermineParameter(semanticModel, cancellationToken: cancellationToken); - if (!string.IsNullOrEmpty(param?.Name)) - addHint(new InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, attribute.SpanStart, GetKind(attribute.Expression))); - } + if (attribute.NameEquals != null || attribute.NameColon != null) + return; + + var parameter = attribute.DetermineParameter(semanticModel, cancellationToken: cancellationToken); + if (string.IsNullOrEmpty(parameter?.Name)) + return; + + addHint(new InlineParameterHint(parameter.GetSymbolKey(cancellationToken), parameter.Name, attribute.SpanStart, GetKind(attribute.Expression))); } } + private static bool MatchesMethodIntent(ArgumentSyntax argument, IParameterSymbol parameter) + { + // Methods like `SetColor(color: "y")` `FromResult(result: "x")` `Enable/DisablePolling(bool)` don't need + // parameter names to improve clarity. The parameter is clear from the context of the method name. + if (argument.Parent is not ArgumentListSyntax argumentList) + return false; + + if (argumentList.Arguments[0] != argument) + return false; + + if (argumentList.Parent is not InvocationExpressionSyntax invocationExpression) + return false; + + var invokedExpression = invocationExpression.Expression; + var rightMostName = invokedExpression.GetRightmostName(); + if (rightMostName == null) + return false; + + return MatchesMethodIntent(rightMostName.Identifier.ValueText, parameter); + } + private static InlineParameterHintKind GetKind(ExpressionSyntax arg) => arg switch { diff --git a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs index bddd6f8dd2cc2..32e9172ccbc98 100644 --- a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs @@ -2,11 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; -using System.Collections.Generic; using System.Collections.Immutable; +using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.PooledObjects; @@ -19,7 +17,9 @@ namespace Microsoft.CodeAnalysis.InlineHints internal abstract class AbstractInlineParameterNameHintsService : IInlineParameterNameHintsService { protected abstract void AddAllParameterNameHintLocations( - SemanticModel semanticModel, SyntaxNode node, Action addHint, CancellationToken cancellationToken); + SemanticModel semanticModel, SyntaxNode node, Action addHint, + bool hideForParametersThatDifferBySuffix, bool hideForParametersThatMatchMethodIntent, + CancellationToken cancellationToken); public async Task> GetInlineParameterNameHintsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken) { @@ -35,16 +35,24 @@ public async Task> GetInlineParameterNameHin if (!literalParameters && !objectCreationParameters && !otherParameters) return ImmutableArray.Empty; + var hideForParametersThatDifferBySuffix = options.GetOption(InlineHintsOptions.HideForParametersThatDifferBySuffix); + var hideForParametersThatMatchMethodIntent = options.GetOption(InlineHintsOptions.HideForParametersThatMatchMethodIntent); + var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); - using var _ = ArrayBuilder.GetInstance(out var result); + using var _1 = ArrayBuilder.GetInstance(out var result); + Action addHint = AddHint; foreach (var node in root.DescendantNodes(textSpan)) { cancellationToken.ThrowIfCancellationRequested(); - AddAllParameterNameHintLocations(semanticModel, node, addHint, cancellationToken); + AddAllParameterNameHintLocations( + semanticModel, node, addHint, + hideForParametersThatDifferBySuffix, + hideForParametersThatMatchMethodIntent, + cancellationToken); } return result.ToImmutable(); @@ -64,5 +72,47 @@ private static bool HintMatches(InlineParameterHint hint, bool literalParameters InlineParameterHintKind.Other => otherParameters, _ => throw ExceptionUtilities.UnexpectedValue(hint.Kind), }; + + protected static bool MatchesMethodIntent(string methodName, IParameterSymbol parameter) + { + // Check for something like `EnableLogging(true)` + if (TryGetIntent("Enable", methodName, out _) || + TryGetIntent("Disable", methodName, out _)) + { + return parameter.Type.SpecialType == SpecialType.System_Boolean; + } + + // More names can be added here if we find other patterns like this. + if (TryGetIntent("Set", methodName, out var methodIntent) || + TryGetIntent("From", methodName, out methodIntent)) + { + return IntentNameMatchesParameterName(methodIntent.Value, parameter.Name); + } + + return false; + + static bool TryGetIntent(string prefix, string nameValue, [NotNullWhen(true)] out ReadOnlyMemory? result) + { + if (nameValue.Length > prefix.Length && + nameValue.StartsWith(prefix) && + char.IsUpper(nameValue[prefix.Length])) + { + result = nameValue.AsMemory().Slice(prefix.Length); + return true; + } + + result = null; + return false; + } + + static bool IntentNameMatchesParameterName(ReadOnlyMemory intent, string parameterName) + { + // Method's name will be something like 'FromResult', so 'intent' will be 'Result' and parameterName + // will be 'result'. So we check if the first letters differ on case and the rest of the method + // matches. + return char.ToLower(intent.Span[0]) == parameterName[0] && + intent.Span.Slice(1).Equals(parameterName.AsSpan().Slice(1), StringComparison.Ordinal); + } + } } } diff --git a/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb b/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb index adf4dbb0a9a78..063d73faa8df9 100644 --- a/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb +++ b/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb @@ -23,14 +23,16 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.InlineParameterNameHints semanticModel As SemanticModel, node As SyntaxNode, addHint As Action(Of InlineParameterHint), - cancellationToken As CancellationToken) + hideForParametersThatDifferBySuffix As Boolean, + hideForParametersThatMatchMethodIntent As Boolean, + CancellationToken As CancellationToken) Dim simpleArgument = TryCast(node, SimpleArgumentSyntax) If simpleArgument?.Expression IsNot Nothing Then If Not simpleArgument.IsNamed AndAlso simpleArgument.NameColonEquals Is Nothing Then - Dim param = simpleArgument.DetermineParameter(semanticModel, allowParamArray:=False, cancellationToken) + Dim param = simpleArgument.DetermineParameter(semanticModel, allowParamArray:=False, CancellationToken) If Not String.IsNullOrEmpty(param?.Name) Then - addHint(New InlineParameterHint(param.GetSymbolKey(cancellationToken), param.Name, simpleArgument.Span.Start, GetKind(simpleArgument.Expression))) + addHint(New InlineParameterHint(param.GetSymbolKey(CancellationToken), param.Name, simpleArgument.Span.Start, GetKind(simpleArgument.Expression))) End If End If End If From 9587a6c3e0510607ff0f132b6abb268f1ebc18b4 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 6 Oct 2020 14:03:25 -0700 Subject: [PATCH 171/295] Suppress inline hints when parameter name isn't important given hte method name. --- ...isualBasicInlineParameterNameHintsTests.vb | 132 ++++++++++++++++++ ...ualBasicInlineParameterNameHintsService.vb | 52 +++++-- .../Extensions/ExpressionSyntaxExtensions.vb | 9 +- 3 files changed, 177 insertions(+), 16 deletions(-) diff --git a/src/EditorFeatures/Test2/InlineHints/VisualBasicInlineParameterNameHintsTests.vb b/src/EditorFeatures/Test2/InlineHints/VisualBasicInlineParameterNameHintsTests.vb index 4556ad97b8a40..a385715e26da4 100644 --- a/src/EditorFeatures/Test2/InlineHints/VisualBasicInlineParameterNameHintsTests.vb +++ b/src/EditorFeatures/Test2/InlineHints/VisualBasicInlineParameterNameHintsTests.vb @@ -352,5 +352,137 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Await VerifyParamHints(input) End Function + + + + Public Async Function TestNotOnEnableDisableBoolean1() As Task + Dim input = + + + +class A + sub EnableLogging(value as boolean) + end sub + + sub Main() + EnableLogging(true) + end sub +end class + + + + + Await VerifyParamHints(input) + End Function + + + + Public Async Function TestNotOnEnableDisableBoolean2() As Task + Dim input = + + + +class A + sub DisableLogging(value as boolean) + end sub + + sub Main() + DisableLogging(true) + end sub +end class + + + + + Await VerifyParamHints(input) + End Function + + + + Public Async Function TestOnEnableDisableNonBoolean1() As Task + Dim input = + + + +class A + sub EnableLogging(value as string) + end sub + + sub Main() + EnableLogging({|value:"IO"|}) + end sub +end class + + + + + Await VerifyParamHints(input) + End Function + + + + Public Async Function TestOnEnableDisableNonBoolean2() As Task + Dim input = + + + +class A + sub DisableLogging(value as string) + end sub + + sub Main() + DisableLogging({|value:"IO"|}) + end sub +end class + + + + + Await VerifyParamHints(input) + End Function + + + + Public Async Function TestOnSetMethodWithClearContext() As Task + Dim input = + + + +class A + sub SetClassification(classification as string) + end sub + + sub Main() + SetClassification("IO") + end sub +end class + + + + + Await VerifyParamHints(input) + End Function + + + + Public Async Function TestOnSetMethodWithUnclearContext() As Task + Dim input = + + + +class A + sub SetClassification(values as string) + end sub + + sub Main() + SetClassification({|values:"IO"|}) + end sub +end class + + + + + Await VerifyParamHints(input) + End Function End Class End Namespace diff --git a/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb b/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb index 063d73faa8df9..0823646f301a5 100644 --- a/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb +++ b/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb @@ -6,7 +6,6 @@ Imports System.Composition Imports System.Threading Imports Microsoft.CodeAnalysis.Host.Mef Imports Microsoft.CodeAnalysis.InlineHints -Imports Microsoft.CodeAnalysis.PooledObjects Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Namespace Microsoft.CodeAnalysis.VisualBasic.InlineParameterNameHints @@ -27,17 +26,52 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.InlineParameterNameHints hideForParametersThatMatchMethodIntent As Boolean, CancellationToken As CancellationToken) - Dim simpleArgument = TryCast(node, SimpleArgumentSyntax) - If simpleArgument?.Expression IsNot Nothing Then - If Not simpleArgument.IsNamed AndAlso simpleArgument.NameColonEquals Is Nothing Then - Dim param = simpleArgument.DetermineParameter(semanticModel, allowParamArray:=False, CancellationToken) - If Not String.IsNullOrEmpty(param?.Name) Then - addHint(New InlineParameterHint(param.GetSymbolKey(CancellationToken), param.Name, simpleArgument.Span.Start, GetKind(simpleArgument.Expression))) - End If - End If + Dim argument = TryCast(node, SimpleArgumentSyntax) + If argument?.Expression Is Nothing Then + Return End If + + If argument.IsNamed OrElse argument.NameColonEquals IsNot Nothing Then + Return + End If + + Dim parameter = argument.DetermineParameter(semanticModel, allowParamArray:=False, CancellationToken) + If String.IsNullOrEmpty(parameter?.Name) Then + Return + End If + + If hideForParametersThatMatchMethodIntent AndAlso MatchesMethodIntent(argument, parameter) Then + Return + End If + + addHint(New InlineParameterHint(parameter.GetSymbolKey(CancellationToken), parameter.Name, argument.Span.Start, GetKind(argument.Expression))) End Sub + Private Overloads Shared Function MatchesMethodIntent(argument As ArgumentSyntax, parameter As IParameterSymbol) As Boolean + ' Methods Like `SetColor(color: "y")` `FromResult(result: "x")` `Enable/DisablePolling(bool)` don't need + ' parameter names to improve clarity. The parameter Is clear from the context of the method name. + Dim argumentList = TryCast(argument.Parent, ArgumentListSyntax) + If argumentList Is Nothing Then + Return False + End If + + If argumentList.Arguments(0) IsNot argument Then + Return False + End If + + Dim invocationExpression = TryCast(argumentList.Parent, InvocationExpressionSyntax) + If invocationExpression Is Nothing Then + Return False + End If + + Dim rightMostName = invocationExpression.Expression.GetRightmostName() + If rightMostName Is Nothing Then + Return False + End If + + Return AbstractInlineParameterNameHintsService.MatchesMethodIntent(rightMostName.Identifier.ValueText, parameter) + End Function + Private Function GetKind(arg As ExpressionSyntax) As InlineParameterHintKind If TypeOf arg Is LiteralExpressionSyntax OrElse TypeOf arg Is InterpolatedStringExpressionSyntax Then diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/Extensions/ExpressionSyntaxExtensions.vb b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/Extensions/ExpressionSyntaxExtensions.vb index 22a59e2d194b4..4841fa6d677ce 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/Extensions/ExpressionSyntaxExtensions.vb +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/Extensions/ExpressionSyntaxExtensions.vb @@ -254,7 +254,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Extensions End Function - Public Function GetRightmostName(node As ExpressionSyntax) As NameSyntax + Public Function GetRightmostName(node As ExpressionSyntax) As SimpleNameSyntax Dim memberAccess = TryCast(node, MemberAccessExpressionSyntax) If memberAccess IsNot Nothing AndAlso memberAccess.Name IsNot Nothing Then Return memberAccess.Name @@ -265,12 +265,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Extensions Return qualified.Right End If - Dim simple = TryCast(node, SimpleNameSyntax) - If simple IsNot Nothing Then - Return simple - End If - - Return Nothing + Return TryCast(node, SimpleNameSyntax) End Function From 47f0af4737c541eeac7fd94f87b9b79989f4991d Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 6 Oct 2020 14:17:45 -0700 Subject: [PATCH 172/295] Update UI --- .../CSharp/Impl/Options/AdvancedOptionPageControl.xaml | 3 +++ .../CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs | 2 ++ .../CSharp/Impl/Options/AdvancedOptionPageStrings.cs | 3 +++ src/VisualStudio/Core/Def/ServicesVSResources.resx | 3 +++ src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf | 5 +++++ src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf | 5 +++++ src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf | 5 +++++ src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf | 5 +++++ src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf | 5 +++++ src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf | 5 +++++ src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf | 5 +++++ src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf | 5 +++++ src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf | 5 +++++ src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf | 5 +++++ src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf | 5 +++++ .../Core/Def/xlf/ServicesVSResources.zh-Hans.xlf | 5 +++++ .../Core/Def/xlf/ServicesVSResources.zh-Hant.xlf | 5 +++++ .../VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml | 3 +++ .../Impl/Options/AdvancedOptionPageControl.xaml.vb | 2 ++ .../VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb | 3 +++ 20 files changed, 84 insertions(+) diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml index b909bec9d4435..1f9fff45e8b8d 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml @@ -124,6 +124,9 @@ + diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs index 13b949a3c2f2e..da86106700537 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs @@ -69,6 +69,7 @@ public AdvancedOptionPageControl(OptionStore optionStore, IComponentModel compon BindToOption(ShowHintsForLiterals, InlineHintsOptions.ForLiteralParameters, LanguageNames.CSharp); BindToOption(ShowHintsForNewExpressions, InlineHintsOptions.ForObjectCreationParameters, LanguageNames.CSharp); BindToOption(ShowHintsForEverythingElse, InlineHintsOptions.ForOtherParameters, LanguageNames.CSharp); + BindToOption(HideHintsWhenClearBasedonMethodAndParameterName, InlineHintsOptions.HideForParametersThatMatchMethodIntent, LanguageNames.CSharp); BindToOption(ShowRemarksInQuickInfo, QuickInfoOptions.ShowRemarksInQuickInfo, LanguageNames.CSharp); BindToOption(DisplayLineSeparators, FeatureOnOffOptions.LineSeparator, LanguageNames.CSharp); @@ -116,6 +117,7 @@ private void UpdateInlineHintsOptions() ShowHintsForLiterals.IsEnabled = enabledForParameters; ShowHintsForNewExpressions.IsEnabled = enabledForParameters; ShowHintsForEverythingElse.IsEnabled = enabledForParameters; + HideHintsWhenClearBasedonMethodAndParameterName.IsEnabled = enabledForParameters; } private void DisplayInlineParameterNameHints_Checked(object sender, RoutedEventArgs e) diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs index 5799bd8fd7ae9..d29586879b375 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs @@ -46,6 +46,9 @@ public static string Option_Show_hints_for_new_expressions public static string Option_Show_hints_for_everything_else => ServicesVSResources.Show_hints_for_everything_else; + public static string Option_Hide_hints_when_clear_based_on_method_and_parameter_name + => ServicesVSResources.Hide_hints_when_clear_based_on_method_and_parameter_name; + public static string Option_RenameTrackingPreview => CSharpVSResources.Show_preview_for_rename_tracking; public static string Option_Split_string_literals_on_enter => CSharpVSResources.Split_string_literals_on_enter; diff --git a/src/VisualStudio/Core/Def/ServicesVSResources.resx b/src/VisualStudio/Core/Def/ServicesVSResources.resx index 30a9c6464a4bf..be2f84b477bd5 100644 --- a/src/VisualStudio/Core/Def/ServicesVSResources.resx +++ b/src/VisualStudio/Core/Def/ServicesVSResources.resx @@ -1566,4 +1566,7 @@ I agree to all of the foregoing: Show hints for literals + + Hide hints when clear based on method and parameter name + \ No newline at end of file diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf index b758f55e35498..5650b4e7f378a 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf @@ -242,6 +242,11 @@ Generovat soubor .editorconfig z nastavení + + Hide hints when clear based on method and parameter name + Hide hints when clear based on method and parameter name + + Highlight related components under cursor Zvýrazňovat související komponenty pod kurzorem diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf index 36e9a2245f243..dc4ed47437ece 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf @@ -242,6 +242,11 @@ EDITORCONFIG-Datei aus Einstellungen generieren + + Hide hints when clear based on method and parameter name + Hide hints when clear based on method and parameter name + + Highlight related components under cursor Zugehörige Komponenten unter dem Cursor markieren diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf index 42ccccc4ddddf..27aa0dcb8fc51 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf @@ -242,6 +242,11 @@ Generar archivo .editorconfig a partir de la configuración + + Hide hints when clear based on method and parameter name + Hide hints when clear based on method and parameter name + + Highlight related components under cursor Resaltar componentes relacionados bajo el cursor diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf index 4debe1a56b7d8..3c48666730a81 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf @@ -242,6 +242,11 @@ Générer le fichier .editorconfig à partir des paramètres + + Hide hints when clear based on method and parameter name + Hide hints when clear based on method and parameter name + + Highlight related components under cursor Surligner les composants liés sous le curseur diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf index 77af5d3facece..d512596c3f153 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf @@ -242,6 +242,11 @@ Genera file con estensione editorconfig dalle impostazioni + + Hide hints when clear based on method and parameter name + Hide hints when clear based on method and parameter name + + Highlight related components under cursor Evidenzia i componenti correlati sotto il cursore diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf index 793a2af34717e..303d6107e3c32 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf @@ -242,6 +242,11 @@ 設定から .editorconfig ファイルを生成 + + Hide hints when clear based on method and parameter name + Hide hints when clear based on method and parameter name + + Highlight related components under cursor カーソルの下にある関連コンポーネントをハイライトする diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf index c25aa3c113757..33612a4a34431 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf @@ -242,6 +242,11 @@ 설정에서 .editorconfig 파일 생성 + + Hide hints when clear based on method and parameter name + Hide hints when clear based on method and parameter name + + Highlight related components under cursor 커서 아래의 관련 구성 요소 강조 diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf index f58fb1b99a580..0a423bee8bc6c 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf @@ -242,6 +242,11 @@ Wygeneruj plik .editorconfig na podstawie ustawień + + Hide hints when clear based on method and parameter name + Hide hints when clear based on method and parameter name + + Highlight related components under cursor Wyróżnij powiązane składniki pod kursorem diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf index fd9134f158a09..c55fed977db95 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf @@ -242,6 +242,11 @@ Gerar o arquivo .editorconfig das configurações + + Hide hints when clear based on method and parameter name + Hide hints when clear based on method and parameter name + + Highlight related components under cursor Realçar componentes relacionados usando o cursor diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf index 640fbb205e3fe..9ebf663529295 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf @@ -242,6 +242,11 @@ Создать файл EDITORCONFIG на основе параметров + + Hide hints when clear based on method and parameter name + Hide hints when clear based on method and parameter name + + Highlight related components under cursor Выделить связанные компоненты под курсором diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf index 198314cfca7c3..2ff1412f350b3 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf @@ -242,6 +242,11 @@ Ayarlardan .editorconfig dosyası oluştur + + Hide hints when clear based on method and parameter name + Hide hints when clear based on method and parameter name + + Highlight related components under cursor İmlecin altında ilgili bileşenleri vurgula diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf index b5a33d82ba5d4..261525e863142 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf @@ -242,6 +242,11 @@ 基于设置生成 .editorconfig 文件 + + Hide hints when clear based on method and parameter name + Hide hints when clear based on method and parameter name + + Highlight related components under cursor 突出显示光标下的相关组件 diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf index 310befb1996fe..d1b2798838ff0 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf @@ -242,6 +242,11 @@ 從設定產生 .editorconfig 檔案 + + Hide hints when clear based on method and parameter name + Hide hints when clear based on method and parameter name + + Highlight related components under cursor 反白資料指標下的相關元件 diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml index 658c84224b421..25605414d99db 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml @@ -118,6 +118,9 @@ + diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb index c08f5cd60258b..8504a2cc2a7e5 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb @@ -63,6 +63,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options BindToOption(ShowHintsForLiterals, InlineHintsOptions.ForLiteralParameters, LanguageNames.VisualBasic) BindToOption(ShowHintsForNewExpressions, InlineHintsOptions.ForObjectCreationParameters, LanguageNames.VisualBasic) BindToOption(ShowHintsForEverythingElse, InlineHintsOptions.ForOtherParameters, LanguageNames.VisualBasic) + BindToOption(HideHintsWhenClearBasedonMethodAndParameterName, InlineHintsOptions.HideForParametersThatMatchMethodIntent, LanguageNames.VisualBasic) BindToOption(EnableEndConstruct, FeatureOnOffOptions.EndConstruct, LanguageNames.VisualBasic) BindToOption(EnableLineCommit, FeatureOnOffOptions.PrettyListing, LanguageNames.VisualBasic) @@ -112,6 +113,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options ShowHintsForLiterals.IsEnabled = enabledForParameters ShowHintsForNewExpressions.IsEnabled = enabledForParameters ShowHintsForEverythingElse.IsEnabled = enabledForParameters + HideHintsWhenClearBasedonMethodAndParameterName.IsEnabled = enabledForParameters End Sub Private Sub DisplayInlineParameterNameHints_Checked() diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb index 89d261bb32428..212e22b28b512 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb @@ -48,6 +48,9 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options Public ReadOnly Property Option_Show_hints_for_everything_else As String = ServicesVSResources.Show_hints_for_everything_else + Public ReadOnly Property Option_Hide_hints_when_clear_based_on_method_and_parameter_name As String = + ServicesVSResources.Hide_hints_when_clear_based_on_method_and_parameter_name + Public ReadOnly Property Option_DontPutOutOrRefOnStruct As String Get Return BasicVSResources.Don_t_put_ByRef_on_custom_structure From 56de7e241388407f692574966b1579d40d56e1d4 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 6 Oct 2020 14:19:21 -0700 Subject: [PATCH 173/295] Breakup options into two sections --- .../InlineParameterNameHintsDataTaggerProvider.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs b/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs index bb892b2f987d4..3c666daa165a0 100644 --- a/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs +++ b/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs @@ -48,18 +48,19 @@ public InlineParameterNameHintsDataTaggerProvider( _listener = listenerProvider.GetListener(FeatureAttribute.InlineParameterNameHints); } + // This option controls whether or not we run at all. protected override IEnumerable> PerLanguageOptions - => ImmutableArray.Create( - InlineHintsOptions.EnabledForParameters, - InlineHintsOptions.ForLiteralParameters, - InlineHintsOptions.ForObjectCreationParameters, - InlineHintsOptions.ForOtherParameters); + => ImmutableArray.Create(InlineHintsOptions.EnabledForParameters); protected override ITaggerEventSource CreateEventSource(ITextView textViewOpt, ITextBuffer subjectBuffer) { + // The options we check here just affect the set of results we return if we run. return TaggerEventSources.Compose( TaggerEventSources.OnViewSpanChanged(ThreadingContext, textViewOpt, textChangeDelay: TaggerDelay.Short, scrollChangeDelay: TaggerDelay.NearImmediate), - TaggerEventSources.OnWorkspaceChanged(subjectBuffer, TaggerDelay.NearImmediate, _listener)); + TaggerEventSources.OnWorkspaceChanged(subjectBuffer, TaggerDelay.NearImmediate, _listener), + TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.ForLiteralParameters, TaggerDelay.NearImmediate), + TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.ForObjectCreationParameters, TaggerDelay.NearImmediate), + TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.ForOtherParameters, TaggerDelay.NearImmediate)); } protected override IEnumerable GetSpansToTag(ITextView textView, ITextBuffer subjectBuffer) From 3a6f52a50736348e48f89a0f4e72d6ea1939a993 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 6 Oct 2020 14:26:39 -0700 Subject: [PATCH 174/295] Check option in tagger. --- .../InlineHints/InlineParameterNameHintsDataTaggerProvider.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs b/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs index 3c666daa165a0..4285b1e692ccc 100644 --- a/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs +++ b/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs @@ -60,7 +60,8 @@ protected override ITaggerEventSource CreateEventSource(ITextView textViewOpt, I TaggerEventSources.OnWorkspaceChanged(subjectBuffer, TaggerDelay.NearImmediate, _listener), TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.ForLiteralParameters, TaggerDelay.NearImmediate), TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.ForObjectCreationParameters, TaggerDelay.NearImmediate), - TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.ForOtherParameters, TaggerDelay.NearImmediate)); + TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.ForOtherParameters, TaggerDelay.NearImmediate), + TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.HideForParametersThatMatchMethodIntent, TaggerDelay.NearImmediate)); } protected override IEnumerable GetSpansToTag(ITextView textView, ITextBuffer subjectBuffer) From 7d48de5b4c994f7d0dce34ef5846b5e0f4f66af6 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 6 Oct 2020 14:41:55 -0700 Subject: [PATCH 175/295] Lint --- .../Core/Portable/InlineHints/InlineParameterHintKind.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Features/Core/Portable/InlineHints/InlineParameterHintKind.cs b/src/Features/Core/Portable/InlineHints/InlineParameterHintKind.cs index 95543505831e2..4e11b0a66dcaf 100644 --- a/src/Features/Core/Portable/InlineHints/InlineParameterHintKind.cs +++ b/src/Features/Core/Portable/InlineHints/InlineParameterHintKind.cs @@ -4,7 +4,6 @@ #nullable disable - namespace Microsoft.CodeAnalysis.InlineHints { internal enum InlineParameterHintKind From 900241b01e1069be433960d38c2f9450bbf0b17c Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Mon, 5 Oct 2020 17:10:42 -0700 Subject: [PATCH 176/295] Track asynchronous operations running in ServiceHub --- eng/targets/Services.props | 1 + .../Test/Preview/PreviewWorkspaceTests.cs | 2 +- .../RenameTracking/RenameTrackingTestState.cs | 1 + .../NavigationBarPresenterTests.vb | 4 +- .../Test2/Rename/RenameTestHelpers.vb | 2 +- .../AbstractCommandHandlerTestState.cs | 2 +- .../Diagnostics/TestingOnly_WaitingService.cs | 7 +-- ...ronousOperationListenerProviderAccessor.cs | 13 ++-- ...ft.CodeAnalysis.ExternalAccess.Apex.csproj | 1 + .../VisualStudioRemoteHostClientProvider.cs | 13 ++-- .../InProcess/VisualStudioWorkspace_InProc.cs | 2 +- .../IAsynchronousOperationListenerProvider.cs | 43 +++++++++---- ...oteAsynchronousOperationListenerService.cs | 19 ++++++ .../CoreTest/Remote/ServiceDescriptorTests.cs | 13 ++-- ...AsynchronousOperationListenerExtensions.cs | 9 ++- .../MEF/UseExportProviderAttribute.cs | 4 +- .../Remote/InProcRemostHostClient.cs | 1 + .../Core/RemoteWorkspacesResources.resx | 3 + .../Remote/Core/ServiceDescriptors.cs | 2 + .../Remote/Core/ServiceHubRemoteHostClient.cs | 9 ++- .../Core/xlf/RemoteWorkspacesResources.cs.xlf | 5 ++ .../Core/xlf/RemoteWorkspacesResources.de.xlf | 5 ++ .../Core/xlf/RemoteWorkspacesResources.es.xlf | 5 ++ .../Core/xlf/RemoteWorkspacesResources.fr.xlf | 5 ++ .../Core/xlf/RemoteWorkspacesResources.it.xlf | 5 ++ .../Core/xlf/RemoteWorkspacesResources.ja.xlf | 5 ++ .../Core/xlf/RemoteWorkspacesResources.ko.xlf | 5 ++ .../Core/xlf/RemoteWorkspacesResources.pl.xlf | 5 ++ .../xlf/RemoteWorkspacesResources.pt-BR.xlf | 5 ++ .../Core/xlf/RemoteWorkspacesResources.ru.xlf | 5 ++ .../Core/xlf/RemoteWorkspacesResources.tr.xlf | 5 ++ .../xlf/RemoteWorkspacesResources.zh-Hans.xlf | 5 ++ .../xlf/RemoteWorkspacesResources.zh-Hant.xlf | 5 ++ ...oteAsynchronousOperationListenerService.cs | 60 +++++++++++++++++++ 34 files changed, 235 insertions(+), 41 deletions(-) create mode 100644 src/Workspaces/Core/Portable/Shared/TestHooks/IRemoteAsynchronousOperationListenerService.cs create mode 100644 src/Workspaces/Remote/ServiceHub/Services/Host/RemoteAsynchronousOperationListenerService.cs diff --git a/eng/targets/Services.props b/eng/targets/Services.props index 972b09b076ea1..8340c1600d01e 100644 --- a/eng/targets/Services.props +++ b/eng/targets/Services.props @@ -12,6 +12,7 @@ --> + diff --git a/src/EditorFeatures/Test/Preview/PreviewWorkspaceTests.cs b/src/EditorFeatures/Test/Preview/PreviewWorkspaceTests.cs index 07e023161b65c..bf0ebe1e5fef3 100644 --- a/src/EditorFeatures/Test/Preview/PreviewWorkspaceTests.cs +++ b/src/EditorFeatures/Test/Preview/PreviewWorkspaceTests.cs @@ -224,7 +224,7 @@ public async Task TestPreviewDiagnosticTaggerInPreviewPane() var rightTagger = provider.CreateTagger(rightBuffer); using var rightDisposable = rightTagger as IDisposable; // wait for diagnostics and taggers - await listenerProvider.WaitAllDispatcherOperationAndTasksAsync(FeatureAttribute.DiagnosticService, FeatureAttribute.ErrorSquiggles); + await listenerProvider.WaitAllDispatcherOperationAndTasksAsync(workspace, FeatureAttribute.DiagnosticService, FeatureAttribute.ErrorSquiggles); // check left buffer var leftSnapshot = leftBuffer.CurrentSnapshot; diff --git a/src/EditorFeatures/Test/RenameTracking/RenameTrackingTestState.cs b/src/EditorFeatures/Test/RenameTracking/RenameTrackingTestState.cs index cbfc8fa16f84d..853e9afd779a1 100644 --- a/src/EditorFeatures/Test/RenameTracking/RenameTrackingTestState.cs +++ b/src/EditorFeatures/Test/RenameTracking/RenameTrackingTestState.cs @@ -214,6 +214,7 @@ private async Task WaitForAsyncOperationsAsync() { var provider = Workspace.ExportProvider.GetExportedValue(); await provider.WaitAllDispatcherOperationAndTasksAsync( + Workspace, FeatureAttribute.RenameTracking, FeatureAttribute.SolutionCrawler, FeatureAttribute.Workspace, diff --git a/src/EditorFeatures/Test2/NavigationBar/NavigationBarPresenterTests.vb b/src/EditorFeatures/Test2/NavigationBar/NavigationBarPresenterTests.vb index 572bf57b5726e..d5c649aac4aef 100644 --- a/src/EditorFeatures/Test2/NavigationBar/NavigationBarPresenterTests.vb +++ b/src/EditorFeatures/Test2/NavigationBar/NavigationBarPresenterTests.vb @@ -68,7 +68,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.NavigationBar Dim controller = controllerFactory.CreateController(mockPresenter, subjectDocument.GetTextBuffer()) Dim provider = workspace.ExportProvider.GetExportedValue(Of IAsynchronousOperationListenerProvider) - Await provider.WaitAllDispatcherOperationAndTasksAsync(FeatureAttribute.Workspace, FeatureAttribute.NavigationBar) + Await provider.WaitAllDispatcherOperationAndTasksAsync(workspace, FeatureAttribute.Workspace, FeatureAttribute.NavigationBar) Assert.True(presentItemsCalled) End Using @@ -316,7 +316,7 @@ End Class Await workspaceWaiter.ExpeditedWaitAsync() Await navigationBarWaiter.ExpeditedWaitAsync() - Await listenerProvider.WaitAllDispatcherOperationAndTasksAsync(FeatureAttribute.Workspace, FeatureAttribute.NavigationBar) + Await listenerProvider.WaitAllDispatcherOperationAndTasksAsync(workspace, FeatureAttribute.Workspace, FeatureAttribute.NavigationBar) Assert.Equal("VBProj2", projectName) End Using diff --git a/src/EditorFeatures/Test2/Rename/RenameTestHelpers.vb b/src/EditorFeatures/Test2/Rename/RenameTestHelpers.vb index a956a72192e33..fc8d23a264990 100644 --- a/src/EditorFeatures/Test2/Rename/RenameTestHelpers.vb +++ b/src/EditorFeatures/Test2/Rename/RenameTestHelpers.vb @@ -110,7 +110,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename Public Async Function WaitForRename(workspace As TestWorkspace) As Task Dim provider = workspace.ExportProvider.GetExportedValue(Of AsynchronousOperationListenerProvider) - Await provider.WaitAllDispatcherOperationAndTasksAsync(FeatureAttribute.EventHookup, FeatureAttribute.Rename, FeatureAttribute.RenameTracking) + Await provider.WaitAllDispatcherOperationAndTasksAsync(workspace, FeatureAttribute.EventHookup, FeatureAttribute.Rename, FeatureAttribute.RenameTracking) End Function Public Function CreateRenameTrackingTagger(workspace As TestWorkspace, document As TestHostDocument) As ITagger(Of RenameTrackingTag) diff --git a/src/EditorFeatures/TestUtilities/AbstractCommandHandlerTestState.cs b/src/EditorFeatures/TestUtilities/AbstractCommandHandlerTestState.cs index 7723733526886..20bf54b2b1d23 100644 --- a/src/EditorFeatures/TestUtilities/AbstractCommandHandlerTestState.cs +++ b/src/EditorFeatures/TestUtilities/AbstractCommandHandlerTestState.cs @@ -235,7 +235,7 @@ public void AssertNoAsynchronousOperationsRunning() public async Task WaitForAsynchronousOperationsAsync() { var provider = Workspace.ExportProvider.GetExportedValue(); - await provider.WaitAllDispatcherOperationAndTasksAsync(FeatureAttribute.EventHookup, FeatureAttribute.CompletionSet, FeatureAttribute.SignatureHelp); + await provider.WaitAllDispatcherOperationAndTasksAsync(Workspace, FeatureAttribute.EventHookup, FeatureAttribute.CompletionSet, FeatureAttribute.SignatureHelp); } public void AssertMatchesTextStartingAtLine(int line, string text) diff --git a/src/Test/Diagnostics/TestingOnly_WaitingService.cs b/src/Test/Diagnostics/TestingOnly_WaitingService.cs index 57bb2f04b5242..4e70d67f2ebd0 100644 --- a/src/Test/Diagnostics/TestingOnly_WaitingService.cs +++ b/src/Test/Diagnostics/TestingOnly_WaitingService.cs @@ -2,13 +2,12 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using System.Composition; using System.Threading; using System.Threading.Tasks; using System.Windows.Threading; +using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Shared.TestHooks; using Roslyn.Utilities; @@ -58,9 +57,9 @@ public void WaitForAsyncOperations(TimeSpan timeout, string featureName, bool wa GC.KeepAlive(featureWaiter); } - public void WaitForAllAsyncOperations(TimeSpan timeout, params string[] featureNames) + public void WaitForAllAsyncOperations(Workspace? workspace, TimeSpan timeout, params string[] featureNames) { - var task = _provider.WaitAllAsync(featureNames, timeout: timeout); + var task = _provider.WaitAllAsync(workspace, featureNames, timeout: timeout); if (timeout == TimeSpan.FromMilliseconds(-1)) { diff --git a/src/Tools/ExternalAccess/Apex/ApexAsynchronousOperationListenerProviderAccessor.cs b/src/Tools/ExternalAccess/Apex/ApexAsynchronousOperationListenerProviderAccessor.cs index a6265dfbf7d00..d6b320613d5c0 100644 --- a/src/Tools/ExternalAccess/Apex/ApexAsynchronousOperationListenerProviderAccessor.cs +++ b/src/Tools/ExternalAccess/Apex/ApexAsynchronousOperationListenerProviderAccessor.cs @@ -2,13 +2,12 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using System.Composition; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Shared.TestHooks; +using Microsoft.VisualStudio.LanguageServices; namespace Microsoft.CodeAnalysis.ExternalAccess.Apex { @@ -17,15 +16,19 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.Apex internal sealed class ApexAsynchronousOperationListenerProviderAccessor : IApexAsynchronousOperationListenerProviderAccessor { private readonly AsynchronousOperationListenerProvider _implementation; + private readonly Workspace? _workspace; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public ApexAsynchronousOperationListenerProviderAccessor(AsynchronousOperationListenerProvider implementation) + public ApexAsynchronousOperationListenerProviderAccessor( + AsynchronousOperationListenerProvider implementation, + [Import(AllowDefault = true)] VisualStudioWorkspace? workspace) { _implementation = implementation; + _workspace = workspace; } - public Task WaitAllAsync(string[] featureNames = null, Action eventProcessingAction = null) - => _implementation.WaitAllAsync(featureNames, eventProcessingAction); + public Task WaitAllAsync(string[]? featureNames = null, Action? eventProcessingAction = null) + => _implementation.WaitAllAsync(_workspace, featureNames, eventProcessingAction); } } diff --git a/src/Tools/ExternalAccess/Apex/Microsoft.CodeAnalysis.ExternalAccess.Apex.csproj b/src/Tools/ExternalAccess/Apex/Microsoft.CodeAnalysis.ExternalAccess.Apex.csproj index fe376f49a347f..dae072a434886 100644 --- a/src/Tools/ExternalAccess/Apex/Microsoft.CodeAnalysis.ExternalAccess.Apex.csproj +++ b/src/Tools/ExternalAccess/Apex/Microsoft.CodeAnalysis.ExternalAccess.Apex.csproj @@ -24,6 +24,7 @@ + diff --git a/src/VisualStudio/Core/Def/Implementation/Remote/VisualStudioRemoteHostClientProvider.cs b/src/VisualStudio/Core/Def/Implementation/Remote/VisualStudioRemoteHostClientProvider.cs index 94fa8a14791da..77849ef821957 100644 --- a/src/VisualStudio/Core/Def/Implementation/Remote/VisualStudioRemoteHostClientProvider.cs +++ b/src/VisualStudio/Core/Def/Implementation/Remote/VisualStudioRemoteHostClientProvider.cs @@ -12,6 +12,7 @@ using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Remote; +using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.Telemetry; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.ServiceBroker; @@ -25,12 +26,14 @@ internal sealed class VisualStudioRemoteHostClientProvider : IRemoteHostClientPr internal sealed class Factory : IWorkspaceServiceFactory { private readonly IAsyncServiceProvider _vsServiceProvider; + private readonly AsynchronousOperationListenerProvider _listenerProvider; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public Factory(SVsServiceProvider vsServiceProvider) + public Factory(SVsServiceProvider vsServiceProvider, AsynchronousOperationListenerProvider listenerProvider) { _vsServiceProvider = (IAsyncServiceProvider)vsServiceProvider; + _listenerProvider = listenerProvider; } [Obsolete(MefConstruction.FactoryMethodMessage, error: true)] @@ -43,18 +46,20 @@ public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) return new DefaultRemoteHostClientProvider(); } - return new VisualStudioRemoteHostClientProvider(workspaceServices, _vsServiceProvider); + return new VisualStudioRemoteHostClientProvider(workspaceServices, _vsServiceProvider, _listenerProvider); } } private readonly HostWorkspaceServices _services; private readonly AsyncLazy _lazyClient; private readonly IAsyncServiceProvider _vsServiceProvider; + private readonly AsynchronousOperationListenerProvider _listenerProvider; - private VisualStudioRemoteHostClientProvider(HostWorkspaceServices services, IAsyncServiceProvider vsServiceProvider) + private VisualStudioRemoteHostClientProvider(HostWorkspaceServices services, IAsyncServiceProvider vsServiceProvider, AsynchronousOperationListenerProvider listenerProvider) { _services = services; _vsServiceProvider = vsServiceProvider; + _listenerProvider = listenerProvider; _lazyClient = new AsyncLazy(CreateHostClientAsync, cacheResult: true); } @@ -65,7 +70,7 @@ private VisualStudioRemoteHostClientProvider(HostWorkspaceServices services, IAs var brokeredServiceContainer = await _vsServiceProvider.GetServiceAsync().ConfigureAwait(false); var serviceBroker = brokeredServiceContainer.GetFullAccessServiceBroker(); - var client = await ServiceHubRemoteHostClient.CreateAsync(_services, serviceBroker, cancellationToken).ConfigureAwait(false); + var client = await ServiceHubRemoteHostClient.CreateAsync(_services, _listenerProvider, serviceBroker, cancellationToken).ConfigureAwait(false); // proffer in-proc brokered services: _ = brokeredServiceContainer.Proffer(SolutionAssetProvider.ServiceDescriptor, (_, _, _, _) => new ValueTask(new SolutionAssetProvider(_services))); diff --git a/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/VisualStudioWorkspace_InProc.cs b/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/VisualStudioWorkspace_InProc.cs index 3d2026d17841a..29d06af07a00a 100644 --- a/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/VisualStudioWorkspace_InProc.cs +++ b/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/VisualStudioWorkspace_InProc.cs @@ -133,7 +133,7 @@ public void WaitForAllAsyncOperations(TimeSpan timeout, params string[] featureN WaitForProjectSystem(timeout); } - GetWaitingService().WaitForAllAsyncOperations(timeout, featureNames); + GetWaitingService().WaitForAllAsyncOperations(_visualStudioWorkspace, timeout, featureNames); } public void WaitForAllAsyncOperationsOrFail(TimeSpan timeout, params string[] featureNames) diff --git a/src/Workspaces/Core/Portable/Shared/TestHooks/IAsynchronousOperationListenerProvider.cs b/src/Workspaces/Core/Portable/Shared/TestHooks/IAsynchronousOperationListenerProvider.cs index 27481a02230b9..8a2f3f0c2a9a5 100644 --- a/src/Workspaces/Core/Portable/Shared/TestHooks/IAsynchronousOperationListenerProvider.cs +++ b/src/Workspaces/Core/Portable/Shared/TestHooks/IAsynchronousOperationListenerProvider.cs @@ -2,11 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using System.Collections.Concurrent; using System.Collections.Generic; +using System.Collections.Immutable; using System.Composition; using System.Diagnostics; using System.Linq; @@ -14,6 +13,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.Remote; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Shared.TestHooks @@ -127,18 +127,39 @@ public IAsynchronousOperationWaiter GetWaiter(string featureName) /// loop, dig into the waiters and see all of the active values /// representing the remaining work. /// - public async Task WaitAllAsync(string[] featureNames = null, Action eventProcessingAction = null, TimeSpan? timeout = null) + public async Task WaitAllAsync(Workspace? workspace, string[]? featureNames = null, Action? eventProcessingAction = null, TimeSpan? timeout = null) { var startTime = Stopwatch.StartNew(); var smallTimeout = TimeSpan.FromMilliseconds(10); - Task[] tasks = null; + RemoteHostClient? remoteHostClient = null; + if (workspace?.Services.GetService() is { } remoteHostClientProvider) + { + remoteHostClient = await remoteHostClientProvider.TryGetRemoteHostClientAsync(CancellationToken.None).ConfigureAwait(false); + } + + List? tasks = null; while (true) { var waiters = GetCandidateWaiters(featureNames); - tasks = waiters.Select(x => x.ExpeditedWaitAsync()).Where(t => !t.IsCompleted).ToArray(); + tasks = waiters.Select(x => x.ExpeditedWaitAsync()).Where(t => !t.IsCompleted).ToList(); + + if (remoteHostClient is not null) + { + var isCompleted = await remoteHostClient.TryInvokeAsync( + (service, cancellationToken) => service.IsCompletedAsync(featureNames.ToImmutableArrayOrEmpty(), cancellationToken), + callbackTarget: null, + CancellationToken.None).ConfigureAwait(false); + if (isCompleted.HasValue && !isCompleted.Value) + { + tasks.Add(remoteHostClient.TryInvokeAsync( + (service, cancellationToken) => service.ExpeditedWaitAsync(featureNames.ToImmutableArrayOrEmpty(), cancellationToken), + callbackTarget: null, + CancellationToken.None).AsTask()); + } + } - if (tasks.Length == 0) + if (tasks.Count == 0) { // no new pending tasks break; @@ -147,7 +168,7 @@ public async Task WaitAllAsync(string[] featureNames = null, Action eventProcess do { // wait for all current tasks to be done for the time given - if (Task.WaitAll(tasks, smallTimeout)) + if (Task.WaitAll(tasks.ToArray(), smallTimeout)) { // current set of tasks are done. // see whether there are new tasks added while we were waiting @@ -190,7 +211,7 @@ public bool HasPendingWaiter(params string[] featureNames) public List GetTokens() => _singletonListeners.Values.Where(l => l.TrackActiveTokens).SelectMany(l => l.ActiveDiagnosticTokens).ToList(); - private static bool IsEnabled + internal static bool IsEnabled { get { @@ -205,7 +226,7 @@ private static bool IsEnabled } } - private bool DiagnosticTokensEnabled + internal bool DiagnosticTokensEnabled { get { @@ -227,7 +248,7 @@ private bool DiagnosticTokensEnabled } } - private IEnumerable GetCandidateWaiters(string[] featureNames) + private IEnumerable GetCandidateWaiters(string[]? featureNames) { if (featureNames == null || featureNames.Length == 0) { @@ -241,7 +262,7 @@ private sealed class NullOperationListener : IAsynchronousOperationListener { public IAsyncToken BeginAsyncOperation( string name, - object tag = null, + object? tag = null, [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0) => EmptyAsyncToken.Instance; diff --git a/src/Workspaces/Core/Portable/Shared/TestHooks/IRemoteAsynchronousOperationListenerService.cs b/src/Workspaces/Core/Portable/Shared/TestHooks/IRemoteAsynchronousOperationListenerService.cs new file mode 100644 index 0000000000000..aecc177254ef0 --- /dev/null +++ b/src/Workspaces/Core/Portable/Shared/TestHooks/IRemoteAsynchronousOperationListenerService.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Immutable; +using System.Threading; +using System.Threading.Tasks; + +namespace Microsoft.CodeAnalysis.Shared.TestHooks +{ + internal interface IRemoteAsynchronousOperationListenerService + { + ValueTask EnableAsync(bool enable, bool diagnostics, CancellationToken cancellationToken); + + ValueTask IsCompletedAsync(ImmutableArray featureNames, CancellationToken cancellationToken); + + ValueTask ExpeditedWaitAsync(ImmutableArray featureNames, CancellationToken cancellationToken); + } +} diff --git a/src/Workspaces/CoreTest/Remote/ServiceDescriptorTests.cs b/src/Workspaces/CoreTest/Remote/ServiceDescriptorTests.cs index a87ed6eb548b8..2fc2c01f9a5bd 100644 --- a/src/Workspaces/CoreTest/Remote/ServiceDescriptorTests.cs +++ b/src/Workspaces/CoreTest/Remote/ServiceDescriptorTests.cs @@ -23,6 +23,9 @@ namespace Microsoft.CodeAnalysis.Remote.UnitTests { public class ServiceDescriptorTests { + public static IEnumerable ServiceTypes + => ServiceDescriptors.Descriptors.Select(descriptor => new object[] { descriptor.Key }); + private static Dictionary GetAllParameterTypesOfRemoteApis() { var interfaces = new List(); @@ -156,13 +159,11 @@ public void TypesUsedInRemoteApisMustBeMessagePackSerializable() AssertEx.Empty(errors, "Types are not MessagePack-serializable"); } - [Fact] - public void GetFeatureName() + [Theory] + [MemberData(nameof(ServiceTypes))] + public void GetFeatureName(Type serviceType) { - foreach (var (serviceType, _) in ServiceDescriptors.Descriptors) - { - Assert.NotEmpty(ServiceDescriptors.GetFeatureName(serviceType)); - } + Assert.NotEmpty(ServiceDescriptors.GetFeatureName(serviceType)); } } } diff --git a/src/Workspaces/CoreTestUtilities/AsynchronousOperationListenerExtensions.cs b/src/Workspaces/CoreTestUtilities/AsynchronousOperationListenerExtensions.cs index cebda88c922ba..222b9d610e501 100644 --- a/src/Workspaces/CoreTestUtilities/AsynchronousOperationListenerExtensions.cs +++ b/src/Workspaces/CoreTestUtilities/AsynchronousOperationListenerExtensions.cs @@ -2,15 +2,20 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Remote; using Microsoft.CodeAnalysis.Shared.TestHooks; namespace Roslyn.Test.Utilities { public static class AsynchronousOperationListenerExtensions { - internal static Task WaitAllDispatcherOperationAndTasksAsync(this IAsynchronousOperationListenerProvider provider, params string[] featureNames) - => ((AsynchronousOperationListenerProvider)provider).WaitAllAsync(featureNames); + internal static async Task WaitAllDispatcherOperationAndTasksAsync(this IAsynchronousOperationListenerProvider provider, Workspace? workspace, params string[] featureNames) + { + await ((AsynchronousOperationListenerProvider)provider).WaitAllAsync(workspace, featureNames).ConfigureAwait(false); + } internal static IAsynchronousOperationWaiter GetWaiter(this IAsynchronousOperationListenerProvider provider, string featureName) => (IAsynchronousOperationWaiter)provider.GetListener(featureName); diff --git a/src/Workspaces/CoreTestUtilities/MEF/UseExportProviderAttribute.cs b/src/Workspaces/CoreTestUtilities/MEF/UseExportProviderAttribute.cs index 28dc247d9f0ed..987c60476ec00 100644 --- a/src/Workspaces/CoreTestUtilities/MEF/UseExportProviderAttribute.cs +++ b/src/Workspaces/CoreTestUtilities/MEF/UseExportProviderAttribute.cs @@ -145,7 +145,9 @@ private static void DisposeExportProvider(ExportProvider? exportProvider) try { - var waiter = ((AsynchronousOperationListenerProvider)listenerProvider).WaitAllDispatcherOperationAndTasksAsync(); + // This attribute cleans up the in-process and out-of-process export providers separately, so we + // don't need to provide a workspace when waiting for operations to complete. + var waiter = ((AsynchronousOperationListenerProvider)listenerProvider).WaitAllDispatcherOperationAndTasksAsync(workspace: null); waiter.JoinUsingDispatcher(timeoutTokenSource.Token); } catch (OperationCanceledException ex) when (timeoutTokenSource.IsCancellationRequested) diff --git a/src/Workspaces/CoreTestUtilities/Remote/InProcRemostHostClient.cs b/src/Workspaces/CoreTestUtilities/Remote/InProcRemostHostClient.cs index 30b1ff55a6670..6a0d9483df837 100644 --- a/src/Workspaces/CoreTestUtilities/Remote/InProcRemostHostClient.cs +++ b/src/Workspaces/CoreTestUtilities/Remote/InProcRemostHostClient.cs @@ -248,6 +248,7 @@ public InProcRemoteServices(HostWorkspaceServices workspaceServices, TraceListen RegisterService(WellKnownServiceHubService.RemoteHost, (s, p, o) => new RemoteHostService(s, p)); RegisterInProcBrokeredService(SolutionAssetProvider.ServiceDescriptor, () => new SolutionAssetProvider(workspaceServices)); + RegisterRemoteBrokeredService(new RemoteAsynchronousOperationListenerService.Factory()); RegisterRemoteBrokeredService(new RemoteSymbolSearchUpdateService.Factory()); RegisterRemoteBrokeredService(new RemoteDesignerAttributeDiscoveryService.Factory()); RegisterRemoteBrokeredService(new RemoteProjectTelemetryService.Factory()); diff --git a/src/Workspaces/Remote/Core/RemoteWorkspacesResources.resx b/src/Workspaces/Remote/Core/RemoteWorkspacesResources.resx index a7055d04205cf..c918f954ddd6e 100644 --- a/src/Workspaces/Remote/Core/RemoteWorkspacesResources.resx +++ b/src/Workspaces/Remote/Core/RemoteWorkspacesResources.resx @@ -183,4 +183,7 @@ TODO comments discovery + + Asynchronous operation listener + \ No newline at end of file diff --git a/src/Workspaces/Remote/Core/ServiceDescriptors.cs b/src/Workspaces/Remote/Core/ServiceDescriptors.cs index d7474a2e855ca..01c73b9a6362c 100644 --- a/src/Workspaces/Remote/Core/ServiceDescriptors.cs +++ b/src/Workspaces/Remote/Core/ServiceDescriptors.cs @@ -19,6 +19,7 @@ using Microsoft.CodeAnalysis.NavigateTo; using Microsoft.CodeAnalysis.ProjectTelemetry; using Microsoft.CodeAnalysis.Rename; +using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.SymbolSearch; using Microsoft.CodeAnalysis.TodoComments; using Microsoft.ServiceHub.Framework; @@ -41,6 +42,7 @@ internal static class ServiceDescriptors internal static readonly ImmutableDictionary Descriptors = ImmutableDictionary.CreateRange(new[] { + CreateDescriptors(typeof(IRemoteAsynchronousOperationListenerService)), CreateDescriptors(typeof(IRemoteTodoCommentsDiscoveryService), callbackInterface: typeof(ITodoCommentsListener)), CreateDescriptors(typeof(IRemoteDesignerAttributeDiscoveryService), callbackInterface: typeof(IDesignerAttributeListener)), CreateDescriptors(typeof(IRemoteProjectTelemetryService), callbackInterface: typeof(IProjectTelemetryListener)), diff --git a/src/Workspaces/Remote/Core/ServiceHubRemoteHostClient.cs b/src/Workspaces/Remote/Core/ServiceHubRemoteHostClient.cs index 294fbb6e38b07..88a7490ec4c75 100644 --- a/src/Workspaces/Remote/Core/ServiceHubRemoteHostClient.cs +++ b/src/Workspaces/Remote/Core/ServiceHubRemoteHostClient.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System; -using System.Diagnostics; using System.Globalization; using System.IO; using System.Threading; @@ -14,6 +13,7 @@ using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Internal.Log; using Microsoft.CodeAnalysis.Serialization; +using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.Telemetry; using Microsoft.ServiceHub.Client; using Microsoft.ServiceHub.Framework; @@ -72,7 +72,7 @@ private ServiceHubRemoteHostClient( private void OnUnexpectedExceptionThrown(Exception unexpectedException) => _errorReportingService?.ShowRemoteHostCrashedErrorInfo(unexpectedException); - public static async Task CreateAsync(HostWorkspaceServices services, IServiceBroker serviceBroker, CancellationToken cancellationToken) + public static async Task CreateAsync(HostWorkspaceServices services, AsynchronousOperationListenerProvider listenerProvider, IServiceBroker serviceBroker, CancellationToken cancellationToken) { using (Logger.LogBlock(FunctionId.ServiceHubRemoteHostClient_CreateAsync, KeyValueLogMessage.NoProperty, cancellationToken)) { @@ -98,6 +98,11 @@ await client._endPoint.InvokeAsync( new object?[] { uiCultureLCID, cultureLCID }, cancellationToken).ConfigureAwait(false); + await client.TryInvokeAsync( + (service, cancellationToken) => service.EnableAsync(AsynchronousOperationListenerProvider.IsEnabled, listenerProvider.DiagnosticTokensEnabled, cancellationToken), + callbackTarget: null, + cancellationToken).ConfigureAwait(false); + client.Started(); return client; } diff --git a/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.cs.xlf b/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.cs.xlf index 5cf79a1dcd8ac..1a663219c3412 100644 --- a/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.cs.xlf +++ b/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.cs.xlf @@ -2,6 +2,11 @@ + + Asynchronous operation listener + Asynchronous operation listener + + CodeLens references CodeLens references diff --git a/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.de.xlf b/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.de.xlf index c7438653818e1..49a856caf08af 100644 --- a/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.de.xlf +++ b/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.de.xlf @@ -2,6 +2,11 @@ + + Asynchronous operation listener + Asynchronous operation listener + + CodeLens references CodeLens references diff --git a/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.es.xlf b/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.es.xlf index 961d988a73908..cef93cbacc5a5 100644 --- a/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.es.xlf +++ b/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.es.xlf @@ -2,6 +2,11 @@ + + Asynchronous operation listener + Asynchronous operation listener + + CodeLens references CodeLens references diff --git a/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.fr.xlf b/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.fr.xlf index 4de4b95589c24..b02d203cc5971 100644 --- a/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.fr.xlf +++ b/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.fr.xlf @@ -2,6 +2,11 @@ + + Asynchronous operation listener + Asynchronous operation listener + + CodeLens references CodeLens references diff --git a/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.it.xlf b/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.it.xlf index cd16f1d4a8e8b..9ecc518179365 100644 --- a/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.it.xlf +++ b/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.it.xlf @@ -2,6 +2,11 @@ + + Asynchronous operation listener + Asynchronous operation listener + + CodeLens references CodeLens references diff --git a/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.ja.xlf b/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.ja.xlf index 670006576714f..1c47084d33ed4 100644 --- a/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.ja.xlf +++ b/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.ja.xlf @@ -2,6 +2,11 @@ + + Asynchronous operation listener + Asynchronous operation listener + + CodeLens references CodeLens references diff --git a/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.ko.xlf b/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.ko.xlf index bf0c69be3b194..ed0f8befa0521 100644 --- a/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.ko.xlf +++ b/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.ko.xlf @@ -2,6 +2,11 @@ + + Asynchronous operation listener + Asynchronous operation listener + + CodeLens references CodeLens references diff --git a/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.pl.xlf b/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.pl.xlf index 63036390f159f..3fe2d525d15a1 100644 --- a/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.pl.xlf +++ b/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.pl.xlf @@ -2,6 +2,11 @@ + + Asynchronous operation listener + Asynchronous operation listener + + CodeLens references CodeLens references diff --git a/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.pt-BR.xlf b/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.pt-BR.xlf index 4a6f2853990a9..e4f4b44e76e40 100644 --- a/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.pt-BR.xlf +++ b/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.pt-BR.xlf @@ -2,6 +2,11 @@ + + Asynchronous operation listener + Asynchronous operation listener + + CodeLens references CodeLens references diff --git a/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.ru.xlf b/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.ru.xlf index 1ad650d8156ff..d677ccdbaf019 100644 --- a/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.ru.xlf +++ b/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.ru.xlf @@ -2,6 +2,11 @@ + + Asynchronous operation listener + Asynchronous operation listener + + CodeLens references CodeLens references diff --git a/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.tr.xlf b/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.tr.xlf index 3a5b8c41b3d30..045b599fc89b9 100644 --- a/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.tr.xlf +++ b/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.tr.xlf @@ -2,6 +2,11 @@ + + Asynchronous operation listener + Asynchronous operation listener + + CodeLens references CodeLens references diff --git a/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.zh-Hans.xlf b/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.zh-Hans.xlf index ce5bfe569807d..f90b3bc643c05 100644 --- a/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.zh-Hans.xlf +++ b/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.zh-Hans.xlf @@ -2,6 +2,11 @@ + + Asynchronous operation listener + Asynchronous operation listener + + CodeLens references CodeLens references diff --git a/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.zh-Hant.xlf b/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.zh-Hant.xlf index 050669b54e42e..c79cbac8041b1 100644 --- a/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.zh-Hant.xlf +++ b/src/Workspaces/Remote/Core/xlf/RemoteWorkspacesResources.zh-Hant.xlf @@ -2,6 +2,11 @@ + + Asynchronous operation listener + Asynchronous operation listener + + CodeLens references CodeLens references diff --git a/src/Workspaces/Remote/ServiceHub/Services/Host/RemoteAsynchronousOperationListenerService.cs b/src/Workspaces/Remote/ServiceHub/Services/Host/RemoteAsynchronousOperationListenerService.cs new file mode 100644 index 0000000000000..94f97098d2a3b --- /dev/null +++ b/src/Workspaces/Remote/ServiceHub/Services/Host/RemoteAsynchronousOperationListenerService.cs @@ -0,0 +1,60 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Immutable; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.Shared.TestHooks; + +namespace Microsoft.CodeAnalysis.Remote +{ + internal class RemoteAsynchronousOperationListenerService : BrokeredServiceBase, IRemoteAsynchronousOperationListenerService + { + public RemoteAsynchronousOperationListenerService(in ServiceConstructionArguments arguments) + : base(in arguments) + { + } + + public ValueTask EnableAsync(bool enable, bool diagnostics, CancellationToken cancellationToken) + { + return RunServiceAsync(cancellationToken => + { + AsynchronousOperationListenerProvider.Enable(enable, diagnostics); + return default; + }, cancellationToken); + } + + public ValueTask IsCompletedAsync(ImmutableArray featureNames, CancellationToken cancellationToken) + { + return RunServiceAsync(cancellationToken => + { + var workspace = GetWorkspace(); + var exportProvider = (IMefHostExportProvider)workspace.Services.HostServices; + var listenerProvider = exportProvider.GetExports().Single().Value; + + return new ValueTask(!listenerProvider.HasPendingWaiter(featureNames.ToArray())); + }, cancellationToken); + } + + public ValueTask ExpeditedWaitAsync(ImmutableArray featureNames, CancellationToken cancellationToken) + { + return RunServiceAsync(async cancellationToken => + { + var workspace = GetWorkspace(); + var exportProvider = (IMefHostExportProvider)workspace.Services.HostServices; + var listenerProvider = exportProvider.GetExports().Single().Value; + + await listenerProvider.WaitAllAsync(workspace, featureNames.ToArray()).ConfigureAwait(false); + }, cancellationToken); + } + + internal sealed class Factory : FactoryBase + { + protected override IRemoteAsynchronousOperationListenerService CreateService(in ServiceConstructionArguments arguments) + => new RemoteAsynchronousOperationListenerService(in arguments); + } + } +} From 19d16744886f3b872b861d56c2f089e1b5f96241 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Tue, 6 Oct 2020 06:39:28 -0700 Subject: [PATCH 177/295] Enable fuzzy matching for RemoteTemporaryWorkspace Fixes test failures of GFUFuzzyMatchAfterRenameTracking. --- .../Core/Portable/AddImport/AbstractAddImportFeatureService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Features/Core/Portable/AddImport/AbstractAddImportFeatureService.cs b/src/Features/Core/Portable/AddImport/AbstractAddImportFeatureService.cs index 980cb46fc1ddb..c25efe6fcad1a 100644 --- a/src/Features/Core/Portable/AddImport/AbstractAddImportFeatureService.cs +++ b/src/Features/Core/Portable/AddImport/AbstractAddImportFeatureService.cs @@ -156,7 +156,8 @@ private async Task> FindResultsAsync( private static bool IsHostOrRemoteWorkspace(Project project) { return project.Solution.Workspace.Kind == WorkspaceKind.Host || - project.Solution.Workspace.Kind == WorkspaceKind.RemoteWorkspace; + project.Solution.Workspace.Kind == WorkspaceKind.RemoteWorkspace || + project.Solution.Workspace.Kind == WorkspaceKind.RemoteTemporaryWorkspace; } private async Task> FindResultsAsync( From ec16f3571db59c35c14f988af9e54d8c242baf2e Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 6 Oct 2020 15:08:33 -0700 Subject: [PATCH 178/295] Share logic --- ...ineParameterNameHintsDataTaggerProvider.cs | 6 +- .../AbstractInlineParameterNameHintsTests.vb | 2 +- .../CSharpInlineParameterNameHintsService.cs | 69 ++++---- ...AbstractInlineParameterNameHintsService.cs | 149 +++++++++++++++--- .../InlineHints/InlineParameterHint.cs | 11 +- ...ualBasicInlineParameterNameHintsService.vb | 74 ++++----- 6 files changed, 202 insertions(+), 109 deletions(-) diff --git a/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs b/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs index 4285b1e692ccc..970d90470465c 100644 --- a/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs +++ b/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs @@ -93,7 +93,11 @@ protected override async Task ProduceTagsAsync(TaggerContext(new SnapshotSpan(snapshotSpan.Snapshot, parameterHint.Position, 0), new InlineParameterNameHintDataTag(parameterHint.ParameterSymbolKey, parameterHint.Name))); + context.AddTag(new TagSpan( + new SnapshotSpan(snapshotSpan.Snapshot, parameterHint.Position, 0), + new InlineParameterNameHintDataTag( + parameterHint.Parameter.GetSymbolKey(cancellationToken), + parameterHint.Parameter.Name))); } } } diff --git a/src/EditorFeatures/Test2/InlineHints/AbstractInlineParameterNameHintsTests.vb b/src/EditorFeatures/Test2/InlineHints/AbstractInlineParameterNameHintsTests.vb index a69fbed16a587..69245959e73ad 100644 --- a/src/EditorFeatures/Test2/InlineHints/AbstractInlineParameterNameHintsTests.vb +++ b/src/EditorFeatures/Test2/InlineHints/AbstractInlineParameterNameHintsTests.vb @@ -27,7 +27,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Dim paramNameHintSpans = Await tagService.GetInlineParameterNameHintsAsync(document, New Text.TextSpan(0, snapshot.Length), New CancellationToken()) Dim producedTags = From tag In paramNameHintSpans - Select tag.Name + ":" + tag.Position.ToString + Select tag.Parameter.Name + ":" + tag.Position.ToString Dim expectedTags As New List(Of String) diff --git a/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs b/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs index 0d07c6d63dced..78d12b863157a 100644 --- a/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs +++ b/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs @@ -9,6 +9,7 @@ using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.InlineHints; +using Microsoft.CodeAnalysis.PooledObjects; namespace Microsoft.CodeAnalysis.CSharp.InlineHints { @@ -28,57 +29,47 @@ public CSharpInlineParameterNameHintsService() protected override void AddAllParameterNameHintLocations( SemanticModel semanticModel, SyntaxNode node, - Action addHint, - bool hideForParametersThatDifferBySuffix, - bool hideForParametersThatMatchMethodIntent, + ArrayBuilder buffer, CancellationToken cancellationToken) { - if (node is ArgumentSyntax argument) + if (node is BaseArgumentListSyntax argumentList) { - if (argument.NameColon != null) - return; - - var parameter = argument.DetermineParameter(semanticModel, cancellationToken: cancellationToken); - if (string.IsNullOrEmpty(parameter?.Name)) - return; - - if (hideForParametersThatMatchMethodIntent && MatchesMethodIntent(argument, parameter)) - return; - - addHint(new InlineParameterHint(parameter.GetSymbolKey(cancellationToken), parameter.Name, argument.Span.Start, GetKind(argument.Expression))); + AddArguments(semanticModel, buffer, argumentList, cancellationToken); } - else if (node is AttributeArgumentSyntax attribute) + else if (node is AttributeArgumentListSyntax attributeArgumentList) { - if (attribute.NameEquals != null || attribute.NameColon != null) - return; - - var parameter = attribute.DetermineParameter(semanticModel, cancellationToken: cancellationToken); - if (string.IsNullOrEmpty(parameter?.Name)) - return; - - addHint(new InlineParameterHint(parameter.GetSymbolKey(cancellationToken), parameter.Name, attribute.SpanStart, GetKind(attribute.Expression))); + AddArguments(semanticModel, buffer, attributeArgumentList, cancellationToken); } } - private static bool MatchesMethodIntent(ArgumentSyntax argument, IParameterSymbol parameter) + private static void AddArguments(SemanticModel semanticModel, ArrayBuilder buffer, AttributeArgumentListSyntax argumentList, CancellationToken cancellationToken) { - // Methods like `SetColor(color: "y")` `FromResult(result: "x")` `Enable/DisablePolling(bool)` don't need - // parameter names to improve clarity. The parameter is clear from the context of the method name. - if (argument.Parent is not ArgumentListSyntax argumentList) - return false; - - if (argumentList.Arguments[0] != argument) - return false; + foreach (var argument in argumentList.Arguments) + { + if (argument.NameEquals != null || argument.NameColon != null) + continue; - if (argumentList.Parent is not InvocationExpressionSyntax invocationExpression) - return false; + var parameter = argument.DetermineParameter(semanticModel, cancellationToken: cancellationToken); + buffer.Add(new InlineParameterHint( + parameter, + argument.Span.Start, + GetKind(argument.Expression))); + } + } - var invokedExpression = invocationExpression.Expression; - var rightMostName = invokedExpression.GetRightmostName(); - if (rightMostName == null) - return false; + private static void AddArguments(SemanticModel semanticModel, ArrayBuilder buffer, BaseArgumentListSyntax argumentList, CancellationToken cancellationToken) + { + foreach (var argument in argumentList.Arguments) + { + if (argument.NameColon != null) + continue; - return MatchesMethodIntent(rightMostName.Identifier.ValueText, parameter); + var parameter = argument.DetermineParameter(semanticModel, cancellationToken: cancellationToken); + buffer.Add(new InlineParameterHint( + parameter, + argument.Span.Start, + GetKind(argument.Expression))); + } } private static InlineParameterHintKind GetKind(ExpressionSyntax arg) diff --git a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs index 32e9172ccbc98..3028660d96f31 100644 --- a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Immutable; -using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.PooledObjects; @@ -17,8 +16,9 @@ namespace Microsoft.CodeAnalysis.InlineHints internal abstract class AbstractInlineParameterNameHintsService : IInlineParameterNameHintsService { protected abstract void AddAllParameterNameHintLocations( - SemanticModel semanticModel, SyntaxNode node, Action addHint, - bool hideForParametersThatDifferBySuffix, bool hideForParametersThatMatchMethodIntent, + SemanticModel semanticModel, + SyntaxNode node, + ArrayBuilder buffer, CancellationToken cancellationToken); public async Task> GetInlineParameterNameHintsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken) @@ -42,26 +42,123 @@ public async Task> GetInlineParameterNameHin var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); using var _1 = ArrayBuilder.GetInstance(out var result); - - Action addHint = AddHint; + using var _2 = ArrayBuilder.GetInstance(out var buffer); foreach (var node in root.DescendantNodes(textSpan)) { cancellationToken.ThrowIfCancellationRequested(); - AddAllParameterNameHintLocations( - semanticModel, node, addHint, - hideForParametersThatDifferBySuffix, - hideForParametersThatMatchMethodIntent, - cancellationToken); + AddAllParameterNameHintLocations(semanticModel, node, buffer, cancellationToken); + + if (buffer.Count > 0) + { + AddHintsIfAppropriate(); + buffer.Clear(); + } } return result.ToImmutable(); - void AddHint(InlineParameterHint hint) + void AddHintsIfAppropriate() + { + if (hideForParametersThatDifferBySuffix && ParametersDifferOnlyBySuffix(buffer)) + return; + + foreach (var hint in buffer) + { + if (string.IsNullOrEmpty(hint.Parameter?.Name)) + continue; + + if (hideForParametersThatMatchMethodIntent && MatchesMethodIntent(hint)) + continue; + + if (HintMatches(hint, literalParameters, objectCreationParameters, otherParameters)) + result.Add(hint); + } + } + } + + private static bool ParametersDifferOnlyBySuffix(ArrayBuilder parameterHints) + { + // Only relevant if we have two or more parameters. + if (parameterHints.Count <= 1) + return false; + + return ParametersDifferOnlyByAlphaSuffix(parameterHints) || + ParametersDifferOnlyByNumericSuffix(parameterHints); + + static bool ParametersDifferOnlyByAlphaSuffix(ArrayBuilder parameterHints) + { + if (!HasAlphaSuffix(parameterHints[0], out var firstPrefix)) + return false; + + for (var i = 1; i < parameterHints.Count; i++) + { + if (!HasAlphaSuffix(parameterHints[i], out var nextPrefix)) + return false; + + if (!firstPrefix.Span.Equals(nextPrefix.Span, StringComparison.Ordinal)) + return false; + } + + return true; + } + + static bool ParametersDifferOnlyByNumericSuffix(ArrayBuilder parameterHints) + { + if (!HasNumericSuffix(parameterHints[0], out var firstPrefix)) + return false; + + for (var i = 1; i < parameterHints.Count; i++) + { + if (!HasNumericSuffix(parameterHints[i], out var nextPrefix)) + return false; + + if (!firstPrefix.Span.Equals(nextPrefix.Span, StringComparison.Ordinal)) + return false; + } + + return true; + } + + static bool HasAlphaSuffix(InlineParameterHint hint, out ReadOnlyMemory prefix) + { + var name = hint.Parameter?.Name; + + // Has to end with A-Z + // That A-Z can't be following another A-Z (that's just a capitalized word). + if (name?.Length >= 2 && + IsUpperAlpha(name[^1]) && + !IsUpperAlpha(name[^2])) + { + prefix = name.AsMemory()[..^1]; + return true; + } + + prefix = default; + return false; + } + + static bool HasNumericSuffix(InlineParameterHint hint, out ReadOnlyMemory prefix) { - if (HintMatches(hint, literalParameters, objectCreationParameters, otherParameters)) - result.Add(hint); + var name = hint.Parameter?.Name; + + // Has to end with 0-9. only handles single-digit numeric suffix for now for simplicity + if (name?.Length >= 2 && + IsNumeric(name[^1])) + { + prefix = name.AsMemory()[..^1]; + return true; + } + + prefix = default; + return false; } + + static bool IsUpperAlpha(char c) + => c is >= 'A' and <= 'Z'; + + static bool IsNumeric(char c) + => c is >= '0' and <= '9'; } private static bool HintMatches(InlineParameterHint hint, bool literalParameters, bool objectCreationParameters, bool otherParameters) @@ -73,8 +170,24 @@ private static bool HintMatches(InlineParameterHint hint, bool literalParameters _ => throw ExceptionUtilities.UnexpectedValue(hint.Kind), }; - protected static bool MatchesMethodIntent(string methodName, IParameterSymbol parameter) + protected static bool MatchesMethodIntent(InlineParameterHint hint) { + // Methods like `SetColor(color: "y")` `FromResult(result: "x")` `Enable/DisablePolling(bool)` don't need + // parameter names to improve clarity. The parameter is clear from the context of the method name. + + // First, this only applies to methods (as we're looking at the method name itself) so filter down to those. + var parameter = hint.Parameter; + if (parameter is not { ContainingSymbol: IMethodSymbol { MethodKind: MethodKind.Ordinary } method }) + return false; + + // We only care when dealing with the first parameter. Note: we don't have to worry parameter reordering + // due to named-parameter use. That's because this entire feature only works when we don't use + // named-parameters. So, by definition, the parameter/arg must be in the right location. + if (method.Parameters[0] != parameter) + return false; + + var methodName = method.Name; + // Check for something like `EnableLogging(true)` if (TryGetIntent("Enable", methodName, out _) || TryGetIntent("Disable", methodName, out _)) @@ -86,22 +199,22 @@ protected static bool MatchesMethodIntent(string methodName, IParameterSymbol pa if (TryGetIntent("Set", methodName, out var methodIntent) || TryGetIntent("From", methodName, out methodIntent)) { - return IntentNameMatchesParameterName(methodIntent.Value, parameter.Name); + return IntentNameMatchesParameterName(methodIntent, parameter.Name); } return false; - static bool TryGetIntent(string prefix, string nameValue, [NotNullWhen(true)] out ReadOnlyMemory? result) + static bool TryGetIntent(string prefix, string nameValue, out ReadOnlyMemory result) { if (nameValue.Length > prefix.Length && nameValue.StartsWith(prefix) && char.IsUpper(nameValue[prefix.Length])) { - result = nameValue.AsMemory().Slice(prefix.Length); + result = nameValue.AsMemory()[prefix.Length..]; return true; } - result = null; + result = default; return false; } diff --git a/src/Features/Core/Portable/InlineHints/InlineParameterHint.cs b/src/Features/Core/Portable/InlineHints/InlineParameterHint.cs index 877d56c1487a9..fd53b8e03bd87 100644 --- a/src/Features/Core/Portable/InlineHints/InlineParameterHint.cs +++ b/src/Features/Core/Portable/InlineHints/InlineParameterHint.cs @@ -8,15 +8,16 @@ namespace Microsoft.CodeAnalysis.InlineHints { internal readonly struct InlineParameterHint { - public readonly SymbolKey ParameterSymbolKey; - public readonly string Name; + public readonly IParameterSymbol Parameter; public readonly int Position; public readonly InlineParameterHintKind Kind; - public InlineParameterHint(SymbolKey parameterSymbolKey, string name, int position, InlineParameterHintKind kind) + public InlineParameterHint( + IParameterSymbol parameter, + int position, + InlineParameterHintKind kind) { - ParameterSymbolKey = parameterSymbolKey; - Name = name; + Parameter = parameter; Position = position; Kind = kind; } diff --git a/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb b/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb index 0823646f301a5..598773234cb78 100644 --- a/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb +++ b/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb @@ -6,6 +6,7 @@ Imports System.Composition Imports System.Threading Imports Microsoft.CodeAnalysis.Host.Mef Imports Microsoft.CodeAnalysis.InlineHints +Imports Microsoft.CodeAnalysis.PooledObjects Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Namespace Microsoft.CodeAnalysis.VisualBasic.InlineParameterNameHints @@ -21,57 +22,40 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.InlineParameterNameHints Protected Overrides Sub AddAllParameterNameHintLocations( semanticModel As SemanticModel, node As SyntaxNode, - addHint As Action(Of InlineParameterHint), - hideForParametersThatDifferBySuffix As Boolean, - hideForParametersThatMatchMethodIntent As Boolean, - CancellationToken As CancellationToken) + buffer As ArrayBuilder(Of InlineParameterHint), + cancellationToken As CancellationToken) - Dim argument = TryCast(node, SimpleArgumentSyntax) - If argument?.Expression Is Nothing Then - Return - End If - - If argument.IsNamed OrElse argument.NameColonEquals IsNot Nothing Then - Return - End If - - Dim parameter = argument.DetermineParameter(semanticModel, allowParamArray:=False, CancellationToken) - If String.IsNullOrEmpty(parameter?.Name) Then - Return - End If - - If hideForParametersThatMatchMethodIntent AndAlso MatchesMethodIntent(argument, parameter) Then + Dim argumentList = TryCast(node, ArgumentListSyntax) + If argumentList Is Nothing Then Return End If - addHint(New InlineParameterHint(parameter.GetSymbolKey(CancellationToken), parameter.Name, argument.Span.Start, GetKind(argument.Expression))) + For Each arg In argumentList.Arguments + Dim argument = TryCast(arg, SimpleArgumentSyntax) + If argument Is Nothing Then + Continue For + End If + + If argument?.Expression Is Nothing Then + Continue For + End If + + If argument.IsNamed OrElse argument.NameColonEquals IsNot Nothing Then + Continue For + End If + + Dim parameter = argument.DetermineParameter(semanticModel, allowParamArray:=False, cancellationToken) + If String.IsNullOrEmpty(parameter?.Name) Then + Continue For + End If + + buffer.Add(New InlineParameterHint( + parameter, + argument.Span.Start, + GetKind(argument.Expression))) + Next End Sub - Private Overloads Shared Function MatchesMethodIntent(argument As ArgumentSyntax, parameter As IParameterSymbol) As Boolean - ' Methods Like `SetColor(color: "y")` `FromResult(result: "x")` `Enable/DisablePolling(bool)` don't need - ' parameter names to improve clarity. The parameter Is clear from the context of the method name. - Dim argumentList = TryCast(argument.Parent, ArgumentListSyntax) - If argumentList Is Nothing Then - Return False - End If - - If argumentList.Arguments(0) IsNot argument Then - Return False - End If - - Dim invocationExpression = TryCast(argumentList.Parent, InvocationExpressionSyntax) - If invocationExpression Is Nothing Then - Return False - End If - - Dim rightMostName = invocationExpression.Expression.GetRightmostName() - If rightMostName Is Nothing Then - Return False - End If - - Return AbstractInlineParameterNameHintsService.MatchesMethodIntent(rightMostName.Identifier.ValueText, parameter) - End Function - Private Function GetKind(arg As ExpressionSyntax) As InlineParameterHintKind If TypeOf arg Is LiteralExpressionSyntax OrElse TypeOf arg Is InterpolatedStringExpressionSyntax Then From 64e59923c39700342e738d9407dddd371a7bf889 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 6 Oct 2020 15:54:49 -0700 Subject: [PATCH 179/295] Add tests --- .../CSharpInlineParameterNameHintsTests.vb | 100 ++++++++++++++++++ ...isualBasicInlineParameterNameHintsTests.vb | 88 +++++++++++++++ 2 files changed, 188 insertions(+) diff --git a/src/EditorFeatures/Test2/InlineHints/CSharpInlineParameterNameHintsTests.vb b/src/EditorFeatures/Test2/InlineHints/CSharpInlineParameterNameHintsTests.vb index b2fc18293a570..d6a929902f2af 100644 --- a/src/EditorFeatures/Test2/InlineHints/CSharpInlineParameterNameHintsTests.vb +++ b/src/EditorFeatures/Test2/InlineHints/CSharpInlineParameterNameHintsTests.vb @@ -548,5 +548,105 @@ class A Await VerifyParamHints(input) End Function + + + + Public Async Function TestMethodWithAlphaSuffix1() As Task + Dim input = + + + +class A +{ + void Goo(int objA, int objB, int objC) + { + } + + void Main() + { + Goo(1, 2, 3); + } +} + + + + + Await VerifyParamHints(input) + End Function + + + + Public Async Function TestMethodWithNonAlphaSuffix1() As Task + Dim input = + + + +class A +{ + void Goo(int objA, int objB, int nonobjC) + { + } + + void Main() + { + Goo({|objA:1|}, {|objB:2|}, {|nonobjC:3|}); + } +} + + + + + Await VerifyParamHints(input) + End Function + + + + Public Async Function TestMethodWithNumericSuffix1() As Task + Dim input = + + + +class A +{ + void Goo(int obj1, int obj2, int obj3) + { + } + + void Main() + { + Goo(1, 2, 3); + } +} + + + + + Await VerifyParamHints(input) + End Function + + + + Public Async Function TestMethodWithNonNumericSuffix1() As Task + Dim input = + + + +class A +{ + void Goo(int obj1, int obj2, int nonobj3) + { + } + + void Main() + { + Goo({|obj1:1|}, {|obj2:2|}, {|nonobj3:3|}); + } +} + + + + + Await VerifyParamHints(input) + End Function End Class End Namespace diff --git a/src/EditorFeatures/Test2/InlineHints/VisualBasicInlineParameterNameHintsTests.vb b/src/EditorFeatures/Test2/InlineHints/VisualBasicInlineParameterNameHintsTests.vb index a385715e26da4..e1169778b55ec 100644 --- a/src/EditorFeatures/Test2/InlineHints/VisualBasicInlineParameterNameHintsTests.vb +++ b/src/EditorFeatures/Test2/InlineHints/VisualBasicInlineParameterNameHintsTests.vb @@ -484,5 +484,93 @@ end class Await VerifyParamHints(input) End Function + + + + Public Async Function TestMethodWithAlphaSuffix1() As Task + Dim input = + + + +class A + sub Goo(objA as integer, objB as integer, objC as integer) + end sub + + sub Main() + Goo(1, 2, 3) + end sub +end class + + + + + Await VerifyParamHints(input) + End Function + + + + Public Async Function TestMethodWithNonAlphaSuffix1() As Task + Dim input = + + + +class A + sub Goo(objA as integer, objB as integer, nonobjC as integer) + end sub + + sub Main() + Goo({|objA:1|}, {|objB:2|}, {|nonobjC:3|}) + end sub +end class + + + + + Await VerifyParamHints(input) + End Function + + + + Public Async Function TestMethodWithNumericSuffix1() As Task + Dim input = + + + +class A + sub Goo(obj1 as integer, obj2 as integer, obj3 as integer) + end sub + + sub Main() + Goo(1, 2, 3) + end sub +end class + + + + + Await VerifyParamHints(input) + End Function + + + + Public Async Function TestMethodWithNonNumericSuffix1() As Task + Dim input = + + + +class A + sub Goo(obj1 as integer, obj2 as integer, nonobj3 as integer) + end sub + + sub Main() + Goo({|obj1:1|}, {|obj2:2|}, {|nonobj3:3|}) + end sub +end class + + + + + Await VerifyParamHints(input) + End Function End Class End Namespace From 2bd5f92a0b59ecde81ae791991955adb2a40fa09 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 6 Oct 2020 16:03:18 -0700 Subject: [PATCH 180/295] Update UI --- ...ineParameterNameHintsDataTaggerProvider.cs | 3 +- ...AbstractInlineParameterNameHintsService.cs | 4 +- .../InlineHints/InlineHintsOptions.cs | 6 +-- .../Options/AdvancedOptionPageControl.xaml | 51 ++++++++++--------- .../Options/AdvancedOptionPageControl.xaml.cs | 6 ++- .../Impl/Options/AdvancedOptionPageStrings.cs | 3 ++ .../Core/Def/ServicesVSResources.resx | 3 ++ .../Core/Def/xlf/ServicesVSResources.cs.xlf | 5 ++ .../Core/Def/xlf/ServicesVSResources.de.xlf | 5 ++ .../Core/Def/xlf/ServicesVSResources.es.xlf | 5 ++ .../Core/Def/xlf/ServicesVSResources.fr.xlf | 5 ++ .../Core/Def/xlf/ServicesVSResources.it.xlf | 5 ++ .../Core/Def/xlf/ServicesVSResources.ja.xlf | 5 ++ .../Core/Def/xlf/ServicesVSResources.ko.xlf | 5 ++ .../Core/Def/xlf/ServicesVSResources.pl.xlf | 5 ++ .../Def/xlf/ServicesVSResources.pt-BR.xlf | 5 ++ .../Core/Def/xlf/ServicesVSResources.ru.xlf | 5 ++ .../Core/Def/xlf/ServicesVSResources.tr.xlf | 5 ++ .../Def/xlf/ServicesVSResources.zh-Hans.xlf | 5 ++ .../Def/xlf/ServicesVSResources.zh-Hant.xlf | 5 ++ .../Options/AdvancedOptionPageControl.xaml | 50 +++++++++--------- .../Options/AdvancedOptionPageControl.xaml.vb | 6 ++- .../Impl/Options/AdvancedOptionPageStrings.vb | 3 ++ 23 files changed, 142 insertions(+), 58 deletions(-) diff --git a/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs b/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs index 970d90470465c..e7267565651e6 100644 --- a/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs +++ b/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs @@ -61,7 +61,8 @@ protected override ITaggerEventSource CreateEventSource(ITextView textViewOpt, I TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.ForLiteralParameters, TaggerDelay.NearImmediate), TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.ForObjectCreationParameters, TaggerDelay.NearImmediate), TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.ForOtherParameters, TaggerDelay.NearImmediate), - TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.HideForParametersThatMatchMethodIntent, TaggerDelay.NearImmediate)); + TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.HideForParametersThatMatchMethodIntent, TaggerDelay.NearImmediate), + TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.HideForParametersThatDifferOnlyBySuffix, TaggerDelay.NearImmediate)); } protected override IEnumerable GetSpansToTag(ITextView textView, ITextBuffer subjectBuffer) diff --git a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs index 3028660d96f31..80ca2369ab11e 100644 --- a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs @@ -35,7 +35,7 @@ public async Task> GetInlineParameterNameHin if (!literalParameters && !objectCreationParameters && !otherParameters) return ImmutableArray.Empty; - var hideForParametersThatDifferBySuffix = options.GetOption(InlineHintsOptions.HideForParametersThatDifferBySuffix); + var hideForParametersThatDifferOnlyBySuffix = options.GetOption(InlineHintsOptions.HideForParametersThatDifferOnlyBySuffix); var hideForParametersThatMatchMethodIntent = options.GetOption(InlineHintsOptions.HideForParametersThatMatchMethodIntent); var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); @@ -60,7 +60,7 @@ public async Task> GetInlineParameterNameHin void AddHintsIfAppropriate() { - if (hideForParametersThatDifferBySuffix && ParametersDifferOnlyBySuffix(buffer)) + if (hideForParametersThatDifferOnlyBySuffix && ParametersDifferOnlyBySuffix(buffer)) return; foreach (var hint in buffer) diff --git a/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs b/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs index 5d3971c4f31e0..4c5efefec6d23 100644 --- a/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs +++ b/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs @@ -39,11 +39,11 @@ internal static class InlineHintsOptions defaultValue: false, storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.InlineParameterNameHints.ForOtherParameters")); - public static readonly PerLanguageOption2 HideForParametersThatDifferBySuffix = + public static readonly PerLanguageOption2 HideForParametersThatDifferOnlyBySuffix = new(nameof(InlineHintsOptions), - nameof(HideForParametersThatDifferBySuffix), + nameof(HideForParametersThatDifferOnlyBySuffix), defaultValue: true, - storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.InlineParameterNameHints.HideForParametersThatDifferBySuffix")); + storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.InlineParameterNameHints.HideForParametersThatDifferOnlyBySuffix")); public static readonly PerLanguageOption2 HideForParametersThatMatchMethodIntent = new(nameof(InlineHintsOptions), diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml index 1f9fff45e8b8d..1e19503b8b4c3 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml @@ -107,30 +107,6 @@ - - - - - - - - - - - - @@ -210,6 +186,33 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs index da86106700537..a515517a485fa 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs @@ -69,7 +69,8 @@ public AdvancedOptionPageControl(OptionStore optionStore, IComponentModel compon BindToOption(ShowHintsForLiterals, InlineHintsOptions.ForLiteralParameters, LanguageNames.CSharp); BindToOption(ShowHintsForNewExpressions, InlineHintsOptions.ForObjectCreationParameters, LanguageNames.CSharp); BindToOption(ShowHintsForEverythingElse, InlineHintsOptions.ForOtherParameters, LanguageNames.CSharp); - BindToOption(HideHintsWhenClearBasedonMethodAndParameterName, InlineHintsOptions.HideForParametersThatMatchMethodIntent, LanguageNames.CSharp); + BindToOption(HideHintsWhenClearBasedOnMethodAndParameterName, InlineHintsOptions.HideForParametersThatMatchMethodIntent, LanguageNames.CSharp); + BindToOption(HideHintsWhenParameterNamesDifferOnlyBySuffix, InlineHintsOptions.HideForParametersThatDifferOnlyBySuffix, LanguageNames.CSharp); BindToOption(ShowRemarksInQuickInfo, QuickInfoOptions.ShowRemarksInQuickInfo, LanguageNames.CSharp); BindToOption(DisplayLineSeparators, FeatureOnOffOptions.LineSeparator, LanguageNames.CSharp); @@ -117,7 +118,8 @@ private void UpdateInlineHintsOptions() ShowHintsForLiterals.IsEnabled = enabledForParameters; ShowHintsForNewExpressions.IsEnabled = enabledForParameters; ShowHintsForEverythingElse.IsEnabled = enabledForParameters; - HideHintsWhenClearBasedonMethodAndParameterName.IsEnabled = enabledForParameters; + HideHintsWhenClearBasedOnMethodAndParameterName.IsEnabled = enabledForParameters; + HideHintsWhenParameterNamesDifferOnlyBySuffix.IsEnabled = enabledForParameters; } private void DisplayInlineParameterNameHints_Checked(object sender, RoutedEventArgs e) diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs index d29586879b375..753900015de3e 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs @@ -49,6 +49,9 @@ public static string Option_Show_hints_for_everything_else public static string Option_Hide_hints_when_clear_based_on_method_and_parameter_name => ServicesVSResources.Hide_hints_when_clear_based_on_method_and_parameter_name; + public static string Option_Hide_hints_when_parameter_names_differ_only_by_suffix + => ServicesVSResources.Hide_hints_when_parameter_names_differ_only_by_suffix; + public static string Option_RenameTrackingPreview => CSharpVSResources.Show_preview_for_rename_tracking; public static string Option_Split_string_literals_on_enter => CSharpVSResources.Split_string_literals_on_enter; diff --git a/src/VisualStudio/Core/Def/ServicesVSResources.resx b/src/VisualStudio/Core/Def/ServicesVSResources.resx index be2f84b477bd5..dc13be2a273cf 100644 --- a/src/VisualStudio/Core/Def/ServicesVSResources.resx +++ b/src/VisualStudio/Core/Def/ServicesVSResources.resx @@ -1569,4 +1569,7 @@ I agree to all of the foregoing: Hide hints when clear based on method and parameter name + + Hide hints when parameter names differ only by suffix + \ No newline at end of file diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf index 5650b4e7f378a..96b6d3f48703e 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf @@ -247,6 +247,11 @@ Hide hints when clear based on method and parameter name + + Hide hints when parameter names differ only by suffix + Hide hints when parameter names differ only by suffix + + Highlight related components under cursor Zvýrazňovat související komponenty pod kurzorem diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf index dc4ed47437ece..c033d826ae0db 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf @@ -247,6 +247,11 @@ Hide hints when clear based on method and parameter name + + Hide hints when parameter names differ only by suffix + Hide hints when parameter names differ only by suffix + + Highlight related components under cursor Zugehörige Komponenten unter dem Cursor markieren diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf index 27aa0dcb8fc51..c9ec5b9d7d177 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf @@ -247,6 +247,11 @@ Hide hints when clear based on method and parameter name + + Hide hints when parameter names differ only by suffix + Hide hints when parameter names differ only by suffix + + Highlight related components under cursor Resaltar componentes relacionados bajo el cursor diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf index 3c48666730a81..40b2686461b05 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf @@ -247,6 +247,11 @@ Hide hints when clear based on method and parameter name + + Hide hints when parameter names differ only by suffix + Hide hints when parameter names differ only by suffix + + Highlight related components under cursor Surligner les composants liés sous le curseur diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf index d512596c3f153..5ac2ce1ed50d3 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf @@ -247,6 +247,11 @@ Hide hints when clear based on method and parameter name + + Hide hints when parameter names differ only by suffix + Hide hints when parameter names differ only by suffix + + Highlight related components under cursor Evidenzia i componenti correlati sotto il cursore diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf index 303d6107e3c32..9ed6258d8d1ac 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf @@ -247,6 +247,11 @@ Hide hints when clear based on method and parameter name + + Hide hints when parameter names differ only by suffix + Hide hints when parameter names differ only by suffix + + Highlight related components under cursor カーソルの下にある関連コンポーネントをハイライトする diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf index 33612a4a34431..b3f8ab7c12613 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf @@ -247,6 +247,11 @@ Hide hints when clear based on method and parameter name + + Hide hints when parameter names differ only by suffix + Hide hints when parameter names differ only by suffix + + Highlight related components under cursor 커서 아래의 관련 구성 요소 강조 diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf index 0a423bee8bc6c..42a928871b291 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf @@ -247,6 +247,11 @@ Hide hints when clear based on method and parameter name + + Hide hints when parameter names differ only by suffix + Hide hints when parameter names differ only by suffix + + Highlight related components under cursor Wyróżnij powiązane składniki pod kursorem diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf index c55fed977db95..d043c83d1ef02 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf @@ -247,6 +247,11 @@ Hide hints when clear based on method and parameter name + + Hide hints when parameter names differ only by suffix + Hide hints when parameter names differ only by suffix + + Highlight related components under cursor Realçar componentes relacionados usando o cursor diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf index 9ebf663529295..9f31971ec7182 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf @@ -247,6 +247,11 @@ Hide hints when clear based on method and parameter name + + Hide hints when parameter names differ only by suffix + Hide hints when parameter names differ only by suffix + + Highlight related components under cursor Выделить связанные компоненты под курсором diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf index 2ff1412f350b3..3b265b5d72e7e 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf @@ -247,6 +247,11 @@ Hide hints when clear based on method and parameter name + + Hide hints when parameter names differ only by suffix + Hide hints when parameter names differ only by suffix + + Highlight related components under cursor İmlecin altında ilgili bileşenleri vurgula diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf index 261525e863142..4afc2b5335683 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf @@ -247,6 +247,11 @@ Hide hints when clear based on method and parameter name + + Hide hints when parameter names differ only by suffix + Hide hints when parameter names differ only by suffix + + Highlight related components under cursor 突出显示光标下的相关组件 diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf index d1b2798838ff0..86ca81761fb8d 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf @@ -247,6 +247,11 @@ Hide hints when clear based on method and parameter name + + Hide hints when parameter names differ only by suffix + Hide hints when parameter names differ only by suffix + + Highlight related components under cursor 反白資料指標下的相關元件 diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml index 25605414d99db..c599547981d63 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml @@ -101,30 +101,6 @@ - - - - - - - - - - - - @@ -217,6 +193,32 @@ + + + + + + + + + + + + diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb index 8504a2cc2a7e5..f4001df4faf1e 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb @@ -63,7 +63,8 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options BindToOption(ShowHintsForLiterals, InlineHintsOptions.ForLiteralParameters, LanguageNames.VisualBasic) BindToOption(ShowHintsForNewExpressions, InlineHintsOptions.ForObjectCreationParameters, LanguageNames.VisualBasic) BindToOption(ShowHintsForEverythingElse, InlineHintsOptions.ForOtherParameters, LanguageNames.VisualBasic) - BindToOption(HideHintsWhenClearBasedonMethodAndParameterName, InlineHintsOptions.HideForParametersThatMatchMethodIntent, LanguageNames.VisualBasic) + BindToOption(HideHintsWhenClearBasedOnMethodAndParameterName, InlineHintsOptions.HideForParametersThatMatchMethodIntent, LanguageNames.VisualBasic) + BindToOption(HideHintsWhenParameterNamesDifferOnlyBySuffix, InlineHintsOptions.HideForParametersThatDifferOnlyBySuffix, LanguageNames.VisualBasic) BindToOption(EnableEndConstruct, FeatureOnOffOptions.EndConstruct, LanguageNames.VisualBasic) BindToOption(EnableLineCommit, FeatureOnOffOptions.PrettyListing, LanguageNames.VisualBasic) @@ -113,7 +114,8 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options ShowHintsForLiterals.IsEnabled = enabledForParameters ShowHintsForNewExpressions.IsEnabled = enabledForParameters ShowHintsForEverythingElse.IsEnabled = enabledForParameters - HideHintsWhenClearBasedonMethodAndParameterName.IsEnabled = enabledForParameters + HideHintsWhenClearBasedOnMethodAndParameterName.IsEnabled = enabledForParameters + HideHintsWhenParameterNamesDifferOnlyBySuffix.IsEnabled = enabledForParameters End Sub Private Sub DisplayInlineParameterNameHints_Checked() diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb index 212e22b28b512..63d119d0084f1 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb @@ -51,6 +51,9 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options Public ReadOnly Property Option_Hide_hints_when_clear_based_on_method_and_parameter_name As String = ServicesVSResources.Hide_hints_when_clear_based_on_method_and_parameter_name + Public ReadOnly Property Option_Hide_hints_when_parameter_names_differ_only_by_suffix As String = + ServicesVSResources.Hide_hints_when_parameter_names_differ_only_by_suffix + Public ReadOnly Property Option_DontPutOutOrRefOnStruct As String Get Return BasicVSResources.Don_t_put_ByRef_on_custom_structure From b15b40c592ed8ed09af7200d73cbdd5108b8f306 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 6 Oct 2020 16:32:32 -0700 Subject: [PATCH 181/295] Fix tests --- .../AbstractInlineParameterNameHintsTests.vb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/EditorFeatures/Test2/InlineHints/AbstractInlineParameterNameHintsTests.vb b/src/EditorFeatures/Test2/InlineHints/AbstractInlineParameterNameHintsTests.vb index 48d40b53d4e98..c65196bcaa404 100644 --- a/src/EditorFeatures/Test2/InlineHints/AbstractInlineParameterNameHintsTests.vb +++ b/src/EditorFeatures/Test2/InlineHints/AbstractInlineParameterNameHintsTests.vb @@ -14,6 +14,11 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Using workspace = TestWorkspace.Create(test) WpfTestRunner.RequireWpfFact($"{NameOf(AbstractInlineParameterNameHintsTests)}.{NameOf(Me.VerifyParamHints)} creates asynchronous taggers") + workspace.TryApplyChanges(workspace.CurrentSolution.WithOptions(workspace.Options.WithChangedOption( + InlineHintsOptions.EnabledForParameters, + workspace.CurrentSolution.Projects().First().Language, + optionIsEnabled))) + Dim hostDocument = workspace.Documents.Single() Dim snapshot = hostDocument.GetTextBuffer().CurrentSnapshot Dim document = workspace.CurrentSolution.GetDocument(hostDocument.Id) @@ -27,17 +32,13 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Dim nameAndSpansList = hostDocument.AnnotatedSpans.SelectMany( Function(name) name.Value, - Function(name, span) _ - New With {.Name = name.Key, - .Span = span - }) + Function(name, span) New With {.Name = name.Key, span}) For Each nameAndSpan In nameAndSpansList.OrderBy(Function(x) x.Span.Start) expectedTags.Add(nameAndSpan.Name + ":" + nameAndSpan.Span.Start.ToString()) Next AssertEx.Equal(expectedTags, producedTags) - End Using End Function End Class From bd412637fbd8b4ddddf98ffb6ed8469c81413487 Mon Sep 17 00:00:00 2001 From: Youssef Victor <31348972+Youssef1313@users.noreply.github.com> Date: Wed, 7 Oct 2020 01:49:26 +0200 Subject: [PATCH 182/295] Apply feedback --- .../MakeFieldReadonlyDiagnosticAnalyzer.cs | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/Analyzers/Core/Analyzers/MakeFieldReadonly/MakeFieldReadonlyDiagnosticAnalyzer.cs b/src/Analyzers/Core/Analyzers/MakeFieldReadonly/MakeFieldReadonlyDiagnosticAnalyzer.cs index 46294b6ab9b4f..1d3d03b170d65 100644 --- a/src/Analyzers/Core/Analyzers/MakeFieldReadonly/MakeFieldReadonlyDiagnosticAnalyzer.cs +++ b/src/Analyzers/Core/Analyzers/MakeFieldReadonly/MakeFieldReadonlyDiagnosticAnalyzer.cs @@ -6,8 +6,8 @@ using System.Collections.Concurrent; using System.Diagnostics; -using System.Linq; using System.Threading; +using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Operations; @@ -115,20 +115,9 @@ static bool IsCandidateField(IFieldSymbol symbol, INamedTypeSymbol threadStaticA symbol.Locations.Length == 1 && symbol.Type.IsMutableValueType() == false && !symbol.IsFixedSizeBuffer && - !ContainsAttribute(symbol, threadStaticAttribute); - - static bool ContainsAttribute(ISymbol symbol, INamedTypeSymbol attributeSymbol) - { - var attributes = symbol.GetAttributes(); - foreach (var attribute in attributes) - { - if (SymbolEqualityComparer.Default.Equals(attribute.AttributeClass, attributeSymbol)) - { - return true; - } - } - return false; - } + !symbol.GetAttributes().Any( + static (a, threadStaticAttribute) => SymbolEqualityComparer.Default.Equals(a.AttributeClass, threadStaticAttribute), + threadStaticAttribute); // Method to update the field state for a candidate field written outside constructor and field initializer. void UpdateFieldStateOnWrite(IFieldSymbol field) From 4f5220781484fbc068b850543e0aba2ebd5d3795 Mon Sep 17 00:00:00 2001 From: Youssef Victor <31348972+Youssef1313@users.noreply.github.com> Date: Wed, 7 Oct 2020 03:04:30 +0200 Subject: [PATCH 183/295] Update StaticLocalDeclarationTests.vb --- .../Symbol/StaticLocalDeclarationTests.vb | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/Compilers/VisualBasic/Test/Symbol/StaticLocalDeclarationTests.vb b/src/Compilers/VisualBasic/Test/Symbol/StaticLocalDeclarationTests.vb index 6d193d7099525..a1b6571fa5d54 100644 --- a/src/Compilers/VisualBasic/Test/Symbol/StaticLocalDeclarationTests.vb +++ b/src/Compilers/VisualBasic/Test/Symbol/StaticLocalDeclarationTests.vb @@ -735,25 +735,6 @@ End Module Diagnostic(ERRID.ERR_IterationVariableShadowLocal1, "sl").WithArguments("sl"), Diagnostic(ERRID.ERR_IterationVariableShadowLocal1, "sl").WithArguments("sl")) End Sub - - - - Public Sub Bug48307() - Dim compilationDef = - - -Imports System - -Module Module1 - Sub Main() - Dim Length = From s In {""} Select s.Length - End Sub -End Module - - - Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(compilationDef) - compilation.VerifyDiagnostics() - End Sub End Class End Namespace From cbf2abafff816a2968b7e96f7390f50f9292f7ba Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 6 Oct 2020 19:38:14 -0700 Subject: [PATCH 184/295] NRT --- .../InlineHints/InlineParameterNameHintsTaggerProvider.cs | 4 +--- .../InlineHints/IInlineParameterNameHintsService.cs | 3 --- .../Core/Portable/InlineHints/InlineHintsOptions.cs | 2 -- .../Core/Portable/InlineHints/InlineParameterHint.cs | 6 ++---- .../Core/Portable/InlineHints/InlineParameterHintKind.cs | 2 -- 5 files changed, 3 insertions(+), 14 deletions(-) diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTaggerProvider.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTaggerProvider.cs index 10d949e3823b2..44731b113fe83 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTaggerProvider.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTaggerProvider.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using System.ComponentModel.Composition; using Microsoft.CodeAnalysis.Editor.Host; @@ -52,7 +50,7 @@ public InlineParameterNameHintsTaggerProvider(IViewTagAggregatorFactoryService v this.StreamingFindUsagesPresenter = streamingFindUsagesPresenter; } - public ITagger CreateTagger(ITextView textView, ITextBuffer buffer) where T : ITag + public ITagger? CreateTagger(ITextView textView, ITextBuffer buffer) where T : ITag { // Determining of the textView's buffer does not match the buffer in order to skip showing the hints for // the interactive window diff --git a/src/Features/Core/Portable/InlineHints/IInlineParameterNameHintsService.cs b/src/Features/Core/Portable/InlineHints/IInlineParameterNameHintsService.cs index 4a5cbd5688f58..e149e2488e59e 100644 --- a/src/Features/Core/Portable/InlineHints/IInlineParameterNameHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/IInlineParameterNameHintsService.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System.Collections.Generic; using System.Collections.Immutable; using System.Threading; @@ -14,7 +12,6 @@ namespace Microsoft.CodeAnalysis.InlineHints { - internal interface IInlineParameterNameHintsService : ILanguageService { Task> GetInlineParameterNameHintsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken); diff --git a/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs b/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs index 4c5efefec6d23..995afe412e26e 100644 --- a/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs +++ b/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using System.Collections.Immutable; using System.Composition; diff --git a/src/Features/Core/Portable/InlineHints/InlineParameterHint.cs b/src/Features/Core/Portable/InlineHints/InlineParameterHint.cs index fd53b8e03bd87..92f9dec88bf06 100644 --- a/src/Features/Core/Portable/InlineHints/InlineParameterHint.cs +++ b/src/Features/Core/Portable/InlineHints/InlineParameterHint.cs @@ -2,18 +2,16 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - namespace Microsoft.CodeAnalysis.InlineHints { internal readonly struct InlineParameterHint { - public readonly IParameterSymbol Parameter; + public readonly IParameterSymbol? Parameter; public readonly int Position; public readonly InlineParameterHintKind Kind; public InlineParameterHint( - IParameterSymbol parameter, + IParameterSymbol? parameter, int position, InlineParameterHintKind kind) { diff --git a/src/Features/Core/Portable/InlineHints/InlineParameterHintKind.cs b/src/Features/Core/Portable/InlineHints/InlineParameterHintKind.cs index 4e11b0a66dcaf..2c6f5bbadf674 100644 --- a/src/Features/Core/Portable/InlineHints/InlineParameterHintKind.cs +++ b/src/Features/Core/Portable/InlineHints/InlineParameterHintKind.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - namespace Microsoft.CodeAnalysis.InlineHints { internal enum InlineParameterHintKind From 1a1cb6f4cd8bbbf5aa061178ddfd08b88372cf64 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 6 Oct 2020 19:40:28 -0700 Subject: [PATCH 185/295] Rename --- ...AbstractInlineParameterNameHintsService.cs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs index 80ca2369ab11e..5c365963d2695 100644 --- a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs @@ -189,42 +189,42 @@ protected static bool MatchesMethodIntent(InlineParameterHint hint) var methodName = method.Name; // Check for something like `EnableLogging(true)` - if (TryGetIntent("Enable", methodName, out _) || - TryGetIntent("Disable", methodName, out _)) + if (TryGetSuffix("Enable", methodName, out _) || + TryGetSuffix("Disable", methodName, out _)) { return parameter.Type.SpecialType == SpecialType.System_Boolean; } // More names can be added here if we find other patterns like this. - if (TryGetIntent("Set", methodName, out var methodIntent) || - TryGetIntent("From", methodName, out methodIntent)) + if (TryGetSuffix("Set", methodName, out var suffix) || + TryGetSuffix("From", methodName, out suffix)) { - return IntentNameMatchesParameterName(methodIntent, parameter.Name); + return SuffixMatchesParameterName(suffix, parameter.Name); } return false; - static bool TryGetIntent(string prefix, string nameValue, out ReadOnlyMemory result) + static bool TryGetSuffix(string prefix, string nameValue, out ReadOnlyMemory suffix) { if (nameValue.Length > prefix.Length && nameValue.StartsWith(prefix) && char.IsUpper(nameValue[prefix.Length])) { - result = nameValue.AsMemory()[prefix.Length..]; + suffix = nameValue.AsMemory()[prefix.Length..]; return true; } - result = default; + suffix = default; return false; } - static bool IntentNameMatchesParameterName(ReadOnlyMemory intent, string parameterName) + static bool SuffixMatchesParameterName(ReadOnlyMemory suffix, string parameterName) { - // Method's name will be something like 'FromResult', so 'intent' will be 'Result' and parameterName + // Method's name will be something like 'FromResult', so 'suffix' will be 'Result' and parameterName // will be 'result'. So we check if the first letters differ on case and the rest of the method // matches. - return char.ToLower(intent.Span[0]) == parameterName[0] && - intent.Span.Slice(1).Equals(parameterName.AsSpan().Slice(1), StringComparison.Ordinal); + return char.ToLower(suffix.Span[0]) == parameterName[0] && + suffix.Span[1..].Equals(parameterName.AsSpan()[1..], StringComparison.Ordinal); } } } From ad3785fbe32f64cd49e786fd8be78164b23f4a19 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 6 Oct 2020 20:34:56 -0700 Subject: [PATCH 186/295] NRT --- .../InlineHints/InlineParameterNameHintsDataTaggerProvider.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs b/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs index e7267565651e6..b574a0690a25a 100644 --- a/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs +++ b/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs @@ -93,6 +93,8 @@ protected override async Task ProduceTagsAsync(TaggerContext( new SnapshotSpan(snapshotSpan.Snapshot, parameterHint.Position, 0), From 1bbb3a809df9ce1aa0d0b82c5582f5d4b3bfb05a Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 6 Oct 2020 20:54:41 -0700 Subject: [PATCH 187/295] Rename --- Roslyn.sln | 4 ++++ ...ineParameterNameHintsDataTaggerProvider.cs | 4 ++-- ...AbstractInlineParameterNameHintsService.cs | 8 ++++---- .../InlineHints/InlineHintsOptions.cs | 12 +++++------ .../Options/AdvancedOptionPageControl.xaml | 12 +++++------ .../Options/AdvancedOptionPageControl.xaml.cs | 8 ++++---- .../Impl/Options/AdvancedOptionPageStrings.cs | 8 ++++---- .../Core/Def/ServicesVSResources.resx | 8 ++++---- .../Core/Def/xlf/ServicesVSResources.cs.xlf | 20 +++++++++---------- .../Core/Def/xlf/ServicesVSResources.de.xlf | 20 +++++++++---------- .../Core/Def/xlf/ServicesVSResources.es.xlf | 20 +++++++++---------- .../Core/Def/xlf/ServicesVSResources.fr.xlf | 20 +++++++++---------- .../Core/Def/xlf/ServicesVSResources.it.xlf | 20 +++++++++---------- .../Core/Def/xlf/ServicesVSResources.ja.xlf | 20 +++++++++---------- .../Core/Def/xlf/ServicesVSResources.ko.xlf | 20 +++++++++---------- .../Core/Def/xlf/ServicesVSResources.pl.xlf | 20 +++++++++---------- .../Def/xlf/ServicesVSResources.pt-BR.xlf | 20 +++++++++---------- .../Core/Def/xlf/ServicesVSResources.ru.xlf | 20 +++++++++---------- .../Core/Def/xlf/ServicesVSResources.tr.xlf | 20 +++++++++---------- .../Def/xlf/ServicesVSResources.zh-Hans.xlf | 20 +++++++++---------- .../Def/xlf/ServicesVSResources.zh-Hant.xlf | 20 +++++++++---------- .../Options/AdvancedOptionPageControl.xaml | 12 +++++------ .../Options/AdvancedOptionPageControl.xaml.vb | 8 ++++---- .../Impl/Options/AdvancedOptionPageStrings.vb | 8 ++++---- 24 files changed, 178 insertions(+), 174 deletions(-) diff --git a/Roslyn.sln b/Roslyn.sln index 7150215f42caf..abe1a82b59ef5 100644 --- a/Roslyn.sln +++ b/Roslyn.sln @@ -1880,8 +1880,12 @@ Global {2801F82B-78CE-4BAE-B06F-537574751E2E}.Release|x86.Build.0 = Release|x86 {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|x86.ActiveCfg = Debug|Any CPU + {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|x86.Build.0 = Debug|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|Any CPU.ActiveCfg = Release|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|Any CPU.Build.0 = Release|Any CPU + {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|x86.ActiveCfg = Release|Any CPU + {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs b/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs index b574a0690a25a..b891b7b37782d 100644 --- a/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs +++ b/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs @@ -61,8 +61,8 @@ protected override ITaggerEventSource CreateEventSource(ITextView textViewOpt, I TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.ForLiteralParameters, TaggerDelay.NearImmediate), TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.ForObjectCreationParameters, TaggerDelay.NearImmediate), TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.ForOtherParameters, TaggerDelay.NearImmediate), - TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.HideForParametersThatMatchMethodIntent, TaggerDelay.NearImmediate), - TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.HideForParametersThatDifferOnlyBySuffix, TaggerDelay.NearImmediate)); + TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.SuppressForParametersThatMatchMethodIntent, TaggerDelay.NearImmediate), + TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.SuppressForParametersThatDifferOnlyBySuffix, TaggerDelay.NearImmediate)); } protected override IEnumerable GetSpansToTag(ITextView textView, ITextBuffer subjectBuffer) diff --git a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs index 5c365963d2695..a0f9f3196771f 100644 --- a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs @@ -35,8 +35,8 @@ public async Task> GetInlineParameterNameHin if (!literalParameters && !objectCreationParameters && !otherParameters) return ImmutableArray.Empty; - var hideForParametersThatDifferOnlyBySuffix = options.GetOption(InlineHintsOptions.HideForParametersThatDifferOnlyBySuffix); - var hideForParametersThatMatchMethodIntent = options.GetOption(InlineHintsOptions.HideForParametersThatMatchMethodIntent); + var suppressForParametersThatDifferOnlyBySuffix = options.GetOption(InlineHintsOptions.SuppressForParametersThatDifferOnlyBySuffix); + var suppressForParametersThatMatchMethodIntent = options.GetOption(InlineHintsOptions.SuppressForParametersThatMatchMethodIntent); var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); @@ -60,7 +60,7 @@ public async Task> GetInlineParameterNameHin void AddHintsIfAppropriate() { - if (hideForParametersThatDifferOnlyBySuffix && ParametersDifferOnlyBySuffix(buffer)) + if (suppressForParametersThatDifferOnlyBySuffix && ParametersDifferOnlyBySuffix(buffer)) return; foreach (var hint in buffer) @@ -68,7 +68,7 @@ void AddHintsIfAppropriate() if (string.IsNullOrEmpty(hint.Parameter?.Name)) continue; - if (hideForParametersThatMatchMethodIntent && MatchesMethodIntent(hint)) + if (suppressForParametersThatMatchMethodIntent && MatchesMethodIntent(hint)) continue; if (HintMatches(hint, literalParameters, objectCreationParameters, otherParameters)) diff --git a/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs b/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs index 995afe412e26e..5882f11885a12 100644 --- a/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs +++ b/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs @@ -37,17 +37,17 @@ internal static class InlineHintsOptions defaultValue: false, storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.InlineParameterNameHints.ForOtherParameters")); - public static readonly PerLanguageOption2 HideForParametersThatDifferOnlyBySuffix = + public static readonly PerLanguageOption2 SuppressForParametersThatDifferOnlyBySuffix = new(nameof(InlineHintsOptions), - nameof(HideForParametersThatDifferOnlyBySuffix), + nameof(SuppressForParametersThatDifferOnlyBySuffix), defaultValue: true, - storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.InlineParameterNameHints.HideForParametersThatDifferOnlyBySuffix")); + storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.InlineParameterNameHints.SuppressForParametersThatDifferOnlyBySuffix")); - public static readonly PerLanguageOption2 HideForParametersThatMatchMethodIntent = + public static readonly PerLanguageOption2 SuppressForParametersThatMatchMethodIntent = new(nameof(InlineHintsOptions), - nameof(HideForParametersThatMatchMethodIntent), + nameof(SuppressForParametersThatMatchMethodIntent), defaultValue: true, - storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.InlineParameterNameHints.HideForParametersThatMatchMethodIntent")); + storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.InlineParameterNameHints.SuppressForParametersThatMatchMethodIntent")); } [ExportOptionProvider, Shared] diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml index 1e19503b8b4c3..b4086292a4d1c 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml @@ -204,12 +204,12 @@ - - + + diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs index a515517a485fa..f78aebcd20e3b 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs @@ -69,8 +69,8 @@ public AdvancedOptionPageControl(OptionStore optionStore, IComponentModel compon BindToOption(ShowHintsForLiterals, InlineHintsOptions.ForLiteralParameters, LanguageNames.CSharp); BindToOption(ShowHintsForNewExpressions, InlineHintsOptions.ForObjectCreationParameters, LanguageNames.CSharp); BindToOption(ShowHintsForEverythingElse, InlineHintsOptions.ForOtherParameters, LanguageNames.CSharp); - BindToOption(HideHintsWhenClearBasedOnMethodAndParameterName, InlineHintsOptions.HideForParametersThatMatchMethodIntent, LanguageNames.CSharp); - BindToOption(HideHintsWhenParameterNamesDifferOnlyBySuffix, InlineHintsOptions.HideForParametersThatDifferOnlyBySuffix, LanguageNames.CSharp); + BindToOption(SuppressHintsWhenParameterNameMatchesTheMethodsIntent, InlineHintsOptions.SuppressForParametersThatMatchMethodIntent, LanguageNames.CSharp); + BindToOption(SuppressHintsWhenParameterNamesDifferOnlyBySuffix, InlineHintsOptions.SuppressForParametersThatDifferOnlyBySuffix, LanguageNames.CSharp); BindToOption(ShowRemarksInQuickInfo, QuickInfoOptions.ShowRemarksInQuickInfo, LanguageNames.CSharp); BindToOption(DisplayLineSeparators, FeatureOnOffOptions.LineSeparator, LanguageNames.CSharp); @@ -118,8 +118,8 @@ private void UpdateInlineHintsOptions() ShowHintsForLiterals.IsEnabled = enabledForParameters; ShowHintsForNewExpressions.IsEnabled = enabledForParameters; ShowHintsForEverythingElse.IsEnabled = enabledForParameters; - HideHintsWhenClearBasedOnMethodAndParameterName.IsEnabled = enabledForParameters; - HideHintsWhenParameterNamesDifferOnlyBySuffix.IsEnabled = enabledForParameters; + SuppressHintsWhenParameterNameMatchesTheMethodsIntent.IsEnabled = enabledForParameters; + SuppressHintsWhenParameterNamesDifferOnlyBySuffix.IsEnabled = enabledForParameters; } private void DisplayInlineParameterNameHints_Checked(object sender, RoutedEventArgs e) diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs index 753900015de3e..9d5ac8dba5841 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs @@ -46,11 +46,11 @@ public static string Option_Show_hints_for_new_expressions public static string Option_Show_hints_for_everything_else => ServicesVSResources.Show_hints_for_everything_else; - public static string Option_Hide_hints_when_clear_based_on_method_and_parameter_name - => ServicesVSResources.Hide_hints_when_clear_based_on_method_and_parameter_name; + public static string Option_Suppress_hints_when_parameter_name_matches_the_method_s_intent + => ServicesVSResources.Suppress_hints_when_parameter_name_matches_the_method_s_intent; - public static string Option_Hide_hints_when_parameter_names_differ_only_by_suffix - => ServicesVSResources.Hide_hints_when_parameter_names_differ_only_by_suffix; + public static string Option_Suppress_hints_when_parameter_names_differ_only_by_suffix + => ServicesVSResources.Suppress_hints_when_parameter_names_differ_only_by_suffix; public static string Option_RenameTrackingPreview => CSharpVSResources.Show_preview_for_rename_tracking; public static string Option_Split_string_literals_on_enter => CSharpVSResources.Split_string_literals_on_enter; diff --git a/src/VisualStudio/Core/Def/ServicesVSResources.resx b/src/VisualStudio/Core/Def/ServicesVSResources.resx index dc13be2a273cf..b1f508276c219 100644 --- a/src/VisualStudio/Core/Def/ServicesVSResources.resx +++ b/src/VisualStudio/Core/Def/ServicesVSResources.resx @@ -1566,10 +1566,10 @@ I agree to all of the foregoing: Show hints for literals - - Hide hints when clear based on method and parameter name + + Suppress hints when parameter name matches the method's intent - - Hide hints when parameter names differ only by suffix + + Suppress hints when parameter names differ only by suffix \ No newline at end of file diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf index 96b6d3f48703e..dc6563cb172eb 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf @@ -242,16 +242,6 @@ Generovat soubor .editorconfig z nastavení - - Hide hints when clear based on method and parameter name - Hide hints when clear based on method and parameter name - - - - Hide hints when parameter names differ only by suffix - Hide hints when parameter names differ only by suffix - - Highlight related components under cursor Zvýrazňovat související komponenty pod kurzorem @@ -802,6 +792,16 @@ Některé barvy barevného schématu se přepsaly změnami na stránce možností Prostředí > Písma a barvy. Pokud chcete zrušit všechna přizpůsobení, vyberte na stránce Písma a barvy možnost Použít výchozí. + + Suppress hints when parameter name matches the method's intent + Suppress hints when parameter name matches the method's intent + + + + Suppress hints when parameter names differ only by suffix + Suppress hints when parameter names differ only by suffix + + Target Namespace: Cílový obor názvů: diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf index c033d826ae0db..a2676b3b6f7a1 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf @@ -242,16 +242,6 @@ EDITORCONFIG-Datei aus Einstellungen generieren - - Hide hints when clear based on method and parameter name - Hide hints when clear based on method and parameter name - - - - Hide hints when parameter names differ only by suffix - Hide hints when parameter names differ only by suffix - - Highlight related components under cursor Zugehörige Komponenten unter dem Cursor markieren @@ -802,6 +792,16 @@ Einige Farbschemafarben werden durch Änderungen überschrieben, die auf der Optionsseite "Umgebung" > "Schriftarten und Farben" vorgenommen wurden. Wählen Sie auf der Seite "Schriftarten und Farben" die Option "Standardwerte verwenden" aus, um alle Anpassungen rückgängig zu machen. + + Suppress hints when parameter name matches the method's intent + Suppress hints when parameter name matches the method's intent + + + + Suppress hints when parameter names differ only by suffix + Suppress hints when parameter names differ only by suffix + + Target Namespace: Zielnamespace: diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf index c9ec5b9d7d177..8a5e8ecdb178d 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf @@ -242,16 +242,6 @@ Generar archivo .editorconfig a partir de la configuración - - Hide hints when clear based on method and parameter name - Hide hints when clear based on method and parameter name - - - - Hide hints when parameter names differ only by suffix - Hide hints when parameter names differ only by suffix - - Highlight related components under cursor Resaltar componentes relacionados bajo el cursor @@ -802,6 +792,16 @@ Algunos de los colores de la combinación se reemplazan por los cambios realizados en la página de opciones de Entorno > Fuentes y colores. Elija "Usar valores predeterminados" en la página Fuentes y colores para revertir todas las personalizaciones. + + Suppress hints when parameter name matches the method's intent + Suppress hints when parameter name matches the method's intent + + + + Suppress hints when parameter names differ only by suffix + Suppress hints when parameter names differ only by suffix + + Target Namespace: Espacio de nombres de destino: diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf index 40b2686461b05..24ac7660eaf93 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf @@ -242,16 +242,6 @@ Générer le fichier .editorconfig à partir des paramètres - - Hide hints when clear based on method and parameter name - Hide hints when clear based on method and parameter name - - - - Hide hints when parameter names differ only by suffix - Hide hints when parameter names differ only by suffix - - Highlight related components under cursor Surligner les composants liés sous le curseur @@ -802,6 +792,16 @@ Certaines couleurs du modèle de couleurs sont substituées à la suite des changements apportés dans la page d'options Environnement > Polices et couleurs. Choisissez Utiliser les valeurs par défaut dans la page Polices et couleurs pour restaurer toutes les personnalisations. + + Suppress hints when parameter name matches the method's intent + Suppress hints when parameter name matches the method's intent + + + + Suppress hints when parameter names differ only by suffix + Suppress hints when parameter names differ only by suffix + + Target Namespace: Espace de noms cible : diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf index 5ac2ce1ed50d3..1c7f427b7be24 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf @@ -242,16 +242,6 @@ Genera file con estensione editorconfig dalle impostazioni - - Hide hints when clear based on method and parameter name - Hide hints when clear based on method and parameter name - - - - Hide hints when parameter names differ only by suffix - Hide hints when parameter names differ only by suffix - - Highlight related components under cursor Evidenzia i componenti correlati sotto il cursore @@ -802,6 +792,16 @@ Alcuni colori della combinazione colori sono sostituiti dalle modifiche apportate nella pagina di opzioni Ambiente > Tipi di carattere e colori. Scegliere `Usa impostazioni predefinite` nella pagina Tipi di carattere e colori per ripristinare tutte le personalizzazioni. + + Suppress hints when parameter name matches the method's intent + Suppress hints when parameter name matches the method's intent + + + + Suppress hints when parameter names differ only by suffix + Suppress hints when parameter names differ only by suffix + + Target Namespace: Spazio dei nomi di destinazione: diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf index 9ed6258d8d1ac..28f26cd7c3034 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf @@ -242,16 +242,6 @@ 設定から .editorconfig ファイルを生成 - - Hide hints when clear based on method and parameter name - Hide hints when clear based on method and parameter name - - - - Hide hints when parameter names differ only by suffix - Hide hints when parameter names differ only by suffix - - Highlight related components under cursor カーソルの下にある関連コンポーネントをハイライトする @@ -802,6 +792,16 @@ 一部の配色パターンの色は、[環境] > [フォントおよび色] オプション ページで行われた変更によって上書きされます。[フォントおよび色] オプション ページで [既定値を使用] を選択すると、すべてのカスタマイズが元に戻ります。 + + Suppress hints when parameter name matches the method's intent + Suppress hints when parameter name matches the method's intent + + + + Suppress hints when parameter names differ only by suffix + Suppress hints when parameter names differ only by suffix + + Target Namespace: ターゲット名前空間: diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf index b3f8ab7c12613..00c13cc8401b6 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf @@ -242,16 +242,6 @@ 설정에서 .editorconfig 파일 생성 - - Hide hints when clear based on method and parameter name - Hide hints when clear based on method and parameter name - - - - Hide hints when parameter names differ only by suffix - Hide hints when parameter names differ only by suffix - - Highlight related components under cursor 커서 아래의 관련 구성 요소 강조 @@ -802,6 +792,16 @@ 색 구성표의 일부 색이 [환경] > [글꼴 및 색] 옵션 페이지에서 변경한 내용에 따라 재정의됩니다. 모든 사용자 지정을 되돌리려면 [글꼴 및 색] 페이지에서 '기본값 사용'을 선택하세요. + + Suppress hints when parameter name matches the method's intent + Suppress hints when parameter name matches the method's intent + + + + Suppress hints when parameter names differ only by suffix + Suppress hints when parameter names differ only by suffix + + Target Namespace: 대상 네임스페이스: diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf index 42a928871b291..b4d9acc3b72ac 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf @@ -242,16 +242,6 @@ Wygeneruj plik .editorconfig na podstawie ustawień - - Hide hints when clear based on method and parameter name - Hide hints when clear based on method and parameter name - - - - Hide hints when parameter names differ only by suffix - Hide hints when parameter names differ only by suffix - - Highlight related components under cursor Wyróżnij powiązane składniki pod kursorem @@ -802,6 +792,16 @@ Niektóre kolory w schemacie kolorów są przesłaniane przez zmiany wprowadzone na stronie opcji Środowisko > Czcionki i kolory. Wybierz pozycję „Użyj ustawień domyślnych” na stronie Czcionki i kolory, aby wycofać wszystkie dostosowania. + + Suppress hints when parameter name matches the method's intent + Suppress hints when parameter name matches the method's intent + + + + Suppress hints when parameter names differ only by suffix + Suppress hints when parameter names differ only by suffix + + Target Namespace: Docelowa przestrzeń nazw: diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf index d043c83d1ef02..dad4bf0ef10b7 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf @@ -242,16 +242,6 @@ Gerar o arquivo .editorconfig das configurações - - Hide hints when clear based on method and parameter name - Hide hints when clear based on method and parameter name - - - - Hide hints when parameter names differ only by suffix - Hide hints when parameter names differ only by suffix - - Highlight related components under cursor Realçar componentes relacionados usando o cursor @@ -802,6 +792,16 @@ Algumas cores do esquema de cores estão sendo substituídas pelas alterações feitas na página de Ambiente > Opções de Fontes e Cores. Escolha 'Usar Padrões' na página Fontes e Cores para reverter todas as personalizações. + + Suppress hints when parameter name matches the method's intent + Suppress hints when parameter name matches the method's intent + + + + Suppress hints when parameter names differ only by suffix + Suppress hints when parameter names differ only by suffix + + Target Namespace: Namespace de Destino: diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf index 9f31971ec7182..c72ac68a1f4bf 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf @@ -242,16 +242,6 @@ Создать файл EDITORCONFIG на основе параметров - - Hide hints when clear based on method and parameter name - Hide hints when clear based on method and parameter name - - - - Hide hints when parameter names differ only by suffix - Hide hints when parameter names differ only by suffix - - Highlight related components under cursor Выделить связанные компоненты под курсором @@ -802,6 +792,16 @@ Некоторые цвета цветовой схемы переопределяются изменениями, сделанными на странице "Среда" > "Шрифты и цвета". Выберите "Использовать значения по умолчанию" на странице "Шрифты и цвета", чтобы отменить все настройки. + + Suppress hints when parameter name matches the method's intent + Suppress hints when parameter name matches the method's intent + + + + Suppress hints when parameter names differ only by suffix + Suppress hints when parameter names differ only by suffix + + Target Namespace: Целевое пространство имен: diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf index 3b265b5d72e7e..4abf25fe8d5dd 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf @@ -242,16 +242,6 @@ Ayarlardan .editorconfig dosyası oluştur - - Hide hints when clear based on method and parameter name - Hide hints when clear based on method and parameter name - - - - Hide hints when parameter names differ only by suffix - Hide hints when parameter names differ only by suffix - - Highlight related components under cursor İmlecin altında ilgili bileşenleri vurgula @@ -802,6 +792,16 @@ Bazı renk düzeni renkleri, Ortam > Yazı Tipleri ve Renkler seçenek sayfasında yapılan değişiklikler tarafından geçersiz kılınıyor. Tüm özelleştirmeleri geri döndürmek için Yazı Tipleri ve Renkler sayfasında `Varsayılanları Kullan` seçeneğini belirleyin. + + Suppress hints when parameter name matches the method's intent + Suppress hints when parameter name matches the method's intent + + + + Suppress hints when parameter names differ only by suffix + Suppress hints when parameter names differ only by suffix + + Target Namespace: Hedef Ad Alanı: diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf index 4afc2b5335683..c2f830b7f5c6a 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf @@ -242,16 +242,6 @@ 基于设置生成 .editorconfig 文件 - - Hide hints when clear based on method and parameter name - Hide hints when clear based on method and parameter name - - - - Hide hints when parameter names differ only by suffix - Hide hints when parameter names differ only by suffix - - Highlight related components under cursor 突出显示光标下的相关组件 @@ -802,6 +792,16 @@ 在“环境”>“字体和颜色”选项页中所做的更改将替代某些配色方案颜色。在“字体和颜色”页中选择“使用默认值”,还原所有自定义项。 + + Suppress hints when parameter name matches the method's intent + Suppress hints when parameter name matches the method's intent + + + + Suppress hints when parameter names differ only by suffix + Suppress hints when parameter names differ only by suffix + + Target Namespace: 目标命名空间: diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf index 86ca81761fb8d..af06ea7254f81 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf @@ -242,16 +242,6 @@ 從設定產生 .editorconfig 檔案 - - Hide hints when clear based on method and parameter name - Hide hints when clear based on method and parameter name - - - - Hide hints when parameter names differ only by suffix - Hide hints when parameter names differ only by suffix - - Highlight related components under cursor 反白資料指標下的相關元件 @@ -802,6 +792,16 @@ [環境] > [字型和色彩選項] 頁面中所做的變更覆寫了某些色彩配置的色彩。請選擇 [字型和色彩] 頁面中的 [使用預設] 來還原所有自訂。 + + Suppress hints when parameter name matches the method's intent + Suppress hints when parameter name matches the method's intent + + + + Suppress hints when parameter names differ only by suffix + Suppress hints when parameter names differ only by suffix + + Target Namespace: 目標命名空間: diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml index c599547981d63..9d71c858d4335 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml @@ -210,12 +210,12 @@ - - + + diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb index f4001df4faf1e..615b9cb031067 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb @@ -63,8 +63,8 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options BindToOption(ShowHintsForLiterals, InlineHintsOptions.ForLiteralParameters, LanguageNames.VisualBasic) BindToOption(ShowHintsForNewExpressions, InlineHintsOptions.ForObjectCreationParameters, LanguageNames.VisualBasic) BindToOption(ShowHintsForEverythingElse, InlineHintsOptions.ForOtherParameters, LanguageNames.VisualBasic) - BindToOption(HideHintsWhenClearBasedOnMethodAndParameterName, InlineHintsOptions.HideForParametersThatMatchMethodIntent, LanguageNames.VisualBasic) - BindToOption(HideHintsWhenParameterNamesDifferOnlyBySuffix, InlineHintsOptions.HideForParametersThatDifferOnlyBySuffix, LanguageNames.VisualBasic) + BindToOption(SuppressHintsWhenParameterNameMatchesTheMethodsIntent, InlineHintsOptions.SuppressForParametersThatMatchMethodIntent, LanguageNames.VisualBasic) + BindToOption(SuppressHintsWhenParameterNamesDifferOnlyBySuffix, InlineHintsOptions.SuppressForParametersThatDifferOnlyBySuffix, LanguageNames.VisualBasic) BindToOption(EnableEndConstruct, FeatureOnOffOptions.EndConstruct, LanguageNames.VisualBasic) BindToOption(EnableLineCommit, FeatureOnOffOptions.PrettyListing, LanguageNames.VisualBasic) @@ -114,8 +114,8 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options ShowHintsForLiterals.IsEnabled = enabledForParameters ShowHintsForNewExpressions.IsEnabled = enabledForParameters ShowHintsForEverythingElse.IsEnabled = enabledForParameters - HideHintsWhenClearBasedOnMethodAndParameterName.IsEnabled = enabledForParameters - HideHintsWhenParameterNamesDifferOnlyBySuffix.IsEnabled = enabledForParameters + SuppressHintsWhenParameterNameMatchesTheMethodsIntent.IsEnabled = enabledForParameters + SuppressHintsWhenParameterNamesDifferOnlyBySuffix.IsEnabled = enabledForParameters End Sub Private Sub DisplayInlineParameterNameHints_Checked() diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb index 63d119d0084f1..44caf7aef65d0 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb @@ -48,11 +48,11 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options Public ReadOnly Property Option_Show_hints_for_everything_else As String = ServicesVSResources.Show_hints_for_everything_else - Public ReadOnly Property Option_Hide_hints_when_clear_based_on_method_and_parameter_name As String = - ServicesVSResources.Hide_hints_when_clear_based_on_method_and_parameter_name + Public ReadOnly Property Option_Suppress_hints_when_parameter_name_matches_the_method_s_intent As String = + ServicesVSResources.Suppress_hints_when_parameter_name_matches_the_method_s_intent - Public ReadOnly Property Option_Hide_hints_when_parameter_names_differ_only_by_suffix As String = - ServicesVSResources.Hide_hints_when_parameter_names_differ_only_by_suffix + Public ReadOnly Property Option_Suppress_hints_when_parameter_names_differ_only_by_suffix As String = + ServicesVSResources.Suppress_hints_when_parameter_names_differ_only_by_suffix Public ReadOnly Property Option_DontPutOutOrRefOnStruct As String Get From 6dee0cae235ea16197e97e240639b52dd6517a91 Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Wed, 7 Oct 2020 10:45:38 -0700 Subject: [PATCH 188/295] Use PowerShell directly in YML (#48369) * Use PowerShell directly in YML closes #48117 * More * More --- azure-pipelines-integration.yml | 5 ++- azure-pipelines-official.yml | 47 +++++++++++++++++------------ azure-pipelines-richnav.yml | 5 ++- eng/build.cmd | 2 -- eng/cibuild.cmd | 2 -- eng/pipelines/build-windows-job.yml | 15 +++++++-- eng/pipelines/test-windows-job.yml | 11 +++++-- eng/prepare-tests.cmd | 3 -- eng/rehydrate-tests.cmd | 2 -- 9 files changed, 56 insertions(+), 36 deletions(-) delete mode 100644 eng/build.cmd delete mode 100644 eng/cibuild.cmd delete mode 100644 eng/prepare-tests.cmd delete mode 100644 eng/rehydrate-tests.cmd diff --git a/azure-pipelines-integration.yml b/azure-pipelines-integration.yml index 1abc12b0f8bed..f896121cceb95 100644 --- a/azure-pipelines-integration.yml +++ b/azure-pipelines-integration.yml @@ -37,8 +37,11 @@ jobs: timeoutInMinutes: 135 steps: - - script: eng/cibuild.cmd -configuration $(_configuration) -prepareMachine -testVsi -oop64bit:$$(_oop64bit) + - task: PowerShell@2 displayName: Build and Test + inputs: + filePath: eng/build.ps1 + arguments: -ci -restore -build -pack -sign -publish -binaryLog -configuration $(_configuration) -prepareMachine -testVsi -oop64bit:$$(_oop64bit) - task: PublishTestResults@2 displayName: Publish xUnit Test Results diff --git a/azure-pipelines-official.yml b/azure-pipelines-official.yml index 048c0e4dfbe58..9952dc0ad30bf 100644 --- a/azure-pipelines-official.yml +++ b/azure-pipelines-official.yml @@ -88,26 +88,35 @@ stages: zipSources: false condition: and(succeeded(), in(variables['SignType'], 'test', 'real')) - - script: eng\cibuild.cmd - -configuration $(BuildConfiguration) - -officialBuildId $(Build.BuildNumber) - -officialSkipTests $(SkipTests) - -officialSkipApplyOptimizationData $(SkipApplyOptimizationData) - -officialSourceBranchName $(SourceBranchName) - -officialIbcDrop $(IbcDrop) - /p:RepositoryName=$(Build.Repository.Name) - /p:VisualStudioDropAccessToken=$(System.AccessToken) - /p:VisualStudioDropName=$(VisualStudio.DropName) - /p:DotNetSignType=$(SignType) - /p:DotNetPublishToBlobFeed=true - /p:DotNetPublishBlobFeedKey=$(dotnetfeed-storage-access-key-1) - /p:DotNetPublishBlobFeedUrl=https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json - /p:PublishToSymbolServer=true - /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) - /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) - /p:DotNetArtifactsCategory=$(_DotNetArtifactsCategory) - /p:DotnetPublishUsingPipelines=true + - task: PowerShell@2 displayName: Build + inputs: + filePath: eng/build.ps1 + arguments: -ci + -restore + -build + -pack + -sign + -publish + -binaryLog + -configuration $(BuildConfiguration) + -officialBuildId $(Build.BuildNumber) + -officialSkipTests $(SkipTests) + -officialSkipApplyOptimizationData $(SkipApplyOptimizationData) + -officialSourceBranchName $(SourceBranchName) + -officialIbcDrop $(IbcDrop) + /p:RepositoryName=$(Build.Repository.Name) + /p:VisualStudioDropAccessToken=$(System.AccessToken) + /p:VisualStudioDropName=$(VisualStudio.DropName) + /p:DotNetSignType=$(SignType) + /p:DotNetPublishToBlobFeed=true + /p:DotNetPublishBlobFeedKey=$(dotnetfeed-storage-access-key-1) + /p:DotNetPublishBlobFeedUrl=https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json + /p:PublishToSymbolServer=true + /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) + /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) + /p:DotNetArtifactsCategory=$(_DotNetArtifactsCategory) + /p:DotnetPublishUsingPipelines=true condition: succeeded() - task: PowerShell@2 diff --git a/azure-pipelines-richnav.yml b/azure-pipelines-richnav.yml index 8670b7dccd702..c3d4e7c8ea835 100644 --- a/azure-pipelines-richnav.yml +++ b/azure-pipelines-richnav.yml @@ -18,8 +18,11 @@ jobs: timeoutInMinutes: 200 steps: - - script: eng/cibuild.cmd -configuration Debug -prepareMachine + - task: PowerShell@2 displayName: Build + inputs: + filePath: eng/build.ps1 + arguments: -ci -restore -build -binaryLog -configuration Debug -prepareMachine - task: RichCodeNavIndexer@0 displayName: RichCodeNav Upload diff --git a/eng/build.cmd b/eng/build.cmd deleted file mode 100644 index fd1f85219fea5..0000000000000 --- a/eng/build.cmd +++ /dev/null @@ -1,2 +0,0 @@ -@echo off -powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0build.ps1""" %*" diff --git a/eng/cibuild.cmd b/eng/cibuild.cmd deleted file mode 100644 index 832f531137de7..0000000000000 --- a/eng/cibuild.cmd +++ /dev/null @@ -1,2 +0,0 @@ -@echo off -powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0build.ps1""" -ci -restore -build -pack -sign -publish -binaryLog %*" diff --git a/eng/pipelines/build-windows-job.yml b/eng/pipelines/build-windows-job.yml index 1fbbaa59a1610..a6277409d2347 100644 --- a/eng/pipelines/build-windows-job.yml +++ b/eng/pipelines/build-windows-job.yml @@ -18,14 +18,23 @@ jobs: timeoutInMinutes: 40 steps: - - script: eng/build.cmd -configuration ${{ parameters.configuration }} -prepareMachine -ci -restore -binaryLog + - task: PowerShell@2 displayName: Restore + inputs: + filePath: eng/build.ps1 + arguments: -configuration ${{ parameters.configuration }} -prepareMachine -ci -restore -binaryLog - - script: eng/build.cmd -configuration ${{ parameters.configuration }} -prepareMachine -ci -build -pack -sign -publish -binaryLog + - task: PowerShell@2 displayName: Build + inputs: + filePath: eng/build.ps1 + arguments: -configuration ${{ parameters.configuration }} -prepareMachine -ci -build -pack -sign -publish -binaryLog - - script: eng/prepare-tests.cmd -configuration ${{ parameters.configuration }} + - task: PowerShell@2 displayName: Prepare Unit Tests + inputs: + filePath: eng/prepare-tests.ps1 + arguments: -configuration ${{ parameters.configuration }} - task: PublishPipelineArtifact@1 displayName: Publish Test Payload diff --git a/eng/pipelines/test-windows-job.yml b/eng/pipelines/test-windows-job.yml index e4b0b71de689c..734e7d9643e72 100644 --- a/eng/pipelines/test-windows-job.yml +++ b/eng/pipelines/test-windows-job.yml @@ -35,11 +35,16 @@ jobs: artifact: ${{ parameters.testArtifactName }} path: '$(Build.SourcesDirectory)\artifacts\bin' - - script: eng/rehydrate-tests.cmd - displayName: Rehydrate unit tests environment + - task: PowerShell@2 + displayName: Rehydrate Unit Tests Environment + inputs: + filePath: eng/rehydrate-tests.ps1 - - script: eng/build.cmd -ci -configuration ${{ parameters.configuration }} ${{ parameters.testArguments }} + - task: PowerShell@2 displayName: Run Unit Tests + inputs: + filePath: eng/build.ps1 + arguments: -ci -configuration ${{ parameters.configuration }} ${{ parameters.testArguments }} - task: PublishTestResults@2 displayName: Publish xUnit Test Results diff --git a/eng/prepare-tests.cmd b/eng/prepare-tests.cmd deleted file mode 100644 index f2501af2fa48d..0000000000000 --- a/eng/prepare-tests.cmd +++ /dev/null @@ -1,3 +0,0 @@ -@echo off -powershell -noprofile -executionPolicy RemoteSigned -file "%~dp0\prepare-tests.ps1" %* - diff --git a/eng/rehydrate-tests.cmd b/eng/rehydrate-tests.cmd deleted file mode 100644 index 68904a4cd4d7f..0000000000000 --- a/eng/rehydrate-tests.cmd +++ /dev/null @@ -1,2 +0,0 @@ -@echo off -powershell -noprofile -executionPolicy RemoteSigned -file "%~dp0\rehydrate-tests.ps1" %* \ No newline at end of file From ae53ca54c1d74b5f25edeb0cf3e08708fab19eac Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Wed, 7 Oct 2020 11:31:42 -0700 Subject: [PATCH 189/295] Avoid binding the world looking for target-typed new --- .../FindReferences/Finders/AbstractReferenceFinder.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder.cs index d3d45f1901940..19ea338fb40fa 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder.cs @@ -638,6 +638,12 @@ static bool IsRelevantDocument(SyntaxTreeIndex syntaxTreeInfo) void CollectMatchingReferences(ISymbol originalUnreducedSymbolDefinition, SyntaxNode node, ISyntaxFactsService syntaxFacts, ISemanticFactsService semanticFacts, ArrayBuilder locations) { + if (!syntaxFacts.IsImplicitObjectCreation(node)) + { + // Avoid binding unrelated nodes + return; + } + var constructor = semanticModel.GetSymbolInfo(node, cancellationToken).Symbol; if (Matches(constructor, originalUnreducedSymbolDefinition)) From f86af972fe53f26951bddc0ad6bf52b9567962ab Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 7 Oct 2020 12:03:40 -0700 Subject: [PATCH 190/295] Bind less when finding implicit object construction for FindReferences --- .../FindReferencesTests.ConstructorSymbols.vb | 241 +++++++++++++++++- .../Finders/AbstractReferenceFinder.cs | 37 +-- .../ConstructorSymbolReferenceFinder.cs | 51 ++++ 3 files changed, 296 insertions(+), 33 deletions(-) diff --git a/src/EditorFeatures/Test2/FindReferences/FindReferencesTests.ConstructorSymbols.vb b/src/EditorFeatures/Test2/FindReferences/FindReferencesTests.ConstructorSymbols.vb index 6dec719af6f6e..6245f0d1952e6 100644 --- a/src/EditorFeatures/Test2/FindReferences/FindReferencesTests.ConstructorSymbols.vb +++ b/src/EditorFeatures/Test2/FindReferences/FindReferencesTests.ConstructorSymbols.vb @@ -2,7 +2,6 @@ ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. -Imports System.Threading.Tasks Imports Microsoft.CodeAnalysis.Remote.Testing Namespace Microsoft.CodeAnalysis.Editor.UnitTests.FindReferences @@ -929,6 +928,246 @@ static class D } + + Await TestAPIAndFeature(input, kind, host) + End Function + + + Public Async Function TestImplicitConstructorNotEnoughArguments(kind As TestKind, host As TestHost) As Task + Dim input = + + + +class D +{ + {|Definition:$$D|}(int x) { } + void M() + { + D d = new(); + } +} + + + + Await TestAPIAndFeature(input, kind, host) + End Function + + + Public Async Function TestImplicitConstructorExactArgumentCount(kind As TestKind, host As TestHost) As Task + Dim input = + + + +class D +{ + {|Definition:$$D|}(int x) { } + void M() + { + D d = [|new|](1); + } +} + + + + Await TestAPIAndFeature(input, kind, host) + End Function + + + Public Async Function TestImplicitConstructorTooManyArguments(kind As TestKind, host As TestHost) As Task + Dim input = + + + +class D +{ + {|Definition:$$D|}(int x) { } + void M() + { + D d = new(1, 2); + } +} + + + + Await TestAPIAndFeature(input, kind, host) + End Function + + + Public Async Function TestImplicitConstructorWithOptionalParam0(kind As TestKind, host As TestHost) As Task + Dim input = + + + +class D +{ + {|Definition:$$D|}(int x, int? y = null) { } + void M() + { + D d = new(); + } +} + + + + Await TestAPIAndFeature(input, kind, host) + End Function + + + Public Async Function TestImplicitConstructorWithOptionalParam1(kind As TestKind, host As TestHost) As Task + Dim input = + + + +class D +{ + {|Definition:$$D|}(int x, int? y = null) { } + void M() + { + D d = [|new|](1); + } +} + + + + Await TestAPIAndFeature(input, kind, host) + End Function + + + Public Async Function TestImplicitConstructorWithOptionalParam2(kind As TestKind, host As TestHost) As Task + Dim input = + + + +class D +{ + {|Definition:$$D|}(int x, int? y = null) { } + void M() + { + D d = [|new|](1, 2); + } +} + + + + Await TestAPIAndFeature(input, kind, host) + End Function + + + Public Async Function TestImplicitConstructorWithOptionalParam3(kind As TestKind, host As TestHost) As Task + Dim input = + + + +class D +{ + {|Definition:$$D|}(int x, int? y = null) { } + void M() + { + D d = new(1, 2, 3); + } +} + + + + Await TestAPIAndFeature(input, kind, host) + End Function + + + Public Async Function TestImplicitConstructorWithParams0(kind As TestKind, host As TestHost) As Task + Dim input = + + + +class D +{ + {|Definition:$$D|}(int x, params int[] y) { } + void M() + { + D d = new(); + } +} + + + + Await TestAPIAndFeature(input, kind, host) + End Function + + + Public Async Function TestImplicitConstructorWithParams1(kind As TestKind, host As TestHost) As Task + Dim input = + + + +class D +{ + {|Definition:$$D|}(int x, params int[] y) { } + void M() + { + D d = [|new|](1); + } +} + + + + Await TestAPIAndFeature(input, kind, host) + End Function + + + Public Async Function TestImplicitConstructorWithParams2(kind As TestKind, host As TestHost) As Task + Dim input = + + + +class D +{ + {|Definition:$$D|}(int x, params int[] y) { } + void M() + { + D d = [|new|](1, 2); + } +} + + + + Await TestAPIAndFeature(input, kind, host) + End Function + + + Public Async Function TestImplicitConstructorWithParams3(kind As TestKind, host As TestHost) As Task + Dim input = + + + +class D +{ + {|Definition:$$D|}(int x, params int[] y) { } + void M() + { + D d = [|new|](1, 2, 3); + } +} + + + + Await TestAPIAndFeature(input, kind, host) + End Function + + + Public Async Function TestImplicitConstructorWithParams4(kind As TestKind, host As TestHost) As Task + Dim input = + + + +class D +{ + {|Definition:$$D|}(int x, params int[] y) { } + void M() + { + D d = [|new|](1, 2, 3, 4); + } +} + + Await TestAPIAndFeature(input, kind, host) End Function diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder.cs index da3b22e55c747..c3bd78b1c633e 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder.cs @@ -495,10 +495,10 @@ protected static Task> FindDocumentsWithImplicitObjectC /// /// If the `node` implicitly matches the `symbol`, then it will be added to `locations`. /// - private delegate void CollectMatchingReferences(ISymbol symbol, SyntaxNode node, + protected delegate void CollectMatchingReferences(ISymbol symbol, SyntaxNode node, ISyntaxFactsService syntaxFacts, ISemanticFactsService semanticFacts, ArrayBuilder locations); - private static async Task> FindReferencesInDocumentAsync( + protected static async Task> FindReferencesInDocumentAsync( ISymbol symbol, Document document, Func isRelevantDocument, @@ -512,7 +512,7 @@ private static async Task> FindReferencesInDocume var semanticFacts = document.GetRequiredLanguageService(); var syntaxRoot = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); - var locations = ArrayBuilder.GetInstance(); + using var _ = ArrayBuilder.GetInstance(out var locations); var originalUnreducedSymbolDefinition = symbol.GetOriginalUnreducedDefinition(); @@ -522,7 +522,7 @@ private static async Task> FindReferencesInDocume collectMatchingReferences(originalUnreducedSymbolDefinition, node, syntaxFacts, semanticFacts, locations); } - return locations.ToImmutableAndFree(); + return locations.ToImmutable(); } return ImmutableArray.Empty; @@ -623,34 +623,7 @@ void CollectMatchingReferences(ISymbol originalUnreducedSymbolDefinition, Syntax } } - protected Task> FindReferencesInImplicitObjectCreationExpressionAsync( - ISymbol symbol, - Document document, - SemanticModel semanticModel, - CancellationToken cancellationToken) - { - return FindReferencesInDocumentAsync(symbol, document, IsRelevantDocument, CollectMatchingReferences, cancellationToken); - - static bool IsRelevantDocument(SyntaxTreeIndex syntaxTreeInfo) - => syntaxTreeInfo.ContainsImplicitObjectCreation; - - void CollectMatchingReferences(ISymbol originalUnreducedSymbolDefinition, SyntaxNode node, - ISyntaxFactsService syntaxFacts, ISemanticFactsService semanticFacts, ArrayBuilder locations) - { - var constructor = semanticModel.GetSymbolInfo(node, cancellationToken).Symbol; - - if (Matches(constructor, originalUnreducedSymbolDefinition)) - { - var location = node.GetFirstToken().GetLocation(); - var symbolUsageInfo = GetSymbolUsageInfo(node, semanticModel, syntaxFacts, semanticFacts, cancellationToken); - - locations.Add(new FinderLocation(node, new ReferenceLocation( - document, alias: null, location, isImplicit: true, symbolUsageInfo, GetAdditionalFindUsagesProperties(node, semanticModel, syntaxFacts), CandidateReason.None))); - } - } - } - - private static bool Matches(ISymbol? symbol1, ISymbol notNulloriginalUnreducedSymbol2) + protected static bool Matches(ISymbol? symbol1, ISymbol notNulloriginalUnreducedSymbol2) { return symbol1 != null && SymbolEquivalenceComparer.Instance.Equals( symbol1.GetOriginalUnreducedDefinition(), diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/ConstructorSymbolReferenceFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/ConstructorSymbolReferenceFinder.cs index 4f080112a777b..7081689c59b12 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/ConstructorSymbolReferenceFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/ConstructorSymbolReferenceFinder.cs @@ -8,6 +8,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.LanguageServices; +using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; using Roslyn.Utilities; @@ -146,5 +147,55 @@ private static ValueTask> FindAttributeReferences ? FindReferencesInDocumentUsingIdentifierAsync(symbol, simpleName, document, semanticModel, cancellationToken) : new ValueTask>(ImmutableArray.Empty); } + + private Task> FindReferencesInImplicitObjectCreationExpressionAsync( + IMethodSymbol symbol, + Document document, + SemanticModel semanticModel, + CancellationToken cancellationToken) + { + // Only check `new (...)` calls that supply enough arguments to match all the required parameters for the constructor. + var minimumArgumentCount = symbol.Parameters.Count(p => !p.IsOptional && !p.IsParams); + var maximumArgumentCount = symbol.Parameters.Length > 0 && symbol.Parameters.Last().IsParams + ? int.MaxValue + : symbol.Parameters.Length; + + var exactArgumentCount = symbol.Parameters.Any(p => p.IsOptional || p.IsParams) + ? -1 + : symbol.Parameters.Length; + + return FindReferencesInDocumentAsync(symbol, document, IsRelevantDocument, CollectMatchingReferences, cancellationToken); + + static bool IsRelevantDocument(SyntaxTreeIndex syntaxTreeInfo) + => syntaxTreeInfo.ContainsImplicitObjectCreation; + + void CollectMatchingReferences( + ISymbol originalUnreducedSymbolDefinition, SyntaxNode node, + ISyntaxFactsService syntaxFacts, ISemanticFactsService semanticFacts, + ArrayBuilder locations) + { + if (!syntaxFacts.IsImplicitObjectCreationExpression(node)) + return; + + // if there are too few or too many arguments, then don't bother checking. + var actualArgumentCount = syntaxFacts.GetArgumentsOfObjectCreationExpression(node).Count; + if (actualArgumentCount < minimumArgumentCount || actualArgumentCount > maximumArgumentCount) + return; + + // if we need an exact count then make sure that the count we have fits the count we need. + if (exactArgumentCount != -1 && exactArgumentCount != actualArgumentCount) + return; + + var constructor = semanticModel.GetSymbolInfo(node, cancellationToken).Symbol; + if (Matches(constructor, originalUnreducedSymbolDefinition)) + { + var location = node.GetFirstToken().GetLocation(); + var symbolUsageInfo = GetSymbolUsageInfo(node, semanticModel, syntaxFacts, semanticFacts, cancellationToken); + + locations.Add(new FinderLocation(node, new ReferenceLocation( + document, alias: null, location, isImplicit: true, symbolUsageInfo, GetAdditionalFindUsagesProperties(node, semanticModel, syntaxFacts), CandidateReason.None))); + } + } + } } } From aaff726daa69c2b688be2bff4540c068049b8fe4 Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Wed, 7 Oct 2020 12:28:04 -0700 Subject: [PATCH 191/295] Upgrade our .NET SDK to 5.0 RC 1 --- global.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/global.json b/global.json index a19643d24f773..aaa923904fb3c 100644 --- a/global.json +++ b/global.json @@ -1,11 +1,11 @@ { "sdk": { - "version": "5.0.100-preview.8.20417.9", + "version": "5.0.100-rc.1.20452.10", "allowPrerelease": true, "rollForward": "major" }, "tools": { - "dotnet": "5.0.100-preview.8.20417.9", + "dotnet": "5.0.100-rc.1.20452.10", "vs": { "version": "16.8" }, From c756744877d89d9c083c5e8665b67b5bfccaac99 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Wed, 7 Oct 2020 13:19:57 -0700 Subject: [PATCH 192/295] Use SupportedOSPlatformAttribute where necessary --- .../InternalUtilities/PlatformAttributes.cs | 94 +++++++++++++++++++ .../HostProcess/InteractiveHost32.csproj | 4 + .../HostProcess/InteractiveHost64.csproj | 4 + .../HostProcess/InteractiveHostEntryPoint.cs | 4 + 4 files changed, 106 insertions(+) create mode 100644 src/Compilers/Core/Portable/InternalUtilities/PlatformAttributes.cs diff --git a/src/Compilers/Core/Portable/InternalUtilities/PlatformAttributes.cs b/src/Compilers/Core/Portable/InternalUtilities/PlatformAttributes.cs new file mode 100644 index 0000000000000..4990bae8264d3 --- /dev/null +++ b/src/Compilers/Core/Portable/InternalUtilities/PlatformAttributes.cs @@ -0,0 +1,94 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#nullable enable + +#if !NET5_0 + +namespace System.Runtime.Versioning +{ + /// + /// Base type for all platform-specific API attributes. + /// + internal abstract class OSPlatformAttribute : Attribute + { + private protected OSPlatformAttribute(string platformName) + { + PlatformName = platformName; + } + + public string PlatformName { get; } + } + + /// + /// Records the platform that the project targeted. + /// + [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)] + internal sealed class TargetPlatformAttribute : OSPlatformAttribute + { + public TargetPlatformAttribute(string platformName) + : base(platformName) + { + } + } + + /// + /// Records the operating system (and minimum version) that supports an API. Multiple attributes can be + /// applied to indicate support on multiple operating systems. + /// + /// + /// Callers can apply a + /// or use guards to prevent calls to APIs on unsupported operating systems. + /// + /// A given platform should only be specified once. + /// + [AttributeUsage( + AttributeTargets.Assembly + | AttributeTargets.Class + | AttributeTargets.Constructor + | AttributeTargets.Enum + | AttributeTargets.Event + | AttributeTargets.Field + | AttributeTargets.Method + | AttributeTargets.Module + | AttributeTargets.Property + | AttributeTargets.Struct, + AllowMultiple = true, Inherited = false)] + internal sealed class SupportedOSPlatformAttribute : OSPlatformAttribute + { + public SupportedOSPlatformAttribute(string platformName) + : base(platformName) + { + } + } + + /// + /// Marks APIs that were removed in a given operating system version. + /// + /// + /// Primarily used by OS bindings to indicate APIs that are only available in + /// earlier versions. + /// + [AttributeUsage( + AttributeTargets.Assembly + | AttributeTargets.Class + | AttributeTargets.Constructor + | AttributeTargets.Enum + | AttributeTargets.Event + | AttributeTargets.Field + | AttributeTargets.Method + | AttributeTargets.Module + | AttributeTargets.Property + | AttributeTargets.Struct, + AllowMultiple = true, Inherited = false)] + internal sealed class UnsupportedOSPlatformAttribute : OSPlatformAttribute + { + public UnsupportedOSPlatformAttribute(string platformName) + : base(platformName) + { + } + } +} + +#endif diff --git a/src/Interactive/HostProcess/InteractiveHost32.csproj b/src/Interactive/HostProcess/InteractiveHost32.csproj index ca1a0ee3144fb..5d501a10f47b7 100644 --- a/src/Interactive/HostProcess/InteractiveHost32.csproj +++ b/src/Interactive/HostProcess/InteractiveHost32.csproj @@ -16,6 +16,10 @@ + + + + diff --git a/src/Interactive/HostProcess/InteractiveHostEntryPoint.cs b/src/Interactive/HostProcess/InteractiveHostEntryPoint.cs index 4ad2601964870..6fcf537f64707 100644 --- a/src/Interactive/HostProcess/InteractiveHostEntryPoint.cs +++ b/src/Interactive/HostProcess/InteractiveHostEntryPoint.cs @@ -6,6 +6,7 @@ using System; using System.Runtime.InteropServices; +using System.Runtime.Versioning; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; @@ -15,6 +16,7 @@ namespace Microsoft.CodeAnalysis.Interactive { internal static class InteractiveHostEntryPoint { + [SupportedOSPlatform("windows")] private static async Task Main(string[] args) { FatalError.Handler = FailFast.OnFatalException; @@ -53,9 +55,11 @@ private static async Task Main(string[] args) } } + [SupportedOSPlatform("windows")] [DllImport("kernel32", PreserveSig = true)] internal static extern ErrorMode SetErrorMode(ErrorMode mode); + [SupportedOSPlatform("windows")] [DllImport("kernel32", PreserveSig = true)] internal static extern ErrorMode GetErrorMode(); From 81457f23bba814285217af4806b6b2cb11650592 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Wed, 7 Oct 2020 13:23:45 -0700 Subject: [PATCH 193/295] Fix IDE0044 (Make field readonly) --- .../VisualBasic/Portable/Semantics/OverloadResolution.vb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Compilers/VisualBasic/Portable/Semantics/OverloadResolution.vb b/src/Compilers/VisualBasic/Portable/Semantics/OverloadResolution.vb index 5509d712336c6..5dbbf1f4bf96b 100644 --- a/src/Compilers/VisualBasic/Portable/Semantics/OverloadResolution.vb +++ b/src/Compilers/VisualBasic/Portable/Semantics/OverloadResolution.vb @@ -502,12 +502,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic #If DEBUG Then ' Compile time asserts. Private Const s_delegateRelaxationLevelMask_AssertZero = SmallFieldMask.DelegateRelaxationLevelMask - ConversionKind.DelegateRelaxationLevelMask - Private _delegateRelaxationLevelMask_Assert1(s_delegateRelaxationLevelMask_AssertZero) As Boolean - Private _delegateRelaxationLevelMask_Assert2(-s_delegateRelaxationLevelMask_AssertZero) As Boolean + Private ReadOnly _delegateRelaxationLevelMask_Assert1(s_delegateRelaxationLevelMask_AssertZero) As Boolean + Private ReadOnly _delegateRelaxationLevelMask_Assert2(-s_delegateRelaxationLevelMask_AssertZero) As Boolean Private Const s_inferenceLevelMask_AssertZero = CByte((SmallFieldMask.InferenceLevelMask >> SmallFieldMask.InferenceLevelShift) <> ((TypeArgumentInference.InferenceLevel.Invalid << 1) - 1)) - Private _inferenceLevelMask_Assert1(s_inferenceLevelMask_AssertZero) As Boolean - Private _inferenceLevelMask_Assert2(-s_inferenceLevelMask_AssertZero) As Boolean + Private ReadOnly _inferenceLevelMask_Assert1(s_inferenceLevelMask_AssertZero) As Boolean + Private ReadOnly _inferenceLevelMask_Assert2(-s_inferenceLevelMask_AssertZero) As Boolean #End If Public Structure OptionalArgument Public ReadOnly DefaultValue As BoundExpression From d95d41181ab6b80360afb38a59f47361542e219e Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Wed, 7 Oct 2020 13:24:19 -0700 Subject: [PATCH 194/295] Suppress nullability false positives --- .../CSharp/Test/Semantic/Semantics/FunctionPointerTests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/FunctionPointerTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/FunctionPointerTests.cs index ddbeb5d2775f5..e1bdc7185adbb 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/FunctionPointerTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/FunctionPointerTests.cs @@ -1614,7 +1614,7 @@ public static void M() .OfType() .Select(s => model.GetSymbolInfo(s).CandidateSymbols.Single()) .Cast() - .Select(m => m.TypeArguments.Single().ToTestDisplayString()) + .Select(m => m!.TypeArguments.Single().ToTestDisplayString()) .ToList(); var expectedTypes = new string[] { @@ -1676,7 +1676,7 @@ public static void M() return symbolInfo.Symbol ?? symbolInfo.CandidateSymbols.Single(); }) .Cast() - .Select(m => m.TypeArguments.Single().ToTestDisplayString()) + .Select(m => m!.TypeArguments.Single().ToTestDisplayString()) .ToList(); var expectedTypes = new string[] { @@ -1749,7 +1749,7 @@ public static void M() return symbolInfo.Symbol ?? symbolInfo.CandidateSymbols.Single(); }) .Cast() - .Select(m => m.TypeArguments.Single().ToTestDisplayString()) + .Select(m => m!.TypeArguments.Single().ToTestDisplayString()) .ToList(); var expectedTypes = new string[] { From a30757d80b238dcf459059339660d7cc683f169e Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Wed, 7 Oct 2020 13:24:55 -0700 Subject: [PATCH 195/295] Conditionally mark InitializeLifetimeService obsolete for .NET 5 --- .../CoreTestUtilities/Remote/InProcRemostHostClient.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Workspaces/CoreTestUtilities/Remote/InProcRemostHostClient.cs b/src/Workspaces/CoreTestUtilities/Remote/InProcRemostHostClient.cs index eae3747ec9a67..c3fae5cb512c0 100644 --- a/src/Workspaces/CoreTestUtilities/Remote/InProcRemostHostClient.cs +++ b/src/Workspaces/CoreTestUtilities/Remote/InProcRemostHostClient.cs @@ -259,6 +259,9 @@ public override int WriteTimeout public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken) => _stream.CopyToAsync(destination, bufferSize, cancellationToken); +#if NET5_0 + [Obsolete] +#endif public override object InitializeLifetimeService() => throw new NotSupportedException(); From c9417fcee2d310c8607f74bd67b5dfb3b9a4dd33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Matou=C5=A1ek?= Date: Wed, 7 Oct 2020 13:47:00 -0700 Subject: [PATCH 196/295] Remove call to Dispatcher.CurrentDispatcher.DoEvents (#48338) --- .../TestUtilities/Workspaces/TestWorkspace.cs | 5 --- .../CoreTestUtilities/DispatcherExtensions.cs | 38 ------------------- 2 files changed, 43 deletions(-) delete mode 100644 src/Workspaces/CoreTestUtilities/DispatcherExtensions.cs diff --git a/src/EditorFeatures/TestUtilities/Workspaces/TestWorkspace.cs b/src/EditorFeatures/TestUtilities/Workspaces/TestWorkspace.cs index 1ada97d195319..9ec2107487261 100644 --- a/src/EditorFeatures/TestUtilities/Workspaces/TestWorkspace.cs +++ b/src/EditorFeatures/TestUtilities/Workspaces/TestWorkspace.cs @@ -158,11 +158,6 @@ protected override void Dispose(bool finalize) document.CloseTextView(); } - if (SynchronizationContext.Current != null) - { - Dispatcher.CurrentDispatcher.DoEvents(); - } - if (_backgroundParser != null) { _backgroundParser.CancelAllParses(); diff --git a/src/Workspaces/CoreTestUtilities/DispatcherExtensions.cs b/src/Workspaces/CoreTestUtilities/DispatcherExtensions.cs deleted file mode 100644 index 746995816c95d..0000000000000 --- a/src/Workspaces/CoreTestUtilities/DispatcherExtensions.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Windows.Threading; - -namespace Roslyn.Test.Utilities -{ - public static class DispatcherExtensions - { - public static void DoEvents(this Dispatcher dispatcher) - { - // A DispatcherFrame represents a loop that processes pending work - // items. - var frame = new DispatcherFrame(); - var callback = (Action)(f => f.Continue = false); - - // Executes the specified delegate asynchronously. When it is - // complete mark the frame as complete so the dispatcher loop - // pops out (stops). -#pragma warning disable VSTHRD001 // Avoid legacy thread switching APIs - var operation = dispatcher.BeginInvoke( -#pragma warning restore VSTHRD001 // Avoid legacy thread switching APIs - DispatcherPriority.ApplicationIdle, callback, frame); - - // Start the loop. It will process all items in the queue, then - // will process the above callback. That callback will tell the - // loop to then stop processing. - Dispatcher.PushFrame(frame); - - if (operation.Status != DispatcherOperationStatus.Completed) - { - operation.Abort(); - } - } - } -} From 4c877bcd78d96468e4c3ebb45994be1ca8e1a0bc Mon Sep 17 00:00:00 2001 From: Louis Zanella Date: Tue, 6 Oct 2020 20:45:07 -0400 Subject: [PATCH 197/295] No "implement implicitly" when class implements no interface - If a method implements explicitly a method but its class implements no interface, don't suggest implicit implementation. --- .../ImplementImplicitlyTests.cs | 19 +++++++++++++++++++ ...angeImplementionCodeRefactoringProvider.cs | 5 ++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementImplicitlyTests.cs b/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementImplicitlyTests.cs index 89ce84703158c..2ef5e7b74ade8 100644 --- a/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementImplicitlyTests.cs +++ b/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementImplicitlyTests.cs @@ -11,6 +11,7 @@ using Microsoft.CodeAnalysis.CSharp.ImplementInterface; using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.CodeRefactorings; using Microsoft.CodeAnalysis.Test.Utilities; +using Roslyn.Test.Utilities; using Xunit; namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.ImplementInterface @@ -206,5 +207,23 @@ public void Goo1() { } private void Goo1() { } }", index: SingleMember); } + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + [WorkItem(48027, "https://github.com/dotnet/roslyn/issues/48027")] + public async Task TestSingleMemberNoInterface() + { + await TestMissingAsync( +@" +using System; +using System.Collections; + +class C +{ + IEnumerator IEnumerable.[||]GetEnumerator() + { + throw new NotImplementedException(); + } +}"); + } } } diff --git a/src/Features/CSharp/Portable/ImplementInterface/AbstractChangeImplementionCodeRefactoringProvider.cs b/src/Features/CSharp/Portable/ImplementInterface/AbstractChangeImplementionCodeRefactoringProvider.cs index e28eb764dea36..4596b7b29efd7 100644 --- a/src/Features/CSharp/Portable/ImplementInterface/AbstractChangeImplementionCodeRefactoringProvider.cs +++ b/src/Features/CSharp/Portable/ImplementInterface/AbstractChangeImplementionCodeRefactoringProvider.cs @@ -69,7 +69,10 @@ public sealed override async Task ComputeRefactoringsAsync(CodeRefactoringContex // member. Interface member names are the expected names that people expect to see // (like "GetEnumerator"), instead of the auto-generated names that the compiler makes // like: "System.IEnumerable.GetEnumerator" - directlyImplementedMembers.AddRange(member, member.ExplicitOrImplicitInterfaceImplementations()); + var interfaceImplementations = member.ExplicitOrImplicitInterfaceImplementations(); + if (interfaceImplementations.Length == 0) + return; + directlyImplementedMembers.AddRange(member, interfaceImplementations); var codeAction = new MyCodeAction( string.Format(Implement_0, member.ExplicitOrImplicitInterfaceImplementations().First().Name), From f35c3c0d2522e0512f9e4395281a4debc9e98b4b Mon Sep 17 00:00:00 2001 From: Louis Zanella Date: Wed, 7 Oct 2020 15:49:22 -0400 Subject: [PATCH 198/295] Move logic to CheckMemberCanBeConverted --- .../ImplementInterface/ImplementImplicitlyTests.cs | 2 +- ...stractChangeImplementionCodeRefactoringProvider.cs | 5 +---- ...SharpImplementImplicitlyCodeRefactoringProvider.cs | 11 ++++++++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementImplicitlyTests.cs b/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementImplicitlyTests.cs index 2ef5e7b74ade8..9e5cf1cf288a1 100644 --- a/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementImplicitlyTests.cs +++ b/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementImplicitlyTests.cs @@ -210,7 +210,7 @@ private void Goo1() { } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] [WorkItem(48027, "https://github.com/dotnet/roslyn/issues/48027")] - public async Task TestSingleMemberNoInterface() + public async Task TestSingleMemberAndContainingTypeHasNoInterface() { await TestMissingAsync( @" diff --git a/src/Features/CSharp/Portable/ImplementInterface/AbstractChangeImplementionCodeRefactoringProvider.cs b/src/Features/CSharp/Portable/ImplementInterface/AbstractChangeImplementionCodeRefactoringProvider.cs index 4596b7b29efd7..e28eb764dea36 100644 --- a/src/Features/CSharp/Portable/ImplementInterface/AbstractChangeImplementionCodeRefactoringProvider.cs +++ b/src/Features/CSharp/Portable/ImplementInterface/AbstractChangeImplementionCodeRefactoringProvider.cs @@ -69,10 +69,7 @@ public sealed override async Task ComputeRefactoringsAsync(CodeRefactoringContex // member. Interface member names are the expected names that people expect to see // (like "GetEnumerator"), instead of the auto-generated names that the compiler makes // like: "System.IEnumerable.GetEnumerator" - var interfaceImplementations = member.ExplicitOrImplicitInterfaceImplementations(); - if (interfaceImplementations.Length == 0) - return; - directlyImplementedMembers.AddRange(member, interfaceImplementations); + directlyImplementedMembers.AddRange(member, member.ExplicitOrImplicitInterfaceImplementations()); var codeAction = new MyCodeAction( string.Format(Implement_0, member.ExplicitOrImplicitInterfaceImplementations().First().Name), diff --git a/src/Features/CSharp/Portable/ImplementInterface/CSharpImplementImplicitlyCodeRefactoringProvider.cs b/src/Features/CSharp/Portable/ImplementInterface/CSharpImplementImplicitlyCodeRefactoringProvider.cs index 10bcf0598a2d5..455f483c4416a 100644 --- a/src/Features/CSharp/Portable/ImplementInterface/CSharpImplementImplicitlyCodeRefactoringProvider.cs +++ b/src/Features/CSharp/Portable/ImplementInterface/CSharpImplementImplicitlyCodeRefactoringProvider.cs @@ -4,6 +4,7 @@ using System.Composition; using System.Diagnostics.CodeAnalysis; +using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeRefactorings; @@ -35,7 +36,15 @@ protected override bool CheckExplicitNameAllowsConversion(ExplicitInterfaceSpeci // If we don't implement any interface members explicitly we can't convert this to be // implicit. protected override bool CheckMemberCanBeConverted(ISymbol member) - => member.ExplicitInterfaceImplementations().Length > 0; + { + var memberInterfaceImplementations = member.ExplicitInterfaceImplementations(); + if (memberInterfaceImplementations.Length == 0) + return false; + var containingTypeInterfaces = member.ContainingType.AllInterfaces; + if (containingTypeInterfaces.Length == 0) + return false; + return memberInterfaceImplementations.Any(impl => containingTypeInterfaces.Contains(impl.ContainingType)); + } // When converting to implicit, we don't need to update any references. protected override Task UpdateReferencesAsync(Project project, SolutionEditor solutionEditor, ISymbol implMember, INamedTypeSymbol containingType, CancellationToken cancellationToken) From 20f7a51fed2cb3915845bbd2af220efb755d80b0 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 7 Oct 2020 13:52:58 -0700 Subject: [PATCH 199/295] Add a ctrl-alt shortcut one can hold to have all inline-hints show up. --- .../InlineHintsKeyProcessorProvider.cs | 140 ++++++++++++++++++ .../InlineParameterNameHintsTagger.cs | 1 + .../InlineParameterNameHintsTaggerProvider.cs | 14 +- ...ineParameterNameHintsDataTaggerProvider.cs | 9 +- ...AbstractInlineParameterNameHintsService.cs | 10 +- .../InlineHints/InlineHintsOptions.cs | 8 + .../Impl/Options/AdvancedOptionPageStrings.cs | 2 +- .../Core/Def/ServicesVSResources.resx | 4 +- .../Core/Def/xlf/ServicesVSResources.cs.xlf | 6 +- .../Core/Def/xlf/ServicesVSResources.de.xlf | 6 +- .../Core/Def/xlf/ServicesVSResources.es.xlf | 6 +- .../Core/Def/xlf/ServicesVSResources.fr.xlf | 6 +- .../Core/Def/xlf/ServicesVSResources.it.xlf | 6 +- .../Core/Def/xlf/ServicesVSResources.ja.xlf | 6 +- .../Core/Def/xlf/ServicesVSResources.ko.xlf | 6 +- .../Core/Def/xlf/ServicesVSResources.pl.xlf | 6 +- .../Def/xlf/ServicesVSResources.pt-BR.xlf | 6 +- .../Core/Def/xlf/ServicesVSResources.ru.xlf | 6 +- .../Core/Def/xlf/ServicesVSResources.tr.xlf | 6 +- .../Def/xlf/ServicesVSResources.zh-Hans.xlf | 6 +- .../Def/xlf/ServicesVSResources.zh-Hant.xlf | 6 +- .../Impl/Options/AdvancedOptionPageStrings.vb | 2 +- 22 files changed, 208 insertions(+), 60 deletions(-) create mode 100644 src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs new file mode 100644 index 0000000000000..6fc1ac4c32601 --- /dev/null +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs @@ -0,0 +1,140 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#nullable disable + +using System; +using System.ComponentModel.Composition; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Windows.Input; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.InlineHints; +using Microsoft.CodeAnalysis.Text; +using Microsoft.VisualStudio.Text.Editor; +using Microsoft.VisualStudio.Utilities; +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.Editor.InlineHints +{ + /// + /// Key processor that allows us to toggle inline hints when a user hits ctrl-alt. + /// + [Export(typeof(IKeyProcessorProvider))] + [TextViewRole(PredefinedTextViewRoles.Document)] + [ContentType(ContentTypeNames.RoslynContentType)] + [Name(nameof(InlineHintsKeyProcessorProvider))] + [Order(Before = "default")] + internal class InlineHintsKeyProcessorProvider : IKeyProcessorProvider + { + private static readonly ConditionalWeakTable s_viewToProcessor = new(); + + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public InlineHintsKeyProcessorProvider() + { + } + + public KeyProcessor GetAssociatedProcessor(IWpfTextView wpfTextView) + { + return s_viewToProcessor.GetValue(wpfTextView, v => new InlineHintsKeyProcessor(v)); + } + + private class InlineHintsKeyProcessor : KeyProcessor + { + private readonly IWpfTextView _view; + + public InlineHintsKeyProcessor(IWpfTextView view) + { + _view = view; + _view.Closed += OnViewClosed; + _view.LostAggregateFocus += OnLostFocus; + } + + private static bool IsCtrlOrAlt(KeyEventArgs args) + => args.Key is Key.LeftCtrl or Key.RightCtrl or Key.LeftAlt or Key.RightAlt; + + private Workspace GetWorkspace() + { + var document = + _view.BufferGraph.GetTextBuffers(b => true) + .Select(b => b.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges()) + .WhereNotNull() + .FirstOrDefault(); + + return document?.Project.Solution.Workspace; + } + + private void OnViewClosed(object sender, EventArgs e) + { + // Disconnect our callbacks. + _view.Closed -= OnViewClosed; + _view.LostAggregateFocus -= OnLostFocus; + } + + private void OnLostFocus(object sender, EventArgs e) + { + // if focus is lost (which can happen for shortcuts that include ctrl-alt...) then go back to normal + // inline-hint processing. + var workspace = GetWorkspace(); + if (workspace == null) + return; + + ToggleOff(workspace); + } + + public override void KeyDown(KeyEventArgs args) + { + base.KeyDown(args); + + var workspace = GetWorkspace(); + if (workspace == null) + return; + + // if this is either the ctrl or alt key, and only ctrl-alt is down, then toggle on. + // otherwise toggle off if anything else is pressed down. + if (IsCtrlOrAlt(args)) + { + if (args.KeyboardDevice.Modifiers == (ModifierKeys.Control | ModifierKeys.Alt)) + { + ToggleOn(workspace); + return; + } + } + + ToggleOff(workspace); + } + + public override void KeyUp(KeyEventArgs args) + { + base.KeyUp(args); + + var workspace = GetWorkspace(); + if (workspace == null) + return; + + // If we've lifted a key up turn of the inline hints. + ToggleOff(workspace); + } + + private static void ToggleOn(Workspace workspace) + => Toggle(workspace, on: true); + + private static void ToggleOff(Workspace workspace) + => Toggle(workspace, on: false); + + private static void Toggle(Workspace workspace, bool on) + { + // No need to do anything if we're already in the requested state + var state = workspace.Options.GetOption(InlineHintsOptions.DisplayAllOverride); + if (state == on) + return; + + workspace.TryApplyChanges( + workspace.CurrentSolution.WithOptions( + workspace.CurrentSolution.Options.WithChangedOption(InlineHintsOptions.DisplayAllOverride, on))); + } + } + } +} diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTagger.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTagger.cs index 459b812c09527..5f81e0453b812 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTagger.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTagger.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; +using System.Composition; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Classification; diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTaggerProvider.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTaggerProvider.cs index 10d949e3823b2..ce7da400203c3 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTaggerProvider.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTaggerProvider.cs @@ -18,6 +18,7 @@ namespace Microsoft.CodeAnalysis.Editor.InlineHints { + /// /// The provider that is used as a middleman to create the tagger so that the data tag /// can be used to create the UI tag @@ -37,12 +38,13 @@ internal class InlineParameterNameHintsTaggerProvider : IViewTaggerProvider [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public InlineParameterNameHintsTaggerProvider(IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, - IClassificationFormatMapService classificationFormatMapService, - IClassificationTypeRegistryService classificationTypeRegistryService, - IThreadingContext threadingContext, - IToolTipService toolTipService, - Lazy streamingFindUsagesPresenter) + public InlineParameterNameHintsTaggerProvider( + IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, + IClassificationFormatMapService classificationFormatMapService, + IClassificationTypeRegistryService classificationTypeRegistryService, + IThreadingContext threadingContext, + IToolTipService toolTipService, + Lazy streamingFindUsagesPresenter) { _viewTagAggregatorFactoryService = viewTagAggregatorFactoryService; this.ClassificationFormatMapService = classificationFormatMapService; diff --git a/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs b/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs index 3c666daa165a0..28f28656083d1 100644 --- a/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs +++ b/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; -using System.Collections.Immutable; using System.ComponentModel.Composition; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; @@ -13,7 +12,6 @@ using Microsoft.CodeAnalysis.Editor.Tagging; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.InlineHints; -using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.VisualStudio.Text; @@ -48,16 +46,13 @@ public InlineParameterNameHintsDataTaggerProvider( _listener = listenerProvider.GetListener(FeatureAttribute.InlineParameterNameHints); } - // This option controls whether or not we run at all. - protected override IEnumerable> PerLanguageOptions - => ImmutableArray.Create(InlineHintsOptions.EnabledForParameters); - protected override ITaggerEventSource CreateEventSource(ITextView textViewOpt, ITextBuffer subjectBuffer) { - // The options we check here just affect the set of results we return if we run. return TaggerEventSources.Compose( TaggerEventSources.OnViewSpanChanged(ThreadingContext, textViewOpt, textChangeDelay: TaggerDelay.Short, scrollChangeDelay: TaggerDelay.NearImmediate), TaggerEventSources.OnWorkspaceChanged(subjectBuffer, TaggerDelay.NearImmediate, _listener), + TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.DisplayAllOverride, TaggerDelay.NearImmediate), + TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.EnabledForParameters, TaggerDelay.NearImmediate), TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.ForLiteralParameters, TaggerDelay.NearImmediate), TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.ForObjectCreationParameters, TaggerDelay.NearImmediate), TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.ForOtherParameters, TaggerDelay.NearImmediate)); diff --git a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs index 337f4731bdf1b..f0646ee4825c3 100644 --- a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs @@ -22,13 +22,15 @@ public async Task> GetInlineParameterNameHin { var options = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); - var forParameters = options.GetOption(InlineHintsOptions.EnabledForParameters); + var displayAllOverride = options.GetOption(InlineHintsOptions.DisplayAllOverride); + + var forParameters = displayAllOverride || options.GetOption(InlineHintsOptions.EnabledForParameters); if (!forParameters) return ImmutableArray.Empty; - var literalParameters = options.GetOption(InlineHintsOptions.ForLiteralParameters); - var objectCreationParameters = options.GetOption(InlineHintsOptions.ForObjectCreationParameters); - var otherParameters = options.GetOption(InlineHintsOptions.ForOtherParameters); + var literalParameters = displayAllOverride || options.GetOption(InlineHintsOptions.ForLiteralParameters); + var objectCreationParameters = displayAllOverride || options.GetOption(InlineHintsOptions.ForObjectCreationParameters); + var otherParameters = displayAllOverride || options.GetOption(InlineHintsOptions.ForOtherParameters); if (!literalParameters && !objectCreationParameters && !otherParameters) return ImmutableArray.Empty; diff --git a/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs b/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs index cce97233319b1..95af3889fa944 100644 --- a/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs +++ b/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs @@ -15,6 +15,14 @@ namespace Microsoft.CodeAnalysis.InlineHints { internal static class InlineHintsOptions { + /// + /// Non-persisted option used to switch to displaying everything while the user is holding ctrl-alt. + /// + public static readonly Option2 DisplayAllOverride = + new(nameof(DisplayAllOverride), + nameof(EnabledForParameters), + defaultValue: false); + public static readonly PerLanguageOption2 EnabledForParameters = new(nameof(InlineHintsOptions), nameof(EnabledForParameters), diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs index 5799bd8fd7ae9..fea679a6ce539 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs @@ -32,7 +32,7 @@ public static string Option_use_64bit_analysis_process => ServicesVSResources.Use_64_bit_process_for_code_analysis_requires_restart; public static string Option_Inline_Hints_experimental - => ServicesVSResources.Inline_Hints_experimental; + => ServicesVSResources.Inline_Hints_experimental_Hold_ctrl_alt_to_show_all; public static string Option_Display_inline_parameter_name_hints => ServicesVSResources.Display_inline_parameter_name_hints; diff --git a/src/VisualStudio/Core/Def/ServicesVSResources.resx b/src/VisualStudio/Core/Def/ServicesVSResources.resx index 30a9c6464a4bf..c5337bf7721ff 100644 --- a/src/VisualStudio/Core/Def/ServicesVSResources.resx +++ b/src/VisualStudio/Core/Def/ServicesVSResources.resx @@ -1557,8 +1557,8 @@ I agree to all of the foregoing: Comments - - Inline Hints (experimental) + + Inline Hints (experimental): Hold ctrl-alt to show all Show hints for everything else diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf index b758f55e35498..21d8903b31a3b 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf @@ -272,9 +272,9 @@ Indexováno v úložišti - - Inline Hints (experimental) - Inline Hints (experimental) + + Inline Hints (experimental): Hold ctrl-alt to show all + Inline Hints (experimental): Hold ctrl-alt to show all diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf index 36e9a2245f243..998c6440afa64 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf @@ -272,9 +272,9 @@ In Repository indiziert - - Inline Hints (experimental) - Inline Hints (experimental) + + Inline Hints (experimental): Hold ctrl-alt to show all + Inline Hints (experimental): Hold ctrl-alt to show all diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf index 42ccccc4ddddf..f935a1e75045f 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf @@ -272,9 +272,9 @@ Indexado en el repositorio - - Inline Hints (experimental) - Inline Hints (experimental) + + Inline Hints (experimental): Hold ctrl-alt to show all + Inline Hints (experimental): Hold ctrl-alt to show all diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf index 4debe1a56b7d8..821554df64a36 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf @@ -272,9 +272,9 @@ Indexé dans le dépôt - - Inline Hints (experimental) - Inline Hints (experimental) + + Inline Hints (experimental): Hold ctrl-alt to show all + Inline Hints (experimental): Hold ctrl-alt to show all diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf index 77af5d3facece..049a195af3904 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf @@ -272,9 +272,9 @@ Indicizzata nel repository - - Inline Hints (experimental) - Inline Hints (experimental) + + Inline Hints (experimental): Hold ctrl-alt to show all + Inline Hints (experimental): Hold ctrl-alt to show all diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf index 793a2af34717e..2333a96ed8cf5 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf @@ -272,9 +272,9 @@ リポジトリ内でインデックス付け - - Inline Hints (experimental) - Inline Hints (experimental) + + Inline Hints (experimental): Hold ctrl-alt to show all + Inline Hints (experimental): Hold ctrl-alt to show all diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf index c25aa3c113757..df4e663412bf2 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf @@ -272,9 +272,9 @@ 리포지토리에서 인덱싱됨 - - Inline Hints (experimental) - Inline Hints (experimental) + + Inline Hints (experimental): Hold ctrl-alt to show all + Inline Hints (experimental): Hold ctrl-alt to show all diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf index f58fb1b99a580..784edc43b2053 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf @@ -272,9 +272,9 @@ Indeksowane w repozytorium - - Inline Hints (experimental) - Inline Hints (experimental) + + Inline Hints (experimental): Hold ctrl-alt to show all + Inline Hints (experimental): Hold ctrl-alt to show all diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf index fd9134f158a09..80c036b92c337 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf @@ -272,9 +272,9 @@ Indexado no repositório - - Inline Hints (experimental) - Inline Hints (experimental) + + Inline Hints (experimental): Hold ctrl-alt to show all + Inline Hints (experimental): Hold ctrl-alt to show all diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf index 640fbb205e3fe..6acb4eba4f4fa 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf @@ -272,9 +272,9 @@ Индексированный в репозитории - - Inline Hints (experimental) - Inline Hints (experimental) + + Inline Hints (experimental): Hold ctrl-alt to show all + Inline Hints (experimental): Hold ctrl-alt to show all diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf index 198314cfca7c3..dc715bb004c59 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf @@ -272,9 +272,9 @@ Depo içinde dizini oluşturulmuş - - Inline Hints (experimental) - Inline Hints (experimental) + + Inline Hints (experimental): Hold ctrl-alt to show all + Inline Hints (experimental): Hold ctrl-alt to show all diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf index b5a33d82ba5d4..72f78408ce8e4 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf @@ -272,9 +272,9 @@ 已在存储库中编入索引 - - Inline Hints (experimental) - Inline Hints (experimental) + + Inline Hints (experimental): Hold ctrl-alt to show all + Inline Hints (experimental): Hold ctrl-alt to show all diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf index 310befb1996fe..5dcdfcc554714 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf @@ -272,9 +272,9 @@ 已在存放庫中編制索引 - - Inline Hints (experimental) - Inline Hints (experimental) + + Inline Hints (experimental): Hold ctrl-alt to show all + Inline Hints (experimental): Hold ctrl-alt to show all diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb index 89d261bb32428..96f21f50d4471 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb @@ -34,7 +34,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options BasicVSResources.Show_procedure_line_separators Public ReadOnly Property Option_Inline_Hints_experimental As String = - ServicesVSResources.Inline_Hints_experimental + ServicesVSResources.Inline_Hints_experimental_Hold_ctrl_alt_to_show_all Public ReadOnly Property Option_Display_inline_parameter_name_hints As String = ServicesVSResources.Display_inline_parameter_name_hints From 8844a966cc5d8607b213de8f96104f2922271b65 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Wed, 7 Oct 2020 14:02:59 -0700 Subject: [PATCH 200/295] Add null vsix entries to publish data to unblock older builds --- eng/config/PublishData.json | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/eng/config/PublishData.json b/eng/config/PublishData.json index 0c27858652642..3b5d8f4ec84d1 100644 --- a/eng/config/PublishData.json +++ b/eng/config/PublishData.json @@ -116,6 +116,7 @@ "nugetKind": "PerBuildPreRelease", "version": "2.10.*", "nuget": [ "https://dotnet.myget.org/F/roslyn/api/v2/package" ], + "vsix": null, "channels": [ "dev15.9" ], "vsBranch": "rel/d15.9", "vsMajorVersion": 15 @@ -124,6 +125,7 @@ "nugetKind": ["Shipping", "NonShipping"], "version": "3.0.*", "nuget": [ "https://dotnet.myget.org/F/roslyn/api/v2/package" ], + "vsix": null, "channels": [ "dev16.0" ], "vsBranch": "rel/d16.0", "vsMajorVersion": 16 @@ -132,6 +134,7 @@ "nugetKind": ["Shipping", "NonShipping"], "version": "3.1.*", "nuget": [ "https://dotnet.myget.org/F/roslyn/api/v2/package" ], + "vsix": null, "channels": [ "dev16.1" ], "vsBranch": "rel/d16.1", "vsMajorVersion": 16 @@ -140,6 +143,7 @@ "nugetKind": ["Shipping", "NonShipping"], "version": "3.2.*", "nuget": [ "https://dotnet.myget.org/F/roslyn/api/v2/package" ], + "vsix": null, "channels": [ "dev16.2" ], "vsBranch": "rel/d16.2", "vsMajorVersion": 16 @@ -148,6 +152,7 @@ "nugetKind": ["Shipping", "NonShipping"], "version": "3.3.*", "nuget": [ "https://dotnet.myget.org/F/roslyn/api/v2/package" ], + "vsix": null, "channels": [ "dev16.3" ], "vsBranch": "rel/d16.3", "vsMajorVersion": 16 @@ -156,6 +161,7 @@ "nugetKind": ["Shipping"], "version": "3.4.*", "nuget": [ "https://dotnet.myget.org/F/roslyn/api/v2/package" ], + "vsix": null, "channels": [ "dev16.4" ], "vsBranch": "rel/d16.4", "vsMajorVersion": 16 @@ -164,6 +170,7 @@ "nugetKind": ["Shipping", "NonShipping"], "version": "3.5.*", "nuget": [ "https://dotnet.myget.org/F/roslyn/api/v2/package" ], + "vsix": null, "channels": [ "dev16.5", "dev16.5p4" ], "vsBranch": "rel/d16.5", "vsMajorVersion": 16 @@ -172,6 +179,7 @@ "nugetKind": ["Shipping", "NonShipping"], "version": "3.6.*", "nuget": [ "https://dotnet.myget.org/F/roslyn/api/v2/package" ], + "vsix": null, "channels": [ "dev16.6", "dev16.6p3" ], "vsBranch": "rel/d16.6", "vsMajorVersion": 16 @@ -180,6 +188,7 @@ "nugetKind": ["Shipping", "NonShipping"], "version": "3.7.*", "nuget": [ "https://dotnet.myget.org/F/roslyn/api/v2/package" ], + "vsix": null, "channels": [ "dev16.7", "dev16.7p4" ], "vsBranch": "rel/d16.7", "vsMajorVersion": 16 @@ -187,6 +196,7 @@ "release/dev16.8-vs-deps": { "nugetKind": [ "Shipping", "NonShipping" ], "version": "3.8.*", + "vsix": null, "packageFeeds": "default", "channels": [ "dev16.8p4" ], "vsBranch": "rel/d16.8", @@ -204,6 +214,7 @@ "nugetKind": "PerBuildPreRelease", "version": "2.6.*", "nuget": [ "https://dotnet.myget.org/F/roslyn-nonnull/api/v2/package" ], + "vsix": null, "channels": [ "nonnull" ], "vsBranch": "lab/d16.1stg", "vsMajorVersion": 16 @@ -212,6 +223,7 @@ "nugetKind": "PerBuildPreRelease", "version": "2.8.*", "nuget": [ "https://dotnet.myget.org/F/roslyn/api/v2/package" ], + "vsix": null, "channels": [ "dataflow" ], "vsBranch": "lab/d16.1stg", "vsMajorVersion": 16 @@ -220,6 +232,7 @@ "nugetKind": [ "Shipping", "NonShipping" ], "version": "3.1.*", "nuget": [ "https://dotnet.myget.org/F/roslyn/api/v2/package" ], + "vsix": null, "channels": [ "razorSupport2" ], "vsBranch": "lab/d16.1stg", "vsMajorVersion": 16 @@ -228,6 +241,7 @@ "nugetKind": [ "Shipping", "NonShipping" ], "version": "3.4.*", "nuget": [ "https://dotnet.myget.org/F/roslyn/api/v2/package" ], + "vsix": null, "channels": [ "compilerNext" ], "vsBranch": "main", "vsMajorVersion": 16 @@ -237,6 +251,7 @@ "version": "3.8.*", "packageFeeds": "arcade", "channels": [ "UsedAssemblyReferences" ], + "vsix": null, "vsBranch": "main", "vsMajorVersion": 16 }, @@ -244,6 +259,7 @@ "nugetKind": [ "Shipping", "NonShipping" ], "version": "3.3.*", "nuget": [ "https://dotnet.myget.org/F/roslyn/api/v2/package" ], + "vsix": null, "channels": [ "unitTesting" ], "vsBranch": "rel/d16.5", "vsMajorVersion": 16 From d9f64653ee7a5ff27f975ce832d18610f1688f55 Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Wed, 7 Oct 2020 14:36:51 -0700 Subject: [PATCH 201/295] Work around https://github.com/dotnet/sdk/issues/13427 --- eng/targets/Imports.targets | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/eng/targets/Imports.targets b/eng/targets/Imports.targets index f1d6ee86ea9cb..d91c8cdc39726 100644 --- a/eng/targets/Imports.targets +++ b/eng/targets/Imports.targets @@ -404,4 +404,10 @@ + + + <_MicrosoftWindowsDesktopSdkImported>false + + From 8f220bd41df8813dbd77be6462fe33883f86148c Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 7 Oct 2020 14:46:36 -0700 Subject: [PATCH 202/295] Renames --- ...tion.cs => InlineHintsFormatDefinition.cs} | 12 +-- ...meterNameHintsTag.cs => InlineHintsTag.cs} | 90 ++++++++++--------- ...ameHintsTagger.cs => InlineHintsTagger.cs} | 26 +++--- ...ovider.cs => InlineHintsTaggerProvider.cs} | 10 +-- .../Core/EditorFeaturesResources.resx | 4 +- ...ameHintDataTag.cs => InlineHintDataTag.cs} | 18 ++-- ...er.cs => InlineHintsDataTaggerProvider.cs} | 18 ++-- .../Core/xlf/EditorFeaturesResources.cs.xlf | 6 +- .../Core/xlf/EditorFeaturesResources.de.xlf | 6 +- .../Core/xlf/EditorFeaturesResources.es.xlf | 6 +- .../Core/xlf/EditorFeaturesResources.fr.xlf | 6 +- .../Core/xlf/EditorFeaturesResources.it.xlf | 6 +- .../Core/xlf/EditorFeaturesResources.ja.xlf | 6 +- .../Core/xlf/EditorFeaturesResources.ko.xlf | 6 +- .../Core/xlf/EditorFeaturesResources.pl.xlf | 6 +- .../xlf/EditorFeaturesResources.pt-BR.xlf | 6 +- .../Core/xlf/EditorFeaturesResources.ru.xlf | 6 +- .../Core/xlf/EditorFeaturesResources.tr.xlf | 6 +- .../xlf/EditorFeaturesResources.zh-Hans.xlf | 6 +- .../xlf/EditorFeaturesResources.zh-Hant.xlf | 6 +- .../InlineHints/InlineHintsOptions.cs | 18 ++++ 21 files changed, 151 insertions(+), 123 deletions(-) rename src/EditorFeatures/Core.Wpf/InlineHints/{InlineParameterNameHintsFormatDefinition.cs => InlineHintsFormatDefinition.cs} (77%) rename src/EditorFeatures/Core.Wpf/InlineHints/{InlineParameterNameHintsTag.cs => InlineHintsTag.cs} (70%) rename src/EditorFeatures/Core.Wpf/InlineHints/{InlineParameterNameHintsTagger.cs => InlineHintsTagger.cs} (83%) rename src/EditorFeatures/Core.Wpf/InlineHints/{InlineParameterNameHintsTaggerProvider.cs => InlineHintsTaggerProvider.cs} (88%) rename src/EditorFeatures/Core/InlineHints/{InlineParameterNameHintDataTag.cs => InlineHintDataTag.cs} (55%) rename src/EditorFeatures/Core/InlineHints/{InlineParameterNameHintsDataTaggerProvider.cs => InlineHintsDataTaggerProvider.cs} (88%) diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsFormatDefinition.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsFormatDefinition.cs similarity index 77% rename from src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsFormatDefinition.cs rename to src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsFormatDefinition.cs index 19c70996bb9fd..de151b1710d38 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsFormatDefinition.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsFormatDefinition.cs @@ -17,21 +17,21 @@ namespace Microsoft.CodeAnalysis.Editor.InlineHints internal sealed class ClassificationTypeDefinitions { [Export] - [Name(InlineParameterNameHintsTag.TagId)] + [Name(InlineHintsTag.TagId)] [BaseDefinition(PredefinedClassificationTypeNames.FormalLanguage)] - internal ClassificationTypeDefinition InlineParameterNameHints; + internal ClassificationTypeDefinition InlineHints; [Export(typeof(EditorFormatDefinition))] - [Name(InlineParameterNameHintsTag.TagId)] + [Name(InlineHintsTag.TagId)] [Order(After = LanguagePriority.NaturalLanguage, Before = LanguagePriority.FormalLanguage)] [UserVisible(true)] - internal sealed class InlineParameterNameHintsFormatDefinition : EditorFormatDefinition + internal sealed class InlineHintsFormatDefinition : EditorFormatDefinition { [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public InlineParameterNameHintsFormatDefinition() + public InlineHintsFormatDefinition() { - this.DisplayName = EditorFeaturesResources.Inline_Parameter_Name_Hints; + this.DisplayName = EditorFeaturesResources.Inline_Hints; this.ForegroundBrush = Brushes.Black; this.BackgroundBrush = Brushes.LightGray; } diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTag.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs similarity index 70% rename from src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTag.cs rename to src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs index b2ae66d9e45f7..8ad76c2ffe69b 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTag.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs @@ -29,22 +29,23 @@ namespace Microsoft.CodeAnalysis.Editor.InlineHints /// This is the tag which implements the IntraTextAdornmentTag and is meant to create the UIElements that get shown /// in the editor /// - internal class InlineParameterNameHintsTag : IntraTextAdornmentTag + internal class InlineHintsTag : IntraTextAdornmentTag { - public const string TagId = "inline parameter name hints"; + public const string TagId = "inline hints"; + private readonly IToolTipService _toolTipService; private readonly ITextView _textView; private readonly SnapshotSpan _span; - private readonly SymbolKey _key; + private readonly SymbolKey? _key; private readonly IThreadingContext _threadingContext; private readonly Lazy _streamingPresenter; - private InlineParameterNameHintsTag( + private InlineHintsTag( FrameworkElement adornment, ITextView textView, SnapshotSpan span, - SymbolKey key, - InlineParameterNameHintsTaggerProvider taggerProvider) + SymbolKey? key, + InlineHintsTaggerProvider taggerProvider) : base(adornment, removalCallback: null, PositionAffinity.Predecessor) { _textView = textView; @@ -68,57 +69,64 @@ private InlineParameterNameHintsTag( /// The view of the editor /// The span that has the location of the hint /// The symbolkey associated with each parameter - public static InlineParameterNameHintsTag Create(string text, TextFormattingRunProperties format, - IWpfTextView textView, SnapshotSpan span, SymbolKey key, - InlineParameterNameHintsTaggerProvider taggerProvider) + public static InlineHintsTag Create( + string text, + TextFormattingRunProperties format, + IWpfTextView textView, + SnapshotSpan span, + SymbolKey? key, + InlineHintsTaggerProvider taggerProvider) { - return new InlineParameterNameHintsTag(CreateElement(text, textView, format), textView, - span, key, taggerProvider); + return new InlineHintsTag(CreateElement(text, textView, format), textView, span, key, taggerProvider); } public async Task> CreateDescriptionAsync(CancellationToken cancellationToken) { - var document = _textView.TextBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges(); - var textContentBuilder = new List(); - - if (document != null) + if (_key != null) { - var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false); - var symbol = _key.Resolve(compilation, cancellationToken: cancellationToken).Symbol; + var document = _span.Snapshot.TextBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges(); - if (symbol != null) + if (document != null) { - var workspace = document.Project.Solution.Workspace; - var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); - var symbolDisplayService = document.Project.LanguageServices.GetRequiredService(); - var formatter = document.Project.LanguageServices.GetService(); - var sections = await symbolDisplayService.ToDescriptionGroupsAsync(workspace, semanticModel, _span.Start, ImmutableArray.Create(symbol), cancellationToken).ConfigureAwait(false); - textContentBuilder.AddRange(sections[SymbolDescriptionGroups.MainDescription]); - if (formatter != null) - { - var documentation = symbol.GetDocumentationParts(semanticModel, _span.Start, formatter, cancellationToken); + var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false); + var symbol = _key.Value.Resolve(compilation, cancellationToken: cancellationToken).Symbol; - if (documentation.Any()) + if (symbol != null) + { + var textContentBuilder = new List(); + + var workspace = document.Project.Solution.Workspace; + var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); + var symbolDisplayService = document.GetRequiredLanguageService(); + var formatter = document.GetRequiredLanguageService(); + var sections = await symbolDisplayService.ToDescriptionGroupsAsync(workspace, semanticModel, _span.Start, ImmutableArray.Create(symbol), cancellationToken).ConfigureAwait(false); + textContentBuilder.AddRange(sections[SymbolDescriptionGroups.MainDescription]); + if (formatter != null) { - textContentBuilder.AddLineBreak(); - textContentBuilder.AddRange(documentation); + var documentation = symbol.GetDocumentationParts(semanticModel, _span.Start, formatter, cancellationToken); + + if (documentation.Any()) + { + textContentBuilder.AddLineBreak(); + textContentBuilder.AddRange(documentation); + } } - } - if (sections.TryGetValue(SymbolDescriptionGroups.AnonymousTypes, out var parts)) - { - if (!parts.IsDefaultOrEmpty) + if (sections.TryGetValue(SymbolDescriptionGroups.AnonymousTypes, out var parts)) { - textContentBuilder.AddLineBreak(); - textContentBuilder.AddLineBreak(); - textContentBuilder.AddRange(parts); + if (!parts.IsDefaultOrEmpty) + { + textContentBuilder.AddLineBreak(); + textContentBuilder.AddLineBreak(); + textContentBuilder.AddRange(parts); + } } + + var uiCollection = Implementation.IntelliSense.Helpers.BuildInteractiveTextElements(textContentBuilder.ToImmutableArray(), + document, _threadingContext, _streamingPresenter); + return uiCollection; } } - - var uiCollection = Implementation.IntelliSense.Helpers.BuildInteractiveTextElements(textContentBuilder.ToImmutableArray(), - document, _threadingContext, _streamingPresenter); - return uiCollection; } return Array.Empty(); diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTagger.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTagger.cs similarity index 83% rename from src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTagger.cs rename to src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTagger.cs index 5f81e0453b812..6d21bc756a864 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTagger.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTagger.cs @@ -15,13 +15,13 @@ namespace Microsoft.CodeAnalysis.Editor.InlineHints { /// - /// The purpose of this tagger is to convert the to - /// the , which actually creates the UIElement. It reacts to - /// tags changing and updates the adornments accordingly. + /// The purpose of this tagger is to convert the to the , which actually creates the UIElement. It reacts to tags changing and updates the + /// adornments accordingly. /// - internal sealed class InlineParameterNameHintsTagger : ITagger, IDisposable + internal sealed class InlineHintsTagger : ITagger, IDisposable { - private readonly ITagAggregator _tagAggregator; + private readonly ITagAggregator _tagAggregator; /// /// stores the parameter hint tags in a global location @@ -42,26 +42,30 @@ internal sealed class InlineParameterNameHintsTagger : ITagger? TagsChanged; - public InlineParameterNameHintsTagger(InlineParameterNameHintsTaggerProvider taggerProvider, IWpfTextView textView, ITextBuffer buffer, ITagAggregator tagAggregator) + public InlineHintsTagger( + InlineHintsTaggerProvider taggerProvider, + IWpfTextView textView, + ITextBuffer buffer, + ITagAggregator tagAggregator) { _cache = new List>(); _threadAffinitizedObject = new ForegroundThreadAffinitizedObject(taggerProvider.ThreadingContext); - _inlineParameterNameHintsTaggerProvider = taggerProvider; + _taggerProvider = taggerProvider; _textView = textView; _buffer = buffer; _tagAggregator = tagAggregator; _formatMap = taggerProvider.ClassificationFormatMapService.GetClassificationFormatMap(textView); - _hintClassification = taggerProvider.ClassificationTypeRegistryService.GetClassificationType(InlineParameterNameHintsTag.TagId); + _hintClassification = taggerProvider.ClassificationTypeRegistryService.GetClassificationType(InlineHintsTag.TagId); _formatMap.ClassificationFormatMappingChanged += this.OnClassificationFormatMappingChanged; _tagAggregator.TagsChanged += OnTagAggregatorTagsChanged; } @@ -125,8 +129,8 @@ public IEnumerable> GetTags(NormalizedSnapshotSp { var dataTagSpan = dataTagSpans[0]; var parameterHintSnapshotSpan = new SnapshotSpan(dataTagSpan.Start, 0); - var parameterHintUITag = InlineParameterNameHintsTag.Create(textTag.ParameterName, - Format, _textView, dataTagSpan, textTag.ParameterSymbolKey, _inlineParameterNameHintsTaggerProvider); + var parameterHintUITag = InlineHintsTag.Create( + textTag.Text, Format, _textView, dataTagSpan, textTag.SymbolKey, _taggerProvider); _cache.Add(new TagSpan(parameterHintSnapshotSpan, parameterHintUITag)); } diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTaggerProvider.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTaggerProvider.cs similarity index 88% rename from src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTaggerProvider.cs rename to src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTaggerProvider.cs index daefcb67ffbc5..ece2016751fa0 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTaggerProvider.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTaggerProvider.cs @@ -24,8 +24,8 @@ namespace Microsoft.CodeAnalysis.Editor.InlineHints [Export(typeof(IViewTaggerProvider))] [ContentType(ContentTypeNames.RoslynContentType)] [TagType(typeof(IntraTextAdornmentTag))] - [Name(nameof(InlineParameterNameHintsTaggerProvider))] - internal class InlineParameterNameHintsTaggerProvider : IViewTaggerProvider + [Name(nameof(InlineHintsTaggerProvider))] + internal class InlineHintsTaggerProvider : IViewTaggerProvider { private readonly IViewTagAggregatorFactoryService _viewTagAggregatorFactoryService; public readonly IClassificationFormatMapService ClassificationFormatMapService; @@ -36,7 +36,7 @@ internal class InlineParameterNameHintsTaggerProvider : IViewTaggerProvider [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public InlineParameterNameHintsTaggerProvider( + public InlineHintsTaggerProvider( IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, IClassificationFormatMapService classificationFormatMapService, IClassificationTypeRegistryService classificationTypeRegistryService, @@ -61,8 +61,8 @@ public InlineParameterNameHintsTaggerProvider( return null; } - var tagAggregator = _viewTagAggregatorFactoryService.CreateTagAggregator(textView); - return new InlineParameterNameHintsTagger(this, (IWpfTextView)textView, buffer, tagAggregator) as ITagger; + var tagAggregator = _viewTagAggregatorFactoryService.CreateTagAggregator(textView); + return new InlineHintsTagger(this, (IWpfTextView)textView, buffer, tagAggregator) as ITagger; } } } diff --git a/src/EditorFeatures/Core/EditorFeaturesResources.resx b/src/EditorFeatures/Core/EditorFeaturesResources.resx index e12d425a5a077..b3acd7a18475e 100644 --- a/src/EditorFeatures/Core/EditorFeaturesResources.resx +++ b/src/EditorFeatures/Core/EditorFeaturesResources.resx @@ -936,8 +936,8 @@ Do you want to proceed? (external) - - Inline Parameter Name Hints + + Inline Hints Error creating instance of CodeFixProvider '{0}' diff --git a/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintDataTag.cs b/src/EditorFeatures/Core/InlineHints/InlineHintDataTag.cs similarity index 55% rename from src/EditorFeatures/Core/InlineHints/InlineParameterNameHintDataTag.cs rename to src/EditorFeatures/Core/InlineHints/InlineHintDataTag.cs index 226b065bc3ec1..a87110780723c 100644 --- a/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintDataTag.cs +++ b/src/EditorFeatures/Core/InlineHints/InlineHintDataTag.cs @@ -11,20 +11,18 @@ namespace Microsoft.CodeAnalysis.Editor.InlineHints /// The simple tag that only holds information regarding the associated parameter name /// for the argument /// - internal class InlineParameterNameHintDataTag : ITag + internal class InlineHintDataTag : ITag { - public readonly SymbolKey ParameterSymbolKey; - public readonly string ParameterName; + public readonly string Text; + public readonly SymbolKey? SymbolKey; - public InlineParameterNameHintDataTag(SymbolKey parameterSymbolKey, string parameterName) + public InlineHintDataTag(string text, SymbolKey? symbolKey) { - if (parameterName.Length == 0) - { - throw new ArgumentException("Must have a length greater than 0", nameof(parameterName)); - } + if (text.Length == 0) + throw new ArgumentException("Must have a length greater than 0", nameof(text)); - ParameterSymbolKey = parameterSymbolKey; - ParameterName = parameterName; + Text = text; + SymbolKey = symbolKey; } } } diff --git a/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs b/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs similarity index 88% rename from src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs rename to src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs index 89ae80bb39706..13939b143738b 100644 --- a/src/EditorFeatures/Core/InlineHints/InlineParameterNameHintsDataTaggerProvider.cs +++ b/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs @@ -27,9 +27,9 @@ namespace Microsoft.CodeAnalysis.Editor.InlineHints /// [Export(typeof(IViewTaggerProvider))] [ContentType(ContentTypeNames.RoslynContentType)] - [TagType(typeof(InlineParameterNameHintDataTag))] - [Name(nameof(InlineParameterNameHintsDataTaggerProvider))] - internal class InlineParameterNameHintsDataTaggerProvider : AsynchronousViewTaggerProvider + [TagType(typeof(InlineHintDataTag))] + [Name(nameof(InlineHintsDataTaggerProvider))] + internal class InlineHintsDataTaggerProvider : AsynchronousViewTaggerProvider { private readonly IAsynchronousOperationListener _listener; @@ -37,7 +37,7 @@ internal class InlineParameterNameHintsDataTaggerProvider : AsynchronousViewTagg [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] [ImportingConstructor] - public InlineParameterNameHintsDataTaggerProvider( + public InlineHintsDataTaggerProvider( IThreadingContext threadingContext, IAsynchronousOperationListenerProvider listenerProvider, IForegroundNotificationService notificationService) @@ -76,7 +76,7 @@ protected override IEnumerable GetSpansToTag(ITextView textView, I return SpecializedCollections.SingletonEnumerable(visibleSpanOpt.Value); } - protected override async Task ProduceTagsAsync(TaggerContext context, DocumentSnapshotSpan documentSnapshotSpan, int? caretPosition) + protected override async Task ProduceTagsAsync(TaggerContext context, DocumentSnapshotSpan documentSnapshotSpan, int? caretPosition) { var cancellationToken = context.CancellationToken; var document = documentSnapshotSpan.Document; @@ -91,11 +91,11 @@ protected override async Task ProduceTagsAsync(TaggerContext( + context.AddTag(new TagSpan( new SnapshotSpan(snapshotSpan.Snapshot, parameterHint.Position, 0), - new InlineParameterNameHintDataTag( - parameterHint.Parameter.GetSymbolKey(cancellationToken), - parameterHint.Parameter.Name))); + new InlineHintDataTag( + parameterHint.Parameter.Name, + parameterHint.Parameter.GetSymbolKey(cancellationToken)))); } } } diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.cs.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.cs.xlf index eb3bdc9abc207..612c4de0091b1 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.cs.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.cs.xlf @@ -77,9 +77,9 @@ Přejít na základní typ - - Inline Parameter Name Hints - Nápovědy k názvům vložených parametrů + + Inline Hints + Inline Hints diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.de.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.de.xlf index 39fbb426d8974..8996d95829ab2 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.de.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.de.xlf @@ -77,9 +77,9 @@ Zu Basis wechseln - - Inline Parameter Name Hints - Inline Parameter Name Hints + + Inline Hints + Inline Hints diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.es.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.es.xlf index 072ed41b36a20..7a7eb082c9983 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.es.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.es.xlf @@ -77,9 +77,9 @@ Ir a base - - Inline Parameter Name Hints - Inline Parameter Name Hints + + Inline Hints + Inline Hints diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.fr.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.fr.xlf index b147a5775ea10..40946fff72a4c 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.fr.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.fr.xlf @@ -77,9 +77,9 @@ Accéder à la base - - Inline Parameter Name Hints - Inline Parameter Name Hints + + Inline Hints + Inline Hints diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.it.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.it.xlf index 2e1a7d77a8627..31703fea76a2e 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.it.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.it.xlf @@ -77,9 +77,9 @@ Vai a base - - Inline Parameter Name Hints - Inline Parameter Name Hints + + Inline Hints + Inline Hints diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ja.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ja.xlf index 83e3bb54f5c4f..f3accbbda67bf 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ja.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ja.xlf @@ -77,9 +77,9 @@ 基本へ移動 - - Inline Parameter Name Hints - Inline Parameter Name Hints + + Inline Hints + Inline Hints diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ko.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ko.xlf index f78de6ca7e666..31c59ead8db6d 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ko.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ko.xlf @@ -77,9 +77,9 @@ 기본으로 이동 - - Inline Parameter Name Hints - Inline Parameter Name Hints + + Inline Hints + Inline Hints diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pl.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pl.xlf index 47295051a5027..ee5d157df8658 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pl.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pl.xlf @@ -77,9 +77,9 @@ Przejdź do podstawy - - Inline Parameter Name Hints - Inline Parameter Name Hints + + Inline Hints + Inline Hints diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pt-BR.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pt-BR.xlf index cd4558d54ece8..0cae43970e1be 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pt-BR.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.pt-BR.xlf @@ -77,9 +77,9 @@ Ir Para a Base - - Inline Parameter Name Hints - Inline Parameter Name Hints + + Inline Hints + Inline Hints diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ru.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ru.xlf index 682b877a4ea2d..d0b0819d0a7d4 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ru.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.ru.xlf @@ -77,9 +77,9 @@ Перейти к базовому - - Inline Parameter Name Hints - Inline Parameter Name Hints + + Inline Hints + Inline Hints diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.tr.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.tr.xlf index 7be0cb4db4642..102ec5ee07d7b 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.tr.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.tr.xlf @@ -77,9 +77,9 @@ Tabana Git - - Inline Parameter Name Hints - Inline Parameter Name Hints + + Inline Hints + Inline Hints diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hans.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hans.xlf index a5037ff8d868f..cc9df3e209b03 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hans.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hans.xlf @@ -77,9 +77,9 @@ 转到基础映像 - - Inline Parameter Name Hints - 内联参数名提示 + + Inline Hints + Inline Hints diff --git a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hant.xlf b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hant.xlf index c377644d5a8fb..533e0d1b4f736 100644 --- a/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hant.xlf +++ b/src/EditorFeatures/Core/xlf/EditorFeaturesResources.zh-Hant.xlf @@ -77,9 +77,9 @@ 移至基底 - - Inline Parameter Name Hints - Inline Parameter Name Hints + + Inline Hints + Inline Hints diff --git a/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs b/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs index f5c50545b75ca..73e405ba19315 100644 --- a/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs +++ b/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs @@ -56,6 +56,24 @@ internal static class InlineHintsOptions nameof(SuppressForParametersThatMatchMethodIntent), defaultValue: true, storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.InlineParameterNameHints.SuppressForParametersThatMatchMethodIntent")); + + public static readonly PerLanguageOption2 EnabledForTypes = + new(nameof(InlineHintsOptions), + nameof(EnabledForTypes), + defaultValue: false, + storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.InlineTypeHints")); + + public static readonly PerLanguageOption2 ForImplicitVariableTypes = + new(nameof(InlineHintsOptions), + nameof(ForImplicitVariableTypes), + defaultValue: true, + storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.InlineTypeHints.ForImplicitVariableTypes")); + + public static readonly PerLanguageOption2 ForLambdaParameterTypes = + new(nameof(InlineHintsOptions), + nameof(ForLambdaParameterTypes), + defaultValue: true, + storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.InlineTypeHints.ForLambdaParameterTypes")); } [ExportOptionProvider, Shared] From 14bb7beecc383609b98d673fe6c5e353d5f7faf6 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 7 Oct 2020 16:28:26 -0700 Subject: [PATCH 203/295] Hints for types --- .../InlineHintsDataTaggerProvider.cs | 60 +++++++++++++---- .../CSharpInlineTypeHintsService.cs | 66 +++++++++++++++++++ ...AbstractInlineParameterNameHintsService.cs | 2 +- .../AbstractInlineTypeHintsService.cs | 35 ++++++++++ .../IInlineParameterNameHintsService.cs | 2 - .../InlineHints/IInlineTypeHintsService.cs | 17 +++++ .../Portable/InlineHints/InlineTypeHint.cs | 20 ++++++ 7 files changed, 185 insertions(+), 17 deletions(-) create mode 100644 src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs create mode 100644 src/Features/Core/Portable/InlineHints/AbstractInlineTypeHintsService.cs create mode 100644 src/Features/Core/Portable/InlineHints/IInlineTypeHintsService.cs create mode 100644 src/Features/Core/Portable/InlineHints/InlineTypeHint.cs diff --git a/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs b/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs index 13939b143738b..19ddbd216aaa3 100644 --- a/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs +++ b/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.ComponentModel.Composition; +using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; using Microsoft.CodeAnalysis.Editor.Shared.Tagging; @@ -31,6 +32,10 @@ namespace Microsoft.CodeAnalysis.Editor.InlineHints [Name(nameof(InlineHintsDataTaggerProvider))] internal class InlineHintsDataTaggerProvider : AsynchronousViewTaggerProvider { + private static SymbolDisplayFormat s_minimalTypeStyle = new SymbolDisplayFormat( + genericsOptions: SymbolDisplayGenericsOptions.IncludeTypeParameters, + miscellaneousOptions: SymbolDisplayMiscellaneousOptions.AllowDefaultLiteral | SymbolDisplayMiscellaneousOptions.IncludeNullableReferenceTypeModifier | SymbolDisplayMiscellaneousOptions.UseSpecialTypes); + private readonly IAsynchronousOperationListener _listener; protected override SpanTrackingMode SpanTrackingMode => SpanTrackingMode.EdgeInclusive; @@ -79,24 +84,51 @@ protected override IEnumerable GetSpansToTag(ITextView textView, I protected override async Task ProduceTagsAsync(TaggerContext context, DocumentSnapshotSpan documentSnapshotSpan, int? caretPosition) { var cancellationToken = context.CancellationToken; + await AddTypeHintsAsync(context, documentSnapshotSpan, cancellationToken).ConfigureAwait(false); + await AddParameterNameHintsAsync(context, documentSnapshotSpan, cancellationToken).ConfigureAwait(false); + } + + private async Task AddTypeHintsAsync(TaggerContext context, DocumentSnapshotSpan documentSnapshotSpan, CancellationToken cancellationToken) + { + var document = documentSnapshotSpan.Document; + var service = document.GetLanguageService(); + if (service == null) + return; + + var snapshotSpan = documentSnapshotSpan.SnapshotSpan; + var hints = await service.GetInlineTypeHintsAsync(document, snapshotSpan.Span.ToTextSpan(), cancellationToken).ConfigureAwait(false); + foreach (var hint in hints) + { + Contract.ThrowIfNull(hint.Type); + + cancellationToken.ThrowIfCancellationRequested(); + context.AddTag(new TagSpan( + new SnapshotSpan(snapshotSpan.Snapshot, hint.Position, 0), + new InlineHintDataTag( + hint.Type.ToDisplayString(s_minimalTypeStyle), + hint.Type.GetSymbolKey(cancellationToken)))); + } + } + + private static async Task AddParameterNameHintsAsync(TaggerContext context, DocumentSnapshotSpan documentSnapshotSpan, CancellationToken cancellationToken) + { var document = documentSnapshotSpan.Document; + var service = document.GetLanguageService(); + if (service == null) + return; var snapshotSpan = documentSnapshotSpan.SnapshotSpan; - var paramNameHintsService = document.GetLanguageService(); - if (paramNameHintsService != null) + var hints = await service.GetInlineParameterNameHintsAsync(document, snapshotSpan.Span.ToTextSpan(), cancellationToken).ConfigureAwait(false); + foreach (var hint in hints) { - var parameterHints = await paramNameHintsService.GetInlineParameterNameHintsAsync(document, snapshotSpan.Span.ToTextSpan(), cancellationToken).ConfigureAwait(false); - foreach (var parameterHint in parameterHints) - { - Contract.ThrowIfNull(parameterHint.Parameter); - - cancellationToken.ThrowIfCancellationRequested(); - context.AddTag(new TagSpan( - new SnapshotSpan(snapshotSpan.Snapshot, parameterHint.Position, 0), - new InlineHintDataTag( - parameterHint.Parameter.Name, - parameterHint.Parameter.GetSymbolKey(cancellationToken)))); - } + Contract.ThrowIfNull(hint.Parameter); + + cancellationToken.ThrowIfCancellationRequested(); + context.AddTag(new TagSpan( + new SnapshotSpan(snapshotSpan.Snapshot, hint.Position, 0), + new InlineHintDataTag( + hint.Parameter.Name, + hint.Parameter.GetSymbolKey(cancellationToken)))); } } } diff --git a/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs b/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs new file mode 100644 index 0000000000000..d3bf1482f7c3d --- /dev/null +++ b/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs @@ -0,0 +1,66 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Composition; +using System.Diagnostics.CodeAnalysis; +using System.Threading; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.InlineHints; + +namespace Microsoft.CodeAnalysis.CSharp.InlineHints +{ + [ExportLanguageService(typeof(IInlineTypeHintsService), LanguageNames.CSharp), Shared] + internal class CSharpInlineTypeHintsService : AbstractInlineTypeHintsService + { + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public CSharpInlineTypeHintsService() + { + } + + protected override InlineTypeHint? TryGetTypeHint( + SemanticModel semanticModel, + SyntaxNode node, + CancellationToken cancellationToken) + { + if (node is VariableDeclarationSyntax variableDeclaration && + variableDeclaration.Type.IsVar && + variableDeclaration.Variables.Count == 1 && + !variableDeclaration.Variables[0].Identifier.IsMissing) + { + var type = semanticModel.GetTypeInfo(variableDeclaration.Type, cancellationToken).Type; + if (IsValidType(type)) + return new InlineTypeHint(type, variableDeclaration.Variables[0].Identifier.SpanStart); + } + else if (node is SingleVariableDesignationSyntax variableDesignation) + { + var local = semanticModel.GetDeclaredSymbol(variableDesignation, cancellationToken) as ILocalSymbol; + var type = local?.Type; + if (IsValidType(type)) + return new InlineTypeHint(type, variableDesignation.Identifier.SpanStart); + } + else if (node is SimpleLambdaExpressionSyntax simpleLambda) + { + var parameter = semanticModel.GetDeclaredSymbol(simpleLambda.Parameter, cancellationToken); + if (IsValidType(parameter?.Type)) + return new InlineTypeHint(parameter.Type, simpleLambda.Parameter.Identifier.SpanStart); + } + else if (node is ParameterSyntax { Type: null } parameterNode) + { + var parameter = semanticModel.GetDeclaredSymbol(parameterNode, cancellationToken); + if (IsValidType(parameter?.Type)) + return new InlineTypeHint(parameter.Type, parameterNode.Identifier.SpanStart); + } + + return null; + } + + private static bool IsValidType([NotNullWhen(true)] ITypeSymbol? type) + { + return type is not null or IErrorTypeSymbol && type.Name != "var"; + } + } +} diff --git a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs index 8ef54685b4383..7537918a01607 100644 --- a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs @@ -46,7 +46,7 @@ public async Task> GetInlineParameterNameHin using var _1 = ArrayBuilder.GetInstance(out var result); using var _2 = ArrayBuilder.GetInstance(out var buffer); - foreach (var node in root.DescendantNodes(textSpan)) + foreach (var node in root.DescendantNodes(textSpan, n => n.Span.IntersectsWith(textSpan))) { cancellationToken.ThrowIfCancellationRequested(); AddAllParameterNameHintLocations(semanticModel, node, buffer, cancellationToken); diff --git a/src/Features/Core/Portable/InlineHints/AbstractInlineTypeHintsService.cs b/src/Features/Core/Portable/InlineHints/AbstractInlineTypeHintsService.cs new file mode 100644 index 0000000000000..48aa2048c4996 --- /dev/null +++ b/src/Features/Core/Portable/InlineHints/AbstractInlineTypeHintsService.cs @@ -0,0 +1,35 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Immutable; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.PooledObjects; +using Microsoft.CodeAnalysis.Shared.Extensions; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.InlineHints +{ + internal abstract class AbstractInlineTypeHintsService : IInlineTypeHintsService + { + protected abstract InlineTypeHint? TryGetTypeHint(SemanticModel semanticModel, SyntaxNode node, CancellationToken cancellationToken); + + public async Task> GetInlineTypeHintsAsync( + Document document, TextSpan textSpan, CancellationToken cancellationToken) + { + var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); + var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); + + using var _ = ArrayBuilder.GetInstance(out var result); + + foreach (var node in root.DescendantNodes(n => n.Span.IntersectsWith(textSpan))) + { + result.AddIfNotNull(TryGetTypeHint(semanticModel, node, cancellationToken)); + } + + return result.ToImmutable(); + } + } +} diff --git a/src/Features/Core/Portable/InlineHints/IInlineParameterNameHintsService.cs b/src/Features/Core/Portable/InlineHints/IInlineParameterNameHintsService.cs index e149e2488e59e..58083b276ef4d 100644 --- a/src/Features/Core/Portable/InlineHints/IInlineParameterNameHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/IInlineParameterNameHintsService.cs @@ -2,12 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Collections.Generic; using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.InlineHints diff --git a/src/Features/Core/Portable/InlineHints/IInlineTypeHintsService.cs b/src/Features/Core/Portable/InlineHints/IInlineTypeHintsService.cs new file mode 100644 index 0000000000000..cf43cc1956d60 --- /dev/null +++ b/src/Features/Core/Portable/InlineHints/IInlineTypeHintsService.cs @@ -0,0 +1,17 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Immutable; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Host; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.InlineHints +{ + internal interface IInlineTypeHintsService : ILanguageService + { + Task> GetInlineTypeHintsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken); + } +} diff --git a/src/Features/Core/Portable/InlineHints/InlineTypeHint.cs b/src/Features/Core/Portable/InlineHints/InlineTypeHint.cs new file mode 100644 index 0000000000000..689b1aec40864 --- /dev/null +++ b/src/Features/Core/Portable/InlineHints/InlineTypeHint.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Microsoft.CodeAnalysis.InlineHints +{ + internal readonly struct InlineTypeHint + { + public readonly ITypeSymbol Type; + public readonly int Position; + + public InlineTypeHint( + ITypeSymbol type, + int position) + { + Type = type; + Position = position; + } + } +} From c4f17be79425baacadf503a309b90fe48896793b Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 7 Oct 2020 17:00:04 -0700 Subject: [PATCH 204/295] Support anonymous types --- .../Core.Wpf/InlineHints/InlineHintsTag.cs | 5 +- .../InlineHintsDataTaggerProvider.cs | 48 +++++++++++++++++-- .../CSharpAnonymousTypeDisplayService.cs | 8 ++-- .../AbstractAnonymousTypeDisplayService.cs | 3 +- .../IAnonymousTypeDisplayService.cs | 5 +- .../VisualBasicAnonymousTypeDisplayService.vb | 27 ++++++----- 6 files changed, 72 insertions(+), 24 deletions(-) diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs index 8ad76c2ffe69b..09047240b0c73 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs @@ -136,6 +136,7 @@ private static FrameworkElement CreateElement(string text, IWpfTextView textView { // Constructs the hint block which gets assigned parameter name and fontstyles according to the options // page. Calculates a font size 1/4 smaller than the font size of the rest of the editor + var right = text.EndsWith(":") ? 0 : 1; var block = new TextBlock { FontFamily = format.Typeface.FontFamily, @@ -145,8 +146,8 @@ private static FrameworkElement CreateElement(string text, IWpfTextView textView // Adds a little bit of padding to the left of the text relative to the border // to make the text seem more balanced in the border - Padding = new Thickness(left: 1, top: 0, right: 0, bottom: 0), - Text = text + ":", + Padding = new Thickness(left: 1, top: 0, right: right, bottom: 0), + Text = text, VerticalAlignment = VerticalAlignment.Center, }; diff --git a/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs b/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs index 19ddbd216aaa3..1b8579eef6db4 100644 --- a/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs +++ b/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs @@ -13,6 +13,7 @@ using Microsoft.CodeAnalysis.Editor.Tagging; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.InlineHints; +using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.VisualStudio.Text; @@ -32,7 +33,7 @@ namespace Microsoft.CodeAnalysis.Editor.InlineHints [Name(nameof(InlineHintsDataTaggerProvider))] internal class InlineHintsDataTaggerProvider : AsynchronousViewTaggerProvider { - private static SymbolDisplayFormat s_minimalTypeStyle = new SymbolDisplayFormat( + private static readonly SymbolDisplayFormat s_minimalTypeStyle = new SymbolDisplayFormat( genericsOptions: SymbolDisplayGenericsOptions.IncludeTypeParameters, miscellaneousOptions: SymbolDisplayMiscellaneousOptions.AllowDefaultLiteral | SymbolDisplayMiscellaneousOptions.IncludeNullableReferenceTypeModifier | SymbolDisplayMiscellaneousOptions.UseSpecialTypes); @@ -95,21 +96,62 @@ private async Task AddTypeHintsAsync(TaggerContext context, D if (service == null) return; + var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); + var anonymousTypeService = document.GetRequiredLanguageService(); + var snapshotSpan = documentSnapshotSpan.SnapshotSpan; + var position = snapshotSpan.Span.Start; var hints = await service.GetInlineTypeHintsAsync(document, snapshotSpan.Span.ToTextSpan(), cancellationToken).ConfigureAwait(false); foreach (var hint in hints) { Contract.ThrowIfNull(hint.Type); + var sb = PooledStringBuilder.GetInstance(); + var parts = hint.Type.ToDisplayParts(s_minimalTypeStyle); + + AddParts(anonymousTypeService, sb, parts, semanticModel, position); + cancellationToken.ThrowIfCancellationRequested(); context.AddTag(new TagSpan( new SnapshotSpan(snapshotSpan.Snapshot, hint.Position, 0), new InlineHintDataTag( - hint.Type.ToDisplayString(s_minimalTypeStyle), + sb.ToStringAndFree(), hint.Type.GetSymbolKey(cancellationToken)))); } } + private void AddParts( + IAnonymousTypeDisplayService anonymousTypeService, + PooledStringBuilder sb, + System.Collections.Immutable.ImmutableArray parts, + SemanticModel semanticModel, + int position, + HashSet? seenSymbols = null) + { + seenSymbols ??= new(); + + foreach (var part in parts) + { + if (part.Symbol is INamedTypeSymbol { IsAnonymousType: true } anonymousType) + { + if (seenSymbols.Add(anonymousType)) + { + var anonymousParts = anonymousTypeService.GetAnonymousTypeParts(anonymousType, semanticModel, position); + AddParts(anonymousTypeService, sb, anonymousParts, semanticModel, position, seenSymbols); + seenSymbols.Remove(anonymousType); + } + else + { + sb.Builder.Append("..."); + } + } + else + { + sb.Builder.Append(part.ToString()); + } + } + } + private static async Task AddParameterNameHintsAsync(TaggerContext context, DocumentSnapshotSpan documentSnapshotSpan, CancellationToken cancellationToken) { var document = documentSnapshotSpan.Document; @@ -127,7 +169,7 @@ private static async Task AddParameterNameHintsAsync(TaggerContext( new SnapshotSpan(snapshotSpan.Snapshot, hint.Position, 0), new InlineHintDataTag( - hint.Parameter.Name, + hint.Parameter.Name + ":", hint.Parameter.GetSymbolKey(cancellationToken)))); } } diff --git a/src/Features/CSharp/Portable/LanguageServices/CSharpAnonymousTypeDisplayService.cs b/src/Features/CSharp/Portable/LanguageServices/CSharpAnonymousTypeDisplayService.cs index 81441109e64a9..a67ec6bd8c17d 100644 --- a/src/Features/CSharp/Portable/LanguageServices/CSharpAnonymousTypeDisplayService.cs +++ b/src/Features/CSharp/Portable/LanguageServices/CSharpAnonymousTypeDisplayService.cs @@ -6,12 +6,14 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.Composition; using System.Linq; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServices; +using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.Editor.CSharp.LanguageServices @@ -25,10 +27,10 @@ public CSharpAnonymousTypeDisplayService() { } - public override IEnumerable GetAnonymousTypeParts( + public override ImmutableArray GetAnonymousTypeParts( INamedTypeSymbol anonymousType, SemanticModel semanticModel, int position) { - var members = new List(); + using var _ = ArrayBuilder.GetInstance(out var members); members.Add(Keyword(SyntaxFacts.GetText(SyntaxKind.NewKeyword))); members.AddRange(Space()); @@ -53,7 +55,7 @@ public override IEnumerable GetAnonymousTypeParts( members.AddRange(Space()); members.Add(Punctuation(SyntaxFacts.GetText(SyntaxKind.CloseBraceToken))); - return members; + return members.ToImmutable(); } } } diff --git a/src/Features/Core/Portable/LanguageServices/AnonymousTypeDisplayService/AbstractAnonymousTypeDisplayService.cs b/src/Features/Core/Portable/LanguageServices/AnonymousTypeDisplayService/AbstractAnonymousTypeDisplayService.cs index a61cdb23ead1e..855260bce1d8d 100644 --- a/src/Features/Core/Portable/LanguageServices/AnonymousTypeDisplayService/AbstractAnonymousTypeDisplayService.cs +++ b/src/Features/Core/Portable/LanguageServices/AnonymousTypeDisplayService/AbstractAnonymousTypeDisplayService.cs @@ -5,6 +5,7 @@ #nullable disable using System.Collections.Generic; +using System.Collections.Immutable; using System.Linq; using Microsoft.CodeAnalysis; using Roslyn.Utilities; @@ -13,7 +14,7 @@ namespace Microsoft.CodeAnalysis.LanguageServices { internal abstract partial class AbstractAnonymousTypeDisplayService : IAnonymousTypeDisplayService { - public abstract IEnumerable GetAnonymousTypeParts( + public abstract ImmutableArray GetAnonymousTypeParts( INamedTypeSymbol anonymousType, SemanticModel semanticModel, int position); public AnonymousTypeDisplayInfo GetNormalAnonymousTypeDisplayInfo( diff --git a/src/Features/Core/Portable/LanguageServices/AnonymousTypeDisplayService/IAnonymousTypeDisplayService.cs b/src/Features/Core/Portable/LanguageServices/AnonymousTypeDisplayService/IAnonymousTypeDisplayService.cs index 61cf6e55722f4..2871ab58c2308 100644 --- a/src/Features/Core/Portable/LanguageServices/AnonymousTypeDisplayService/IAnonymousTypeDisplayService.cs +++ b/src/Features/Core/Portable/LanguageServices/AnonymousTypeDisplayService/IAnonymousTypeDisplayService.cs @@ -2,9 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System.Collections.Generic; +using System.Collections.Immutable; using Microsoft.CodeAnalysis.Host; namespace Microsoft.CodeAnalysis.LanguageServices @@ -17,7 +16,7 @@ AnonymousTypeDisplayInfo GetNormalAnonymousTypeDisplayInfo( SemanticModel semanticModel, int position); - IEnumerable GetAnonymousTypeParts( + ImmutableArray GetAnonymousTypeParts( INamedTypeSymbol anonymousType, SemanticModel semanticModel, int position); diff --git a/src/Features/VisualBasic/Portable/LanguageServices/VisualBasicAnonymousTypeDisplayService.vb b/src/Features/VisualBasic/Portable/LanguageServices/VisualBasicAnonymousTypeDisplayService.vb index d9fb3d3379124..6f8c8515459e5 100644 --- a/src/Features/VisualBasic/Portable/LanguageServices/VisualBasicAnonymousTypeDisplayService.vb +++ b/src/Features/VisualBasic/Portable/LanguageServices/VisualBasicAnonymousTypeDisplayService.vb @@ -2,9 +2,11 @@ ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. +Imports System.Collections.Immutable Imports System.Composition Imports Microsoft.CodeAnalysis.Host.Mef Imports Microsoft.CodeAnalysis.LanguageServices +Imports Microsoft.CodeAnalysis.PooledObjects Imports Microsoft.CodeAnalysis.VisualBasic Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.LanguageServices @@ -35,7 +37,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.LanguageServices Public Sub New() End Sub - Public Overrides Function GetAnonymousTypeParts(anonymousType As INamedTypeSymbol, semanticModel As SemanticModel, position As Integer) As IEnumerable(Of SymbolDisplayPart) + Public Overrides Function GetAnonymousTypeParts(anonymousType As INamedTypeSymbol, semanticModel As SemanticModel, position As Integer) As ImmutableArray(Of SymbolDisplayPart) If anonymousType.IsAnonymousDelegateType() Then Return GetDelegateAnonymousType(anonymousType, semanticModel, position) Else @@ -43,19 +45,20 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.LanguageServices End If End Function - Private Shared Function GetDelegateAnonymousType(anonymousType As INamedTypeSymbol, - semanticModel As SemanticModel, - position As Integer) As IList(Of SymbolDisplayPart) + Private Shared Function GetDelegateAnonymousType( + anonymousType As INamedTypeSymbol, + semanticModel As SemanticModel, + position As Integer) As ImmutableArray(Of SymbolDisplayPart) Dim method = anonymousType.DelegateInvokeMethod - Dim members = New List(Of SymbolDisplayPart)() + Dim members = ArrayBuilder(Of SymbolDisplayPart).GetInstance() members.Add(Punctuation("<")) members.AddRange(MassageDelegateParts( method, method.ToMinimalDisplayParts(semanticModel, position, s_anonymousDelegateFormat))) members.Add(Punctuation(">")) - Return members + Return members.ToImmutableAndFree() End Function Private Shared Function MassageDelegateParts(delegateInvoke As IMethodSymbol, @@ -77,10 +80,11 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.LanguageServices Return result End Function - Private Shared Function GetNormalAnonymousType(anonymousType As INamedTypeSymbol, - semanticModel As SemanticModel, - position As Integer) As IList(Of SymbolDisplayPart) - Dim members = New List(Of SymbolDisplayPart)() + Private Shared Function GetNormalAnonymousType( + anonymousType As INamedTypeSymbol, + semanticModel As SemanticModel, + position As Integer) As ImmutableArray(Of SymbolDisplayPart) + Dim members = ArrayBuilder(Of SymbolDisplayPart).GetInstance() members.Add(Keyword(SyntaxFacts.GetText(SyntaxKind.NewKeyword))) members.AddRange(Space()) @@ -112,8 +116,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.LanguageServices members.AddRange(Space()) members.Add(Punctuation(SyntaxFacts.GetText(SyntaxKind.CloseBraceToken))) - Return members + Return members.ToImmutableAndFree() End Function End Class - End Namespace From 8a3b5ae413590151c6d04eba8613517cc032589c Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 7 Oct 2020 17:07:45 -0700 Subject: [PATCH 205/295] Pass along options --- .../CSharpInlineTypeHintsService.cs | 57 +++++++++++-------- .../AbstractInlineTypeHintsService.cs | 23 +++++++- 2 files changed, 54 insertions(+), 26 deletions(-) diff --git a/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs b/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs index d3bf1482f7c3d..4d9c9bbc86e97 100644 --- a/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs +++ b/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs @@ -24,35 +24,44 @@ public CSharpInlineTypeHintsService() protected override InlineTypeHint? TryGetTypeHint( SemanticModel semanticModel, SyntaxNode node, + bool forImplicitVariableTypes, + bool forLambdaParameterTypes, CancellationToken cancellationToken) { - if (node is VariableDeclarationSyntax variableDeclaration && - variableDeclaration.Type.IsVar && - variableDeclaration.Variables.Count == 1 && - !variableDeclaration.Variables[0].Identifier.IsMissing) + if (forImplicitVariableTypes) { - var type = semanticModel.GetTypeInfo(variableDeclaration.Type, cancellationToken).Type; - if (IsValidType(type)) - return new InlineTypeHint(type, variableDeclaration.Variables[0].Identifier.SpanStart); + if (node is VariableDeclarationSyntax variableDeclaration && + variableDeclaration.Type.IsVar && + variableDeclaration.Variables.Count == 1 && + !variableDeclaration.Variables[0].Identifier.IsMissing) + { + var type = semanticModel.GetTypeInfo(variableDeclaration.Type, cancellationToken).Type; + if (IsValidType(type)) + return new InlineTypeHint(type, variableDeclaration.Variables[0].Identifier.SpanStart); + } + else if (node is SingleVariableDesignationSyntax variableDesignation) + { + var local = semanticModel.GetDeclaredSymbol(variableDesignation, cancellationToken) as ILocalSymbol; + var type = local?.Type; + if (IsValidType(type)) + return new InlineTypeHint(type, variableDesignation.Identifier.SpanStart); + } } - else if (node is SingleVariableDesignationSyntax variableDesignation) - { - var local = semanticModel.GetDeclaredSymbol(variableDesignation, cancellationToken) as ILocalSymbol; - var type = local?.Type; - if (IsValidType(type)) - return new InlineTypeHint(type, variableDesignation.Identifier.SpanStart); - } - else if (node is SimpleLambdaExpressionSyntax simpleLambda) - { - var parameter = semanticModel.GetDeclaredSymbol(simpleLambda.Parameter, cancellationToken); - if (IsValidType(parameter?.Type)) - return new InlineTypeHint(parameter.Type, simpleLambda.Parameter.Identifier.SpanStart); - } - else if (node is ParameterSyntax { Type: null } parameterNode) + + if (forLambdaParameterTypes) { - var parameter = semanticModel.GetDeclaredSymbol(parameterNode, cancellationToken); - if (IsValidType(parameter?.Type)) - return new InlineTypeHint(parameter.Type, parameterNode.Identifier.SpanStart); + if (node is SimpleLambdaExpressionSyntax simpleLambda) + { + var parameter = semanticModel.GetDeclaredSymbol(simpleLambda.Parameter, cancellationToken); + if (IsValidType(parameter?.Type)) + return new InlineTypeHint(parameter.Type, simpleLambda.Parameter.Identifier.SpanStart); + } + else if (node is ParameterSyntax { Type: null } parameterNode) + { + var parameter = semanticModel.GetDeclaredSymbol(parameterNode, cancellationToken); + if (IsValidType(parameter?.Type)) + return new InlineTypeHint(parameter.Type, parameterNode.Identifier.SpanStart); + } } return null; diff --git a/src/Features/Core/Portable/InlineHints/AbstractInlineTypeHintsService.cs b/src/Features/Core/Portable/InlineHints/AbstractInlineTypeHintsService.cs index 48aa2048c4996..ee8a4e750c5bf 100644 --- a/src/Features/Core/Portable/InlineHints/AbstractInlineTypeHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/AbstractInlineTypeHintsService.cs @@ -14,11 +14,27 @@ namespace Microsoft.CodeAnalysis.InlineHints { internal abstract class AbstractInlineTypeHintsService : IInlineTypeHintsService { - protected abstract InlineTypeHint? TryGetTypeHint(SemanticModel semanticModel, SyntaxNode node, CancellationToken cancellationToken); + protected abstract InlineTypeHint? TryGetTypeHint( + SemanticModel semanticModel, SyntaxNode node, + bool forImplicitVariableTypes, + bool forLambdaParameterTypes, + CancellationToken cancellationToken); public async Task> GetInlineTypeHintsAsync( Document document, TextSpan textSpan, CancellationToken cancellationToken) { + var options = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); + + var displayAllOverride = options.GetOption(InlineHintsOptions.DisplayAllOverride); + var enabledForTypes = displayAllOverride || options.GetOption(InlineHintsOptions.EnabledForTypes); + if (!enabledForTypes) + return ImmutableArray.Empty; + + var forImplicitVariableTypes = displayAllOverride || options.GetOption(InlineHintsOptions.ForImplicitVariableTypes); + var forLambdaParameterTypes = displayAllOverride || options.GetOption(InlineHintsOptions.ForLambdaParameterTypes); + if (!forImplicitVariableTypes && !forLambdaParameterTypes) + return ImmutableArray.Empty; + var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); @@ -26,7 +42,10 @@ public async Task> GetInlineTypeHintsAsync( foreach (var node in root.DescendantNodes(n => n.Span.IntersectsWith(textSpan))) { - result.AddIfNotNull(TryGetTypeHint(semanticModel, node, cancellationToken)); + result.AddIfNotNull(TryGetTypeHint( + semanticModel, node, + forImplicitVariableTypes, + forLambdaParameterTypes, cancellationToken)); } return result.ToImmutable(); From 237721be7aa94e63e24db16071998cb2a8db3579 Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Wed, 7 Oct 2020 17:17:50 -0700 Subject: [PATCH 206/295] Update documentation for new minimum dependencies --- .../Building, Debugging, and Testing on Windows.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/contributing/Building, Debugging, and Testing on Windows.md b/docs/contributing/Building, Debugging, and Testing on Windows.md index 5f3950f7c7117..3a8a644479159 100644 --- a/docs/contributing/Building, Debugging, and Testing on Windows.md +++ b/docs/contributing/Building, Debugging, and Testing on Windows.md @@ -17,10 +17,10 @@ The minimal required version of .NET Framework is 4.7.2. 1. [Visual Studio 2019 16.8p2](https://visualstudio.microsoft.com/downloads/) - Ensure C#, VB, MSBuild, .NET Core and Visual Studio Extensibility are included in the selected work loads - - Ensure Visual Studio is on Version "16.8 Preview 2" or greater + - Ensure Visual Studio is on Version "16.8 Preview 3" or greater - Ensure "Use previews of the .NET Core SDK" is checked in Tools -> Options -> Environment -> Preview Features - Restart Visual Studio -1. [.NET Core SDK 5.0 Preview 8](https://dotnet.microsoft.com/download/dotnet-core/5.0) [Windows x64 installer](https://dotnet.microsoft.com/download/dotnet/thank-you/sdk-5.0.100-preview.8-windows-x64-installer) +1. [.NET Core SDK 5.0 Release Candidate 1](https://dotnet.microsoft.com/download/dotnet-core/5.0) [Windows x64 installer](https://dotnet.microsoft.com/download/dotnet-core/thank-you/sdk-5.0.100-rc.1-windows-x64-installer) 1. [PowerShell 5.0 or newer](https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-windows-powershell). If you are on Windows 10, you are fine; you'll only need to upgrade if you're on earlier versions of Windows. The download link is under the ["Upgrading existing Windows PowerShell"](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-windows-powershell?view=powershell-6#upgrading-existing-windows-powershell) heading. 1. Run Restore.cmd 1. Open Roslyn.sln From 2742d9ffe433795e1832302439119694adbfae86 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 7 Oct 2020 17:25:00 -0700 Subject: [PATCH 207/295] Add UI options --- ...AbstractInlineParameterNameHintsService.cs | 8 ++--- .../Options/AdvancedOptionPageControl.xaml | 12 +++++++ .../Options/AdvancedOptionPageControl.xaml.cs | 34 +++++++++++++++---- .../Impl/Options/AdvancedOptionPageStrings.cs | 17 ++++++---- .../Core/Def/ServicesVSResources.resx | 9 +++++ .../Core/Def/xlf/ServicesVSResources.cs.xlf | 15 ++++++++ .../Core/Def/xlf/ServicesVSResources.de.xlf | 15 ++++++++ .../Core/Def/xlf/ServicesVSResources.es.xlf | 15 ++++++++ .../Core/Def/xlf/ServicesVSResources.fr.xlf | 15 ++++++++ .../Core/Def/xlf/ServicesVSResources.it.xlf | 15 ++++++++ .../Core/Def/xlf/ServicesVSResources.ja.xlf | 15 ++++++++ .../Core/Def/xlf/ServicesVSResources.ko.xlf | 15 ++++++++ .../Core/Def/xlf/ServicesVSResources.pl.xlf | 15 ++++++++ .../Def/xlf/ServicesVSResources.pt-BR.xlf | 15 ++++++++ .../Core/Def/xlf/ServicesVSResources.ru.xlf | 15 ++++++++ .../Core/Def/xlf/ServicesVSResources.tr.xlf | 15 ++++++++ .../Def/xlf/ServicesVSResources.zh-Hans.xlf | 15 ++++++++ .../Def/xlf/ServicesVSResources.zh-Hant.xlf | 15 ++++++++ 18 files changed, 258 insertions(+), 17 deletions(-) diff --git a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs index 7537918a01607..4e76b6257480d 100644 --- a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs @@ -27,8 +27,8 @@ public async Task> GetInlineParameterNameHin var displayAllOverride = options.GetOption(InlineHintsOptions.DisplayAllOverride); - var forParameters = displayAllOverride || options.GetOption(InlineHintsOptions.EnabledForParameters); - if (!forParameters) + var enabledForParameters = displayAllOverride || options.GetOption(InlineHintsOptions.EnabledForParameters); + if (!enabledForParameters) return ImmutableArray.Empty; var literalParameters = displayAllOverride || options.GetOption(InlineHintsOptions.ForLiteralParameters); @@ -37,8 +37,8 @@ public async Task> GetInlineParameterNameHin if (!literalParameters && !objectCreationParameters && !otherParameters) return ImmutableArray.Empty; - var suppressForParametersThatDifferOnlyBySuffix = options.GetOption(InlineHintsOptions.SuppressForParametersThatDifferOnlyBySuffix); - var suppressForParametersThatMatchMethodIntent = options.GetOption(InlineHintsOptions.SuppressForParametersThatMatchMethodIntent); + var suppressForParametersThatDifferOnlyBySuffix = !displayAllOverride && options.GetOption(InlineHintsOptions.SuppressForParametersThatDifferOnlyBySuffix); + var suppressForParametersThatMatchMethodIntent = !displayAllOverride && options.GetOption(InlineHintsOptions.SuppressForParametersThatMatchMethodIntent); var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml index b4086292a4d1c..3b355cc171f02 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml @@ -211,6 +211,18 @@ x:Name="SuppressHintsWhenParameterNamesDifferOnlyBySuffix" Content="{x:Static local:AdvancedOptionPageStrings.Option_Suppress_hints_when_parameter_names_differ_only_by_suffix}" /> + + + + + diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs index f78aebcd20e3b..719a5ef1dfe35 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs @@ -65,13 +65,6 @@ public AdvancedOptionPageControl(OptionStore optionStore, IComponentModel compon BindToOption(InsertSlashSlashAtTheStartOfNewLinesWhenWritingSingleLineComments, SplitStringLiteralOptions.Enabled, LanguageNames.CSharp); BindToOption(InsertAsteriskAtTheStartOfNewLinesWhenWritingBlockComments, FeatureOnOffOptions.AutoInsertBlockCommentStartString, LanguageNames.CSharp); - BindToOption(DisplayInlineParameterNameHints, InlineHintsOptions.EnabledForParameters, LanguageNames.CSharp); - BindToOption(ShowHintsForLiterals, InlineHintsOptions.ForLiteralParameters, LanguageNames.CSharp); - BindToOption(ShowHintsForNewExpressions, InlineHintsOptions.ForObjectCreationParameters, LanguageNames.CSharp); - BindToOption(ShowHintsForEverythingElse, InlineHintsOptions.ForOtherParameters, LanguageNames.CSharp); - BindToOption(SuppressHintsWhenParameterNameMatchesTheMethodsIntent, InlineHintsOptions.SuppressForParametersThatMatchMethodIntent, LanguageNames.CSharp); - BindToOption(SuppressHintsWhenParameterNamesDifferOnlyBySuffix, InlineHintsOptions.SuppressForParametersThatDifferOnlyBySuffix, LanguageNames.CSharp); - BindToOption(ShowRemarksInQuickInfo, QuickInfoOptions.ShowRemarksInQuickInfo, LanguageNames.CSharp); BindToOption(DisplayLineSeparators, FeatureOnOffOptions.LineSeparator, LanguageNames.CSharp); BindToOption(EnableHighlightReferences, FeatureOnOffOptions.ReferenceHighlighting, LanguageNames.CSharp); @@ -94,6 +87,17 @@ public AdvancedOptionPageControl(OptionStore optionStore, IComponentModel compon BindToOption(Show_completion_list, RegularExpressionsOptions.ProvideRegexCompletions, LanguageNames.CSharp); BindToOption(Editor_color_scheme, ColorSchemeOptions.ColorScheme); + + BindToOption(DisplayInlineParameterNameHints, InlineHintsOptions.EnabledForParameters, LanguageNames.CSharp); + BindToOption(ShowHintsForLiterals, InlineHintsOptions.ForLiteralParameters, LanguageNames.CSharp); + BindToOption(ShowHintsForNewExpressions, InlineHintsOptions.ForObjectCreationParameters, LanguageNames.CSharp); + BindToOption(ShowHintsForEverythingElse, InlineHintsOptions.ForOtherParameters, LanguageNames.CSharp); + BindToOption(SuppressHintsWhenParameterNameMatchesTheMethodsIntent, InlineHintsOptions.SuppressForParametersThatMatchMethodIntent, LanguageNames.CSharp); + BindToOption(SuppressHintsWhenParameterNamesDifferOnlyBySuffix, InlineHintsOptions.SuppressForParametersThatDifferOnlyBySuffix, LanguageNames.CSharp); + + BindToOption(DisplayInlineTypeHints, InlineHintsOptions.EnabledForTypes, LanguageNames.CSharp); + BindToOption(ShowHintsForVariablesWithInferredTypes, InlineHintsOptions.ForImplicitVariableTypes, LanguageNames.CSharp); + BindToOption(ShowHintsForLambdaParameterTypes, InlineHintsOptions.ForLambdaParameterTypes, LanguageNames.CSharp); } // Since this dialog is constructed once for the lifetime of the application and VS Theme can be changed after the application has started, @@ -120,6 +124,10 @@ private void UpdateInlineHintsOptions() ShowHintsForEverythingElse.IsEnabled = enabledForParameters; SuppressHintsWhenParameterNameMatchesTheMethodsIntent.IsEnabled = enabledForParameters; SuppressHintsWhenParameterNamesDifferOnlyBySuffix.IsEnabled = enabledForParameters; + + var enabledForTypes = this.OptionStore.GetOption(InlineHintsOptions.EnabledForTypes, LanguageNames.CSharp); + ShowHintsForVariablesWithInferredTypes.IsEnabled = enabledForTypes; + ShowHintsForLambdaParameterTypes.IsEnabled = enabledForTypes; } private void DisplayInlineParameterNameHints_Checked(object sender, RoutedEventArgs e) @@ -133,5 +141,17 @@ private void DisplayInlineParameterNameHints_Unchecked(object sender, RoutedEven this.OptionStore.SetOption(InlineHintsOptions.EnabledForParameters, LanguageNames.CSharp, false); UpdateInlineHintsOptions(); } + + private void DisplayInlineTypeHints_Checked(object sender, RoutedEventArgs e) + { + this.OptionStore.SetOption(InlineHintsOptions.EnabledForTypes, LanguageNames.CSharp, true); + UpdateInlineHintsOptions(); + } + + private void DisplayInlineTypeHints_Unchecked(object sender, RoutedEventArgs e) + { + this.OptionStore.SetOption(InlineHintsOptions.EnabledForTypes, LanguageNames.CSharp, false); + UpdateInlineHintsOptions(); + } } } diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs index 220204787d81e..abca35ce90281 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs @@ -52,13 +52,20 @@ public static string Option_Suppress_hints_when_parameter_name_matches_the_metho public static string Option_Suppress_hints_when_parameter_names_differ_only_by_suffix => ServicesVSResources.Suppress_hints_when_parameter_names_differ_only_by_suffix; + public static string Option_Display_inline_type_hints + => ServicesVSResources.Display_inline_type_hints; + + public static string Option_Show_hints_for_variables_with_inferred_types + => ServicesVSResources.Show_hints_for_variables_with_inferred_types; + + public static string Option_Show_hints_for_lambda_parameter_types + => ServicesVSResources.Show_hints_for_lambda_parameter_types; + public static string Option_RenameTrackingPreview => CSharpVSResources.Show_preview_for_rename_tracking; public static string Option_Split_string_literals_on_enter => CSharpVSResources.Split_string_literals_on_enter; public static string Option_DisplayLineSeparators - { - get { return CSharpVSResources.Show_procedure_line_separators; } - } + => CSharpVSResources.Show_procedure_line_separators; public static string Option_DontPutOutOrRefOnStruct { @@ -122,9 +129,7 @@ public static string Option_InsertAsteriskAtTheStartOfNewLinesWhenWritingBlockCo => CSharpVSResources.Insert_at_the_start_of_new_lines_when_writing_comments; public static string Option_ShowRemarksInQuickInfo - { - get { return CSharpVSResources.Show_remarks_in_Quick_Info; } - } + => CSharpVSResources.Show_remarks_in_Quick_Info; public static string Option_Highlighting { diff --git a/src/VisualStudio/Core/Def/ServicesVSResources.resx b/src/VisualStudio/Core/Def/ServicesVSResources.resx index df5db42c3c1f2..682e76994843b 100644 --- a/src/VisualStudio/Core/Def/ServicesVSResources.resx +++ b/src/VisualStudio/Core/Def/ServicesVSResources.resx @@ -1572,4 +1572,13 @@ I agree to all of the foregoing: Suppress hints when parameter names differ only by suffix + + Display inline type hints + + + Show hints for lambda parameter types + + + Show hints for variables with inferred types + \ No newline at end of file diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf index 5233a5a0f46d6..e1831a9497013 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf @@ -182,6 +182,11 @@ Zobrazovat nápovědy k názvům v_ložených parametrů (experimentální) + + Display inline type hints + Display inline type hints + + _Edit _Upravit @@ -782,11 +787,21 @@ Show hints for everything else + + Show hints for lambda parameter types + Show hints for lambda parameter types + + Show hints for literals Show hints for literals + + Show hints for variables with inferred types + Show hints for variables with inferred types + + Some color scheme colors are being overridden by changes made in the Environment > Fonts and Colors options page. Choose `Use Defaults` in the Fonts and Colors page to revert all customizations. Některé barvy barevného schématu se přepsaly změnami na stránce možností Prostředí > Písma a barvy. Pokud chcete zrušit všechna přizpůsobení, vyberte na stránce Písma a barvy možnost Použít výchozí. diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf index 02e55aa884793..b1100b3c81093 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf @@ -182,6 +182,11 @@ Disp_lay inline parameter name hints + + Display inline type hints + Display inline type hints + + _Edit _Bearbeiten @@ -782,11 +787,21 @@ Show hints for everything else + + Show hints for lambda parameter types + Show hints for lambda parameter types + + Show hints for literals Show hints for literals + + Show hints for variables with inferred types + Show hints for variables with inferred types + + Some color scheme colors are being overridden by changes made in the Environment > Fonts and Colors options page. Choose `Use Defaults` in the Fonts and Colors page to revert all customizations. Einige Farbschemafarben werden durch Änderungen überschrieben, die auf der Optionsseite "Umgebung" > "Schriftarten und Farben" vorgenommen wurden. Wählen Sie auf der Seite "Schriftarten und Farben" die Option "Standardwerte verwenden" aus, um alle Anpassungen rückgängig zu machen. diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf index 3a6ef9cfba573..7ee835458614c 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf @@ -182,6 +182,11 @@ Disp_lay inline parameter name hints + + Display inline type hints + Display inline type hints + + _Edit _Editar @@ -782,11 +787,21 @@ Show hints for everything else + + Show hints for lambda parameter types + Show hints for lambda parameter types + + Show hints for literals Show hints for literals + + Show hints for variables with inferred types + Show hints for variables with inferred types + + Some color scheme colors are being overridden by changes made in the Environment > Fonts and Colors options page. Choose `Use Defaults` in the Fonts and Colors page to revert all customizations. Algunos de los colores de la combinación se reemplazan por los cambios realizados en la página de opciones de Entorno > Fuentes y colores. Elija "Usar valores predeterminados" en la página Fuentes y colores para revertir todas las personalizaciones. diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf index fc136cdb9e01f..69898515c1118 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf @@ -182,6 +182,11 @@ Disp_lay inline parameter name hints + + Display inline type hints + Display inline type hints + + _Edit _Modifier @@ -782,11 +787,21 @@ Show hints for everything else + + Show hints for lambda parameter types + Show hints for lambda parameter types + + Show hints for literals Show hints for literals + + Show hints for variables with inferred types + Show hints for variables with inferred types + + Some color scheme colors are being overridden by changes made in the Environment > Fonts and Colors options page. Choose `Use Defaults` in the Fonts and Colors page to revert all customizations. Certaines couleurs du modèle de couleurs sont substituées à la suite des changements apportés dans la page d'options Environnement > Polices et couleurs. Choisissez Utiliser les valeurs par défaut dans la page Polices et couleurs pour restaurer toutes les personnalisations. diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf index 7e662d6bc2dd0..57e7c47c5346d 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf @@ -182,6 +182,11 @@ Disp_lay inline parameter name hints + + Display inline type hints + Display inline type hints + + _Edit _Modifica @@ -782,11 +787,21 @@ Show hints for everything else + + Show hints for lambda parameter types + Show hints for lambda parameter types + + Show hints for literals Show hints for literals + + Show hints for variables with inferred types + Show hints for variables with inferred types + + Some color scheme colors are being overridden by changes made in the Environment > Fonts and Colors options page. Choose `Use Defaults` in the Fonts and Colors page to revert all customizations. Alcuni colori della combinazione colori sono sostituiti dalle modifiche apportate nella pagina di opzioni Ambiente > Tipi di carattere e colori. Scegliere `Usa impostazioni predefinite` nella pagina Tipi di carattere e colori per ripristinare tutte le personalizzazioni. diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf index b3eb9352f4588..d5e4a9ee5687a 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf @@ -182,6 +182,11 @@ Disp_lay inline parameter name hints + + Display inline type hints + Display inline type hints + + _Edit 編集(_E) @@ -782,11 +787,21 @@ Show hints for everything else + + Show hints for lambda parameter types + Show hints for lambda parameter types + + Show hints for literals Show hints for literals + + Show hints for variables with inferred types + Show hints for variables with inferred types + + Some color scheme colors are being overridden by changes made in the Environment > Fonts and Colors options page. Choose `Use Defaults` in the Fonts and Colors page to revert all customizations. 一部の配色パターンの色は、[環境] > [フォントおよび色] オプション ページで行われた変更によって上書きされます。[フォントおよび色] オプション ページで [既定値を使用] を選択すると、すべてのカスタマイズが元に戻ります。 diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf index ac9ebada5e8d6..a82298ed19ddb 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf @@ -182,6 +182,11 @@ Disp_lay inline parameter name hints + + Display inline type hints + Display inline type hints + + _Edit 편집(_E) @@ -782,11 +787,21 @@ Show hints for everything else + + Show hints for lambda parameter types + Show hints for lambda parameter types + + Show hints for literals Show hints for literals + + Show hints for variables with inferred types + Show hints for variables with inferred types + + Some color scheme colors are being overridden by changes made in the Environment > Fonts and Colors options page. Choose `Use Defaults` in the Fonts and Colors page to revert all customizations. 색 구성표의 일부 색이 [환경] > [글꼴 및 색] 옵션 페이지에서 변경한 내용에 따라 재정의됩니다. 모든 사용자 지정을 되돌리려면 [글꼴 및 색] 페이지에서 '기본값 사용'을 선택하세요. diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf index 4c43507f25b85..9bf08a479a16a 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf @@ -182,6 +182,11 @@ Disp_lay inline parameter name hints + + Display inline type hints + Display inline type hints + + _Edit _Edytuj @@ -782,11 +787,21 @@ Show hints for everything else + + Show hints for lambda parameter types + Show hints for lambda parameter types + + Show hints for literals Show hints for literals + + Show hints for variables with inferred types + Show hints for variables with inferred types + + Some color scheme colors are being overridden by changes made in the Environment > Fonts and Colors options page. Choose `Use Defaults` in the Fonts and Colors page to revert all customizations. Niektóre kolory w schemacie kolorów są przesłaniane przez zmiany wprowadzone na stronie opcji Środowisko > Czcionki i kolory. Wybierz pozycję „Użyj ustawień domyślnych” na stronie Czcionki i kolory, aby wycofać wszystkie dostosowania. diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf index c847ff53c3d9f..40e52c3ff6ca7 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf @@ -182,6 +182,11 @@ Disp_lay inline parameter name hints + + Display inline type hints + Display inline type hints + + _Edit _Editar @@ -782,11 +787,21 @@ Show hints for everything else + + Show hints for lambda parameter types + Show hints for lambda parameter types + + Show hints for literals Show hints for literals + + Show hints for variables with inferred types + Show hints for variables with inferred types + + Some color scheme colors are being overridden by changes made in the Environment > Fonts and Colors options page. Choose `Use Defaults` in the Fonts and Colors page to revert all customizations. Algumas cores do esquema de cores estão sendo substituídas pelas alterações feitas na página de Ambiente > Opções de Fontes e Cores. Escolha 'Usar Padrões' na página Fontes e Cores para reverter todas as personalizações. diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf index b08c35026b105..c43c6e0d82f69 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf @@ -182,6 +182,11 @@ Disp_lay inline parameter name hints + + Display inline type hints + Display inline type hints + + _Edit _Изменить @@ -782,11 +787,21 @@ Show hints for everything else + + Show hints for lambda parameter types + Show hints for lambda parameter types + + Show hints for literals Show hints for literals + + Show hints for variables with inferred types + Show hints for variables with inferred types + + Some color scheme colors are being overridden by changes made in the Environment > Fonts and Colors options page. Choose `Use Defaults` in the Fonts and Colors page to revert all customizations. Некоторые цвета цветовой схемы переопределяются изменениями, сделанными на странице "Среда" > "Шрифты и цвета". Выберите "Использовать значения по умолчанию" на странице "Шрифты и цвета", чтобы отменить все настройки. diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf index 20919710d992b..dd3cb15bd4ed3 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf @@ -182,6 +182,11 @@ Disp_lay inline parameter name hints + + Display inline type hints + Display inline type hints + + _Edit _Düzenle @@ -782,11 +787,21 @@ Show hints for everything else + + Show hints for lambda parameter types + Show hints for lambda parameter types + + Show hints for literals Show hints for literals + + Show hints for variables with inferred types + Show hints for variables with inferred types + + Some color scheme colors are being overridden by changes made in the Environment > Fonts and Colors options page. Choose `Use Defaults` in the Fonts and Colors page to revert all customizations. Bazı renk düzeni renkleri, Ortam > Yazı Tipleri ve Renkler seçenek sayfasında yapılan değişiklikler tarafından geçersiz kılınıyor. Tüm özelleştirmeleri geri döndürmek için Yazı Tipleri ve Renkler sayfasında `Varsayılanları Kullan` seçeneğini belirleyin. diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf index aebf4c0a3e88d..ee5483430bda7 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf @@ -182,6 +182,11 @@ 显示内联参数名称提示(实验)(_L) + + Display inline type hints + Display inline type hints + + _Edit 编辑(_E) @@ -782,11 +787,21 @@ Show hints for everything else + + Show hints for lambda parameter types + Show hints for lambda parameter types + + Show hints for literals Show hints for literals + + Show hints for variables with inferred types + Show hints for variables with inferred types + + Some color scheme colors are being overridden by changes made in the Environment > Fonts and Colors options page. Choose `Use Defaults` in the Fonts and Colors page to revert all customizations. 在“环境”>“字体和颜色”选项页中所做的更改将替代某些配色方案颜色。在“字体和颜色”页中选择“使用默认值”,还原所有自定义项。 diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf index 1a190de2af1fd..bfe09224de904 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf @@ -182,6 +182,11 @@ Disp_lay inline parameter name hints + + Display inline type hints + Display inline type hints + + _Edit 編輯(_E) @@ -782,11 +787,21 @@ Show hints for everything else + + Show hints for lambda parameter types + Show hints for lambda parameter types + + Show hints for literals Show hints for literals + + Show hints for variables with inferred types + Show hints for variables with inferred types + + Some color scheme colors are being overridden by changes made in the Environment > Fonts and Colors options page. Choose `Use Defaults` in the Fonts and Colors page to revert all customizations. [環境] > [字型和色彩選項] 頁面中所做的變更覆寫了某些色彩配置的色彩。請選擇 [字型和色彩] 頁面中的 [使用預設] 來還原所有自訂。 From 47047cc194c18e721f3ca9246e7844f57e9ff2ec Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Wed, 7 Oct 2020 18:40:34 -0700 Subject: [PATCH 208/295] Add timeout to IApexAsynchronousOperationListenerProviderAccessor.WaitAllAsync Closes #48423 --- .../Apex/ApexAsynchronousOperationListenerProviderAccessor.cs | 4 ++-- .../IApexAsynchronousOperationListenerProviderAccessor.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Tools/ExternalAccess/Apex/ApexAsynchronousOperationListenerProviderAccessor.cs b/src/Tools/ExternalAccess/Apex/ApexAsynchronousOperationListenerProviderAccessor.cs index d6b320613d5c0..d6de1909b8716 100644 --- a/src/Tools/ExternalAccess/Apex/ApexAsynchronousOperationListenerProviderAccessor.cs +++ b/src/Tools/ExternalAccess/Apex/ApexAsynchronousOperationListenerProviderAccessor.cs @@ -28,7 +28,7 @@ public ApexAsynchronousOperationListenerProviderAccessor( _workspace = workspace; } - public Task WaitAllAsync(string[]? featureNames = null, Action? eventProcessingAction = null) - => _implementation.WaitAllAsync(_workspace, featureNames, eventProcessingAction); + public Task WaitAllAsync(string[]? featureNames = null, Action? eventProcessingAction = null, TimeSpan? timeout = null) + => _implementation.WaitAllAsync(_workspace, featureNames, eventProcessingAction, timeout); } } diff --git a/src/Tools/ExternalAccess/Apex/IApexAsynchronousOperationListenerProviderAccessor.cs b/src/Tools/ExternalAccess/Apex/IApexAsynchronousOperationListenerProviderAccessor.cs index b79123e17a867..df11ab995f128 100644 --- a/src/Tools/ExternalAccess/Apex/IApexAsynchronousOperationListenerProviderAccessor.cs +++ b/src/Tools/ExternalAccess/Apex/IApexAsynchronousOperationListenerProviderAccessor.cs @@ -11,6 +11,6 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.Apex { internal interface IApexAsynchronousOperationListenerProviderAccessor { - Task WaitAllAsync(string[] featureNames = null, Action eventProcessingAction = null); + Task WaitAllAsync(string[] featureNames = null, Action eventProcessingAction = null, TimeSpan? timeout = null); } } From f21b5ea90bfb986565e34a84b296de75801ab98c Mon Sep 17 00:00:00 2001 From: Youssef Victor <31348972+Youssef1313@users.noreply.github.com> Date: Thu, 8 Oct 2020 04:33:41 +0200 Subject: [PATCH 209/295] Module constructors can't have accessibility modifiers (#48311) --- .../AddAccessibilityModifiersTests.vb | 11 +++++++++++ .../Services/SyntaxFacts/VisualBasicSyntaxFacts.vb | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Analyzers/VisualBasic/Tests/AddAccessibilityModifiers/AddAccessibilityModifiersTests.vb b/src/Analyzers/VisualBasic/Tests/AddAccessibilityModifiers/AddAccessibilityModifiersTests.vb index 10fdaf70469e4..e0286e76825ff 100644 --- a/src/Analyzers/VisualBasic/Tests/AddAccessibilityModifiers/AddAccessibilityModifiersTests.vb +++ b/src/Analyzers/VisualBasic/Tests/AddAccessibilityModifiers/AddAccessibilityModifiersTests.vb @@ -423,5 +423,16 @@ end namespace" Await test.RunAsync() End Function + + + Public Async Function TestModuleConstructor() As Task + Dim source = " +Friend Module Example + Sub New() + End Sub +End Module +" + Await VerifyVB.VerifyCodeFixAsync(source, source) + End Function End Class End Namespace diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/VisualBasic/Services/SyntaxFacts/VisualBasicSyntaxFacts.vb b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/VisualBasic/Services/SyntaxFacts/VisualBasicSyntaxFacts.vb index c41d4bfd09675..fcbfb8f67ec6e 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/VisualBasic/Services/SyntaxFacts/VisualBasicSyntaxFacts.vb +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/VisualBasic/Services/SyntaxFacts/VisualBasicSyntaxFacts.vb @@ -1988,7 +1988,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.LanguageServices Case SyntaxKind.ConstructorBlock, SyntaxKind.SubNewStatement ' Shared constructor cannot have modifiers in VB. - Return Not declaration.GetModifiers().Any(SyntaxKind.SharedKeyword) + ' Module constructors are implicitly Shared and can't have accessibility modifier. + Return Not declaration.GetModifiers().Any(SyntaxKind.SharedKeyword) AndAlso + Not declaration.Parent.IsKind(SyntaxKind.ModuleBlock) Case SyntaxKind.ModifiedIdentifier Return If(IsChildOf(declaration, SyntaxKind.VariableDeclarator), From fc05c12d94c55e23e88723f3be88647203f044d2 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 7 Oct 2020 19:56:04 -0700 Subject: [PATCH 210/295] revert --- Roslyn.sln | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Roslyn.sln b/Roslyn.sln index abe1a82b59ef5..7150215f42caf 100644 --- a/Roslyn.sln +++ b/Roslyn.sln @@ -1880,12 +1880,8 @@ Global {2801F82B-78CE-4BAE-B06F-537574751E2E}.Release|x86.Build.0 = Release|x86 {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|x86.ActiveCfg = Debug|Any CPU - {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|x86.Build.0 = Debug|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|Any CPU.ActiveCfg = Release|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|Any CPU.Build.0 = Release|Any CPU - {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|x86.ActiveCfg = Release|Any CPU - {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 60b0f4eaaf9280aceaa981b17cda5a6036682a09 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Thu, 8 Oct 2020 07:57:34 -0700 Subject: [PATCH 211/295] Remove the X86 platform from Roslyn.sln This platform is not used by the build. --- Roslyn.sln | 660 ----------------------------------------------------- 1 file changed, 660 deletions(-) diff --git a/Roslyn.sln b/Roslyn.sln index 7150215f42caf..9fecacb0a11f4 100644 --- a/Roslyn.sln +++ b/Roslyn.sln @@ -549,1335 +549,675 @@ Global EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU - Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU - Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {600AF682-E097-407B-AD85-EE3CED37E680}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {600AF682-E097-407B-AD85-EE3CED37E680}.Debug|Any CPU.Build.0 = Debug|Any CPU - {600AF682-E097-407B-AD85-EE3CED37E680}.Debug|x86.ActiveCfg = Debug|Any CPU - {600AF682-E097-407B-AD85-EE3CED37E680}.Debug|x86.Build.0 = Debug|Any CPU {600AF682-E097-407B-AD85-EE3CED37E680}.Release|Any CPU.ActiveCfg = Release|Any CPU {600AF682-E097-407B-AD85-EE3CED37E680}.Release|Any CPU.Build.0 = Release|Any CPU - {600AF682-E097-407B-AD85-EE3CED37E680}.Release|x86.ActiveCfg = Release|Any CPU - {600AF682-E097-407B-AD85-EE3CED37E680}.Release|x86.Build.0 = Release|Any CPU {A4C99B85-765C-4C65-9C2A-BB609AAB09E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A4C99B85-765C-4C65-9C2A-BB609AAB09E6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A4C99B85-765C-4C65-9C2A-BB609AAB09E6}.Debug|x86.ActiveCfg = Debug|Any CPU - {A4C99B85-765C-4C65-9C2A-BB609AAB09E6}.Debug|x86.Build.0 = Debug|Any CPU {A4C99B85-765C-4C65-9C2A-BB609AAB09E6}.Release|Any CPU.ActiveCfg = Release|Any CPU {A4C99B85-765C-4C65-9C2A-BB609AAB09E6}.Release|Any CPU.Build.0 = Release|Any CPU - {A4C99B85-765C-4C65-9C2A-BB609AAB09E6}.Release|x86.ActiveCfg = Release|Any CPU - {A4C99B85-765C-4C65-9C2A-BB609AAB09E6}.Release|x86.Build.0 = Release|Any CPU {1EE8CAD3-55F9-4D91-96B2-084641DA9A6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1EE8CAD3-55F9-4D91-96B2-084641DA9A6C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1EE8CAD3-55F9-4D91-96B2-084641DA9A6C}.Debug|x86.ActiveCfg = Debug|Any CPU - {1EE8CAD3-55F9-4D91-96B2-084641DA9A6C}.Debug|x86.Build.0 = Debug|Any CPU {1EE8CAD3-55F9-4D91-96B2-084641DA9A6C}.Release|Any CPU.ActiveCfg = Release|Any CPU {1EE8CAD3-55F9-4D91-96B2-084641DA9A6C}.Release|Any CPU.Build.0 = Release|Any CPU - {1EE8CAD3-55F9-4D91-96B2-084641DA9A6C}.Release|x86.ActiveCfg = Release|Any CPU - {1EE8CAD3-55F9-4D91-96B2-084641DA9A6C}.Release|x86.Build.0 = Release|Any CPU {9508F118-F62E-4C16-A6F4-7C3B56E166AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9508F118-F62E-4C16-A6F4-7C3B56E166AD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9508F118-F62E-4C16-A6F4-7C3B56E166AD}.Debug|x86.ActiveCfg = Debug|Any CPU - {9508F118-F62E-4C16-A6F4-7C3B56E166AD}.Debug|x86.Build.0 = Debug|Any CPU {9508F118-F62E-4C16-A6F4-7C3B56E166AD}.Release|Any CPU.ActiveCfg = Release|Any CPU {9508F118-F62E-4C16-A6F4-7C3B56E166AD}.Release|Any CPU.Build.0 = Release|Any CPU - {9508F118-F62E-4C16-A6F4-7C3B56E166AD}.Release|x86.ActiveCfg = Release|Any CPU - {9508F118-F62E-4C16-A6F4-7C3B56E166AD}.Release|x86.Build.0 = Release|Any CPU {F5CE416E-B906-41D2-80B9-0078E887A3F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F5CE416E-B906-41D2-80B9-0078E887A3F6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F5CE416E-B906-41D2-80B9-0078E887A3F6}.Debug|x86.ActiveCfg = Debug|Any CPU - {F5CE416E-B906-41D2-80B9-0078E887A3F6}.Debug|x86.Build.0 = Debug|Any CPU {F5CE416E-B906-41D2-80B9-0078E887A3F6}.Release|Any CPU.ActiveCfg = Release|Any CPU {F5CE416E-B906-41D2-80B9-0078E887A3F6}.Release|Any CPU.Build.0 = Release|Any CPU - {F5CE416E-B906-41D2-80B9-0078E887A3F6}.Release|x86.ActiveCfg = Release|Any CPU - {F5CE416E-B906-41D2-80B9-0078E887A3F6}.Release|x86.Build.0 = Release|Any CPU {4B45CA0C-03A0-400F-B454-3D4BCB16AF38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4B45CA0C-03A0-400F-B454-3D4BCB16AF38}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4B45CA0C-03A0-400F-B454-3D4BCB16AF38}.Debug|x86.ActiveCfg = Debug|Any CPU - {4B45CA0C-03A0-400F-B454-3D4BCB16AF38}.Debug|x86.Build.0 = Debug|Any CPU {4B45CA0C-03A0-400F-B454-3D4BCB16AF38}.Release|Any CPU.ActiveCfg = Release|Any CPU {4B45CA0C-03A0-400F-B454-3D4BCB16AF38}.Release|Any CPU.Build.0 = Release|Any CPU - {4B45CA0C-03A0-400F-B454-3D4BCB16AF38}.Release|x86.ActiveCfg = Release|Any CPU - {4B45CA0C-03A0-400F-B454-3D4BCB16AF38}.Release|x86.Build.0 = Release|Any CPU {B501A547-C911-4A05-AC6E-274A50DFF30E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B501A547-C911-4A05-AC6E-274A50DFF30E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B501A547-C911-4A05-AC6E-274A50DFF30E}.Debug|x86.ActiveCfg = Debug|Any CPU - {B501A547-C911-4A05-AC6E-274A50DFF30E}.Debug|x86.Build.0 = Debug|Any CPU {B501A547-C911-4A05-AC6E-274A50DFF30E}.Release|Any CPU.ActiveCfg = Release|Any CPU {B501A547-C911-4A05-AC6E-274A50DFF30E}.Release|Any CPU.Build.0 = Release|Any CPU - {B501A547-C911-4A05-AC6E-274A50DFF30E}.Release|x86.ActiveCfg = Release|Any CPU - {B501A547-C911-4A05-AC6E-274A50DFF30E}.Release|x86.Build.0 = Release|Any CPU {50D26304-0961-4A51-ABF6-6CAD1A56D203}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {50D26304-0961-4A51-ABF6-6CAD1A56D203}.Debug|Any CPU.Build.0 = Debug|Any CPU - {50D26304-0961-4A51-ABF6-6CAD1A56D203}.Debug|x86.ActiveCfg = Debug|Any CPU - {50D26304-0961-4A51-ABF6-6CAD1A56D203}.Debug|x86.Build.0 = Debug|Any CPU {50D26304-0961-4A51-ABF6-6CAD1A56D203}.Release|Any CPU.ActiveCfg = Release|Any CPU {50D26304-0961-4A51-ABF6-6CAD1A56D203}.Release|Any CPU.Build.0 = Release|Any CPU - {50D26304-0961-4A51-ABF6-6CAD1A56D203}.Release|x86.ActiveCfg = Release|Any CPU - {50D26304-0961-4A51-ABF6-6CAD1A56D203}.Release|x86.Build.0 = Release|Any CPU {4462B57A-7245-4146-B504-D46FDE762948}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4462B57A-7245-4146-B504-D46FDE762948}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4462B57A-7245-4146-B504-D46FDE762948}.Debug|x86.ActiveCfg = Debug|Any CPU - {4462B57A-7245-4146-B504-D46FDE762948}.Debug|x86.Build.0 = Debug|Any CPU {4462B57A-7245-4146-B504-D46FDE762948}.Release|Any CPU.ActiveCfg = Release|Any CPU {4462B57A-7245-4146-B504-D46FDE762948}.Release|Any CPU.Build.0 = Release|Any CPU - {4462B57A-7245-4146-B504-D46FDE762948}.Release|x86.ActiveCfg = Release|Any CPU - {4462B57A-7245-4146-B504-D46FDE762948}.Release|x86.Build.0 = Release|Any CPU {1AF3672A-C5F1-4604-B6AB-D98C4DE9C3B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1AF3672A-C5F1-4604-B6AB-D98C4DE9C3B1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1AF3672A-C5F1-4604-B6AB-D98C4DE9C3B1}.Debug|x86.ActiveCfg = Debug|Any CPU - {1AF3672A-C5F1-4604-B6AB-D98C4DE9C3B1}.Debug|x86.Build.0 = Debug|Any CPU {1AF3672A-C5F1-4604-B6AB-D98C4DE9C3B1}.Release|Any CPU.ActiveCfg = Release|Any CPU {1AF3672A-C5F1-4604-B6AB-D98C4DE9C3B1}.Release|Any CPU.Build.0 = Release|Any CPU - {1AF3672A-C5F1-4604-B6AB-D98C4DE9C3B1}.Release|x86.ActiveCfg = Release|Any CPU - {1AF3672A-C5F1-4604-B6AB-D98C4DE9C3B1}.Release|x86.Build.0 = Release|Any CPU {B2C33A93-DB30-4099-903E-77D75C4C3F45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B2C33A93-DB30-4099-903E-77D75C4C3F45}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B2C33A93-DB30-4099-903E-77D75C4C3F45}.Debug|x86.ActiveCfg = Debug|Any CPU - {B2C33A93-DB30-4099-903E-77D75C4C3F45}.Debug|x86.Build.0 = Debug|Any CPU {B2C33A93-DB30-4099-903E-77D75C4C3F45}.Release|Any CPU.ActiveCfg = Release|Any CPU {B2C33A93-DB30-4099-903E-77D75C4C3F45}.Release|Any CPU.Build.0 = Release|Any CPU - {B2C33A93-DB30-4099-903E-77D75C4C3F45}.Release|x86.ActiveCfg = Release|Any CPU - {B2C33A93-DB30-4099-903E-77D75C4C3F45}.Release|x86.Build.0 = Release|Any CPU {28026D16-EB0C-40B0-BDA7-11CAA2B97CCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {28026D16-EB0C-40B0-BDA7-11CAA2B97CCC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {28026D16-EB0C-40B0-BDA7-11CAA2B97CCC}.Debug|x86.ActiveCfg = Debug|Any CPU - {28026D16-EB0C-40B0-BDA7-11CAA2B97CCC}.Debug|x86.Build.0 = Debug|Any CPU {28026D16-EB0C-40B0-BDA7-11CAA2B97CCC}.Release|Any CPU.ActiveCfg = Release|Any CPU {28026D16-EB0C-40B0-BDA7-11CAA2B97CCC}.Release|Any CPU.Build.0 = Release|Any CPU - {28026D16-EB0C-40B0-BDA7-11CAA2B97CCC}.Release|x86.ActiveCfg = Release|Any CPU - {28026D16-EB0C-40B0-BDA7-11CAA2B97CCC}.Release|x86.Build.0 = Release|Any CPU {50D26304-0961-4A51-ABF6-6CAD1A56D202}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {50D26304-0961-4A51-ABF6-6CAD1A56D202}.Debug|Any CPU.Build.0 = Debug|Any CPU - {50D26304-0961-4A51-ABF6-6CAD1A56D202}.Debug|x86.ActiveCfg = Debug|Any CPU - {50D26304-0961-4A51-ABF6-6CAD1A56D202}.Debug|x86.Build.0 = Debug|Any CPU {50D26304-0961-4A51-ABF6-6CAD1A56D202}.Release|Any CPU.ActiveCfg = Release|Any CPU {50D26304-0961-4A51-ABF6-6CAD1A56D202}.Release|Any CPU.Build.0 = Release|Any CPU - {50D26304-0961-4A51-ABF6-6CAD1A56D202}.Release|x86.ActiveCfg = Release|Any CPU - {50D26304-0961-4A51-ABF6-6CAD1A56D202}.Release|x86.Build.0 = Release|Any CPU {7FE6B002-89D8-4298-9B1B-0B5C247DD1FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7FE6B002-89D8-4298-9B1B-0B5C247DD1FD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7FE6B002-89D8-4298-9B1B-0B5C247DD1FD}.Debug|x86.ActiveCfg = Debug|Any CPU - {7FE6B002-89D8-4298-9B1B-0B5C247DD1FD}.Debug|x86.Build.0 = Debug|Any CPU {7FE6B002-89D8-4298-9B1B-0B5C247DD1FD}.Release|Any CPU.ActiveCfg = Release|Any CPU {7FE6B002-89D8-4298-9B1B-0B5C247DD1FD}.Release|Any CPU.Build.0 = Release|Any CPU - {7FE6B002-89D8-4298-9B1B-0B5C247DD1FD}.Release|x86.ActiveCfg = Release|Any CPU - {7FE6B002-89D8-4298-9B1B-0B5C247DD1FD}.Release|x86.Build.0 = Release|Any CPU {4371944A-D3BA-4B5B-8285-82E5FFC6D1F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4371944A-D3BA-4B5B-8285-82E5FFC6D1F9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4371944A-D3BA-4B5B-8285-82E5FFC6D1F9}.Debug|x86.ActiveCfg = Debug|Any CPU - {4371944A-D3BA-4B5B-8285-82E5FFC6D1F9}.Debug|x86.Build.0 = Debug|Any CPU {4371944A-D3BA-4B5B-8285-82E5FFC6D1F9}.Release|Any CPU.ActiveCfg = Release|Any CPU {4371944A-D3BA-4B5B-8285-82E5FFC6D1F9}.Release|Any CPU.Build.0 = Release|Any CPU - {4371944A-D3BA-4B5B-8285-82E5FFC6D1F9}.Release|x86.ActiveCfg = Release|Any CPU - {4371944A-D3BA-4B5B-8285-82E5FFC6D1F9}.Release|x86.Build.0 = Release|Any CPU {4371944A-D3BA-4B5B-8285-82E5FFC6D1F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4371944A-D3BA-4B5B-8285-82E5FFC6D1F8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4371944A-D3BA-4B5B-8285-82E5FFC6D1F8}.Debug|x86.ActiveCfg = Debug|Any CPU - {4371944A-D3BA-4B5B-8285-82E5FFC6D1F8}.Debug|x86.Build.0 = Debug|Any CPU {4371944A-D3BA-4B5B-8285-82E5FFC6D1F8}.Release|Any CPU.ActiveCfg = Release|Any CPU {4371944A-D3BA-4B5B-8285-82E5FFC6D1F8}.Release|Any CPU.Build.0 = Release|Any CPU - {4371944A-D3BA-4B5B-8285-82E5FFC6D1F8}.Release|x86.ActiveCfg = Release|Any CPU - {4371944A-D3BA-4B5B-8285-82E5FFC6D1F8}.Release|x86.Build.0 = Release|Any CPU {2523D0E6-DF32-4A3E-8AE0-A19BFFAE2EF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2523D0E6-DF32-4A3E-8AE0-A19BFFAE2EF6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2523D0E6-DF32-4A3E-8AE0-A19BFFAE2EF6}.Debug|x86.ActiveCfg = Debug|Any CPU - {2523D0E6-DF32-4A3E-8AE0-A19BFFAE2EF6}.Debug|x86.Build.0 = Debug|Any CPU {2523D0E6-DF32-4A3E-8AE0-A19BFFAE2EF6}.Release|Any CPU.ActiveCfg = Release|Any CPU {2523D0E6-DF32-4A3E-8AE0-A19BFFAE2EF6}.Release|Any CPU.Build.0 = Release|Any CPU - {2523D0E6-DF32-4A3E-8AE0-A19BFFAE2EF6}.Release|x86.ActiveCfg = Release|Any CPU - {2523D0E6-DF32-4A3E-8AE0-A19BFFAE2EF6}.Release|x86.Build.0 = Release|Any CPU {E3B32027-3362-41DF-9172-4D3B623F42A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E3B32027-3362-41DF-9172-4D3B623F42A5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E3B32027-3362-41DF-9172-4D3B623F42A5}.Debug|x86.ActiveCfg = Debug|Any CPU - {E3B32027-3362-41DF-9172-4D3B623F42A5}.Debug|x86.Build.0 = Debug|Any CPU {E3B32027-3362-41DF-9172-4D3B623F42A5}.Release|Any CPU.ActiveCfg = Release|Any CPU {E3B32027-3362-41DF-9172-4D3B623F42A5}.Release|Any CPU.Build.0 = Release|Any CPU - {E3B32027-3362-41DF-9172-4D3B623F42A5}.Release|x86.ActiveCfg = Release|Any CPU - {E3B32027-3362-41DF-9172-4D3B623F42A5}.Release|x86.Build.0 = Release|Any CPU {190CE348-596E-435A-9E5B-12A689F9FC29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {190CE348-596E-435A-9E5B-12A689F9FC29}.Debug|Any CPU.Build.0 = Debug|Any CPU - {190CE348-596E-435A-9E5B-12A689F9FC29}.Debug|x86.ActiveCfg = Debug|Any CPU - {190CE348-596E-435A-9E5B-12A689F9FC29}.Debug|x86.Build.0 = Debug|Any CPU {190CE348-596E-435A-9E5B-12A689F9FC29}.Release|Any CPU.ActiveCfg = Release|Any CPU {190CE348-596E-435A-9E5B-12A689F9FC29}.Release|Any CPU.Build.0 = Release|Any CPU - {190CE348-596E-435A-9E5B-12A689F9FC29}.Release|x86.ActiveCfg = Release|Any CPU - {190CE348-596E-435A-9E5B-12A689F9FC29}.Release|x86.Build.0 = Release|Any CPU {9C9DABA4-0E72-4469-ADF1-4991F3CA572A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9C9DABA4-0E72-4469-ADF1-4991F3CA572A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9C9DABA4-0E72-4469-ADF1-4991F3CA572A}.Debug|x86.ActiveCfg = Debug|Any CPU - {9C9DABA4-0E72-4469-ADF1-4991F3CA572A}.Debug|x86.Build.0 = Debug|Any CPU {9C9DABA4-0E72-4469-ADF1-4991F3CA572A}.Release|Any CPU.ActiveCfg = Release|Any CPU {9C9DABA4-0E72-4469-ADF1-4991F3CA572A}.Release|Any CPU.Build.0 = Release|Any CPU - {9C9DABA4-0E72-4469-ADF1-4991F3CA572A}.Release|x86.ActiveCfg = Release|Any CPU - {9C9DABA4-0E72-4469-ADF1-4991F3CA572A}.Release|x86.Build.0 = Release|Any CPU {BF180BD2-4FB7-4252-A7EC-A00E0C7A028A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BF180BD2-4FB7-4252-A7EC-A00E0C7A028A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BF180BD2-4FB7-4252-A7EC-A00E0C7A028A}.Debug|x86.ActiveCfg = Debug|Any CPU - {BF180BD2-4FB7-4252-A7EC-A00E0C7A028A}.Debug|x86.Build.0 = Debug|Any CPU {BF180BD2-4FB7-4252-A7EC-A00E0C7A028A}.Release|Any CPU.ActiveCfg = Release|Any CPU {BF180BD2-4FB7-4252-A7EC-A00E0C7A028A}.Release|Any CPU.Build.0 = Release|Any CPU - {BF180BD2-4FB7-4252-A7EC-A00E0C7A028A}.Release|x86.ActiveCfg = Release|Any CPU - {BF180BD2-4FB7-4252-A7EC-A00E0C7A028A}.Release|x86.Build.0 = Release|Any CPU {BDA5D613-596D-4B61-837C-63554151C8F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BDA5D613-596D-4B61-837C-63554151C8F5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BDA5D613-596D-4B61-837C-63554151C8F5}.Debug|x86.ActiveCfg = Debug|Any CPU - {BDA5D613-596D-4B61-837C-63554151C8F5}.Debug|x86.Build.0 = Debug|Any CPU {BDA5D613-596D-4B61-837C-63554151C8F5}.Release|Any CPU.ActiveCfg = Release|Any CPU {BDA5D613-596D-4B61-837C-63554151C8F5}.Release|Any CPU.Build.0 = Release|Any CPU - {BDA5D613-596D-4B61-837C-63554151C8F5}.Release|x86.ActiveCfg = Release|Any CPU - {BDA5D613-596D-4B61-837C-63554151C8F5}.Release|x86.Build.0 = Release|Any CPU {91F6F646-4F6E-449A-9AB4-2986348F329D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {91F6F646-4F6E-449A-9AB4-2986348F329D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {91F6F646-4F6E-449A-9AB4-2986348F329D}.Debug|x86.ActiveCfg = Debug|Any CPU - {91F6F646-4F6E-449A-9AB4-2986348F329D}.Debug|x86.Build.0 = Debug|Any CPU {91F6F646-4F6E-449A-9AB4-2986348F329D}.Release|Any CPU.ActiveCfg = Release|Any CPU {91F6F646-4F6E-449A-9AB4-2986348F329D}.Release|Any CPU.Build.0 = Release|Any CPU - {91F6F646-4F6E-449A-9AB4-2986348F329D}.Release|x86.ActiveCfg = Release|Any CPU - {91F6F646-4F6E-449A-9AB4-2986348F329D}.Release|x86.Build.0 = Release|Any CPU {AFDE6BEA-5038-4A4A-A88E-DBD2E4088EED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AFDE6BEA-5038-4A4A-A88E-DBD2E4088EED}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AFDE6BEA-5038-4A4A-A88E-DBD2E4088EED}.Debug|x86.ActiveCfg = Debug|Any CPU - {AFDE6BEA-5038-4A4A-A88E-DBD2E4088EED}.Debug|x86.Build.0 = Debug|Any CPU {AFDE6BEA-5038-4A4A-A88E-DBD2E4088EED}.Release|Any CPU.ActiveCfg = Release|Any CPU {AFDE6BEA-5038-4A4A-A88E-DBD2E4088EED}.Release|Any CPU.Build.0 = Release|Any CPU - {AFDE6BEA-5038-4A4A-A88E-DBD2E4088EED}.Release|x86.ActiveCfg = Release|Any CPU - {AFDE6BEA-5038-4A4A-A88E-DBD2E4088EED}.Release|x86.Build.0 = Release|Any CPU {5F8D2414-064A-4B3A-9B42-8E2A04246BE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5F8D2414-064A-4B3A-9B42-8E2A04246BE5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5F8D2414-064A-4B3A-9B42-8E2A04246BE5}.Debug|x86.ActiveCfg = Debug|Any CPU - {5F8D2414-064A-4B3A-9B42-8E2A04246BE5}.Debug|x86.Build.0 = Debug|Any CPU {5F8D2414-064A-4B3A-9B42-8E2A04246BE5}.Release|Any CPU.ActiveCfg = Release|Any CPU {5F8D2414-064A-4B3A-9B42-8E2A04246BE5}.Release|Any CPU.Build.0 = Release|Any CPU - {5F8D2414-064A-4B3A-9B42-8E2A04246BE5}.Release|x86.ActiveCfg = Release|Any CPU - {5F8D2414-064A-4B3A-9B42-8E2A04246BE5}.Release|x86.Build.0 = Release|Any CPU {02459936-CD2C-4F61-B671-5C518F2A3DDC}.Debug|Any CPU.ActiveCfg = Debug|x64 {02459936-CD2C-4F61-B671-5C518F2A3DDC}.Debug|Any CPU.Build.0 = Debug|x64 - {02459936-CD2C-4F61-B671-5C518F2A3DDC}.Debug|x86.ActiveCfg = Debug|x64 {02459936-CD2C-4F61-B671-5C518F2A3DDC}.Release|Any CPU.ActiveCfg = Release|x64 {02459936-CD2C-4F61-B671-5C518F2A3DDC}.Release|Any CPU.Build.0 = Release|x64 - {02459936-CD2C-4F61-B671-5C518F2A3DDC}.Release|x86.ActiveCfg = Release|x64 {288089C5-8721-458E-BE3E-78990DAB5E2E}.Debug|Any CPU.ActiveCfg = Debug|x64 {288089C5-8721-458E-BE3E-78990DAB5E2E}.Debug|Any CPU.Build.0 = Debug|x64 - {288089C5-8721-458E-BE3E-78990DAB5E2E}.Debug|x86.ActiveCfg = Debug|x64 {288089C5-8721-458E-BE3E-78990DAB5E2E}.Release|Any CPU.ActiveCfg = Release|x64 {288089C5-8721-458E-BE3E-78990DAB5E2E}.Release|Any CPU.Build.0 = Release|x64 - {288089C5-8721-458E-BE3E-78990DAB5E2E}.Release|x86.ActiveCfg = Release|x64 {288089C5-8721-458E-BE3E-78990DAB5E2D}.Debug|Any CPU.ActiveCfg = Debug|x64 {288089C5-8721-458E-BE3E-78990DAB5E2D}.Debug|Any CPU.Build.0 = Debug|x64 - {288089C5-8721-458E-BE3E-78990DAB5E2D}.Debug|x86.ActiveCfg = Debug|x64 {288089C5-8721-458E-BE3E-78990DAB5E2D}.Release|Any CPU.ActiveCfg = Release|x64 {288089C5-8721-458E-BE3E-78990DAB5E2D}.Release|Any CPU.Build.0 = Release|x64 - {288089C5-8721-458E-BE3E-78990DAB5E2D}.Release|x86.ActiveCfg = Release|x64 {6AA96934-D6B7-4CC8-990D-DB6B9DD56E34}.Debug|Any CPU.ActiveCfg = Debug|x64 {6AA96934-D6B7-4CC8-990D-DB6B9DD56E34}.Debug|Any CPU.Build.0 = Debug|x64 - {6AA96934-D6B7-4CC8-990D-DB6B9DD56E34}.Debug|x86.ActiveCfg = Debug|x64 {6AA96934-D6B7-4CC8-990D-DB6B9DD56E34}.Release|Any CPU.ActiveCfg = Release|x64 {6AA96934-D6B7-4CC8-990D-DB6B9DD56E34}.Release|Any CPU.Build.0 = Release|x64 - {6AA96934-D6B7-4CC8-990D-DB6B9DD56E34}.Release|x86.ActiveCfg = Release|x64 {C50166F1-BABC-40A9-95EB-8200080CD701}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C50166F1-BABC-40A9-95EB-8200080CD701}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C50166F1-BABC-40A9-95EB-8200080CD701}.Debug|x86.ActiveCfg = Debug|Any CPU - {C50166F1-BABC-40A9-95EB-8200080CD701}.Debug|x86.Build.0 = Debug|Any CPU {C50166F1-BABC-40A9-95EB-8200080CD701}.Release|Any CPU.ActiveCfg = Release|Any CPU {C50166F1-BABC-40A9-95EB-8200080CD701}.Release|Any CPU.Build.0 = Release|Any CPU - {C50166F1-BABC-40A9-95EB-8200080CD701}.Release|x86.ActiveCfg = Release|Any CPU - {C50166F1-BABC-40A9-95EB-8200080CD701}.Release|x86.Build.0 = Release|Any CPU {E195A63F-B5A4-4C5A-96BD-8E7ED6A181B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E195A63F-B5A4-4C5A-96BD-8E7ED6A181B7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E195A63F-B5A4-4C5A-96BD-8E7ED6A181B7}.Debug|x86.ActiveCfg = Debug|Any CPU - {E195A63F-B5A4-4C5A-96BD-8E7ED6A181B7}.Debug|x86.Build.0 = Debug|Any CPU {E195A63F-B5A4-4C5A-96BD-8E7ED6A181B7}.Release|Any CPU.ActiveCfg = Release|Any CPU {E195A63F-B5A4-4C5A-96BD-8E7ED6A181B7}.Release|Any CPU.Build.0 = Release|Any CPU - {E195A63F-B5A4-4C5A-96BD-8E7ED6A181B7}.Release|x86.ActiveCfg = Release|Any CPU - {E195A63F-B5A4-4C5A-96BD-8E7ED6A181B7}.Release|x86.Build.0 = Release|Any CPU {E3FDC65F-568D-4E2D-A093-5132FD3793B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E3FDC65F-568D-4E2D-A093-5132FD3793B7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E3FDC65F-568D-4E2D-A093-5132FD3793B7}.Debug|x86.ActiveCfg = Debug|Any CPU - {E3FDC65F-568D-4E2D-A093-5132FD3793B7}.Debug|x86.Build.0 = Debug|Any CPU {E3FDC65F-568D-4E2D-A093-5132FD3793B7}.Release|Any CPU.ActiveCfg = Release|Any CPU {E3FDC65F-568D-4E2D-A093-5132FD3793B7}.Release|Any CPU.Build.0 = Release|Any CPU - {E3FDC65F-568D-4E2D-A093-5132FD3793B7}.Release|x86.ActiveCfg = Release|Any CPU - {E3FDC65F-568D-4E2D-A093-5132FD3793B7}.Release|x86.Build.0 = Release|Any CPU {909B656F-6095-4AC2-A5AB-C3F032315C45}.Debug|Any CPU.ActiveCfg = Debug|x64 {909B656F-6095-4AC2-A5AB-C3F032315C45}.Debug|Any CPU.Build.0 = Debug|x64 - {909B656F-6095-4AC2-A5AB-C3F032315C45}.Debug|x86.ActiveCfg = Debug|x64 {909B656F-6095-4AC2-A5AB-C3F032315C45}.Release|Any CPU.ActiveCfg = Release|x64 {909B656F-6095-4AC2-A5AB-C3F032315C45}.Release|Any CPU.Build.0 = Release|x64 - {909B656F-6095-4AC2-A5AB-C3F032315C45}.Release|x86.ActiveCfg = Release|x64 {2E87FA96-50BB-4607-8676-46521599F998}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2E87FA96-50BB-4607-8676-46521599F998}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2E87FA96-50BB-4607-8676-46521599F998}.Debug|x86.ActiveCfg = Debug|Any CPU - {2E87FA96-50BB-4607-8676-46521599F998}.Debug|x86.Build.0 = Debug|Any CPU {2E87FA96-50BB-4607-8676-46521599F998}.Release|Any CPU.ActiveCfg = Release|Any CPU {2E87FA96-50BB-4607-8676-46521599F998}.Release|Any CPU.Build.0 = Release|Any CPU - {2E87FA96-50BB-4607-8676-46521599F998}.Release|x86.ActiveCfg = Release|Any CPU - {2E87FA96-50BB-4607-8676-46521599F998}.Release|x86.Build.0 = Release|Any CPU {96EB2D3B-F694-48C6-A284-67382841E086}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {96EB2D3B-F694-48C6-A284-67382841E086}.Debug|Any CPU.Build.0 = Debug|Any CPU - {96EB2D3B-F694-48C6-A284-67382841E086}.Debug|x86.ActiveCfg = Debug|Any CPU - {96EB2D3B-F694-48C6-A284-67382841E086}.Debug|x86.Build.0 = Debug|Any CPU {96EB2D3B-F694-48C6-A284-67382841E086}.Release|Any CPU.ActiveCfg = Release|Any CPU {96EB2D3B-F694-48C6-A284-67382841E086}.Release|Any CPU.Build.0 = Release|Any CPU - {96EB2D3B-F694-48C6-A284-67382841E086}.Release|x86.ActiveCfg = Release|Any CPU - {96EB2D3B-F694-48C6-A284-67382841E086}.Release|x86.Build.0 = Release|Any CPU {21B239D0-D144-430F-A394-C066D58EE267}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {21B239D0-D144-430F-A394-C066D58EE267}.Debug|Any CPU.Build.0 = Debug|Any CPU - {21B239D0-D144-430F-A394-C066D58EE267}.Debug|x86.ActiveCfg = Debug|Any CPU - {21B239D0-D144-430F-A394-C066D58EE267}.Debug|x86.Build.0 = Debug|Any CPU {21B239D0-D144-430F-A394-C066D58EE267}.Release|Any CPU.ActiveCfg = Release|Any CPU {21B239D0-D144-430F-A394-C066D58EE267}.Release|Any CPU.Build.0 = Release|Any CPU - {21B239D0-D144-430F-A394-C066D58EE267}.Release|x86.ActiveCfg = Release|Any CPU - {21B239D0-D144-430F-A394-C066D58EE267}.Release|x86.Build.0 = Release|Any CPU {57CA988D-F010-4BF2-9A2E-07D6DCD2FF2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {57CA988D-F010-4BF2-9A2E-07D6DCD2FF2C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {57CA988D-F010-4BF2-9A2E-07D6DCD2FF2C}.Debug|x86.ActiveCfg = Debug|Any CPU - {57CA988D-F010-4BF2-9A2E-07D6DCD2FF2C}.Debug|x86.Build.0 = Debug|Any CPU {57CA988D-F010-4BF2-9A2E-07D6DCD2FF2C}.Release|Any CPU.ActiveCfg = Release|Any CPU {57CA988D-F010-4BF2-9A2E-07D6DCD2FF2C}.Release|Any CPU.Build.0 = Release|Any CPU - {57CA988D-F010-4BF2-9A2E-07D6DCD2FF2C}.Release|x86.ActiveCfg = Release|Any CPU - {57CA988D-F010-4BF2-9A2E-07D6DCD2FF2C}.Release|x86.Build.0 = Release|Any CPU {1A3941F1-1E1F-4EF7-8064-7729C4C2E2AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1A3941F1-1E1F-4EF7-8064-7729C4C2E2AA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1A3941F1-1E1F-4EF7-8064-7729C4C2E2AA}.Debug|x86.ActiveCfg = Debug|Any CPU - {1A3941F1-1E1F-4EF7-8064-7729C4C2E2AA}.Debug|x86.Build.0 = Debug|Any CPU {1A3941F1-1E1F-4EF7-8064-7729C4C2E2AA}.Release|Any CPU.ActiveCfg = Release|Any CPU {1A3941F1-1E1F-4EF7-8064-7729C4C2E2AA}.Release|Any CPU.Build.0 = Release|Any CPU - {1A3941F1-1E1F-4EF7-8064-7729C4C2E2AA}.Release|x86.ActiveCfg = Release|Any CPU - {1A3941F1-1E1F-4EF7-8064-7729C4C2E2AA}.Release|x86.Build.0 = Release|Any CPU {A1BCD0CE-6C2F-4F8C-9A48-D9D93928E26D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A1BCD0CE-6C2F-4F8C-9A48-D9D93928E26D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A1BCD0CE-6C2F-4F8C-9A48-D9D93928E26D}.Debug|x86.ActiveCfg = Debug|Any CPU - {A1BCD0CE-6C2F-4F8C-9A48-D9D93928E26D}.Debug|x86.Build.0 = Debug|Any CPU {A1BCD0CE-6C2F-4F8C-9A48-D9D93928E26D}.Release|Any CPU.ActiveCfg = Release|Any CPU {A1BCD0CE-6C2F-4F8C-9A48-D9D93928E26D}.Release|Any CPU.Build.0 = Release|Any CPU - {A1BCD0CE-6C2F-4F8C-9A48-D9D93928E26D}.Release|x86.ActiveCfg = Release|Any CPU - {A1BCD0CE-6C2F-4F8C-9A48-D9D93928E26D}.Release|x86.Build.0 = Release|Any CPU {3973B09A-4FBF-44A5-8359-3D22CEB71F71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3973B09A-4FBF-44A5-8359-3D22CEB71F71}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3973B09A-4FBF-44A5-8359-3D22CEB71F71}.Debug|x86.ActiveCfg = Debug|Any CPU - {3973B09A-4FBF-44A5-8359-3D22CEB71F71}.Debug|x86.Build.0 = Debug|Any CPU {3973B09A-4FBF-44A5-8359-3D22CEB71F71}.Release|Any CPU.ActiveCfg = Release|Any CPU {3973B09A-4FBF-44A5-8359-3D22CEB71F71}.Release|Any CPU.Build.0 = Release|Any CPU - {3973B09A-4FBF-44A5-8359-3D22CEB71F71}.Release|x86.ActiveCfg = Release|Any CPU - {3973B09A-4FBF-44A5-8359-3D22CEB71F71}.Release|x86.Build.0 = Release|Any CPU {EDC68A0E-C68D-4A74-91B7-BF38EC909888}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EDC68A0E-C68D-4A74-91B7-BF38EC909888}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EDC68A0E-C68D-4A74-91B7-BF38EC909888}.Debug|x86.ActiveCfg = Debug|Any CPU - {EDC68A0E-C68D-4A74-91B7-BF38EC909888}.Debug|x86.Build.0 = Debug|Any CPU {EDC68A0E-C68D-4A74-91B7-BF38EC909888}.Release|Any CPU.ActiveCfg = Release|Any CPU {EDC68A0E-C68D-4A74-91B7-BF38EC909888}.Release|Any CPU.Build.0 = Release|Any CPU - {EDC68A0E-C68D-4A74-91B7-BF38EC909888}.Release|x86.ActiveCfg = Release|Any CPU - {EDC68A0E-C68D-4A74-91B7-BF38EC909888}.Release|x86.Build.0 = Release|Any CPU {18F5FBB8-7570-4412-8CC7-0A86FF13B7BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {18F5FBB8-7570-4412-8CC7-0A86FF13B7BA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {18F5FBB8-7570-4412-8CC7-0A86FF13B7BA}.Debug|x86.ActiveCfg = Debug|Any CPU - {18F5FBB8-7570-4412-8CC7-0A86FF13B7BA}.Debug|x86.Build.0 = Debug|Any CPU {18F5FBB8-7570-4412-8CC7-0A86FF13B7BA}.Release|Any CPU.ActiveCfg = Release|Any CPU {18F5FBB8-7570-4412-8CC7-0A86FF13B7BA}.Release|Any CPU.Build.0 = Release|Any CPU - {18F5FBB8-7570-4412-8CC7-0A86FF13B7BA}.Release|x86.ActiveCfg = Release|Any CPU - {18F5FBB8-7570-4412-8CC7-0A86FF13B7BA}.Release|x86.Build.0 = Release|Any CPU {49BFAE50-1BCE-48AE-BC89-78B7D90A3ECD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {49BFAE50-1BCE-48AE-BC89-78B7D90A3ECD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {49BFAE50-1BCE-48AE-BC89-78B7D90A3ECD}.Debug|x86.ActiveCfg = Debug|Any CPU - {49BFAE50-1BCE-48AE-BC89-78B7D90A3ECD}.Debug|x86.Build.0 = Debug|Any CPU {49BFAE50-1BCE-48AE-BC89-78B7D90A3ECD}.Release|Any CPU.ActiveCfg = Release|Any CPU {49BFAE50-1BCE-48AE-BC89-78B7D90A3ECD}.Release|Any CPU.Build.0 = Release|Any CPU - {49BFAE50-1BCE-48AE-BC89-78B7D90A3ECD}.Release|x86.ActiveCfg = Release|Any CPU - {49BFAE50-1BCE-48AE-BC89-78B7D90A3ECD}.Release|x86.Build.0 = Release|Any CPU {B0CE9307-FFDB-4838-A5EC-CE1F7CDC4AC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B0CE9307-FFDB-4838-A5EC-CE1F7CDC4AC2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B0CE9307-FFDB-4838-A5EC-CE1F7CDC4AC2}.Debug|x86.ActiveCfg = Debug|Any CPU - {B0CE9307-FFDB-4838-A5EC-CE1F7CDC4AC2}.Debug|x86.Build.0 = Debug|Any CPU {B0CE9307-FFDB-4838-A5EC-CE1F7CDC4AC2}.Release|Any CPU.ActiveCfg = Release|Any CPU {B0CE9307-FFDB-4838-A5EC-CE1F7CDC4AC2}.Release|Any CPU.Build.0 = Release|Any CPU - {B0CE9307-FFDB-4838-A5EC-CE1F7CDC4AC2}.Release|x86.ActiveCfg = Release|Any CPU - {B0CE9307-FFDB-4838-A5EC-CE1F7CDC4AC2}.Release|x86.Build.0 = Release|Any CPU {3CDEEAB7-2256-418A-BEB2-620B5CB16302}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3CDEEAB7-2256-418A-BEB2-620B5CB16302}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3CDEEAB7-2256-418A-BEB2-620B5CB16302}.Debug|x86.ActiveCfg = Debug|Any CPU - {3CDEEAB7-2256-418A-BEB2-620B5CB16302}.Debug|x86.Build.0 = Debug|Any CPU {3CDEEAB7-2256-418A-BEB2-620B5CB16302}.Release|Any CPU.ActiveCfg = Release|Any CPU {3CDEEAB7-2256-418A-BEB2-620B5CB16302}.Release|Any CPU.Build.0 = Release|Any CPU - {3CDEEAB7-2256-418A-BEB2-620B5CB16302}.Release|x86.ActiveCfg = Release|Any CPU - {3CDEEAB7-2256-418A-BEB2-620B5CB16302}.Release|x86.Build.0 = Release|Any CPU {0BE66736-CDAA-4989-88B1-B3F46EBDCA4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0BE66736-CDAA-4989-88B1-B3F46EBDCA4A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0BE66736-CDAA-4989-88B1-B3F46EBDCA4A}.Debug|x86.ActiveCfg = Debug|Any CPU - {0BE66736-CDAA-4989-88B1-B3F46EBDCA4A}.Debug|x86.Build.0 = Debug|Any CPU {0BE66736-CDAA-4989-88B1-B3F46EBDCA4A}.Release|Any CPU.ActiveCfg = Release|Any CPU {0BE66736-CDAA-4989-88B1-B3F46EBDCA4A}.Release|Any CPU.Build.0 = Release|Any CPU - {0BE66736-CDAA-4989-88B1-B3F46EBDCA4A}.Release|x86.ActiveCfg = Release|Any CPU - {0BE66736-CDAA-4989-88B1-B3F46EBDCA4A}.Release|x86.Build.0 = Release|Any CPU {3E7DEA65-317B-4F43-A25D-62F18D96CFD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3E7DEA65-317B-4F43-A25D-62F18D96CFD7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3E7DEA65-317B-4F43-A25D-62F18D96CFD7}.Debug|x86.ActiveCfg = Debug|Any CPU - {3E7DEA65-317B-4F43-A25D-62F18D96CFD7}.Debug|x86.Build.0 = Debug|Any CPU {3E7DEA65-317B-4F43-A25D-62F18D96CFD7}.Release|Any CPU.ActiveCfg = Release|Any CPU {3E7DEA65-317B-4F43-A25D-62F18D96CFD7}.Release|Any CPU.Build.0 = Release|Any CPU - {3E7DEA65-317B-4F43-A25D-62F18D96CFD7}.Release|x86.ActiveCfg = Release|Any CPU - {3E7DEA65-317B-4F43-A25D-62F18D96CFD7}.Release|x86.Build.0 = Release|Any CPU {12A68549-4E8C-42D6-8703-A09335F97997}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {12A68549-4E8C-42D6-8703-A09335F97997}.Debug|Any CPU.Build.0 = Debug|Any CPU - {12A68549-4E8C-42D6-8703-A09335F97997}.Debug|x86.ActiveCfg = Debug|Any CPU - {12A68549-4E8C-42D6-8703-A09335F97997}.Debug|x86.Build.0 = Debug|Any CPU {12A68549-4E8C-42D6-8703-A09335F97997}.Release|Any CPU.ActiveCfg = Release|Any CPU {12A68549-4E8C-42D6-8703-A09335F97997}.Release|Any CPU.Build.0 = Release|Any CPU - {12A68549-4E8C-42D6-8703-A09335F97997}.Release|x86.ActiveCfg = Release|Any CPU - {12A68549-4E8C-42D6-8703-A09335F97997}.Release|x86.Build.0 = Release|Any CPU {2DAE4406-7A89-4B5F-95C3-BC5472CE47CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2DAE4406-7A89-4B5F-95C3-BC5472CE47CE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2DAE4406-7A89-4B5F-95C3-BC5472CE47CE}.Debug|x86.ActiveCfg = Debug|Any CPU - {2DAE4406-7A89-4B5F-95C3-BC5472CE47CE}.Debug|x86.Build.0 = Debug|Any CPU {2DAE4406-7A89-4B5F-95C3-BC5472CE47CE}.Release|Any CPU.ActiveCfg = Release|Any CPU {2DAE4406-7A89-4B5F-95C3-BC5472CE47CE}.Release|Any CPU.Build.0 = Release|Any CPU - {2DAE4406-7A89-4B5F-95C3-BC5472CE47CE}.Release|x86.ActiveCfg = Release|Any CPU - {2DAE4406-7A89-4B5F-95C3-BC5472CE47CE}.Release|x86.Build.0 = Release|Any CPU {066F0DBD-C46C-4C20-AFEC-99829A172625}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {066F0DBD-C46C-4C20-AFEC-99829A172625}.Debug|Any CPU.Build.0 = Debug|Any CPU - {066F0DBD-C46C-4C20-AFEC-99829A172625}.Debug|x86.ActiveCfg = Debug|Any CPU - {066F0DBD-C46C-4C20-AFEC-99829A172625}.Debug|x86.Build.0 = Debug|Any CPU {066F0DBD-C46C-4C20-AFEC-99829A172625}.Release|Any CPU.ActiveCfg = Release|Any CPU {066F0DBD-C46C-4C20-AFEC-99829A172625}.Release|Any CPU.Build.0 = Release|Any CPU - {066F0DBD-C46C-4C20-AFEC-99829A172625}.Release|x86.ActiveCfg = Release|Any CPU - {066F0DBD-C46C-4C20-AFEC-99829A172625}.Release|x86.Build.0 = Release|Any CPU {2DAE4406-7A89-4B5F-95C3-BC5422CE47CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2DAE4406-7A89-4B5F-95C3-BC5422CE47CE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2DAE4406-7A89-4B5F-95C3-BC5422CE47CE}.Debug|x86.ActiveCfg = Debug|Any CPU - {2DAE4406-7A89-4B5F-95C3-BC5422CE47CE}.Debug|x86.Build.0 = Debug|Any CPU {2DAE4406-7A89-4B5F-95C3-BC5422CE47CE}.Release|Any CPU.ActiveCfg = Release|Any CPU {2DAE4406-7A89-4B5F-95C3-BC5422CE47CE}.Release|Any CPU.Build.0 = Release|Any CPU - {2DAE4406-7A89-4B5F-95C3-BC5422CE47CE}.Release|x86.ActiveCfg = Release|Any CPU - {2DAE4406-7A89-4B5F-95C3-BC5422CE47CE}.Release|x86.Build.0 = Release|Any CPU {8E2A252E-A140-45A6-A81A-2652996EA589}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8E2A252E-A140-45A6-A81A-2652996EA589}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8E2A252E-A140-45A6-A81A-2652996EA589}.Debug|x86.ActiveCfg = Debug|Any CPU - {8E2A252E-A140-45A6-A81A-2652996EA589}.Debug|x86.Build.0 = Debug|Any CPU {8E2A252E-A140-45A6-A81A-2652996EA589}.Release|Any CPU.ActiveCfg = Release|Any CPU {8E2A252E-A140-45A6-A81A-2652996EA589}.Release|Any CPU.Build.0 = Release|Any CPU - {8E2A252E-A140-45A6-A81A-2652996EA589}.Release|x86.ActiveCfg = Release|Any CPU - {8E2A252E-A140-45A6-A81A-2652996EA589}.Release|x86.Build.0 = Release|Any CPU {AC2BCEFB-9298-4621-AC48-1FF5E639E48D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AC2BCEFB-9298-4621-AC48-1FF5E639E48D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AC2BCEFB-9298-4621-AC48-1FF5E639E48D}.Debug|x86.ActiveCfg = Debug|Any CPU - {AC2BCEFB-9298-4621-AC48-1FF5E639E48D}.Debug|x86.Build.0 = Debug|Any CPU {AC2BCEFB-9298-4621-AC48-1FF5E639E48D}.Release|Any CPU.ActiveCfg = Release|Any CPU {AC2BCEFB-9298-4621-AC48-1FF5E639E48D}.Release|Any CPU.Build.0 = Release|Any CPU - {AC2BCEFB-9298-4621-AC48-1FF5E639E48D}.Release|x86.ActiveCfg = Release|Any CPU - {AC2BCEFB-9298-4621-AC48-1FF5E639E48D}.Release|x86.Build.0 = Release|Any CPU {16E93074-4252-466C-89A3-3B905ABAF779}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {16E93074-4252-466C-89A3-3B905ABAF779}.Debug|Any CPU.Build.0 = Debug|Any CPU - {16E93074-4252-466C-89A3-3B905ABAF779}.Debug|x86.ActiveCfg = Debug|Any CPU - {16E93074-4252-466C-89A3-3B905ABAF779}.Debug|x86.Build.0 = Debug|Any CPU {16E93074-4252-466C-89A3-3B905ABAF779}.Release|Any CPU.ActiveCfg = Release|Any CPU {16E93074-4252-466C-89A3-3B905ABAF779}.Release|Any CPU.Build.0 = Release|Any CPU - {16E93074-4252-466C-89A3-3B905ABAF779}.Release|x86.ActiveCfg = Release|Any CPU - {16E93074-4252-466C-89A3-3B905ABAF779}.Release|x86.Build.0 = Release|Any CPU {8CEE3609-A5A9-4A9B-86D7-33118F5D6B33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8CEE3609-A5A9-4A9B-86D7-33118F5D6B33}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8CEE3609-A5A9-4A9B-86D7-33118F5D6B33}.Debug|x86.ActiveCfg = Debug|Any CPU - {8CEE3609-A5A9-4A9B-86D7-33118F5D6B33}.Debug|x86.Build.0 = Debug|Any CPU {8CEE3609-A5A9-4A9B-86D7-33118F5D6B33}.Release|Any CPU.ActiveCfg = Release|Any CPU {8CEE3609-A5A9-4A9B-86D7-33118F5D6B33}.Release|Any CPU.Build.0 = Release|Any CPU - {8CEE3609-A5A9-4A9B-86D7-33118F5D6B33}.Release|x86.ActiveCfg = Release|Any CPU - {8CEE3609-A5A9-4A9B-86D7-33118F5D6B33}.Release|x86.Build.0 = Release|Any CPU {3CEA0D69-00D3-40E5-A661-DC41EA07269B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3CEA0D69-00D3-40E5-A661-DC41EA07269B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3CEA0D69-00D3-40E5-A661-DC41EA07269B}.Debug|x86.ActiveCfg = Debug|Any CPU - {3CEA0D69-00D3-40E5-A661-DC41EA07269B}.Debug|x86.Build.0 = Debug|Any CPU {3CEA0D69-00D3-40E5-A661-DC41EA07269B}.Release|Any CPU.ActiveCfg = Release|Any CPU {3CEA0D69-00D3-40E5-A661-DC41EA07269B}.Release|Any CPU.Build.0 = Release|Any CPU - {3CEA0D69-00D3-40E5-A661-DC41EA07269B}.Release|x86.ActiveCfg = Release|Any CPU - {3CEA0D69-00D3-40E5-A661-DC41EA07269B}.Release|x86.Build.0 = Release|Any CPU {76C6F005-C89D-4348-BB4A-39189DDBEB52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {76C6F005-C89D-4348-BB4A-39189DDBEB52}.Debug|Any CPU.Build.0 = Debug|Any CPU - {76C6F005-C89D-4348-BB4A-39189DDBEB52}.Debug|x86.ActiveCfg = Debug|Any CPU - {76C6F005-C89D-4348-BB4A-39189DDBEB52}.Debug|x86.Build.0 = Debug|Any CPU {76C6F005-C89D-4348-BB4A-39189DDBEB52}.Release|Any CPU.ActiveCfg = Release|Any CPU {76C6F005-C89D-4348-BB4A-39189DDBEB52}.Release|Any CPU.Build.0 = Release|Any CPU - {76C6F005-C89D-4348-BB4A-39189DDBEB52}.Release|x86.ActiveCfg = Release|Any CPU - {76C6F005-C89D-4348-BB4A-39189DDBEB52}.Release|x86.Build.0 = Release|Any CPU {FE2CBEA6-D121-4FAA-AA8B-FC9900BF8C83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FE2CBEA6-D121-4FAA-AA8B-FC9900BF8C83}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FE2CBEA6-D121-4FAA-AA8B-FC9900BF8C83}.Debug|x86.ActiveCfg = Debug|Any CPU - {FE2CBEA6-D121-4FAA-AA8B-FC9900BF8C83}.Debug|x86.Build.0 = Debug|Any CPU {FE2CBEA6-D121-4FAA-AA8B-FC9900BF8C83}.Release|Any CPU.ActiveCfg = Release|Any CPU {FE2CBEA6-D121-4FAA-AA8B-FC9900BF8C83}.Release|Any CPU.Build.0 = Release|Any CPU - {FE2CBEA6-D121-4FAA-AA8B-FC9900BF8C83}.Release|x86.ActiveCfg = Release|Any CPU - {FE2CBEA6-D121-4FAA-AA8B-FC9900BF8C83}.Release|x86.Build.0 = Release|Any CPU {EBA4DFA1-6DED-418F-A485-A3B608978906}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EBA4DFA1-6DED-418F-A485-A3B608978906}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EBA4DFA1-6DED-418F-A485-A3B608978906}.Debug|x86.ActiveCfg = Debug|Any CPU - {EBA4DFA1-6DED-418F-A485-A3B608978906}.Debug|x86.Build.0 = Debug|Any CPU {EBA4DFA1-6DED-418F-A485-A3B608978906}.Release|Any CPU.ActiveCfg = Release|Any CPU {EBA4DFA1-6DED-418F-A485-A3B608978906}.Release|Any CPU.Build.0 = Release|Any CPU - {EBA4DFA1-6DED-418F-A485-A3B608978906}.Release|x86.ActiveCfg = Release|Any CPU - {EBA4DFA1-6DED-418F-A485-A3B608978906}.Release|x86.Build.0 = Release|Any CPU {8CEE3609-A5A9-4A9B-86D7-33118F5D6B34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8CEE3609-A5A9-4A9B-86D7-33118F5D6B34}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8CEE3609-A5A9-4A9B-86D7-33118F5D6B34}.Debug|x86.ActiveCfg = Debug|Any CPU - {8CEE3609-A5A9-4A9B-86D7-33118F5D6B34}.Debug|x86.Build.0 = Debug|Any CPU {8CEE3609-A5A9-4A9B-86D7-33118F5D6B34}.Release|Any CPU.ActiveCfg = Release|Any CPU {8CEE3609-A5A9-4A9B-86D7-33118F5D6B34}.Release|Any CPU.Build.0 = Release|Any CPU - {8CEE3609-A5A9-4A9B-86D7-33118F5D6B34}.Release|x86.ActiveCfg = Release|Any CPU - {8CEE3609-A5A9-4A9B-86D7-33118F5D6B34}.Release|x86.Build.0 = Release|Any CPU {14118347-ED06-4608-9C45-18228273C712}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {14118347-ED06-4608-9C45-18228273C712}.Debug|Any CPU.Build.0 = Debug|Any CPU - {14118347-ED06-4608-9C45-18228273C712}.Debug|x86.ActiveCfg = Debug|Any CPU - {14118347-ED06-4608-9C45-18228273C712}.Debug|x86.Build.0 = Debug|Any CPU {14118347-ED06-4608-9C45-18228273C712}.Release|Any CPU.ActiveCfg = Release|Any CPU {14118347-ED06-4608-9C45-18228273C712}.Release|Any CPU.Build.0 = Release|Any CPU - {14118347-ED06-4608-9C45-18228273C712}.Release|x86.ActiveCfg = Release|Any CPU - {14118347-ED06-4608-9C45-18228273C712}.Release|x86.Build.0 = Release|Any CPU {6E62A0FF-D0DC-4109-9131-AB8E60CDFF7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6E62A0FF-D0DC-4109-9131-AB8E60CDFF7B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6E62A0FF-D0DC-4109-9131-AB8E60CDFF7B}.Debug|x86.ActiveCfg = Debug|Any CPU - {6E62A0FF-D0DC-4109-9131-AB8E60CDFF7B}.Debug|x86.Build.0 = Debug|Any CPU {6E62A0FF-D0DC-4109-9131-AB8E60CDFF7B}.Release|Any CPU.ActiveCfg = Release|Any CPU {6E62A0FF-D0DC-4109-9131-AB8E60CDFF7B}.Release|Any CPU.Build.0 = Release|Any CPU - {6E62A0FF-D0DC-4109-9131-AB8E60CDFF7B}.Release|x86.ActiveCfg = Release|Any CPU - {6E62A0FF-D0DC-4109-9131-AB8E60CDFF7B}.Release|x86.Build.0 = Release|Any CPU {86FD5B9A-4FA0-4B10-B59F-CFAF077A859C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {86FD5B9A-4FA0-4B10-B59F-CFAF077A859C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {86FD5B9A-4FA0-4B10-B59F-CFAF077A859C}.Debug|x86.ActiveCfg = Debug|Any CPU - {86FD5B9A-4FA0-4B10-B59F-CFAF077A859C}.Debug|x86.Build.0 = Debug|Any CPU {86FD5B9A-4FA0-4B10-B59F-CFAF077A859C}.Release|Any CPU.ActiveCfg = Release|Any CPU {86FD5B9A-4FA0-4B10-B59F-CFAF077A859C}.Release|Any CPU.Build.0 = Release|Any CPU - {86FD5B9A-4FA0-4B10-B59F-CFAF077A859C}.Release|x86.ActiveCfg = Release|Any CPU - {86FD5B9A-4FA0-4B10-B59F-CFAF077A859C}.Release|x86.Build.0 = Release|Any CPU {C0E80510-4FBE-4B0C-AF2C-4F473787722C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C0E80510-4FBE-4B0C-AF2C-4F473787722C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C0E80510-4FBE-4B0C-AF2C-4F473787722C}.Debug|x86.ActiveCfg = Debug|Any CPU - {C0E80510-4FBE-4B0C-AF2C-4F473787722C}.Debug|x86.Build.0 = Debug|Any CPU {C0E80510-4FBE-4B0C-AF2C-4F473787722C}.Release|Any CPU.ActiveCfg = Release|Any CPU {C0E80510-4FBE-4B0C-AF2C-4F473787722C}.Release|Any CPU.Build.0 = Release|Any CPU - {C0E80510-4FBE-4B0C-AF2C-4F473787722C}.Release|x86.ActiveCfg = Release|Any CPU - {C0E80510-4FBE-4B0C-AF2C-4F473787722C}.Release|x86.Build.0 = Release|Any CPU {7BE3DEEB-87F8-4E15-9C21-4F94B0B1C2D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7BE3DEEB-87F8-4E15-9C21-4F94B0B1C2D6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7BE3DEEB-87F8-4E15-9C21-4F94B0B1C2D6}.Debug|x86.ActiveCfg = Debug|Any CPU - {7BE3DEEB-87F8-4E15-9C21-4F94B0B1C2D6}.Debug|x86.Build.0 = Debug|Any CPU {7BE3DEEB-87F8-4E15-9C21-4F94B0B1C2D6}.Release|Any CPU.ActiveCfg = Release|Any CPU {7BE3DEEB-87F8-4E15-9C21-4F94B0B1C2D6}.Release|Any CPU.Build.0 = Release|Any CPU - {7BE3DEEB-87F8-4E15-9C21-4F94B0B1C2D6}.Release|x86.ActiveCfg = Release|Any CPU - {7BE3DEEB-87F8-4E15-9C21-4F94B0B1C2D6}.Release|x86.Build.0 = Release|Any CPU {D49439D7-56D2-450F-A4F0-74CB95D620E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D49439D7-56D2-450F-A4F0-74CB95D620E6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D49439D7-56D2-450F-A4F0-74CB95D620E6}.Debug|x86.ActiveCfg = Debug|Any CPU - {D49439D7-56D2-450F-A4F0-74CB95D620E6}.Debug|x86.Build.0 = Debug|Any CPU {D49439D7-56D2-450F-A4F0-74CB95D620E6}.Release|Any CPU.ActiveCfg = Release|Any CPU {D49439D7-56D2-450F-A4F0-74CB95D620E6}.Release|Any CPU.Build.0 = Release|Any CPU - {D49439D7-56D2-450F-A4F0-74CB95D620E6}.Release|x86.ActiveCfg = Release|Any CPU - {D49439D7-56D2-450F-A4F0-74CB95D620E6}.Release|x86.Build.0 = Release|Any CPU {5DEFADBD-44EB-47A2-A53E-F1282CC9E4E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5DEFADBD-44EB-47A2-A53E-F1282CC9E4E9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5DEFADBD-44EB-47A2-A53E-F1282CC9E4E9}.Debug|x86.ActiveCfg = Debug|Any CPU - {5DEFADBD-44EB-47A2-A53E-F1282CC9E4E9}.Debug|x86.Build.0 = Debug|Any CPU {5DEFADBD-44EB-47A2-A53E-F1282CC9E4E9}.Release|Any CPU.ActiveCfg = Release|Any CPU {5DEFADBD-44EB-47A2-A53E-F1282CC9E4E9}.Release|Any CPU.Build.0 = Release|Any CPU - {5DEFADBD-44EB-47A2-A53E-F1282CC9E4E9}.Release|x86.ActiveCfg = Release|Any CPU - {5DEFADBD-44EB-47A2-A53E-F1282CC9E4E9}.Release|x86.Build.0 = Release|Any CPU {91C574AD-0352-47E9-A019-EE02CC32A396}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {91C574AD-0352-47E9-A019-EE02CC32A396}.Debug|Any CPU.Build.0 = Debug|Any CPU - {91C574AD-0352-47E9-A019-EE02CC32A396}.Debug|x86.ActiveCfg = Debug|Any CPU - {91C574AD-0352-47E9-A019-EE02CC32A396}.Debug|x86.Build.0 = Debug|Any CPU {91C574AD-0352-47E9-A019-EE02CC32A396}.Release|Any CPU.ActiveCfg = Release|Any CPU {91C574AD-0352-47E9-A019-EE02CC32A396}.Release|Any CPU.Build.0 = Release|Any CPU - {91C574AD-0352-47E9-A019-EE02CC32A396}.Release|x86.ActiveCfg = Release|Any CPU - {91C574AD-0352-47E9-A019-EE02CC32A396}.Release|x86.Build.0 = Release|Any CPU {A1455D30-55FC-45EF-8759-3AEBDB13D940}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A1455D30-55FC-45EF-8759-3AEBDB13D940}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A1455D30-55FC-45EF-8759-3AEBDB13D940}.Debug|x86.ActiveCfg = Debug|Any CPU - {A1455D30-55FC-45EF-8759-3AEBDB13D940}.Debug|x86.Build.0 = Debug|Any CPU {A1455D30-55FC-45EF-8759-3AEBDB13D940}.Release|Any CPU.ActiveCfg = Release|Any CPU {A1455D30-55FC-45EF-8759-3AEBDB13D940}.Release|Any CPU.Build.0 = Release|Any CPU - {A1455D30-55FC-45EF-8759-3AEBDB13D940}.Release|x86.ActiveCfg = Release|Any CPU - {A1455D30-55FC-45EF-8759-3AEBDB13D940}.Release|x86.Build.0 = Release|Any CPU {201EC5B7-F91E-45E5-B9F2-67A266CCE6FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {201EC5B7-F91E-45E5-B9F2-67A266CCE6FC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {201EC5B7-F91E-45E5-B9F2-67A266CCE6FC}.Debug|x86.ActiveCfg = Debug|Any CPU - {201EC5B7-F91E-45E5-B9F2-67A266CCE6FC}.Debug|x86.Build.0 = Debug|Any CPU {201EC5B7-F91E-45E5-B9F2-67A266CCE6FC}.Release|Any CPU.ActiveCfg = Release|Any CPU {201EC5B7-F91E-45E5-B9F2-67A266CCE6FC}.Release|Any CPU.Build.0 = Release|Any CPU - {201EC5B7-F91E-45E5-B9F2-67A266CCE6FC}.Release|x86.ActiveCfg = Release|Any CPU - {201EC5B7-F91E-45E5-B9F2-67A266CCE6FC}.Release|x86.Build.0 = Release|Any CPU {A486D7DE-F614-409D-BB41-0FFDF582E35C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A486D7DE-F614-409D-BB41-0FFDF582E35C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A486D7DE-F614-409D-BB41-0FFDF582E35C}.Debug|x86.ActiveCfg = Debug|Any CPU - {A486D7DE-F614-409D-BB41-0FFDF582E35C}.Debug|x86.Build.0 = Debug|Any CPU {A486D7DE-F614-409D-BB41-0FFDF582E35C}.Release|Any CPU.ActiveCfg = Release|Any CPU {A486D7DE-F614-409D-BB41-0FFDF582E35C}.Release|Any CPU.Build.0 = Release|Any CPU - {A486D7DE-F614-409D-BB41-0FFDF582E35C}.Release|x86.ActiveCfg = Release|Any CPU - {A486D7DE-F614-409D-BB41-0FFDF582E35C}.Release|x86.Build.0 = Release|Any CPU {B617717C-7881-4F01-AB6D-B1B6CC0483A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B617717C-7881-4F01-AB6D-B1B6CC0483A0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B617717C-7881-4F01-AB6D-B1B6CC0483A0}.Debug|x86.ActiveCfg = Debug|Any CPU - {B617717C-7881-4F01-AB6D-B1B6CC0483A0}.Debug|x86.Build.0 = Debug|Any CPU {B617717C-7881-4F01-AB6D-B1B6CC0483A0}.Release|Any CPU.ActiveCfg = Release|Any CPU {B617717C-7881-4F01-AB6D-B1B6CC0483A0}.Release|Any CPU.Build.0 = Release|Any CPU - {B617717C-7881-4F01-AB6D-B1B6CC0483A0}.Release|x86.ActiveCfg = Release|Any CPU - {B617717C-7881-4F01-AB6D-B1B6CC0483A0}.Release|x86.Build.0 = Release|Any CPU {FD6BA96C-7905-4876-8BCC-E38E2CA64F31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FD6BA96C-7905-4876-8BCC-E38E2CA64F31}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FD6BA96C-7905-4876-8BCC-E38E2CA64F31}.Debug|x86.ActiveCfg = Debug|Any CPU - {FD6BA96C-7905-4876-8BCC-E38E2CA64F31}.Debug|x86.Build.0 = Debug|Any CPU {FD6BA96C-7905-4876-8BCC-E38E2CA64F31}.Release|Any CPU.ActiveCfg = Release|Any CPU {FD6BA96C-7905-4876-8BCC-E38E2CA64F31}.Release|Any CPU.Build.0 = Release|Any CPU - {FD6BA96C-7905-4876-8BCC-E38E2CA64F31}.Release|x86.ActiveCfg = Release|Any CPU - {FD6BA96C-7905-4876-8BCC-E38E2CA64F31}.Release|x86.Build.0 = Release|Any CPU {AE297965-4D56-4BA9-85EB-655AC4FC95A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AE297965-4D56-4BA9-85EB-655AC4FC95A0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AE297965-4D56-4BA9-85EB-655AC4FC95A0}.Debug|x86.ActiveCfg = Debug|Any CPU - {AE297965-4D56-4BA9-85EB-655AC4FC95A0}.Debug|x86.Build.0 = Debug|Any CPU {AE297965-4D56-4BA9-85EB-655AC4FC95A0}.Release|Any CPU.ActiveCfg = Release|Any CPU {AE297965-4D56-4BA9-85EB-655AC4FC95A0}.Release|Any CPU.Build.0 = Release|Any CPU - {AE297965-4D56-4BA9-85EB-655AC4FC95A0}.Release|x86.ActiveCfg = Release|Any CPU - {AE297965-4D56-4BA9-85EB-655AC4FC95A0}.Release|x86.Build.0 = Release|Any CPU {60DB272A-21C9-4E8D-9803-FF4E132392C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {60DB272A-21C9-4E8D-9803-FF4E132392C8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {60DB272A-21C9-4E8D-9803-FF4E132392C8}.Debug|x86.ActiveCfg = Debug|Any CPU - {60DB272A-21C9-4E8D-9803-FF4E132392C8}.Debug|x86.Build.0 = Debug|Any CPU {60DB272A-21C9-4E8D-9803-FF4E132392C8}.Release|Any CPU.ActiveCfg = Release|Any CPU {60DB272A-21C9-4E8D-9803-FF4E132392C8}.Release|Any CPU.Build.0 = Release|Any CPU - {60DB272A-21C9-4E8D-9803-FF4E132392C8}.Release|x86.ActiveCfg = Release|Any CPU - {60DB272A-21C9-4E8D-9803-FF4E132392C8}.Release|x86.Build.0 = Release|Any CPU {73242A2D-6300-499D-8C15-FADF7ECB185C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {73242A2D-6300-499D-8C15-FADF7ECB185C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {73242A2D-6300-499D-8C15-FADF7ECB185C}.Debug|x86.ActiveCfg = Debug|Any CPU - {73242A2D-6300-499D-8C15-FADF7ECB185C}.Debug|x86.Build.0 = Debug|Any CPU {73242A2D-6300-499D-8C15-FADF7ECB185C}.Release|Any CPU.ActiveCfg = Release|Any CPU {73242A2D-6300-499D-8C15-FADF7ECB185C}.Release|Any CPU.Build.0 = Release|Any CPU - {73242A2D-6300-499D-8C15-FADF7ECB185C}.Release|x86.ActiveCfg = Release|Any CPU - {73242A2D-6300-499D-8C15-FADF7ECB185C}.Release|x86.Build.0 = Release|Any CPU {AC5E3515-482C-4C6A-92D9-D0CEA687DFC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AC5E3515-482C-4C6A-92D9-D0CEA687DFC2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AC5E3515-482C-4C6A-92D9-D0CEA687DFC2}.Debug|x86.ActiveCfg = Debug|Any CPU - {AC5E3515-482C-4C6A-92D9-D0CEA687DFC2}.Debug|x86.Build.0 = Debug|Any CPU {AC5E3515-482C-4C6A-92D9-D0CEA687DFC2}.Release|Any CPU.ActiveCfg = Release|Any CPU {AC5E3515-482C-4C6A-92D9-D0CEA687DFC2}.Release|Any CPU.Build.0 = Release|Any CPU - {AC5E3515-482C-4C6A-92D9-D0CEA687DFC2}.Release|x86.ActiveCfg = Release|Any CPU - {AC5E3515-482C-4C6A-92D9-D0CEA687DFC2}.Release|x86.Build.0 = Release|Any CPU {B8DA3A90-A60C-42E3-9D8E-6C67B800C395}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B8DA3A90-A60C-42E3-9D8E-6C67B800C395}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B8DA3A90-A60C-42E3-9D8E-6C67B800C395}.Debug|x86.ActiveCfg = Debug|Any CPU - {B8DA3A90-A60C-42E3-9D8E-6C67B800C395}.Debug|x86.Build.0 = Debug|Any CPU {B8DA3A90-A60C-42E3-9D8E-6C67B800C395}.Release|Any CPU.ActiveCfg = Release|Any CPU {B8DA3A90-A60C-42E3-9D8E-6C67B800C395}.Release|Any CPU.Build.0 = Release|Any CPU - {B8DA3A90-A60C-42E3-9D8E-6C67B800C395}.Release|x86.ActiveCfg = Release|Any CPU - {B8DA3A90-A60C-42E3-9D8E-6C67B800C395}.Release|x86.Build.0 = Release|Any CPU {ACE53515-482C-4C6A-E2D2-4242A687DFEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {ACE53515-482C-4C6A-E2D2-4242A687DFEE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {ACE53515-482C-4C6A-E2D2-4242A687DFEE}.Debug|x86.ActiveCfg = Debug|Any CPU - {ACE53515-482C-4C6A-E2D2-4242A687DFEE}.Debug|x86.Build.0 = Debug|Any CPU {ACE53515-482C-4C6A-E2D2-4242A687DFEE}.Release|Any CPU.ActiveCfg = Release|Any CPU {ACE53515-482C-4C6A-E2D2-4242A687DFEE}.Release|Any CPU.Build.0 = Release|Any CPU - {ACE53515-482C-4C6A-E2D2-4242A687DFEE}.Release|x86.ActiveCfg = Release|Any CPU - {ACE53515-482C-4C6A-E2D2-4242A687DFEE}.Release|x86.Build.0 = Release|Any CPU {21B80A31-8FF9-4E3A-8403-AABD635AEED9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {21B80A31-8FF9-4E3A-8403-AABD635AEED9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {21B80A31-8FF9-4E3A-8403-AABD635AEED9}.Debug|x86.ActiveCfg = Debug|Any CPU - {21B80A31-8FF9-4E3A-8403-AABD635AEED9}.Debug|x86.Build.0 = Debug|Any CPU {21B80A31-8FF9-4E3A-8403-AABD635AEED9}.Release|Any CPU.ActiveCfg = Release|Any CPU {21B80A31-8FF9-4E3A-8403-AABD635AEED9}.Release|Any CPU.Build.0 = Release|Any CPU - {21B80A31-8FF9-4E3A-8403-AABD635AEED9}.Release|x86.ActiveCfg = Release|Any CPU - {21B80A31-8FF9-4E3A-8403-AABD635AEED9}.Release|x86.Build.0 = Release|Any CPU {ABDBAC1E-350E-4DC3-BB45-3504404545EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {ABDBAC1E-350E-4DC3-BB45-3504404545EE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {ABDBAC1E-350E-4DC3-BB45-3504404545EE}.Debug|x86.ActiveCfg = Debug|Any CPU - {ABDBAC1E-350E-4DC3-BB45-3504404545EE}.Debug|x86.Build.0 = Debug|Any CPU {ABDBAC1E-350E-4DC3-BB45-3504404545EE}.Release|Any CPU.ActiveCfg = Release|Any CPU {ABDBAC1E-350E-4DC3-BB45-3504404545EE}.Release|Any CPU.Build.0 = Release|Any CPU - {ABDBAC1E-350E-4DC3-BB45-3504404545EE}.Release|x86.ActiveCfg = Release|Any CPU - {ABDBAC1E-350E-4DC3-BB45-3504404545EE}.Release|x86.Build.0 = Release|Any CPU {FCFA8808-A1B6-48CC-A1EA-0B8CA8AEDA8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FCFA8808-A1B6-48CC-A1EA-0B8CA8AEDA8E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FCFA8808-A1B6-48CC-A1EA-0B8CA8AEDA8E}.Debug|x86.ActiveCfg = Debug|Any CPU - {FCFA8808-A1B6-48CC-A1EA-0B8CA8AEDA8E}.Debug|x86.Build.0 = Debug|Any CPU {FCFA8808-A1B6-48CC-A1EA-0B8CA8AEDA8E}.Release|Any CPU.ActiveCfg = Release|Any CPU {FCFA8808-A1B6-48CC-A1EA-0B8CA8AEDA8E}.Release|Any CPU.Build.0 = Release|Any CPU - {FCFA8808-A1B6-48CC-A1EA-0B8CA8AEDA8E}.Release|x86.ActiveCfg = Release|Any CPU - {FCFA8808-A1B6-48CC-A1EA-0B8CA8AEDA8E}.Release|x86.Build.0 = Release|Any CPU {1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Debug|x86.ActiveCfg = Debug|Any CPU - {1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Debug|x86.Build.0 = Debug|Any CPU {1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Release|Any CPU.ActiveCfg = Release|Any CPU {1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Release|Any CPU.Build.0 = Release|Any CPU - {1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Release|x86.ActiveCfg = Release|Any CPU - {1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Release|x86.Build.0 = Release|Any CPU {76242A2D-2600-49DD-8C15-FEA07ECB1842}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {76242A2D-2600-49DD-8C15-FEA07ECB1842}.Debug|Any CPU.Build.0 = Debug|Any CPU - {76242A2D-2600-49DD-8C15-FEA07ECB1842}.Debug|x86.ActiveCfg = Debug|Any CPU - {76242A2D-2600-49DD-8C15-FEA07ECB1842}.Debug|x86.Build.0 = Debug|Any CPU {76242A2D-2600-49DD-8C15-FEA07ECB1842}.Release|Any CPU.ActiveCfg = Release|Any CPU {76242A2D-2600-49DD-8C15-FEA07ECB1842}.Release|Any CPU.Build.0 = Release|Any CPU - {76242A2D-2600-49DD-8C15-FEA07ECB1842}.Release|x86.ActiveCfg = Release|Any CPU - {76242A2D-2600-49DD-8C15-FEA07ECB1842}.Release|x86.Build.0 = Release|Any CPU {76242A2D-2600-49DD-8C15-FEA07ECB1843}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {76242A2D-2600-49DD-8C15-FEA07ECB1843}.Debug|Any CPU.Build.0 = Debug|Any CPU - {76242A2D-2600-49DD-8C15-FEA07ECB1843}.Debug|x86.ActiveCfg = Debug|Any CPU - {76242A2D-2600-49DD-8C15-FEA07ECB1843}.Debug|x86.Build.0 = Debug|Any CPU {76242A2D-2600-49DD-8C15-FEA07ECB1843}.Release|Any CPU.ActiveCfg = Release|Any CPU {76242A2D-2600-49DD-8C15-FEA07ECB1843}.Release|Any CPU.Build.0 = Release|Any CPU - {76242A2D-2600-49DD-8C15-FEA07ECB1843}.Release|x86.ActiveCfg = Release|Any CPU - {76242A2D-2600-49DD-8C15-FEA07ECB1843}.Release|x86.Build.0 = Release|Any CPU {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D3}.Debug|x86.ActiveCfg = Debug|Any CPU - {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D3}.Debug|x86.Build.0 = Debug|Any CPU {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D3}.Release|Any CPU.ActiveCfg = Release|Any CPU {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D3}.Release|Any CPU.Build.0 = Release|Any CPU - {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D3}.Release|x86.ActiveCfg = Release|Any CPU - {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D3}.Release|x86.Build.0 = Release|Any CPU {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D4}.Debug|x86.ActiveCfg = Debug|Any CPU - {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D4}.Debug|x86.Build.0 = Debug|Any CPU {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D4}.Release|Any CPU.ActiveCfg = Release|Any CPU {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D4}.Release|Any CPU.Build.0 = Release|Any CPU - {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D4}.Release|x86.ActiveCfg = Release|Any CPU - {BF9DAC1E-3A5E-4DC3-BB44-9A64E0D4E9D4}.Release|x86.Build.0 = Release|Any CPU {BEDC5A4A-809E-4017-9CFD-6C8D4E1847F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BEDC5A4A-809E-4017-9CFD-6C8D4E1847F0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BEDC5A4A-809E-4017-9CFD-6C8D4E1847F0}.Debug|x86.ActiveCfg = Debug|Any CPU - {BEDC5A4A-809E-4017-9CFD-6C8D4E1847F0}.Debug|x86.Build.0 = Debug|Any CPU {BEDC5A4A-809E-4017-9CFD-6C8D4E1847F0}.Release|Any CPU.ActiveCfg = Release|Any CPU {BEDC5A4A-809E-4017-9CFD-6C8D4E1847F0}.Release|Any CPU.Build.0 = Release|Any CPU - {BEDC5A4A-809E-4017-9CFD-6C8D4E1847F0}.Release|x86.ActiveCfg = Release|Any CPU - {BEDC5A4A-809E-4017-9CFD-6C8D4E1847F0}.Release|x86.Build.0 = Release|Any CPU {FA0E905D-EC46-466D-B7B2-3B5557F9428C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FA0E905D-EC46-466D-B7B2-3B5557F9428C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FA0E905D-EC46-466D-B7B2-3B5557F9428C}.Debug|x86.ActiveCfg = Debug|Any CPU - {FA0E905D-EC46-466D-B7B2-3B5557F9428C}.Debug|x86.Build.0 = Debug|Any CPU {FA0E905D-EC46-466D-B7B2-3B5557F9428C}.Release|Any CPU.ActiveCfg = Release|Any CPU {FA0E905D-EC46-466D-B7B2-3B5557F9428C}.Release|Any CPU.Build.0 = Release|Any CPU - {FA0E905D-EC46-466D-B7B2-3B5557F9428C}.Release|x86.ActiveCfg = Release|Any CPU - {FA0E905D-EC46-466D-B7B2-3B5557F9428C}.Release|x86.Build.0 = Release|Any CPU {E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}.Debug|x86.ActiveCfg = Debug|Any CPU - {E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}.Debug|x86.Build.0 = Debug|Any CPU {E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}.Release|Any CPU.ActiveCfg = Release|Any CPU {E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}.Release|Any CPU.Build.0 = Release|Any CPU - {E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}.Release|x86.ActiveCfg = Release|Any CPU - {E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}.Release|x86.Build.0 = Release|Any CPU {CCBD3438-3E84-40A9-83AD-533F23BCFCA5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CCBD3438-3E84-40A9-83AD-533F23BCFCA5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CCBD3438-3E84-40A9-83AD-533F23BCFCA5}.Debug|x86.ActiveCfg = Debug|Any CPU - {CCBD3438-3E84-40A9-83AD-533F23BCFCA5}.Debug|x86.Build.0 = Debug|Any CPU {CCBD3438-3E84-40A9-83AD-533F23BCFCA5}.Release|Any CPU.ActiveCfg = Release|Any CPU {CCBD3438-3E84-40A9-83AD-533F23BCFCA5}.Release|Any CPU.Build.0 = Release|Any CPU - {CCBD3438-3E84-40A9-83AD-533F23BCFCA5}.Release|x86.ActiveCfg = Release|Any CPU - {CCBD3438-3E84-40A9-83AD-533F23BCFCA5}.Release|x86.Build.0 = Release|Any CPU {6FD1CC3E-6A99-4736-9B8D-757992DDE75D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6FD1CC3E-6A99-4736-9B8D-757992DDE75D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6FD1CC3E-6A99-4736-9B8D-757992DDE75D}.Debug|x86.ActiveCfg = Debug|Any CPU - {6FD1CC3E-6A99-4736-9B8D-757992DDE75D}.Debug|x86.Build.0 = Debug|Any CPU {6FD1CC3E-6A99-4736-9B8D-757992DDE75D}.Release|Any CPU.ActiveCfg = Release|Any CPU {6FD1CC3E-6A99-4736-9B8D-757992DDE75D}.Release|Any CPU.Build.0 = Release|Any CPU - {6FD1CC3E-6A99-4736-9B8D-757992DDE75D}.Release|x86.ActiveCfg = Release|Any CPU - {6FD1CC3E-6A99-4736-9B8D-757992DDE75D}.Release|x86.Build.0 = Release|Any CPU {286B01F3-811A-40A7-8C1F-10C9BB0597F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {286B01F3-811A-40A7-8C1F-10C9BB0597F7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {286B01F3-811A-40A7-8C1F-10C9BB0597F7}.Debug|x86.ActiveCfg = Debug|Any CPU - {286B01F3-811A-40A7-8C1F-10C9BB0597F7}.Debug|x86.Build.0 = Debug|Any CPU {286B01F3-811A-40A7-8C1F-10C9BB0597F7}.Release|Any CPU.ActiveCfg = Release|Any CPU {286B01F3-811A-40A7-8C1F-10C9BB0597F7}.Release|Any CPU.Build.0 = Release|Any CPU - {286B01F3-811A-40A7-8C1F-10C9BB0597F7}.Release|x86.ActiveCfg = Release|Any CPU - {286B01F3-811A-40A7-8C1F-10C9BB0597F7}.Release|x86.Build.0 = Release|Any CPU {24973B4C-FD09-4EE1-97F4-EA03E6B12040}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {24973B4C-FD09-4EE1-97F4-EA03E6B12040}.Debug|Any CPU.Build.0 = Debug|Any CPU - {24973B4C-FD09-4EE1-97F4-EA03E6B12040}.Debug|x86.ActiveCfg = Debug|Any CPU - {24973B4C-FD09-4EE1-97F4-EA03E6B12040}.Debug|x86.Build.0 = Debug|Any CPU {24973B4C-FD09-4EE1-97F4-EA03E6B12040}.Release|Any CPU.ActiveCfg = Release|Any CPU {24973B4C-FD09-4EE1-97F4-EA03E6B12040}.Release|Any CPU.Build.0 = Release|Any CPU - {24973B4C-FD09-4EE1-97F4-EA03E6B12040}.Release|x86.ActiveCfg = Release|Any CPU - {24973B4C-FD09-4EE1-97F4-EA03E6B12040}.Release|x86.Build.0 = Release|Any CPU {ABC7262E-1053-49F3-B846-E3091BB92E8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {ABC7262E-1053-49F3-B846-E3091BB92E8C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {ABC7262E-1053-49F3-B846-E3091BB92E8C}.Debug|x86.ActiveCfg = Debug|Any CPU - {ABC7262E-1053-49F3-B846-E3091BB92E8C}.Debug|x86.Build.0 = Debug|Any CPU {ABC7262E-1053-49F3-B846-E3091BB92E8C}.Release|Any CPU.ActiveCfg = Release|Any CPU {ABC7262E-1053-49F3-B846-E3091BB92E8C}.Release|Any CPU.Build.0 = Release|Any CPU - {ABC7262E-1053-49F3-B846-E3091BB92E8C}.Release|x86.ActiveCfg = Release|Any CPU - {ABC7262E-1053-49F3-B846-E3091BB92E8C}.Release|x86.Build.0 = Release|Any CPU {E2E889A5-2489-4546-9194-47C63E49EAEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E2E889A5-2489-4546-9194-47C63E49EAEB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E2E889A5-2489-4546-9194-47C63E49EAEB}.Debug|x86.ActiveCfg = Debug|Any CPU - {E2E889A5-2489-4546-9194-47C63E49EAEB}.Debug|x86.Build.0 = Debug|Any CPU {E2E889A5-2489-4546-9194-47C63E49EAEB}.Release|Any CPU.ActiveCfg = Release|Any CPU {E2E889A5-2489-4546-9194-47C63E49EAEB}.Release|Any CPU.Build.0 = Release|Any CPU - {E2E889A5-2489-4546-9194-47C63E49EAEB}.Release|x86.ActiveCfg = Release|Any CPU - {E2E889A5-2489-4546-9194-47C63E49EAEB}.Release|x86.Build.0 = Release|Any CPU {43026D51-3083-4850-928D-07E1883D5B1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {43026D51-3083-4850-928D-07E1883D5B1A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {43026D51-3083-4850-928D-07E1883D5B1A}.Debug|x86.ActiveCfg = Debug|Any CPU - {43026D51-3083-4850-928D-07E1883D5B1A}.Debug|x86.Build.0 = Debug|Any CPU {43026D51-3083-4850-928D-07E1883D5B1A}.Release|Any CPU.ActiveCfg = Release|Any CPU {43026D51-3083-4850-928D-07E1883D5B1A}.Release|Any CPU.Build.0 = Release|Any CPU - {43026D51-3083-4850-928D-07E1883D5B1A}.Release|x86.ActiveCfg = Release|Any CPU - {43026D51-3083-4850-928D-07E1883D5B1A}.Release|x86.Build.0 = Release|Any CPU {A88AB44F-7F9D-43F6-A127-83BB65E5A7E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A88AB44F-7F9D-43F6-A127-83BB65E5A7E2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A88AB44F-7F9D-43F6-A127-83BB65E5A7E2}.Debug|x86.ActiveCfg = Debug|Any CPU - {A88AB44F-7F9D-43F6-A127-83BB65E5A7E2}.Debug|x86.Build.0 = Debug|Any CPU {A88AB44F-7F9D-43F6-A127-83BB65E5A7E2}.Release|Any CPU.ActiveCfg = Release|Any CPU {A88AB44F-7F9D-43F6-A127-83BB65E5A7E2}.Release|Any CPU.Build.0 = Release|Any CPU - {A88AB44F-7F9D-43F6-A127-83BB65E5A7E2}.Release|x86.ActiveCfg = Release|Any CPU - {A88AB44F-7F9D-43F6-A127-83BB65E5A7E2}.Release|x86.Build.0 = Release|Any CPU {E5A55C16-A5B9-4874-9043-A5266DC02F58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E5A55C16-A5B9-4874-9043-A5266DC02F58}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E5A55C16-A5B9-4874-9043-A5266DC02F58}.Debug|x86.ActiveCfg = Debug|Any CPU - {E5A55C16-A5B9-4874-9043-A5266DC02F58}.Debug|x86.Build.0 = Debug|Any CPU {E5A55C16-A5B9-4874-9043-A5266DC02F58}.Release|Any CPU.ActiveCfg = Release|Any CPU {E5A55C16-A5B9-4874-9043-A5266DC02F58}.Release|Any CPU.Build.0 = Release|Any CPU - {E5A55C16-A5B9-4874-9043-A5266DC02F58}.Release|x86.ActiveCfg = Release|Any CPU - {E5A55C16-A5B9-4874-9043-A5266DC02F58}.Release|x86.Build.0 = Release|Any CPU {3BED15FD-D608-4573-B432-1569C1026F6D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3BED15FD-D608-4573-B432-1569C1026F6D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3BED15FD-D608-4573-B432-1569C1026F6D}.Debug|x86.ActiveCfg = Debug|Any CPU - {3BED15FD-D608-4573-B432-1569C1026F6D}.Debug|x86.Build.0 = Debug|Any CPU {3BED15FD-D608-4573-B432-1569C1026F6D}.Release|Any CPU.ActiveCfg = Release|Any CPU {3BED15FD-D608-4573-B432-1569C1026F6D}.Release|Any CPU.Build.0 = Release|Any CPU - {3BED15FD-D608-4573-B432-1569C1026F6D}.Release|x86.ActiveCfg = Release|Any CPU - {3BED15FD-D608-4573-B432-1569C1026F6D}.Release|x86.Build.0 = Release|Any CPU {DA0D2A70-A2F9-4654-A99A-3227EDF54FF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DA0D2A70-A2F9-4654-A99A-3227EDF54FF1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DA0D2A70-A2F9-4654-A99A-3227EDF54FF1}.Debug|x86.ActiveCfg = Debug|Any CPU - {DA0D2A70-A2F9-4654-A99A-3227EDF54FF1}.Debug|x86.Build.0 = Debug|Any CPU {DA0D2A70-A2F9-4654-A99A-3227EDF54FF1}.Release|Any CPU.ActiveCfg = Release|Any CPU {DA0D2A70-A2F9-4654-A99A-3227EDF54FF1}.Release|Any CPU.Build.0 = Release|Any CPU - {DA0D2A70-A2F9-4654-A99A-3227EDF54FF1}.Release|x86.ActiveCfg = Release|Any CPU - {DA0D2A70-A2F9-4654-A99A-3227EDF54FF1}.Release|x86.Build.0 = Release|Any CPU {971E832B-7471-48B5-833E-5913188EC0E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {971E832B-7471-48B5-833E-5913188EC0E4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {971E832B-7471-48B5-833E-5913188EC0E4}.Debug|x86.ActiveCfg = Debug|Any CPU - {971E832B-7471-48B5-833E-5913188EC0E4}.Debug|x86.Build.0 = Debug|Any CPU {971E832B-7471-48B5-833E-5913188EC0E4}.Release|Any CPU.ActiveCfg = Release|Any CPU {971E832B-7471-48B5-833E-5913188EC0E4}.Release|Any CPU.Build.0 = Release|Any CPU - {971E832B-7471-48B5-833E-5913188EC0E4}.Release|x86.ActiveCfg = Release|Any CPU - {971E832B-7471-48B5-833E-5913188EC0E4}.Release|x86.Build.0 = Release|Any CPU {59AD474E-2A35-4E8A-A74D-E33479977FBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {59AD474E-2A35-4E8A-A74D-E33479977FBF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {59AD474E-2A35-4E8A-A74D-E33479977FBF}.Debug|x86.ActiveCfg = Debug|Any CPU - {59AD474E-2A35-4E8A-A74D-E33479977FBF}.Debug|x86.Build.0 = Debug|Any CPU {59AD474E-2A35-4E8A-A74D-E33479977FBF}.Release|Any CPU.ActiveCfg = Release|Any CPU {59AD474E-2A35-4E8A-A74D-E33479977FBF}.Release|Any CPU.Build.0 = Release|Any CPU - {59AD474E-2A35-4E8A-A74D-E33479977FBF}.Release|x86.ActiveCfg = Release|Any CPU - {59AD474E-2A35-4E8A-A74D-E33479977FBF}.Release|x86.Build.0 = Release|Any CPU {F822F72A-CC87-4E31-B57D-853F65CBEBF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F822F72A-CC87-4E31-B57D-853F65CBEBF3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F822F72A-CC87-4E31-B57D-853F65CBEBF3}.Debug|x86.ActiveCfg = Debug|Any CPU - {F822F72A-CC87-4E31-B57D-853F65CBEBF3}.Debug|x86.Build.0 = Debug|Any CPU {F822F72A-CC87-4E31-B57D-853F65CBEBF3}.Release|Any CPU.ActiveCfg = Release|Any CPU {F822F72A-CC87-4E31-B57D-853F65CBEBF3}.Release|Any CPU.Build.0 = Release|Any CPU - {F822F72A-CC87-4E31-B57D-853F65CBEBF3}.Release|x86.ActiveCfg = Release|Any CPU - {F822F72A-CC87-4E31-B57D-853F65CBEBF3}.Release|x86.Build.0 = Release|Any CPU {80FDDD00-9393-47F7-8BAF-7E87CE011068}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {80FDDD00-9393-47F7-8BAF-7E87CE011068}.Debug|Any CPU.Build.0 = Debug|Any CPU - {80FDDD00-9393-47F7-8BAF-7E87CE011068}.Debug|x86.ActiveCfg = Debug|Any CPU - {80FDDD00-9393-47F7-8BAF-7E87CE011068}.Debug|x86.Build.0 = Debug|Any CPU {80FDDD00-9393-47F7-8BAF-7E87CE011068}.Release|Any CPU.ActiveCfg = Release|Any CPU {80FDDD00-9393-47F7-8BAF-7E87CE011068}.Release|Any CPU.Build.0 = Release|Any CPU - {80FDDD00-9393-47F7-8BAF-7E87CE011068}.Release|x86.ActiveCfg = Release|Any CPU - {80FDDD00-9393-47F7-8BAF-7E87CE011068}.Release|x86.Build.0 = Release|Any CPU {7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3}.Debug|x86.ActiveCfg = Debug|Any CPU - {7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3}.Debug|x86.Build.0 = Debug|Any CPU {7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3}.Release|Any CPU.ActiveCfg = Release|Any CPU {7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3}.Release|Any CPU.Build.0 = Release|Any CPU - {7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3}.Release|x86.ActiveCfg = Release|Any CPU - {7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3}.Release|x86.Build.0 = Release|Any CPU {2E1658E2-5045-4F85-A64C-C0ECCD39F719}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2E1658E2-5045-4F85-A64C-C0ECCD39F719}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2E1658E2-5045-4F85-A64C-C0ECCD39F719}.Debug|x86.ActiveCfg = Debug|Any CPU - {2E1658E2-5045-4F85-A64C-C0ECCD39F719}.Debug|x86.Build.0 = Debug|Any CPU {2E1658E2-5045-4F85-A64C-C0ECCD39F719}.Release|Any CPU.ActiveCfg = Release|Any CPU {2E1658E2-5045-4F85-A64C-C0ECCD39F719}.Release|Any CPU.Build.0 = Release|Any CPU - {2E1658E2-5045-4F85-A64C-C0ECCD39F719}.Release|x86.ActiveCfg = Release|Any CPU - {2E1658E2-5045-4F85-A64C-C0ECCD39F719}.Release|x86.Build.0 = Release|Any CPU {9C0660D9-48CA-40E1-BABA-8F6A1F11FE10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9C0660D9-48CA-40E1-BABA-8F6A1F11FE10}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9C0660D9-48CA-40E1-BABA-8F6A1F11FE10}.Debug|x86.ActiveCfg = Debug|Any CPU - {9C0660D9-48CA-40E1-BABA-8F6A1F11FE10}.Debug|x86.Build.0 = Debug|Any CPU {9C0660D9-48CA-40E1-BABA-8F6A1F11FE10}.Release|Any CPU.ActiveCfg = Release|Any CPU {9C0660D9-48CA-40E1-BABA-8F6A1F11FE10}.Release|Any CPU.Build.0 = Release|Any CPU - {9C0660D9-48CA-40E1-BABA-8F6A1F11FE10}.Release|x86.ActiveCfg = Release|Any CPU - {9C0660D9-48CA-40E1-BABA-8F6A1F11FE10}.Release|x86.Build.0 = Release|Any CPU {21A01C2D-2501-4619-8144-48977DD22D9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {21A01C2D-2501-4619-8144-48977DD22D9C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {21A01C2D-2501-4619-8144-48977DD22D9C}.Debug|x86.ActiveCfg = Debug|Any CPU - {21A01C2D-2501-4619-8144-48977DD22D9C}.Debug|x86.Build.0 = Debug|Any CPU {21A01C2D-2501-4619-8144-48977DD22D9C}.Release|Any CPU.ActiveCfg = Release|Any CPU {21A01C2D-2501-4619-8144-48977DD22D9C}.Release|Any CPU.Build.0 = Release|Any CPU - {21A01C2D-2501-4619-8144-48977DD22D9C}.Release|x86.ActiveCfg = Release|Any CPU - {21A01C2D-2501-4619-8144-48977DD22D9C}.Release|x86.Build.0 = Release|Any CPU {3F2FDC1C-DC6F-44CB-B4A1-A9026F25D66E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3F2FDC1C-DC6F-44CB-B4A1-A9026F25D66E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3F2FDC1C-DC6F-44CB-B4A1-A9026F25D66E}.Debug|x86.ActiveCfg = Debug|Any CPU - {3F2FDC1C-DC6F-44CB-B4A1-A9026F25D66E}.Debug|x86.Build.0 = Debug|Any CPU {3F2FDC1C-DC6F-44CB-B4A1-A9026F25D66E}.Release|Any CPU.ActiveCfg = Release|Any CPU {3F2FDC1C-DC6F-44CB-B4A1-A9026F25D66E}.Release|Any CPU.Build.0 = Release|Any CPU - {3F2FDC1C-DC6F-44CB-B4A1-A9026F25D66E}.Release|x86.ActiveCfg = Release|Any CPU - {3F2FDC1C-DC6F-44CB-B4A1-A9026F25D66E}.Release|x86.Build.0 = Release|Any CPU {3DFB4701-E3D6-4435-9F70-A6E35822C4F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3DFB4701-E3D6-4435-9F70-A6E35822C4F2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3DFB4701-E3D6-4435-9F70-A6E35822C4F2}.Debug|x86.ActiveCfg = Debug|Any CPU - {3DFB4701-E3D6-4435-9F70-A6E35822C4F2}.Debug|x86.Build.0 = Debug|Any CPU {3DFB4701-E3D6-4435-9F70-A6E35822C4F2}.Release|Any CPU.ActiveCfg = Release|Any CPU {3DFB4701-E3D6-4435-9F70-A6E35822C4F2}.Release|Any CPU.Build.0 = Release|Any CPU - {3DFB4701-E3D6-4435-9F70-A6E35822C4F2}.Release|x86.ActiveCfg = Release|Any CPU - {3DFB4701-E3D6-4435-9F70-A6E35822C4F2}.Release|x86.Build.0 = Release|Any CPU {69F853E5-BD04-4842-984F-FC68CC51F402}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {69F853E5-BD04-4842-984F-FC68CC51F402}.Debug|Any CPU.Build.0 = Debug|Any CPU - {69F853E5-BD04-4842-984F-FC68CC51F402}.Debug|x86.ActiveCfg = Debug|Any CPU - {69F853E5-BD04-4842-984F-FC68CC51F402}.Debug|x86.Build.0 = Debug|Any CPU {69F853E5-BD04-4842-984F-FC68CC51F402}.Release|Any CPU.ActiveCfg = Release|Any CPU {69F853E5-BD04-4842-984F-FC68CC51F402}.Release|Any CPU.Build.0 = Release|Any CPU - {69F853E5-BD04-4842-984F-FC68CC51F402}.Release|x86.ActiveCfg = Release|Any CPU - {69F853E5-BD04-4842-984F-FC68CC51F402}.Release|x86.Build.0 = Release|Any CPU {6FC8E6F5-659C-424D-AEB5-331B95883E29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6FC8E6F5-659C-424D-AEB5-331B95883E29}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6FC8E6F5-659C-424D-AEB5-331B95883E29}.Debug|x86.ActiveCfg = Debug|Any CPU - {6FC8E6F5-659C-424D-AEB5-331B95883E29}.Debug|x86.Build.0 = Debug|Any CPU {6FC8E6F5-659C-424D-AEB5-331B95883E29}.Release|Any CPU.ActiveCfg = Release|Any CPU {6FC8E6F5-659C-424D-AEB5-331B95883E29}.Release|Any CPU.Build.0 = Release|Any CPU - {6FC8E6F5-659C-424D-AEB5-331B95883E29}.Release|x86.ActiveCfg = Release|Any CPU - {6FC8E6F5-659C-424D-AEB5-331B95883E29}.Release|x86.Build.0 = Release|Any CPU {DD317BE1-42A1-4795-B1D4-F370C40D649A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DD317BE1-42A1-4795-B1D4-F370C40D649A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DD317BE1-42A1-4795-B1D4-F370C40D649A}.Debug|x86.ActiveCfg = Debug|Any CPU - {DD317BE1-42A1-4795-B1D4-F370C40D649A}.Debug|x86.Build.0 = Debug|Any CPU {DD317BE1-42A1-4795-B1D4-F370C40D649A}.Release|Any CPU.ActiveCfg = Release|Any CPU {DD317BE1-42A1-4795-B1D4-F370C40D649A}.Release|Any CPU.Build.0 = Release|Any CPU - {DD317BE1-42A1-4795-B1D4-F370C40D649A}.Release|x86.ActiveCfg = Release|Any CPU - {DD317BE1-42A1-4795-B1D4-F370C40D649A}.Release|x86.Build.0 = Release|Any CPU {B6FC05F2-0E49-4BE2-8030-ACBB82B7F431}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B6FC05F2-0E49-4BE2-8030-ACBB82B7F431}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B6FC05F2-0E49-4BE2-8030-ACBB82B7F431}.Debug|x86.ActiveCfg = Debug|Any CPU - {B6FC05F2-0E49-4BE2-8030-ACBB82B7F431}.Debug|x86.Build.0 = Debug|Any CPU {B6FC05F2-0E49-4BE2-8030-ACBB82B7F431}.Release|Any CPU.ActiveCfg = Release|Any CPU {B6FC05F2-0E49-4BE2-8030-ACBB82B7F431}.Release|Any CPU.Build.0 = Release|Any CPU - {B6FC05F2-0E49-4BE2-8030-ACBB82B7F431}.Release|x86.ActiveCfg = Release|Any CPU - {B6FC05F2-0E49-4BE2-8030-ACBB82B7F431}.Release|x86.Build.0 = Release|Any CPU {1688E1E5-D510-4E06-86F3-F8DB10B1393D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1688E1E5-D510-4E06-86F3-F8DB10B1393D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1688E1E5-D510-4E06-86F3-F8DB10B1393D}.Debug|x86.ActiveCfg = Debug|Any CPU - {1688E1E5-D510-4E06-86F3-F8DB10B1393D}.Debug|x86.Build.0 = Debug|Any CPU {1688E1E5-D510-4E06-86F3-F8DB10B1393D}.Release|Any CPU.ActiveCfg = Release|Any CPU {1688E1E5-D510-4E06-86F3-F8DB10B1393D}.Release|Any CPU.Build.0 = Release|Any CPU - {1688E1E5-D510-4E06-86F3-F8DB10B1393D}.Release|x86.ActiveCfg = Release|Any CPU - {1688E1E5-D510-4E06-86F3-F8DB10B1393D}.Release|x86.Build.0 = Release|Any CPU {F040CEC5-5E11-4DBD-9F6A-250478E28177}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F040CEC5-5E11-4DBD-9F6A-250478E28177}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F040CEC5-5E11-4DBD-9F6A-250478E28177}.Debug|x86.ActiveCfg = Debug|Any CPU - {F040CEC5-5E11-4DBD-9F6A-250478E28177}.Debug|x86.Build.0 = Debug|Any CPU {F040CEC5-5E11-4DBD-9F6A-250478E28177}.Release|Any CPU.ActiveCfg = Release|Any CPU {F040CEC5-5E11-4DBD-9F6A-250478E28177}.Release|Any CPU.Build.0 = Release|Any CPU - {F040CEC5-5E11-4DBD-9F6A-250478E28177}.Release|x86.ActiveCfg = Release|Any CPU - {F040CEC5-5E11-4DBD-9F6A-250478E28177}.Release|x86.Build.0 = Release|Any CPU {275812EE-DEDB-4232-9439-91C9757D2AE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {275812EE-DEDB-4232-9439-91C9757D2AE4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {275812EE-DEDB-4232-9439-91C9757D2AE4}.Debug|x86.ActiveCfg = Debug|Any CPU - {275812EE-DEDB-4232-9439-91C9757D2AE4}.Debug|x86.Build.0 = Debug|Any CPU {275812EE-DEDB-4232-9439-91C9757D2AE4}.Release|Any CPU.ActiveCfg = Release|Any CPU {275812EE-DEDB-4232-9439-91C9757D2AE4}.Release|Any CPU.Build.0 = Release|Any CPU - {275812EE-DEDB-4232-9439-91C9757D2AE4}.Release|x86.ActiveCfg = Release|Any CPU - {275812EE-DEDB-4232-9439-91C9757D2AE4}.Release|x86.Build.0 = Release|Any CPU {5FF1E493-69CC-4D0B-83F2-039F469A04E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5FF1E493-69CC-4D0B-83F2-039F469A04E1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5FF1E493-69CC-4D0B-83F2-039F469A04E1}.Debug|x86.ActiveCfg = Debug|Any CPU - {5FF1E493-69CC-4D0B-83F2-039F469A04E1}.Debug|x86.Build.0 = Debug|Any CPU {5FF1E493-69CC-4D0B-83F2-039F469A04E1}.Release|Any CPU.ActiveCfg = Release|Any CPU {5FF1E493-69CC-4D0B-83F2-039F469A04E1}.Release|Any CPU.Build.0 = Release|Any CPU - {5FF1E493-69CC-4D0B-83F2-039F469A04E1}.Release|x86.ActiveCfg = Release|Any CPU - {5FF1E493-69CC-4D0B-83F2-039F469A04E1}.Release|x86.Build.0 = Release|Any CPU {AA87BFED-089A-4096-B8D5-690BDC7D5B24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AA87BFED-089A-4096-B8D5-690BDC7D5B24}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AA87BFED-089A-4096-B8D5-690BDC7D5B24}.Debug|x86.ActiveCfg = Debug|Any CPU - {AA87BFED-089A-4096-B8D5-690BDC7D5B24}.Debug|x86.Build.0 = Debug|Any CPU {AA87BFED-089A-4096-B8D5-690BDC7D5B24}.Release|Any CPU.ActiveCfg = Release|Any CPU {AA87BFED-089A-4096-B8D5-690BDC7D5B24}.Release|Any CPU.Build.0 = Release|Any CPU - {AA87BFED-089A-4096-B8D5-690BDC7D5B24}.Release|x86.ActiveCfg = Release|Any CPU - {AA87BFED-089A-4096-B8D5-690BDC7D5B24}.Release|x86.Build.0 = Release|Any CPU {A07ABCF5-BC43-4EE9-8FD8-B2D77FD54D73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A07ABCF5-BC43-4EE9-8FD8-B2D77FD54D73}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A07ABCF5-BC43-4EE9-8FD8-B2D77FD54D73}.Debug|x86.ActiveCfg = Debug|Any CPU - {A07ABCF5-BC43-4EE9-8FD8-B2D77FD54D73}.Debug|x86.Build.0 = Debug|Any CPU {A07ABCF5-BC43-4EE9-8FD8-B2D77FD54D73}.Release|Any CPU.ActiveCfg = Release|Any CPU {A07ABCF5-BC43-4EE9-8FD8-B2D77FD54D73}.Release|Any CPU.Build.0 = Release|Any CPU - {A07ABCF5-BC43-4EE9-8FD8-B2D77FD54D73}.Release|x86.ActiveCfg = Release|Any CPU - {A07ABCF5-BC43-4EE9-8FD8-B2D77FD54D73}.Release|x86.Build.0 = Release|Any CPU {2531A8C4-97DD-47BC-A79C-B7846051E137}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2531A8C4-97DD-47BC-A79C-B7846051E137}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2531A8C4-97DD-47BC-A79C-B7846051E137}.Debug|x86.ActiveCfg = Debug|Any CPU - {2531A8C4-97DD-47BC-A79C-B7846051E137}.Debug|x86.Build.0 = Debug|Any CPU {2531A8C4-97DD-47BC-A79C-B7846051E137}.Release|Any CPU.ActiveCfg = Release|Any CPU {2531A8C4-97DD-47BC-A79C-B7846051E137}.Release|Any CPU.Build.0 = Release|Any CPU - {2531A8C4-97DD-47BC-A79C-B7846051E137}.Release|x86.ActiveCfg = Release|Any CPU - {2531A8C4-97DD-47BC-A79C-B7846051E137}.Release|x86.Build.0 = Release|Any CPU {0141285D-8F6C-42C7-BAF3-3C0CCD61C716}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0141285D-8F6C-42C7-BAF3-3C0CCD61C716}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0141285D-8F6C-42C7-BAF3-3C0CCD61C716}.Debug|x86.ActiveCfg = Debug|Any CPU - {0141285D-8F6C-42C7-BAF3-3C0CCD61C716}.Debug|x86.Build.0 = Debug|Any CPU {0141285D-8F6C-42C7-BAF3-3C0CCD61C716}.Release|Any CPU.ActiveCfg = Release|Any CPU {0141285D-8F6C-42C7-BAF3-3C0CCD61C716}.Release|Any CPU.Build.0 = Release|Any CPU - {0141285D-8F6C-42C7-BAF3-3C0CCD61C716}.Release|x86.ActiveCfg = Release|Any CPU - {0141285D-8F6C-42C7-BAF3-3C0CCD61C716}.Release|x86.Build.0 = Release|Any CPU {9FF1205F-1D7C-4EE4-B038-3456FE6EBEAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9FF1205F-1D7C-4EE4-B038-3456FE6EBEAF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9FF1205F-1D7C-4EE4-B038-3456FE6EBEAF}.Debug|x86.ActiveCfg = Debug|Any CPU - {9FF1205F-1D7C-4EE4-B038-3456FE6EBEAF}.Debug|x86.Build.0 = Debug|Any CPU {9FF1205F-1D7C-4EE4-B038-3456FE6EBEAF}.Release|Any CPU.ActiveCfg = Release|Any CPU {9FF1205F-1D7C-4EE4-B038-3456FE6EBEAF}.Release|Any CPU.Build.0 = Release|Any CPU - {9FF1205F-1D7C-4EE4-B038-3456FE6EBEAF}.Release|x86.ActiveCfg = Release|Any CPU - {9FF1205F-1D7C-4EE4-B038-3456FE6EBEAF}.Release|x86.Build.0 = Release|Any CPU {5018D049-5870-465A-889B-C742CE1E31CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5018D049-5870-465A-889B-C742CE1E31CB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5018D049-5870-465A-889B-C742CE1E31CB}.Debug|x86.ActiveCfg = Debug|Any CPU - {5018D049-5870-465A-889B-C742CE1E31CB}.Debug|x86.Build.0 = Debug|Any CPU {5018D049-5870-465A-889B-C742CE1E31CB}.Release|Any CPU.ActiveCfg = Release|Any CPU {5018D049-5870-465A-889B-C742CE1E31CB}.Release|Any CPU.Build.0 = Release|Any CPU - {5018D049-5870-465A-889B-C742CE1E31CB}.Release|x86.ActiveCfg = Release|Any CPU - {5018D049-5870-465A-889B-C742CE1E31CB}.Release|x86.Build.0 = Release|Any CPU {E512C6C1-F085-4AD7-B0D9-E8F1A0A2A510}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E512C6C1-F085-4AD7-B0D9-E8F1A0A2A510}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E512C6C1-F085-4AD7-B0D9-E8F1A0A2A510}.Debug|x86.ActiveCfg = Debug|Any CPU - {E512C6C1-F085-4AD7-B0D9-E8F1A0A2A510}.Debug|x86.Build.0 = Debug|Any CPU {E512C6C1-F085-4AD7-B0D9-E8F1A0A2A510}.Release|Any CPU.ActiveCfg = Release|Any CPU {E512C6C1-F085-4AD7-B0D9-E8F1A0A2A510}.Release|Any CPU.Build.0 = Release|Any CPU - {E512C6C1-F085-4AD7-B0D9-E8F1A0A2A510}.Release|x86.ActiveCfg = Release|Any CPU - {E512C6C1-F085-4AD7-B0D9-E8F1A0A2A510}.Release|x86.Build.0 = Release|Any CPU {2D36C343-BB6A-4CB5-902B-E2145ACCB58F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2D36C343-BB6A-4CB5-902B-E2145ACCB58F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2D36C343-BB6A-4CB5-902B-E2145ACCB58F}.Debug|x86.ActiveCfg = Debug|Any CPU - {2D36C343-BB6A-4CB5-902B-E2145ACCB58F}.Debug|x86.Build.0 = Debug|Any CPU {2D36C343-BB6A-4CB5-902B-E2145ACCB58F}.Release|Any CPU.ActiveCfg = Release|Any CPU {2D36C343-BB6A-4CB5-902B-E2145ACCB58F}.Release|Any CPU.Build.0 = Release|Any CPU - {2D36C343-BB6A-4CB5-902B-E2145ACCB58F}.Release|x86.ActiveCfg = Release|Any CPU - {2D36C343-BB6A-4CB5-902B-E2145ACCB58F}.Release|x86.Build.0 = Release|Any CPU {FFB00FB5-8C8C-4A02-B67D-262B9D28E8B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FFB00FB5-8C8C-4A02-B67D-262B9D28E8B1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FFB00FB5-8C8C-4A02-B67D-262B9D28E8B1}.Debug|x86.ActiveCfg = Debug|Any CPU - {FFB00FB5-8C8C-4A02-B67D-262B9D28E8B1}.Debug|x86.Build.0 = Debug|Any CPU {FFB00FB5-8C8C-4A02-B67D-262B9D28E8B1}.Release|Any CPU.ActiveCfg = Release|Any CPU {FFB00FB5-8C8C-4A02-B67D-262B9D28E8B1}.Release|Any CPU.Build.0 = Release|Any CPU - {FFB00FB5-8C8C-4A02-B67D-262B9D28E8B1}.Release|x86.ActiveCfg = Release|Any CPU - {FFB00FB5-8C8C-4A02-B67D-262B9D28E8B1}.Release|x86.Build.0 = Release|Any CPU {60166C60-813C-46C4-911D-2411B4ABBC0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {60166C60-813C-46C4-911D-2411B4ABBC0F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {60166C60-813C-46C4-911D-2411B4ABBC0F}.Debug|x86.ActiveCfg = Debug|Any CPU - {60166C60-813C-46C4-911D-2411B4ABBC0F}.Debug|x86.Build.0 = Debug|Any CPU {60166C60-813C-46C4-911D-2411B4ABBC0F}.Release|Any CPU.ActiveCfg = Release|Any CPU {60166C60-813C-46C4-911D-2411B4ABBC0F}.Release|Any CPU.Build.0 = Release|Any CPU - {60166C60-813C-46C4-911D-2411B4ABBC0F}.Release|x86.ActiveCfg = Release|Any CPU - {60166C60-813C-46C4-911D-2411B4ABBC0F}.Release|x86.Build.0 = Release|Any CPU {FC2AE90B-2E4B-4045-9FDD-73D4F5ED6C89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FC2AE90B-2E4B-4045-9FDD-73D4F5ED6C89}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FC2AE90B-2E4B-4045-9FDD-73D4F5ED6C89}.Debug|x86.ActiveCfg = Debug|Any CPU - {FC2AE90B-2E4B-4045-9FDD-73D4F5ED6C89}.Debug|x86.Build.0 = Debug|Any CPU {FC2AE90B-2E4B-4045-9FDD-73D4F5ED6C89}.Release|Any CPU.ActiveCfg = Release|Any CPU {FC2AE90B-2E4B-4045-9FDD-73D4F5ED6C89}.Release|Any CPU.Build.0 = Release|Any CPU - {FC2AE90B-2E4B-4045-9FDD-73D4F5ED6C89}.Release|x86.ActiveCfg = Release|Any CPU - {FC2AE90B-2E4B-4045-9FDD-73D4F5ED6C89}.Release|x86.Build.0 = Release|Any CPU {49E7C367-181B-499C-AC2E-8E17C81418D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {49E7C367-181B-499C-AC2E-8E17C81418D6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {49E7C367-181B-499C-AC2E-8E17C81418D6}.Debug|x86.ActiveCfg = Debug|Any CPU - {49E7C367-181B-499C-AC2E-8E17C81418D6}.Debug|x86.Build.0 = Debug|Any CPU {49E7C367-181B-499C-AC2E-8E17C81418D6}.Release|Any CPU.ActiveCfg = Release|Any CPU {49E7C367-181B-499C-AC2E-8E17C81418D6}.Release|Any CPU.Build.0 = Release|Any CPU - {49E7C367-181B-499C-AC2E-8E17C81418D6}.Release|x86.ActiveCfg = Release|Any CPU - {49E7C367-181B-499C-AC2E-8E17C81418D6}.Release|x86.Build.0 = Release|Any CPU {037F06F0-3BE8-42D0-801E-2F74FC380AB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {037F06F0-3BE8-42D0-801E-2F74FC380AB8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {037F06F0-3BE8-42D0-801E-2F74FC380AB8}.Debug|x86.ActiveCfg = Debug|Any CPU - {037F06F0-3BE8-42D0-801E-2F74FC380AB8}.Debug|x86.Build.0 = Debug|Any CPU {037F06F0-3BE8-42D0-801E-2F74FC380AB8}.Release|Any CPU.ActiveCfg = Release|Any CPU {037F06F0-3BE8-42D0-801E-2F74FC380AB8}.Release|Any CPU.Build.0 = Release|Any CPU - {037F06F0-3BE8-42D0-801E-2F74FC380AB8}.Release|x86.ActiveCfg = Release|Any CPU - {037F06F0-3BE8-42D0-801E-2F74FC380AB8}.Release|x86.Build.0 = Release|Any CPU {2F11618A-9251-4609-B3D5-CE4D2B3D3E49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2F11618A-9251-4609-B3D5-CE4D2B3D3E49}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2F11618A-9251-4609-B3D5-CE4D2B3D3E49}.Debug|x86.ActiveCfg = Debug|Any CPU - {2F11618A-9251-4609-B3D5-CE4D2B3D3E49}.Debug|x86.Build.0 = Debug|Any CPU {2F11618A-9251-4609-B3D5-CE4D2B3D3E49}.Release|Any CPU.ActiveCfg = Release|Any CPU {2F11618A-9251-4609-B3D5-CE4D2B3D3E49}.Release|Any CPU.Build.0 = Release|Any CPU - {2F11618A-9251-4609-B3D5-CE4D2B3D3E49}.Release|x86.ActiveCfg = Release|Any CPU - {2F11618A-9251-4609-B3D5-CE4D2B3D3E49}.Release|x86.Build.0 = Release|Any CPU {764D2C19-0187-4837-A2A3-96DDC6EF4CE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {764D2C19-0187-4837-A2A3-96DDC6EF4CE2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {764D2C19-0187-4837-A2A3-96DDC6EF4CE2}.Debug|x86.ActiveCfg = Debug|Any CPU - {764D2C19-0187-4837-A2A3-96DDC6EF4CE2}.Debug|x86.Build.0 = Debug|Any CPU {764D2C19-0187-4837-A2A3-96DDC6EF4CE2}.Release|Any CPU.ActiveCfg = Release|Any CPU {764D2C19-0187-4837-A2A3-96DDC6EF4CE2}.Release|Any CPU.Build.0 = Release|Any CPU - {764D2C19-0187-4837-A2A3-96DDC6EF4CE2}.Release|x86.ActiveCfg = Release|Any CPU - {764D2C19-0187-4837-A2A3-96DDC6EF4CE2}.Release|x86.Build.0 = Release|Any CPU {9102ECF3-5CD1-4107-B8B7-F3795A52D790}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9102ECF3-5CD1-4107-B8B7-F3795A52D790}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9102ECF3-5CD1-4107-B8B7-F3795A52D790}.Debug|x86.ActiveCfg = Debug|Any CPU - {9102ECF3-5CD1-4107-B8B7-F3795A52D790}.Debug|x86.Build.0 = Debug|Any CPU {9102ECF3-5CD1-4107-B8B7-F3795A52D790}.Release|Any CPU.ActiveCfg = Release|Any CPU {9102ECF3-5CD1-4107-B8B7-F3795A52D790}.Release|Any CPU.Build.0 = Release|Any CPU - {9102ECF3-5CD1-4107-B8B7-F3795A52D790}.Release|x86.ActiveCfg = Release|Any CPU - {9102ECF3-5CD1-4107-B8B7-F3795A52D790}.Release|x86.Build.0 = Release|Any CPU {50CF5D8F-F82F-4210-A06E-37CC9BFFDD49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {50CF5D8F-F82F-4210-A06E-37CC9BFFDD49}.Debug|Any CPU.Build.0 = Debug|Any CPU - {50CF5D8F-F82F-4210-A06E-37CC9BFFDD49}.Debug|x86.ActiveCfg = Debug|Any CPU - {50CF5D8F-F82F-4210-A06E-37CC9BFFDD49}.Debug|x86.Build.0 = Debug|Any CPU {50CF5D8F-F82F-4210-A06E-37CC9BFFDD49}.Release|Any CPU.ActiveCfg = Release|Any CPU {50CF5D8F-F82F-4210-A06E-37CC9BFFDD49}.Release|Any CPU.Build.0 = Release|Any CPU - {50CF5D8F-F82F-4210-A06E-37CC9BFFDD49}.Release|x86.ActiveCfg = Release|Any CPU - {50CF5D8F-F82F-4210-A06E-37CC9BFFDD49}.Release|x86.Build.0 = Release|Any CPU {CFA94A39-4805-456D-A369-FC35CCC170E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CFA94A39-4805-456D-A369-FC35CCC170E9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CFA94A39-4805-456D-A369-FC35CCC170E9}.Debug|x86.ActiveCfg = Debug|Any CPU - {CFA94A39-4805-456D-A369-FC35CCC170E9}.Debug|x86.Build.0 = Debug|Any CPU {CFA94A39-4805-456D-A369-FC35CCC170E9}.Release|Any CPU.ActiveCfg = Release|Any CPU {CFA94A39-4805-456D-A369-FC35CCC170E9}.Release|Any CPU.Build.0 = Release|Any CPU - {CFA94A39-4805-456D-A369-FC35CCC170E9}.Release|x86.ActiveCfg = Release|Any CPU - {CFA94A39-4805-456D-A369-FC35CCC170E9}.Release|x86.Build.0 = Release|Any CPU {4A490CBC-37F4-4859-AFDB-4B0833D144AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4A490CBC-37F4-4859-AFDB-4B0833D144AF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4A490CBC-37F4-4859-AFDB-4B0833D144AF}.Debug|x86.ActiveCfg = Debug|Any CPU - {4A490CBC-37F4-4859-AFDB-4B0833D144AF}.Debug|x86.Build.0 = Debug|Any CPU {4A490CBC-37F4-4859-AFDB-4B0833D144AF}.Release|Any CPU.ActiveCfg = Release|Any CPU {4A490CBC-37F4-4859-AFDB-4B0833D144AF}.Release|Any CPU.Build.0 = Release|Any CPU - {4A490CBC-37F4-4859-AFDB-4B0833D144AF}.Release|x86.ActiveCfg = Release|Any CPU - {4A490CBC-37F4-4859-AFDB-4B0833D144AF}.Release|x86.Build.0 = Release|Any CPU {34E868E9-D30B-4FB5-BC61-AFC4A9612A0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {34E868E9-D30B-4FB5-BC61-AFC4A9612A0F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {34E868E9-D30B-4FB5-BC61-AFC4A9612A0F}.Debug|x86.ActiveCfg = Debug|Any CPU - {34E868E9-D30B-4FB5-BC61-AFC4A9612A0F}.Debug|x86.Build.0 = Debug|Any CPU {34E868E9-D30B-4FB5-BC61-AFC4A9612A0F}.Release|Any CPU.ActiveCfg = Release|Any CPU {34E868E9-D30B-4FB5-BC61-AFC4A9612A0F}.Release|Any CPU.Build.0 = Release|Any CPU - {34E868E9-D30B-4FB5-BC61-AFC4A9612A0F}.Release|x86.ActiveCfg = Release|Any CPU - {34E868E9-D30B-4FB5-BC61-AFC4A9612A0F}.Release|x86.Build.0 = Release|Any CPU {0EB22BD1-B8B1-417D-8276-F475C2E190FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0EB22BD1-B8B1-417D-8276-F475C2E190FF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0EB22BD1-B8B1-417D-8276-F475C2E190FF}.Debug|x86.ActiveCfg = Debug|Any CPU - {0EB22BD1-B8B1-417D-8276-F475C2E190FF}.Debug|x86.Build.0 = Debug|Any CPU {0EB22BD1-B8B1-417D-8276-F475C2E190FF}.Release|Any CPU.ActiveCfg = Release|Any CPU {0EB22BD1-B8B1-417D-8276-F475C2E190FF}.Release|Any CPU.Build.0 = Release|Any CPU - {0EB22BD1-B8B1-417D-8276-F475C2E190FF}.Release|x86.ActiveCfg = Release|Any CPU - {0EB22BD1-B8B1-417D-8276-F475C2E190FF}.Release|x86.Build.0 = Release|Any CPU {3636D3E2-E3EF-4815-B020-819F382204CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3636D3E2-E3EF-4815-B020-819F382204CD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3636D3E2-E3EF-4815-B020-819F382204CD}.Debug|x86.ActiveCfg = Debug|Any CPU - {3636D3E2-E3EF-4815-B020-819F382204CD}.Debug|x86.Build.0 = Debug|Any CPU {3636D3E2-E3EF-4815-B020-819F382204CD}.Release|Any CPU.ActiveCfg = Release|Any CPU {3636D3E2-E3EF-4815-B020-819F382204CD}.Release|Any CPU.Build.0 = Release|Any CPU - {3636D3E2-E3EF-4815-B020-819F382204CD}.Release|x86.ActiveCfg = Release|Any CPU - {3636D3E2-E3EF-4815-B020-819F382204CD}.Release|x86.Build.0 = Release|Any CPU {B9843F65-262E-4F40-A0BC-2CBEF7563A44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B9843F65-262E-4F40-A0BC-2CBEF7563A44}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B9843F65-262E-4F40-A0BC-2CBEF7563A44}.Debug|x86.ActiveCfg = Debug|Any CPU - {B9843F65-262E-4F40-A0BC-2CBEF7563A44}.Debug|x86.Build.0 = Debug|Any CPU {B9843F65-262E-4F40-A0BC-2CBEF7563A44}.Release|Any CPU.ActiveCfg = Release|Any CPU {B9843F65-262E-4F40-A0BC-2CBEF7563A44}.Release|Any CPU.Build.0 = Release|Any CPU - {B9843F65-262E-4F40-A0BC-2CBEF7563A44}.Release|x86.ActiveCfg = Release|Any CPU - {B9843F65-262E-4F40-A0BC-2CBEF7563A44}.Release|x86.Build.0 = Release|Any CPU {03607817-6800-40B6-BEAA-D6F437CD62B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {03607817-6800-40B6-BEAA-D6F437CD62B7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {03607817-6800-40B6-BEAA-D6F437CD62B7}.Debug|x86.ActiveCfg = Debug|Any CPU - {03607817-6800-40B6-BEAA-D6F437CD62B7}.Debug|x86.Build.0 = Debug|Any CPU {03607817-6800-40B6-BEAA-D6F437CD62B7}.Release|Any CPU.ActiveCfg = Release|Any CPU {03607817-6800-40B6-BEAA-D6F437CD62B7}.Release|Any CPU.Build.0 = Release|Any CPU - {03607817-6800-40B6-BEAA-D6F437CD62B7}.Release|x86.ActiveCfg = Release|Any CPU - {03607817-6800-40B6-BEAA-D6F437CD62B7}.Release|x86.Build.0 = Release|Any CPU {6A68FDF9-24B3-4CB6-A808-96BF50D1BCE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6A68FDF9-24B3-4CB6-A808-96BF50D1BCE5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6A68FDF9-24B3-4CB6-A808-96BF50D1BCE5}.Debug|x86.ActiveCfg = Debug|Any CPU - {6A68FDF9-24B3-4CB6-A808-96BF50D1BCE5}.Debug|x86.Build.0 = Debug|Any CPU {6A68FDF9-24B3-4CB6-A808-96BF50D1BCE5}.Release|Any CPU.ActiveCfg = Release|Any CPU {6A68FDF9-24B3-4CB6-A808-96BF50D1BCE5}.Release|Any CPU.Build.0 = Release|Any CPU - {6A68FDF9-24B3-4CB6-A808-96BF50D1BCE5}.Release|x86.ActiveCfg = Release|Any CPU - {6A68FDF9-24B3-4CB6-A808-96BF50D1BCE5}.Release|x86.Build.0 = Release|Any CPU {23405307-7EFF-4774-8B11-8F5885439761}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {23405307-7EFF-4774-8B11-8F5885439761}.Debug|Any CPU.Build.0 = Debug|Any CPU - {23405307-7EFF-4774-8B11-8F5885439761}.Debug|x86.ActiveCfg = Debug|Any CPU - {23405307-7EFF-4774-8B11-8F5885439761}.Debug|x86.Build.0 = Debug|Any CPU {23405307-7EFF-4774-8B11-8F5885439761}.Release|Any CPU.ActiveCfg = Release|Any CPU {23405307-7EFF-4774-8B11-8F5885439761}.Release|Any CPU.Build.0 = Release|Any CPU - {23405307-7EFF-4774-8B11-8F5885439761}.Release|x86.ActiveCfg = Release|Any CPU - {23405307-7EFF-4774-8B11-8F5885439761}.Release|x86.Build.0 = Release|Any CPU {6362616E-6A47-48F0-9EE0-27800B306ACB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6362616E-6A47-48F0-9EE0-27800B306ACB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6362616E-6A47-48F0-9EE0-27800B306ACB}.Debug|x86.ActiveCfg = Debug|Any CPU - {6362616E-6A47-48F0-9EE0-27800B306ACB}.Debug|x86.Build.0 = Debug|Any CPU {6362616E-6A47-48F0-9EE0-27800B306ACB}.Release|Any CPU.ActiveCfg = Release|Any CPU {6362616E-6A47-48F0-9EE0-27800B306ACB}.Release|Any CPU.Build.0 = Release|Any CPU - {6362616E-6A47-48F0-9EE0-27800B306ACB}.Release|x86.ActiveCfg = Release|Any CPU - {6362616E-6A47-48F0-9EE0-27800B306ACB}.Release|x86.Build.0 = Release|Any CPU {BD8CE303-5F04-45EC-8DCF-73C9164CD614}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BD8CE303-5F04-45EC-8DCF-73C9164CD614}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BD8CE303-5F04-45EC-8DCF-73C9164CD614}.Debug|x86.ActiveCfg = Debug|Any CPU - {BD8CE303-5F04-45EC-8DCF-73C9164CD614}.Debug|x86.Build.0 = Debug|Any CPU {BD8CE303-5F04-45EC-8DCF-73C9164CD614}.Release|Any CPU.ActiveCfg = Release|Any CPU {BD8CE303-5F04-45EC-8DCF-73C9164CD614}.Release|Any CPU.Build.0 = Release|Any CPU - {BD8CE303-5F04-45EC-8DCF-73C9164CD614}.Release|x86.ActiveCfg = Release|Any CPU - {BD8CE303-5F04-45EC-8DCF-73C9164CD614}.Release|x86.Build.0 = Release|Any CPU {2FB6C157-DF91-4B1C-9827-A4D1C08C73EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2FB6C157-DF91-4B1C-9827-A4D1C08C73EC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2FB6C157-DF91-4B1C-9827-A4D1C08C73EC}.Debug|x86.ActiveCfg = Debug|Any CPU - {2FB6C157-DF91-4B1C-9827-A4D1C08C73EC}.Debug|x86.Build.0 = Debug|Any CPU {2FB6C157-DF91-4B1C-9827-A4D1C08C73EC}.Release|Any CPU.ActiveCfg = Release|Any CPU {2FB6C157-DF91-4B1C-9827-A4D1C08C73EC}.Release|Any CPU.Build.0 = Release|Any CPU - {2FB6C157-DF91-4B1C-9827-A4D1C08C73EC}.Release|x86.ActiveCfg = Release|Any CPU - {2FB6C157-DF91-4B1C-9827-A4D1C08C73EC}.Release|x86.Build.0 = Release|Any CPU {5E6E9184-DEC5-4EC5-B0A4-77CFDC8CDEBE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5E6E9184-DEC5-4EC5-B0A4-77CFDC8CDEBE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5E6E9184-DEC5-4EC5-B0A4-77CFDC8CDEBE}.Debug|x86.ActiveCfg = Debug|Any CPU - {5E6E9184-DEC5-4EC5-B0A4-77CFDC8CDEBE}.Debug|x86.Build.0 = Debug|Any CPU {5E6E9184-DEC5-4EC5-B0A4-77CFDC8CDEBE}.Release|Any CPU.ActiveCfg = Release|Any CPU {5E6E9184-DEC5-4EC5-B0A4-77CFDC8CDEBE}.Release|Any CPU.Build.0 = Release|Any CPU - {5E6E9184-DEC5-4EC5-B0A4-77CFDC8CDEBE}.Release|x86.ActiveCfg = Release|Any CPU - {5E6E9184-DEC5-4EC5-B0A4-77CFDC8CDEBE}.Release|x86.Build.0 = Release|Any CPU {A74C7D2E-92FA-490A-B80A-28BEF56B56FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A74C7D2E-92FA-490A-B80A-28BEF56B56FC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A74C7D2E-92FA-490A-B80A-28BEF56B56FC}.Debug|x86.ActiveCfg = Debug|Any CPU - {A74C7D2E-92FA-490A-B80A-28BEF56B56FC}.Debug|x86.Build.0 = Debug|Any CPU {A74C7D2E-92FA-490A-B80A-28BEF56B56FC}.Release|Any CPU.ActiveCfg = Release|Any CPU {A74C7D2E-92FA-490A-B80A-28BEF56B56FC}.Release|Any CPU.Build.0 = Release|Any CPU - {A74C7D2E-92FA-490A-B80A-28BEF56B56FC}.Release|x86.ActiveCfg = Release|Any CPU - {A74C7D2E-92FA-490A-B80A-28BEF56B56FC}.Release|x86.Build.0 = Release|Any CPU {686BF57E-A6FF-467B-AAB3-44DE916A9772}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {686BF57E-A6FF-467B-AAB3-44DE916A9772}.Debug|Any CPU.Build.0 = Debug|Any CPU - {686BF57E-A6FF-467B-AAB3-44DE916A9772}.Debug|x86.ActiveCfg = Debug|Any CPU - {686BF57E-A6FF-467B-AAB3-44DE916A9772}.Debug|x86.Build.0 = Debug|Any CPU {686BF57E-A6FF-467B-AAB3-44DE916A9772}.Release|Any CPU.ActiveCfg = Release|Any CPU {686BF57E-A6FF-467B-AAB3-44DE916A9772}.Release|Any CPU.Build.0 = Release|Any CPU - {686BF57E-A6FF-467B-AAB3-44DE916A9772}.Release|x86.ActiveCfg = Release|Any CPU - {686BF57E-A6FF-467B-AAB3-44DE916A9772}.Release|x86.Build.0 = Release|Any CPU {1DDE89EE-5819-441F-A060-2FF4A986F372}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1DDE89EE-5819-441F-A060-2FF4A986F372}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1DDE89EE-5819-441F-A060-2FF4A986F372}.Debug|x86.ActiveCfg = Debug|Any CPU - {1DDE89EE-5819-441F-A060-2FF4A986F372}.Debug|x86.Build.0 = Debug|Any CPU {1DDE89EE-5819-441F-A060-2FF4A986F372}.Release|Any CPU.ActiveCfg = Release|Any CPU {1DDE89EE-5819-441F-A060-2FF4A986F372}.Release|Any CPU.Build.0 = Release|Any CPU - {1DDE89EE-5819-441F-A060-2FF4A986F372}.Release|x86.ActiveCfg = Release|Any CPU - {1DDE89EE-5819-441F-A060-2FF4A986F372}.Release|x86.Build.0 = Release|Any CPU {655A5B07-39B8-48CD-8590-8AC0C2B708D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {655A5B07-39B8-48CD-8590-8AC0C2B708D8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {655A5B07-39B8-48CD-8590-8AC0C2B708D8}.Debug|x86.ActiveCfg = Debug|Any CPU - {655A5B07-39B8-48CD-8590-8AC0C2B708D8}.Debug|x86.Build.0 = Debug|Any CPU {655A5B07-39B8-48CD-8590-8AC0C2B708D8}.Release|Any CPU.ActiveCfg = Release|Any CPU {655A5B07-39B8-48CD-8590-8AC0C2B708D8}.Release|Any CPU.Build.0 = Release|Any CPU - {655A5B07-39B8-48CD-8590-8AC0C2B708D8}.Release|x86.ActiveCfg = Release|Any CPU - {655A5B07-39B8-48CD-8590-8AC0C2B708D8}.Release|x86.Build.0 = Release|Any CPU {DE53934B-7FC1-48A0-85AB-C519FBBD02CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DE53934B-7FC1-48A0-85AB-C519FBBD02CF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DE53934B-7FC1-48A0-85AB-C519FBBD02CF}.Debug|x86.ActiveCfg = Debug|Any CPU - {DE53934B-7FC1-48A0-85AB-C519FBBD02CF}.Debug|x86.Build.0 = Debug|Any CPU {DE53934B-7FC1-48A0-85AB-C519FBBD02CF}.Release|Any CPU.ActiveCfg = Release|Any CPU {DE53934B-7FC1-48A0-85AB-C519FBBD02CF}.Release|Any CPU.Build.0 = Release|Any CPU - {DE53934B-7FC1-48A0-85AB-C519FBBD02CF}.Release|x86.ActiveCfg = Release|Any CPU - {DE53934B-7FC1-48A0-85AB-C519FBBD02CF}.Release|x86.Build.0 = Release|Any CPU {3D33BBFD-EC63-4E8C-A714-0A48A3809A87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3D33BBFD-EC63-4E8C-A714-0A48A3809A87}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3D33BBFD-EC63-4E8C-A714-0A48A3809A87}.Debug|x86.ActiveCfg = Debug|Any CPU - {3D33BBFD-EC63-4E8C-A714-0A48A3809A87}.Debug|x86.Build.0 = Debug|Any CPU {3D33BBFD-EC63-4E8C-A714-0A48A3809A87}.Release|Any CPU.ActiveCfg = Release|Any CPU {3D33BBFD-EC63-4E8C-A714-0A48A3809A87}.Release|Any CPU.Build.0 = Release|Any CPU - {3D33BBFD-EC63-4E8C-A714-0A48A3809A87}.Release|x86.ActiveCfg = Release|Any CPU - {3D33BBFD-EC63-4E8C-A714-0A48A3809A87}.Release|x86.Build.0 = Release|Any CPU {BFFB5CAE-33B5-447E-9218-BDEBFDA96CB5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BFFB5CAE-33B5-447E-9218-BDEBFDA96CB5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BFFB5CAE-33B5-447E-9218-BDEBFDA96CB5}.Debug|x86.ActiveCfg = Debug|Any CPU - {BFFB5CAE-33B5-447E-9218-BDEBFDA96CB5}.Debug|x86.Build.0 = Debug|Any CPU {BFFB5CAE-33B5-447E-9218-BDEBFDA96CB5}.Release|Any CPU.ActiveCfg = Release|Any CPU {BFFB5CAE-33B5-447E-9218-BDEBFDA96CB5}.Release|Any CPU.Build.0 = Release|Any CPU - {BFFB5CAE-33B5-447E-9218-BDEBFDA96CB5}.Release|x86.ActiveCfg = Release|Any CPU - {BFFB5CAE-33B5-447E-9218-BDEBFDA96CB5}.Release|x86.Build.0 = Release|Any CPU {FC32EF16-31B1-47B3-B625-A80933CB3F29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FC32EF16-31B1-47B3-B625-A80933CB3F29}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FC32EF16-31B1-47B3-B625-A80933CB3F29}.Debug|x86.ActiveCfg = Debug|Any CPU - {FC32EF16-31B1-47B3-B625-A80933CB3F29}.Debug|x86.Build.0 = Debug|Any CPU {FC32EF16-31B1-47B3-B625-A80933CB3F29}.Release|Any CPU.ActiveCfg = Release|Any CPU {FC32EF16-31B1-47B3-B625-A80933CB3F29}.Release|Any CPU.Build.0 = Release|Any CPU - {FC32EF16-31B1-47B3-B625-A80933CB3F29}.Release|x86.ActiveCfg = Release|Any CPU - {FC32EF16-31B1-47B3-B625-A80933CB3F29}.Release|x86.Build.0 = Release|Any CPU {453C8E28-81D4-431E-BFB0-F3D413346E51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {453C8E28-81D4-431E-BFB0-F3D413346E51}.Debug|Any CPU.Build.0 = Debug|Any CPU - {453C8E28-81D4-431E-BFB0-F3D413346E51}.Debug|x86.ActiveCfg = Debug|Any CPU - {453C8E28-81D4-431E-BFB0-F3D413346E51}.Debug|x86.Build.0 = Debug|Any CPU {453C8E28-81D4-431E-BFB0-F3D413346E51}.Release|Any CPU.ActiveCfg = Release|Any CPU {453C8E28-81D4-431E-BFB0-F3D413346E51}.Release|Any CPU.Build.0 = Release|Any CPU - {453C8E28-81D4-431E-BFB0-F3D413346E51}.Release|x86.ActiveCfg = Release|Any CPU - {453C8E28-81D4-431E-BFB0-F3D413346E51}.Release|x86.Build.0 = Release|Any CPU {CE7F7553-DB2D-4839-92E3-F042E4261B4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CE7F7553-DB2D-4839-92E3-F042E4261B4E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CE7F7553-DB2D-4839-92E3-F042E4261B4E}.Debug|x86.ActiveCfg = Debug|Any CPU - {CE7F7553-DB2D-4839-92E3-F042E4261B4E}.Debug|x86.Build.0 = Debug|Any CPU {CE7F7553-DB2D-4839-92E3-F042E4261B4E}.Release|Any CPU.ActiveCfg = Release|Any CPU {CE7F7553-DB2D-4839-92E3-F042E4261B4E}.Release|Any CPU.Build.0 = Release|Any CPU - {CE7F7553-DB2D-4839-92E3-F042E4261B4E}.Release|x86.ActiveCfg = Release|Any CPU - {CE7F7553-DB2D-4839-92E3-F042E4261B4E}.Release|x86.Build.0 = Release|Any CPU {FF38E9C9-7A25-44F0-B2C4-24C9BFD6A8F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FF38E9C9-7A25-44F0-B2C4-24C9BFD6A8F6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FF38E9C9-7A25-44F0-B2C4-24C9BFD6A8F6}.Debug|x86.ActiveCfg = Debug|Any CPU - {FF38E9C9-7A25-44F0-B2C4-24C9BFD6A8F6}.Debug|x86.Build.0 = Debug|Any CPU {FF38E9C9-7A25-44F0-B2C4-24C9BFD6A8F6}.Release|Any CPU.ActiveCfg = Release|Any CPU {FF38E9C9-7A25-44F0-B2C4-24C9BFD6A8F6}.Release|Any CPU.Build.0 = Release|Any CPU - {FF38E9C9-7A25-44F0-B2C4-24C9BFD6A8F6}.Release|x86.ActiveCfg = Release|Any CPU - {FF38E9C9-7A25-44F0-B2C4-24C9BFD6A8F6}.Release|x86.Build.0 = Release|Any CPU {D55FB2BD-CC9E-454B-9654-94AF5D910BF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D55FB2BD-CC9E-454B-9654-94AF5D910BF7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D55FB2BD-CC9E-454B-9654-94AF5D910BF7}.Debug|x86.ActiveCfg = Debug|Any CPU - {D55FB2BD-CC9E-454B-9654-94AF5D910BF7}.Debug|x86.Build.0 = Debug|Any CPU {D55FB2BD-CC9E-454B-9654-94AF5D910BF7}.Release|Any CPU.ActiveCfg = Release|Any CPU {D55FB2BD-CC9E-454B-9654-94AF5D910BF7}.Release|Any CPU.Build.0 = Release|Any CPU - {D55FB2BD-CC9E-454B-9654-94AF5D910BF7}.Release|x86.ActiveCfg = Release|Any CPU - {D55FB2BD-CC9E-454B-9654-94AF5D910BF7}.Release|x86.Build.0 = Release|Any CPU {B9899CF1-E0EB-4599-9E24-6939A04B4979}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B9899CF1-E0EB-4599-9E24-6939A04B4979}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B9899CF1-E0EB-4599-9E24-6939A04B4979}.Debug|x86.ActiveCfg = Debug|Any CPU - {B9899CF1-E0EB-4599-9E24-6939A04B4979}.Debug|x86.Build.0 = Debug|Any CPU {B9899CF1-E0EB-4599-9E24-6939A04B4979}.Release|Any CPU.ActiveCfg = Release|Any CPU {B9899CF1-E0EB-4599-9E24-6939A04B4979}.Release|Any CPU.Build.0 = Release|Any CPU - {B9899CF1-E0EB-4599-9E24-6939A04B4979}.Release|x86.ActiveCfg = Release|Any CPU - {B9899CF1-E0EB-4599-9E24-6939A04B4979}.Release|x86.Build.0 = Release|Any CPU {D15BF03E-04ED-4BEE-A72B-7620F541F4E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D15BF03E-04ED-4BEE-A72B-7620F541F4E2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D15BF03E-04ED-4BEE-A72B-7620F541F4E2}.Debug|x86.ActiveCfg = Debug|Any CPU - {D15BF03E-04ED-4BEE-A72B-7620F541F4E2}.Debug|x86.Build.0 = Debug|Any CPU {D15BF03E-04ED-4BEE-A72B-7620F541F4E2}.Release|Any CPU.ActiveCfg = Release|Any CPU {D15BF03E-04ED-4BEE-A72B-7620F541F4E2}.Release|Any CPU.Build.0 = Release|Any CPU - {D15BF03E-04ED-4BEE-A72B-7620F541F4E2}.Release|x86.ActiveCfg = Release|Any CPU - {D15BF03E-04ED-4BEE-A72B-7620F541F4E2}.Release|x86.Build.0 = Release|Any CPU {B64766CD-1A1F-4C1B-B11F-C30F82B8E41E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B64766CD-1A1F-4C1B-B11F-C30F82B8E41E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B64766CD-1A1F-4C1B-B11F-C30F82B8E41E}.Debug|x86.ActiveCfg = Debug|Any CPU - {B64766CD-1A1F-4C1B-B11F-C30F82B8E41E}.Debug|x86.Build.0 = Debug|Any CPU {B64766CD-1A1F-4C1B-B11F-C30F82B8E41E}.Release|Any CPU.ActiveCfg = Release|Any CPU {B64766CD-1A1F-4C1B-B11F-C30F82B8E41E}.Release|Any CPU.Build.0 = Release|Any CPU - {B64766CD-1A1F-4C1B-B11F-C30F82B8E41E}.Release|x86.ActiveCfg = Release|Any CPU - {B64766CD-1A1F-4C1B-B11F-C30F82B8E41E}.Release|x86.Build.0 = Release|Any CPU {2D5E2DE4-5DA8-41C1-A14F-49855DCCE9C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2D5E2DE4-5DA8-41C1-A14F-49855DCCE9C5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2D5E2DE4-5DA8-41C1-A14F-49855DCCE9C5}.Debug|x86.ActiveCfg = Debug|Any CPU - {2D5E2DE4-5DA8-41C1-A14F-49855DCCE9C5}.Debug|x86.Build.0 = Debug|Any CPU {2D5E2DE4-5DA8-41C1-A14F-49855DCCE9C5}.Release|Any CPU.ActiveCfg = Release|Any CPU {2D5E2DE4-5DA8-41C1-A14F-49855DCCE9C5}.Release|Any CPU.Build.0 = Release|Any CPU - {2D5E2DE4-5DA8-41C1-A14F-49855DCCE9C5}.Release|x86.ActiveCfg = Release|Any CPU - {2D5E2DE4-5DA8-41C1-A14F-49855DCCE9C5}.Release|x86.Build.0 = Release|Any CPU {CEA80C83-5848-4FF6-B4E8-CEEE9482E4AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CEA80C83-5848-4FF6-B4E8-CEEE9482E4AA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CEA80C83-5848-4FF6-B4E8-CEEE9482E4AA}.Debug|x86.ActiveCfg = Debug|Any CPU - {CEA80C83-5848-4FF6-B4E8-CEEE9482E4AA}.Debug|x86.Build.0 = Debug|Any CPU {CEA80C83-5848-4FF6-B4E8-CEEE9482E4AA}.Release|Any CPU.ActiveCfg = Release|Any CPU {CEA80C83-5848-4FF6-B4E8-CEEE9482E4AA}.Release|Any CPU.Build.0 = Release|Any CPU - {CEA80C83-5848-4FF6-B4E8-CEEE9482E4AA}.Release|x86.ActiveCfg = Release|Any CPU - {CEA80C83-5848-4FF6-B4E8-CEEE9482E4AA}.Release|x86.Build.0 = Release|Any CPU {2801F82B-78CE-4BAE-B06F-537574751E2E}.Debug|Any CPU.ActiveCfg = Debug|x86 - {2801F82B-78CE-4BAE-B06F-537574751E2E}.Debug|x86.ActiveCfg = Debug|x86 - {2801F82B-78CE-4BAE-B06F-537574751E2E}.Debug|x86.Build.0 = Debug|x86 {2801F82B-78CE-4BAE-B06F-537574751E2E}.Release|Any CPU.ActiveCfg = Release|x86 - {2801F82B-78CE-4BAE-B06F-537574751E2E}.Release|x86.ActiveCfg = Release|x86 - {2801F82B-78CE-4BAE-B06F-537574751E2E}.Release|x86.Build.0 = Release|x86 {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|Any CPU.Build.0 = Debug|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|Any CPU.ActiveCfg = Release|Any CPU From a7e79fe3490dfe1114092d0f1ec700fab3c53d4c Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Thu, 8 Oct 2020 08:15:09 -0700 Subject: [PATCH 212/295] Enable nullable reference types in SQLite v2 implementation --- .../SQLitePersistentStorageBenchmark.cs | 19 +++++++---- .../AbstractPersistentStorageTests.cs | 22 ++++++------ .../SQLiteV2PersistentStorageTests.cs | 12 +++---- .../PersistenceStorageServiceFactory.cs | 2 -- .../AbstractSQLitePersistentStorageService.cs | 2 -- .../Storage/SQLite/Interop/NativeMethods.cs | 2 +- .../Storage/SQLite/Interop/OpenFlags.cs | 2 -- .../Portable/Storage/SQLite/Interop/Result.cs | 2 -- .../Storage/SQLite/Interop/SqlException.cs | 2 -- ...PersistentStorage_DocumentSerialization.cs | 4 +-- ...ePersistentStorage_ProjectSerialization.cs | 4 +-- .../Portable/Storage/SQLite/v2/Database.cs | 2 -- .../v2/Interop/ResettableSqlStatement.cs | 2 -- .../SQLite/v2/Interop/SqlConnection.cs | 12 +++---- .../Storage/SQLite/v2/Interop/SqlStatement.cs | 2 -- .../Storage/SQLite/v2/PooledConnection.cs | 2 -- .../v2/SQLitePersistentStorage.Accessor.cs | 22 ++++++------ ...SQLitePersistentStorage_BulkPopulateIds.cs | 3 ++ ...PersistentStorage_DocumentSerialization.cs | 4 +-- .../v2/SQLitePersistentStorage_FlushWrites.cs | 2 -- .../v2/SQLitePersistentStorage_Helpers.cs | 4 +-- ...ePersistentStorage_ProjectSerialization.cs | 4 +-- ...PersistentStorage_SolutionSerialization.cs | 8 ++--- .../v2/SQLitePersistentStorage_StringIds.cs | 2 -- .../v2/SQLitePersistentStorage_Threading.cs | 2 -- .../Core/Portable/Storage/StorageDatabase.cs | 2 -- .../Portable/Storage/StorageDatabaseLogger.cs | 6 ++-- .../Core/Portable/Storage/StorageOptions.cs | 2 -- .../AbstractPersistentStorage.cs | 34 +++++++++---------- .../MEF/UseExportProviderAttribute.cs | 4 +-- 30 files changed, 80 insertions(+), 112 deletions(-) diff --git a/src/Tools/IdeBenchmarks/SQLitePersistentStorageBenchmark.cs b/src/Tools/IdeBenchmarks/SQLitePersistentStorageBenchmark.cs index c84beaeab6e55..073fb04e88984 100644 --- a/src/Tools/IdeBenchmarks/SQLitePersistentStorageBenchmark.cs +++ b/src/Tools/IdeBenchmarks/SQLitePersistentStorageBenchmark.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using System.Collections.Generic; using System.IO; @@ -35,6 +33,15 @@ public class SQLitePersistentStorageBenchmarks private Document _document; private Random _random; + public SQLitePersistentStorageBenchmarks() + { + _document = null!; + _storage = null!; + _storageService = null!; + _workspace = null!; + _random = null!; + } + [GlobalSetup] public void GlobalSetup() { @@ -80,12 +87,12 @@ public void GlobalCleanup() throw new InvalidOperationException(); } - _document = null; + _document = null!; _storage.Dispose(); - _storage = null; - _storageService = null; + _storage = null!; + _storageService = null!; _workspace.Dispose(); - _workspace = null; + _workspace = null!; _useExportProviderAttribute.After(null); } diff --git a/src/VisualStudio/CSharp/Test/PersistentStorage/AbstractPersistentStorageTests.cs b/src/VisualStudio/CSharp/Test/PersistentStorage/AbstractPersistentStorageTests.cs index 8d6d5406d3014..eef7f873a5178 100644 --- a/src/VisualStudio/CSharp/Test/PersistentStorage/AbstractPersistentStorageTests.cs +++ b/src/VisualStudio/CSharp/Test/PersistentStorage/AbstractPersistentStorageTests.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using System.Collections.Generic; using System.Composition; @@ -38,7 +36,7 @@ public enum Size private readonly Encoding _encoding = Encoding.UTF8; - private AbstractPersistentStorageService _storageService; + private AbstractPersistentStorageService? _storageService; private readonly DisposableDirectory _persistentFolderRoot; private readonly TempDirectory _persistentFolder; @@ -90,10 +88,10 @@ private string GetData1(Size size) private string GetData2(Size size) => size == Size.Small ? SmallData2 : size == Size.Medium ? MediumData2 : LargeData2; - private Checksum GetChecksum1(bool withChecksum) + private Checksum? GetChecksum1(bool withChecksum) => withChecksum ? s_checksum1 : null; - private Checksum GetChecksum2(bool withChecksum) + private Checksum? GetChecksum2(bool withChecksum) => withChecksum ? s_checksum2 : null; [Fact] @@ -797,9 +795,9 @@ public void CacheDirectoryShouldNotBeAtRoot() var workspace = new AdhocWorkspace(FeaturesTestCompositions.Features.AddParts(typeof(TestPersistentStorageLocationService)).GetHostServices()); workspace.AddSolution(SolutionInfo.Create(SolutionId.CreateNewId(), new VersionStamp(), @"D:\git\PCLCrypto\PCLCrypto.sln")); - var locationService = workspace.Services.GetService(); + var locationService = workspace.Services.GetRequiredService(); var location = locationService.TryGetStorageLocation(workspace.CurrentSolution); - Assert.False(location.StartsWith("/")); + Assert.False(location?.StartsWith("/") ?? false); } [PartNotDiscoverable] @@ -873,7 +871,7 @@ protected Solution CreateOrOpenSolution(bool nullPaths = false) } internal IChecksummedPersistentStorage GetStorage( - Solution solution, IPersistentStorageFaultInjector faultInjectorOpt = null) + Solution solution, IPersistentStorageFaultInjector? faultInjectorOpt = null) { // If we handed out one for a previous test, we need to shut that down first _storageService?.GetTestAccessor().Shutdown(); @@ -892,7 +890,7 @@ internal IChecksummedPersistentStorage GetStorage( } internal IChecksummedPersistentStorage GetStorageFromKey( - Workspace workspace, SolutionKey solutionKey, IPersistentStorageFaultInjector faultInjectorOpt = null) + Workspace workspace, SolutionKey solutionKey, IPersistentStorageFaultInjector? faultInjectorOpt = null) { // If we handed out one for a previous test, we need to shut that down first _storageService?.GetTestAccessor().Shutdown(); @@ -923,14 +921,14 @@ public MockPersistentStorageLocationService(SolutionId solutionId, string storag public bool IsSupported(Workspace workspace) => true; - public string TryGetStorageLocation(Solution solution) + public string? TryGetStorageLocation(Solution solution) => solution.Id == _solutionId ? _storageLocation : null; - public string TryGetStorageLocation(Workspace workspace, SolutionKey solutionKey) + public string? TryGetStorageLocation(Workspace workspace, SolutionKey solutionKey) => solutionKey.Id == _solutionId ? _storageLocation : null; } - internal abstract AbstractPersistentStorageService GetStorageService(IPersistentStorageLocationService locationService, IPersistentStorageFaultInjector faultInjector); + internal abstract AbstractPersistentStorageService GetStorageService(IPersistentStorageLocationService locationService, IPersistentStorageFaultInjector? faultInjector); protected Stream EncodeString(string text) { diff --git a/src/VisualStudio/CSharp/Test/PersistentStorage/SQLiteV2PersistentStorageTests.cs b/src/VisualStudio/CSharp/Test/PersistentStorage/SQLiteV2PersistentStorageTests.cs index 567fbcc162503..ead3586e4eff7 100644 --- a/src/VisualStudio/CSharp/Test/PersistentStorage/SQLiteV2PersistentStorageTests.cs +++ b/src/VisualStudio/CSharp/Test/PersistentStorage/SQLiteV2PersistentStorageTests.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using System.IO; using System.Threading.Tasks; @@ -21,7 +19,7 @@ namespace Microsoft.CodeAnalysis.UnitTests.WorkspaceServices /// public class SQLiteV2PersistentStorageTests : AbstractPersistentStorageTests { - internal override AbstractPersistentStorageService GetStorageService(IPersistentStorageLocationService locationService, IPersistentStorageFaultInjector faultInjector) + internal override AbstractPersistentStorageService GetStorageService(IPersistentStorageLocationService locationService, IPersistentStorageFaultInjector? faultInjector) => new SQLitePersistentStorageService(locationService, faultInjector); [Fact] @@ -68,12 +66,12 @@ public async Task TestCrashInNewConnection() private class PersistentStorageFaultInjector : IPersistentStorageFaultInjector { - private readonly Action _onNewConnection; - private readonly Action _onFatalError; + private readonly Action? _onNewConnection; + private readonly Action? _onFatalError; public PersistentStorageFaultInjector( - Action onNewConnection = null, - Action onFatalError = null) + Action? onNewConnection = null, + Action? onFatalError = null) { _onNewConnection = onNewConnection; _onFatalError = onFatalError; diff --git a/src/Workspaces/Core/Portable/Storage/PersistenceStorageServiceFactory.cs b/src/Workspaces/Core/Portable/Storage/PersistenceStorageServiceFactory.cs index 1a2e5fdbab01a..24acc50268947 100644 --- a/src/Workspaces/Core/Portable/Storage/PersistenceStorageServiceFactory.cs +++ b/src/Workspaces/Core/Portable/Storage/PersistenceStorageServiceFactory.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using System.Composition; using Microsoft.CodeAnalysis.Experiments; diff --git a/src/Workspaces/Core/Portable/Storage/SQLite/AbstractSQLitePersistentStorageService.cs b/src/Workspaces/Core/Portable/Storage/SQLite/AbstractSQLitePersistentStorageService.cs index eebd81107c3ca..d3e13fad2ff82 100644 --- a/src/Workspaces/Core/Portable/Storage/SQLite/AbstractSQLitePersistentStorageService.cs +++ b/src/Workspaces/Core/Portable/Storage/SQLite/AbstractSQLitePersistentStorageService.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using System.IO; using System.Runtime.InteropServices; diff --git a/src/Workspaces/Core/Portable/Storage/SQLite/Interop/NativeMethods.cs b/src/Workspaces/Core/Portable/Storage/SQLite/Interop/NativeMethods.cs index 1ad14e5772b6f..1d5505bc11b32 100644 --- a/src/Workspaces/Core/Portable/Storage/SQLite/Interop/NativeMethods.cs +++ b/src/Workspaces/Core/Portable/Storage/SQLite/Interop/NativeMethods.cs @@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis.SQLite.Interop [SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Name chosen to match SQLitePCL.raw")] internal static class NativeMethods { - public static SafeSqliteHandle sqlite3_open_v2(string filename, int flags, string vfs, out Result result) + public static SafeSqliteHandle sqlite3_open_v2(string filename, int flags, string? vfs, out Result result) { result = (Result)raw.sqlite3_open_v2(filename, out var wrapper, flags, vfs); if (result != Result.OK) diff --git a/src/Workspaces/Core/Portable/Storage/SQLite/Interop/OpenFlags.cs b/src/Workspaces/Core/Portable/Storage/SQLite/Interop/OpenFlags.cs index 552460c25b860..5be779c90a892 100644 --- a/src/Workspaces/Core/Portable/Storage/SQLite/Interop/OpenFlags.cs +++ b/src/Workspaces/Core/Portable/Storage/SQLite/Interop/OpenFlags.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - namespace Microsoft.CodeAnalysis.SQLite.Interop { // From: https://sqlite.org/c3ref/c_open_autoproxy.html diff --git a/src/Workspaces/Core/Portable/Storage/SQLite/Interop/Result.cs b/src/Workspaces/Core/Portable/Storage/SQLite/Interop/Result.cs index 8360bbe7519c3..3e09236ab30cc 100644 --- a/src/Workspaces/Core/Portable/Storage/SQLite/Interop/Result.cs +++ b/src/Workspaces/Core/Portable/Storage/SQLite/Interop/Result.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - namespace Microsoft.CodeAnalysis.SQLite.Interop { // From https://sqlite.org/c3ref/c_abort.html diff --git a/src/Workspaces/Core/Portable/Storage/SQLite/Interop/SqlException.cs b/src/Workspaces/Core/Portable/Storage/SQLite/Interop/SqlException.cs index bba86cd4b3d01..27dc41ad6970a 100644 --- a/src/Workspaces/Core/Portable/Storage/SQLite/Interop/SqlException.cs +++ b/src/Workspaces/Core/Portable/Storage/SQLite/Interop/SqlException.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; namespace Microsoft.CodeAnalysis.SQLite.Interop diff --git a/src/Workspaces/Core/Portable/Storage/SQLite/v1/SQLitePersistentStorage_DocumentSerialization.cs b/src/Workspaces/Core/Portable/Storage/SQLite/v1/SQLitePersistentStorage_DocumentSerialization.cs index 201ce244a997d..045d932f7c3df 100644 --- a/src/Workspaces/Core/Portable/Storage/SQLite/v1/SQLitePersistentStorage_DocumentSerialization.cs +++ b/src/Workspaces/Core/Portable/Storage/SQLite/v1/SQLitePersistentStorage_DocumentSerialization.cs @@ -12,10 +12,10 @@ namespace Microsoft.CodeAnalysis.SQLite.v1 { internal partial class SQLitePersistentStorage { - protected override Task ReadChecksumAsync(DocumentKey documentKey, Document? bulkLoadSnapshot, string name, CancellationToken cancellationToken) + protected override Task ReadChecksumAsync(DocumentKey documentKey, Document? bulkLoadSnapshot, string name, CancellationToken cancellationToken) => _documentAccessor.ReadChecksumAsync((documentKey, bulkLoadSnapshot, name), cancellationToken); - protected override Task ReadStreamAsync(DocumentKey documentKey, Document? bulkLoadSnapshot, string name, Checksum? checksum, CancellationToken cancellationToken) + protected override Task ReadStreamAsync(DocumentKey documentKey, Document? bulkLoadSnapshot, string name, Checksum? checksum, CancellationToken cancellationToken) => _documentAccessor.ReadStreamAsync((documentKey, bulkLoadSnapshot, name), checksum, cancellationToken); public override Task WriteStreamAsync(Document document, string name, Stream stream, Checksum? checksum, CancellationToken cancellationToken) diff --git a/src/Workspaces/Core/Portable/Storage/SQLite/v1/SQLitePersistentStorage_ProjectSerialization.cs b/src/Workspaces/Core/Portable/Storage/SQLite/v1/SQLitePersistentStorage_ProjectSerialization.cs index d71d490d1e725..f44a64953434f 100644 --- a/src/Workspaces/Core/Portable/Storage/SQLite/v1/SQLitePersistentStorage_ProjectSerialization.cs +++ b/src/Workspaces/Core/Portable/Storage/SQLite/v1/SQLitePersistentStorage_ProjectSerialization.cs @@ -12,10 +12,10 @@ namespace Microsoft.CodeAnalysis.SQLite.v1 { internal partial class SQLitePersistentStorage { - protected override Task ReadChecksumAsync(ProjectKey projectKey, Project? bulkLoadSnapshot, string name, CancellationToken cancellationToken) + protected override Task ReadChecksumAsync(ProjectKey projectKey, Project? bulkLoadSnapshot, string name, CancellationToken cancellationToken) => _projectAccessor.ReadChecksumAsync((projectKey, bulkLoadSnapshot, name), cancellationToken); - protected override Task ReadStreamAsync(ProjectKey projectKey, Project? bulkLoadSnapshot, string name, Checksum? checksum, CancellationToken cancellationToken) + protected override Task ReadStreamAsync(ProjectKey projectKey, Project? bulkLoadSnapshot, string name, Checksum? checksum, CancellationToken cancellationToken) => _projectAccessor.ReadStreamAsync((projectKey, bulkLoadSnapshot, name), checksum, cancellationToken); public override Task WriteStreamAsync(Project project, string name, Stream stream, Checksum? checksum, CancellationToken cancellationToken) diff --git a/src/Workspaces/Core/Portable/Storage/SQLite/v2/Database.cs b/src/Workspaces/Core/Portable/Storage/SQLite/v2/Database.cs index 67e087849e76e..77b950a76fcb2 100644 --- a/src/Workspaces/Core/Portable/Storage/SQLite/v2/Database.cs +++ b/src/Workspaces/Core/Portable/Storage/SQLite/v2/Database.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.SQLite.v2 diff --git a/src/Workspaces/Core/Portable/Storage/SQLite/v2/Interop/ResettableSqlStatement.cs b/src/Workspaces/Core/Portable/Storage/SQLite/v2/Interop/ResettableSqlStatement.cs index c09d114f1d59c..fede17c0776d1 100644 --- a/src/Workspaces/Core/Portable/Storage/SQLite/v2/Interop/ResettableSqlStatement.cs +++ b/src/Workspaces/Core/Portable/Storage/SQLite/v2/Interop/ResettableSqlStatement.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; namespace Microsoft.CodeAnalysis.SQLite.v2.Interop diff --git a/src/Workspaces/Core/Portable/Storage/SQLite/v2/Interop/SqlConnection.cs b/src/Workspaces/Core/Portable/Storage/SQLite/v2/Interop/SqlConnection.cs index 97da6650942d6..2c9cab3017a14 100644 --- a/src/Workspaces/Core/Portable/Storage/SQLite/v2/Interop/SqlConnection.cs +++ b/src/Workspaces/Core/Portable/Storage/SQLite/v2/Interop/SqlConnection.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using System.Collections.Generic; using System.IO; @@ -37,7 +35,7 @@ internal class SqlConnection /// /// For testing purposes to simulate failures during testing. /// - private readonly IPersistentStorageFaultInjector _faultInjector; + private readonly IPersistentStorageFaultInjector? _faultInjector; #pragma warning restore IDE0052 // Remove unread private members /// @@ -52,7 +50,7 @@ internal class SqlConnection /// public bool IsInTransaction { get; private set; } - public static SqlConnection Create(IPersistentStorageFaultInjector faultInjector, string databasePath) + public static SqlConnection Create(IPersistentStorageFaultInjector? faultInjector, string databasePath) { faultInjector?.OnNewConnection(); @@ -112,7 +110,7 @@ public static SqlConnection Create(IPersistentStorageFaultInjector faultInjector } } - private SqlConnection(SafeSqliteHandle handle, IPersistentStorageFaultInjector faultInjector, Dictionary queryToStatement) + private SqlConnection(SafeSqliteHandle handle, IPersistentStorageFaultInjector? faultInjector, Dictionary queryToStatement) { _handle = handle; _faultInjector = faultInjector; @@ -176,7 +174,7 @@ public void RunInTransaction(Action action, TState state) state => { state.action(state.state); - return (object)null; + return (object?)null; }, (action, state)); } @@ -239,7 +237,7 @@ public int LastInsertRowId() => (int)NativeMethods.sqlite3_last_insert_rowid(_handle); [PerformanceSensitive("https://github.com/dotnet/roslyn/issues/36114", AllowCaptures = false)] - public Stream ReadBlob_MustRunInTransaction(Database database, string tableName, string columnName, long rowId) + public Stream? ReadBlob_MustRunInTransaction(Database database, string tableName, string columnName, long rowId) { // NOTE: we do need to do the blob reading in a transaction because of the // following: https://www.sqlite.org/c3ref/blob_open.html diff --git a/src/Workspaces/Core/Portable/Storage/SQLite/v2/Interop/SqlStatement.cs b/src/Workspaces/Core/Portable/Storage/SQLite/v2/Interop/SqlStatement.cs index aca482c445c41..291a05b1ed782 100644 --- a/src/Workspaces/Core/Portable/Storage/SQLite/v2/Interop/SqlStatement.cs +++ b/src/Workspaces/Core/Portable/Storage/SQLite/v2/Interop/SqlStatement.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using System.Runtime.InteropServices; using Microsoft.CodeAnalysis.SQLite.Interop; diff --git a/src/Workspaces/Core/Portable/Storage/SQLite/v2/PooledConnection.cs b/src/Workspaces/Core/Portable/Storage/SQLite/v2/PooledConnection.cs index 50d214542420b..d1cb487b52871 100644 --- a/src/Workspaces/Core/Portable/Storage/SQLite/v2/PooledConnection.cs +++ b/src/Workspaces/Core/Portable/Storage/SQLite/v2/PooledConnection.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.SQLite.v2.Interop; diff --git a/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage.Accessor.cs b/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage.Accessor.cs index 772ff7f04f188..c99045c3d2604 100644 --- a/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage.Accessor.cs +++ b/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage.Accessor.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using System.IO; using System.Threading; @@ -65,12 +63,12 @@ public Accessor(SQLitePersistentStorage storage) protected abstract TWriteQueueKey GetWriteQueueKey(TKey key); [PerformanceSensitive("https://github.com/dotnet/roslyn/issues/36114", AllowCaptures = false)] - public Task ReadChecksumAsync(TKey key, CancellationToken cancellationToken) + public Task ReadChecksumAsync(TKey key, CancellationToken cancellationToken) => Storage.PerformReadAsync( static t => t.self.ReadChecksum(t.key, t.cancellationToken), (self: this, key, cancellationToken), cancellationToken); - private Checksum ReadChecksum(TKey key, CancellationToken cancellationToken) + private Checksum? ReadChecksum(TKey key, CancellationToken cancellationToken) { using (var stream = ReadBlobColumn(key, ChecksumColumnName, checksumOpt: null, cancellationToken)) using (var reader = ObjectReader.TryGetReader(stream, leaveOpen: false, cancellationToken)) @@ -85,17 +83,17 @@ private Checksum ReadChecksum(TKey key, CancellationToken cancellationToken) } [PerformanceSensitive("https://github.com/dotnet/roslyn/issues/36114", AllowCaptures = false)] - public Task ReadStreamAsync(TKey key, Checksum checksum, CancellationToken cancellationToken) + public Task ReadStreamAsync(TKey key, Checksum? checksum, CancellationToken cancellationToken) => Storage.PerformReadAsync( static t => t.self.ReadStream(t.key, t.checksum, t.cancellationToken), (self: this, key, checksum, cancellationToken), cancellationToken); [PerformanceSensitive("https://github.com/dotnet/roslyn/issues/36114", AllowCaptures = false)] - private Stream ReadStream(TKey key, Checksum checksum, CancellationToken cancellationToken) + private Stream? ReadStream(TKey key, Checksum? checksum, CancellationToken cancellationToken) => ReadBlobColumn(key, DataColumnName, checksum, cancellationToken); - private Stream ReadBlobColumn( - TKey key, string columnName, Checksum checksumOpt, CancellationToken cancellationToken) + private Stream? ReadBlobColumn( + TKey key, string columnName, Checksum? checksumOpt, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); @@ -121,12 +119,12 @@ private Stream ReadBlobColumn( return null; } - public Task WriteStreamAsync(TKey key, Stream stream, Checksum checksumOpt, CancellationToken cancellationToken) + public Task WriteStreamAsync(TKey key, Stream stream, Checksum? checksumOpt, CancellationToken cancellationToken) => Storage.PerformWriteAsync( static t => t.self.WriteStream(t.key, t.stream, t.checksumOpt, t.cancellationToken), (self: this, key, stream, checksumOpt, cancellationToken), cancellationToken); - private bool WriteStream(TKey key, Stream stream, Checksum checksumOpt, CancellationToken cancellationToken) + private bool WriteStream(TKey key, Stream stream, Checksum? checksumOpt, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); @@ -162,10 +160,10 @@ private bool WriteStream(TKey key, Stream stream, Checksum checksumOpt, Cancella return false; } - private Stream ReadBlob( + private Stream? ReadBlob( SqlConnection connection, Database database, TDatabaseId dataId, string columnName, - Checksum checksumOpt, CancellationToken cancellationToken) + Checksum? checksumOpt, CancellationToken cancellationToken) { // Note: it's possible that someone may write to this row between when we // get the row ID above and now. That's fine. We'll just read the new diff --git a/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_BulkPopulateIds.cs b/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_BulkPopulateIds.cs index 9055f37712bbf..266f0c8f9e4f5 100644 --- a/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_BulkPopulateIds.cs +++ b/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_BulkPopulateIds.cs @@ -10,6 +10,7 @@ using Microsoft.CodeAnalysis.SQLite.Interop; using Microsoft.CodeAnalysis.SQLite.v2.Interop; using Microsoft.CodeAnalysis.Storage; +using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.SQLite.v2 { @@ -196,6 +197,8 @@ bool AddDocumentIds() string GetDocumentIdString(Document document) { + Contract.ThrowIfNull(document.FilePath); + // We should always be able to index directly into these maps. This function is only // ever called after we called AddIndividualProjectAndDocumentComponentIds. var documentPathId = _stringToIdMap[document.FilePath]; diff --git a/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_DocumentSerialization.cs b/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_DocumentSerialization.cs index 8fec7e2fb6143..0186cf321b2cd 100644 --- a/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_DocumentSerialization.cs +++ b/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_DocumentSerialization.cs @@ -12,10 +12,10 @@ namespace Microsoft.CodeAnalysis.SQLite.v2 { internal partial class SQLitePersistentStorage { - protected override Task ReadChecksumAsync(DocumentKey documentKey, Document? bulkLoadSnapshot, string name, CancellationToken cancellationToken) + protected override Task ReadChecksumAsync(DocumentKey documentKey, Document? bulkLoadSnapshot, string name, CancellationToken cancellationToken) => _documentAccessor.ReadChecksumAsync((documentKey, bulkLoadSnapshot, name), cancellationToken); - protected override Task ReadStreamAsync(DocumentKey documentKey, Document? bulkLoadSnapshot, string name, Checksum? checksum, CancellationToken cancellationToken) + protected override Task ReadStreamAsync(DocumentKey documentKey, Document? bulkLoadSnapshot, string name, Checksum? checksum, CancellationToken cancellationToken) => _documentAccessor.ReadStreamAsync((documentKey, bulkLoadSnapshot, name), checksum, cancellationToken); public override Task WriteStreamAsync(Document document, string name, Stream stream, Checksum? checksum, CancellationToken cancellationToken) diff --git a/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_FlushWrites.cs b/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_FlushWrites.cs index f7905523c30ba..606284d4114b3 100644 --- a/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_FlushWrites.cs +++ b/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_FlushWrites.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System.Collections.Immutable; using System.Diagnostics; using System.Threading; diff --git a/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_Helpers.cs b/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_Helpers.cs index b07c948160849..7f9a00b960b07 100644 --- a/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_Helpers.cs +++ b/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_Helpers.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using System.Collections.Generic; using System.IO; @@ -25,7 +23,7 @@ private static long CombineInt32ValuesToInt64(int v1, int v2) => ((long)v1 << 32) | (long)v2; private static (byte[] bytes, int length, bool fromPool) GetBytes( - Checksum checksumOpt, CancellationToken cancellationToken) + Checksum? checksumOpt, CancellationToken cancellationToken) { // If we weren't passed a checksum, just pass the singleton empty byte array. // Note: we don't add this to/from our pool. But it likely wouldn't be a problem diff --git a/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_ProjectSerialization.cs b/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_ProjectSerialization.cs index 3e74277ed2df8..6c5768725caca 100644 --- a/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_ProjectSerialization.cs +++ b/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_ProjectSerialization.cs @@ -12,10 +12,10 @@ namespace Microsoft.CodeAnalysis.SQLite.v2 { internal partial class SQLitePersistentStorage { - protected override Task ReadChecksumAsync(ProjectKey projectKey, Project? bulkLoadSnapshot, string name, CancellationToken cancellationToken) + protected override Task ReadChecksumAsync(ProjectKey projectKey, Project? bulkLoadSnapshot, string name, CancellationToken cancellationToken) => _projectAccessor.ReadChecksumAsync((projectKey, bulkLoadSnapshot, name), cancellationToken); - protected override Task ReadStreamAsync(ProjectKey projectKey, Project? bulkLoadSnapshot, string name, Checksum? checksum, CancellationToken cancellationToken) + protected override Task ReadStreamAsync(ProjectKey projectKey, Project? bulkLoadSnapshot, string name, Checksum? checksum, CancellationToken cancellationToken) => _projectAccessor.ReadStreamAsync((projectKey, bulkLoadSnapshot, name), checksum, cancellationToken); public override Task WriteStreamAsync(Project project, string name, Stream stream, Checksum? checksum, CancellationToken cancellationToken) diff --git a/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_SolutionSerialization.cs b/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_SolutionSerialization.cs index ec06ced6fe087..6d8e733ae3ac8 100644 --- a/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_SolutionSerialization.cs +++ b/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_SolutionSerialization.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System.IO; using System.Threading; using System.Threading.Tasks; @@ -13,13 +11,13 @@ namespace Microsoft.CodeAnalysis.SQLite.v2 { internal partial class SQLitePersistentStorage { - public override Task ReadChecksumAsync(string name, CancellationToken cancellationToken) + public override Task ReadChecksumAsync(string name, CancellationToken cancellationToken) => _solutionAccessor.ReadChecksumAsync(name, cancellationToken); - public override Task ReadStreamAsync(string name, Checksum checksum, CancellationToken cancellationToken) + public override Task ReadStreamAsync(string name, Checksum? checksum, CancellationToken cancellationToken) => _solutionAccessor.ReadStreamAsync(name, checksum, cancellationToken); - public override Task WriteStreamAsync(string name, Stream stream, Checksum checksum, CancellationToken cancellationToken) + public override Task WriteStreamAsync(string name, Stream stream, Checksum? checksum, CancellationToken cancellationToken) => _solutionAccessor.WriteStreamAsync(name, stream, checksum, cancellationToken); /// diff --git a/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_StringIds.cs b/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_StringIds.cs index 856b7576771cf..d3f39235bfe7c 100644 --- a/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_StringIds.cs +++ b/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_StringIds.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using System.Collections.Concurrent; using Microsoft.CodeAnalysis.SQLite.Interop; diff --git a/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_Threading.cs b/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_Threading.cs index 33314959e5d99..e0f9f9a028ded 100644 --- a/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_Threading.cs +++ b/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_Threading.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using System.Threading; using System.Threading.Tasks; diff --git a/src/Workspaces/Core/Portable/Storage/StorageDatabase.cs b/src/Workspaces/Core/Portable/Storage/StorageDatabase.cs index bf435225ac3d9..4587658fe8c46 100644 --- a/src/Workspaces/Core/Portable/Storage/StorageDatabase.cs +++ b/src/Workspaces/Core/Portable/Storage/StorageDatabase.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - namespace Microsoft.CodeAnalysis.Storage { internal enum StorageDatabase diff --git a/src/Workspaces/Core/Portable/Storage/StorageDatabaseLogger.cs b/src/Workspaces/Core/Portable/Storage/StorageDatabaseLogger.cs index 59e9673b72d37..b9d51f882a3cb 100644 --- a/src/Workspaces/Core/Portable/Storage/StorageDatabaseLogger.cs +++ b/src/Workspaces/Core/Portable/Storage/StorageDatabaseLogger.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using System.Collections.Concurrent; using Microsoft.CodeAnalysis.Internal.Log; @@ -18,8 +16,8 @@ internal class StorageDatabaseLogger private static readonly StorageDatabaseLogger Instance = new(); #pragma warning disable IDE0052 // Remove unread private members - hold onto last exception to make investigation easier - private Exception _reportedException; - private string _reportedExceptionMessage; + private Exception? _reportedException; + private string? _reportedExceptionMessage; #pragma warning restore IDE0052 // Remove unread private members private readonly ConcurrentDictionary _set = new(concurrencyLevel: 2, capacity: 10); diff --git a/src/Workspaces/Core/Portable/Storage/StorageOptions.cs b/src/Workspaces/Core/Portable/Storage/StorageOptions.cs index 72b630be1a117..6f8a157d8d263 100644 --- a/src/Workspaces/Core/Portable/Storage/StorageOptions.cs +++ b/src/Workspaces/Core/Portable/Storage/StorageOptions.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using System.Collections.Immutable; using System.Composition; diff --git a/src/Workspaces/Core/Portable/Workspace/Host/PersistentStorage/AbstractPersistentStorage.cs b/src/Workspaces/Core/Portable/Workspace/Host/PersistentStorage/AbstractPersistentStorage.cs index 2503d00092b90..124caa5935097 100644 --- a/src/Workspaces/Core/Portable/Workspace/Host/PersistentStorage/AbstractPersistentStorage.cs +++ b/src/Workspaces/Core/Portable/Workspace/Host/PersistentStorage/AbstractPersistentStorage.cs @@ -35,51 +35,51 @@ protected AbstractPersistentStorage( public abstract void Dispose(); - public abstract Task ReadChecksumAsync(string name, CancellationToken cancellationToken); + public abstract Task ReadChecksumAsync(string name, CancellationToken cancellationToken); - protected abstract Task ReadChecksumAsync(ProjectKey projectKey, Project? bulkLoadSnapshot, string name, CancellationToken cancellationToken); - protected abstract Task ReadChecksumAsync(DocumentKey documentKey, Document? bulkLoadSnapshot, string name, CancellationToken cancellationToken); + protected abstract Task ReadChecksumAsync(ProjectKey projectKey, Project? bulkLoadSnapshot, string name, CancellationToken cancellationToken); + protected abstract Task ReadChecksumAsync(DocumentKey documentKey, Document? bulkLoadSnapshot, string name, CancellationToken cancellationToken); - public Task ReadChecksumAsync(ProjectKey projectKey, string name, CancellationToken cancellationToken) + public Task ReadChecksumAsync(ProjectKey projectKey, string name, CancellationToken cancellationToken) => ReadChecksumAsync(projectKey, bulkLoadSnapshot: null, name, cancellationToken); - public Task ReadChecksumAsync(DocumentKey documentKey, string name, CancellationToken cancellationToken) + public Task ReadChecksumAsync(DocumentKey documentKey, string name, CancellationToken cancellationToken) => ReadChecksumAsync(documentKey, bulkLoadSnapshot: null, name, cancellationToken); - public Task ReadChecksumAsync(Project project, string name, CancellationToken cancellationToken) + public Task ReadChecksumAsync(Project project, string name, CancellationToken cancellationToken) => ReadChecksumAsync((ProjectKey)project, project, name, cancellationToken); - public Task ReadChecksumAsync(Document document, string name, CancellationToken cancellationToken) + public Task ReadChecksumAsync(Document document, string name, CancellationToken cancellationToken) => ReadChecksumAsync((DocumentKey)document, document, name, cancellationToken); - public abstract Task ReadStreamAsync(string name, Checksum? checksum, CancellationToken cancellationToken); + public abstract Task ReadStreamAsync(string name, Checksum? checksum, CancellationToken cancellationToken); - protected abstract Task ReadStreamAsync(ProjectKey projectKey, Project? bulkLoadSnapshot, string name, Checksum? checksum, CancellationToken cancellationToken); - protected abstract Task ReadStreamAsync(DocumentKey documentKey, Document? bulkLoadSnapshot, string name, Checksum? checksum, CancellationToken cancellationToken); + protected abstract Task ReadStreamAsync(ProjectKey projectKey, Project? bulkLoadSnapshot, string name, Checksum? checksum, CancellationToken cancellationToken); + protected abstract Task ReadStreamAsync(DocumentKey documentKey, Document? bulkLoadSnapshot, string name, Checksum? checksum, CancellationToken cancellationToken); - public Task ReadStreamAsync(ProjectKey projectKey, string name, Checksum? checksum, CancellationToken cancellationToken) + public Task ReadStreamAsync(ProjectKey projectKey, string name, Checksum? checksum, CancellationToken cancellationToken) => ReadStreamAsync(projectKey, bulkLoadSnapshot: null, name, checksum, cancellationToken); - public Task ReadStreamAsync(DocumentKey documentKey, string name, Checksum? checksum, CancellationToken cancellationToken) + public Task ReadStreamAsync(DocumentKey documentKey, string name, Checksum? checksum, CancellationToken cancellationToken) => ReadStreamAsync(documentKey, bulkLoadSnapshot: null, name, checksum, cancellationToken); - public Task ReadStreamAsync(Project project, string name, Checksum? checksum, CancellationToken cancellationToken) + public Task ReadStreamAsync(Project project, string name, Checksum? checksum, CancellationToken cancellationToken) => ReadStreamAsync((ProjectKey)project, project, name, checksum, cancellationToken); - public Task ReadStreamAsync(Document document, string name, Checksum? checksum, CancellationToken cancellationToken) + public Task ReadStreamAsync(Document document, string name, Checksum? checksum, CancellationToken cancellationToken) => ReadStreamAsync((DocumentKey)document, document, name, checksum, cancellationToken); public abstract Task WriteStreamAsync(string name, Stream stream, Checksum? checksum, CancellationToken cancellationToken); public abstract Task WriteStreamAsync(Project project, string name, Stream stream, Checksum? checksum, CancellationToken cancellationToken); public abstract Task WriteStreamAsync(Document document, string name, Stream stream, Checksum? checksum, CancellationToken cancellationToken); - public Task ReadStreamAsync(string name, CancellationToken cancellationToken) + public Task ReadStreamAsync(string name, CancellationToken cancellationToken) => ReadStreamAsync(name, checksum: null, cancellationToken); - public Task ReadStreamAsync(Project project, string name, CancellationToken cancellationToken) + public Task ReadStreamAsync(Project project, string name, CancellationToken cancellationToken) => ReadStreamAsync(project, name, checksum: null, cancellationToken); - public Task ReadStreamAsync(Document document, string name, CancellationToken cancellationToken) + public Task ReadStreamAsync(Document document, string name, CancellationToken cancellationToken) => ReadStreamAsync(document, name, checksum: null, cancellationToken); public Task WriteStreamAsync(string name, Stream stream, CancellationToken cancellationToken) diff --git a/src/Workspaces/CoreTestUtilities/MEF/UseExportProviderAttribute.cs b/src/Workspaces/CoreTestUtilities/MEF/UseExportProviderAttribute.cs index 987c60476ec00..d5a98c493913d 100644 --- a/src/Workspaces/CoreTestUtilities/MEF/UseExportProviderAttribute.cs +++ b/src/Workspaces/CoreTestUtilities/MEF/UseExportProviderAttribute.cs @@ -66,7 +66,7 @@ static UseExportProviderAttribute() RuntimeHelpers.RunModuleConstructor(typeof(TestBase).Module.ModuleHandle); } - public override void Before(MethodInfo methodUnderTest) + public override void Before(MethodInfo? methodUnderTest) { MefHostServices.TestAccessor.HookServiceCreation(CreateMefHostServices); @@ -87,7 +87,7 @@ public override void Before(MethodInfo methodUnderTest) /// Clearing static state variables related to the use of MEF during a test. /// /// - public override void After(MethodInfo methodUnderTest) + public override void After(MethodInfo? methodUnderTest) { try { From c93dd9f57a55a56326101a02f2fd58ff2c83d20c Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Thu, 8 Oct 2020 08:58:39 -0700 Subject: [PATCH 213/295] Fix all RS0046 (Avoid 'Opt' suffix in nullable-enabled code) --- .../AbstractPersistentStorageTests.cs | 12 ++++----- .../v2/SQLitePersistentStorage.Accessor.cs | 26 +++++++++---------- .../SQLite/v2/SQLitePersistentStorage.cs | 8 +++--- .../v2/SQLitePersistentStorage_Helpers.cs | 6 ++--- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/VisualStudio/CSharp/Test/PersistentStorage/AbstractPersistentStorageTests.cs b/src/VisualStudio/CSharp/Test/PersistentStorage/AbstractPersistentStorageTests.cs index eef7f873a5178..b4e23c515bc69 100644 --- a/src/VisualStudio/CSharp/Test/PersistentStorage/AbstractPersistentStorageTests.cs +++ b/src/VisualStudio/CSharp/Test/PersistentStorage/AbstractPersistentStorageTests.cs @@ -871,17 +871,17 @@ protected Solution CreateOrOpenSolution(bool nullPaths = false) } internal IChecksummedPersistentStorage GetStorage( - Solution solution, IPersistentStorageFaultInjector? faultInjectorOpt = null) + Solution solution, IPersistentStorageFaultInjector? faultInjector = null) { // If we handed out one for a previous test, we need to shut that down first _storageService?.GetTestAccessor().Shutdown(); var locationService = new MockPersistentStorageLocationService(solution.Id, _persistentFolder.Path); - _storageService = GetStorageService(locationService, faultInjectorOpt); + _storageService = GetStorageService(locationService, faultInjector); var storage = _storageService.GetStorage(solution, checkBranchId: true); // If we're injecting faults, we expect things to be strange - if (faultInjectorOpt == null) + if (faultInjector == null) { Assert.NotEqual(NoOpPersistentStorage.Instance, storage); } @@ -890,17 +890,17 @@ internal IChecksummedPersistentStorage GetStorage( } internal IChecksummedPersistentStorage GetStorageFromKey( - Workspace workspace, SolutionKey solutionKey, IPersistentStorageFaultInjector? faultInjectorOpt = null) + Workspace workspace, SolutionKey solutionKey, IPersistentStorageFaultInjector? faultInjector = null) { // If we handed out one for a previous test, we need to shut that down first _storageService?.GetTestAccessor().Shutdown(); var locationService = new MockPersistentStorageLocationService(solutionKey.Id, _persistentFolder.Path); - _storageService = GetStorageService(locationService, faultInjectorOpt); + _storageService = GetStorageService(locationService, faultInjector); var storage = _storageService.GetStorage(workspace, solutionKey, checkBranchId: true); // If we're injecting faults, we expect things to be strange - if (faultInjectorOpt == null) + if (faultInjector == null) { Assert.NotEqual(NoOpPersistentStorage.Instance, storage); } diff --git a/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage.Accessor.cs b/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage.Accessor.cs index c99045c3d2604..cd4fa361d3bbe 100644 --- a/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage.Accessor.cs +++ b/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage.Accessor.cs @@ -70,7 +70,7 @@ public Accessor(SQLitePersistentStorage storage) private Checksum? ReadChecksum(TKey key, CancellationToken cancellationToken) { - using (var stream = ReadBlobColumn(key, ChecksumColumnName, checksumOpt: null, cancellationToken)) + using (var stream = ReadBlobColumn(key, ChecksumColumnName, checksum: null, cancellationToken)) using (var reader = ObjectReader.TryGetReader(stream, leaveOpen: false, cancellationToken)) { if (reader != null) @@ -93,7 +93,7 @@ public Accessor(SQLitePersistentStorage storage) => ReadBlobColumn(key, DataColumnName, checksum, cancellationToken); private Stream? ReadBlobColumn( - TKey key, string columnName, Checksum? checksumOpt, CancellationToken cancellationToken) + TKey key, string columnName, Checksum? checksum, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); @@ -106,8 +106,8 @@ public Accessor(SQLitePersistentStorage storage) { // First, try to see if there was a write to this key in our in-memory db. // If it wasn't in the in-memory write-cache. Check the full on-disk file. - return ReadBlob(connection, Database.WriteCache, dataId, columnName, checksumOpt, cancellationToken) ?? - ReadBlob(connection, Database.Main, dataId, columnName, checksumOpt, cancellationToken); + return ReadBlob(connection, Database.WriteCache, dataId, columnName, checksum, cancellationToken) ?? + ReadBlob(connection, Database.Main, dataId, columnName, checksum, cancellationToken); } catch (Exception ex) { @@ -119,12 +119,12 @@ public Accessor(SQLitePersistentStorage storage) return null; } - public Task WriteStreamAsync(TKey key, Stream stream, Checksum? checksumOpt, CancellationToken cancellationToken) + public Task WriteStreamAsync(TKey key, Stream stream, Checksum? checksum, CancellationToken cancellationToken) => Storage.PerformWriteAsync( - static t => t.self.WriteStream(t.key, t.stream, t.checksumOpt, t.cancellationToken), - (self: this, key, stream, checksumOpt, cancellationToken), cancellationToken); + static t => t.self.WriteStream(t.key, t.stream, t.checksum, t.cancellationToken), + (self: this, key, stream, checksum, cancellationToken), cancellationToken); - private bool WriteStream(TKey key, Stream stream, Checksum? checksumOpt, CancellationToken cancellationToken) + private bool WriteStream(TKey key, Stream stream, Checksum? checksum, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); @@ -135,7 +135,7 @@ private bool WriteStream(TKey key, Stream stream, Checksum? checksumOpt, Cancell // Determine the appropriate data-id to store this stream at. if (TryGetDatabaseId(connection, key, out var dataId)) { - var (checksumBytes, checksumLength, checksumPooled) = GetBytes(checksumOpt, cancellationToken); + var (checksumBytes, checksumLength, checksumPooled) = GetBytes(checksum, cancellationToken); var (dataBytes, dataLength, dataPooled) = GetBytes(stream); // Write the information into the in-memory write-cache. Later on a background task @@ -163,7 +163,7 @@ private bool WriteStream(TKey key, Stream stream, Checksum? checksumOpt, Cancell private Stream? ReadBlob( SqlConnection connection, Database database, TDatabaseId dataId, string columnName, - Checksum? checksumOpt, CancellationToken cancellationToken) + Checksum? checksum, CancellationToken cancellationToken) { // Note: it's possible that someone may write to this row between when we // get the row ID above and now. That's fine. We'll just read the new @@ -189,15 +189,15 @@ private bool WriteStream(TKey key, Stream stream, Checksum? checksumOpt, Cancell // If we were passed a checksum, make sure it matches what we have // stored in the table already. If they don't match, don't read // out the data value at all. - if (t.checksumOpt != null && - !t.self.ChecksumsMatch_MustRunInTransaction(t.connection, t.database, t.rowId, t.checksumOpt, t.cancellationToken)) + if (t.checksum != null && + !t.self.ChecksumsMatch_MustRunInTransaction(t.connection, t.database, t.rowId, t.checksum, t.cancellationToken)) { return null; } return t.connection.ReadBlob_MustRunInTransaction(t.database, t.self.DataTableName, t.columnName, t.rowId); }, - (self: this, connection, database, columnName, checksumOpt, rowId, cancellationToken)); + (self: this, connection, database, columnName, checksum, rowId, cancellationToken)); } private bool ChecksumsMatch_MustRunInTransaction( diff --git a/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage.cs b/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage.cs index ab5ab4ae774dc..93e9b41b35c4c 100644 --- a/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage.cs +++ b/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage.cs @@ -105,7 +105,7 @@ internal partial class SQLitePersistentStorage : AbstractPersistentStorage private readonly CancellationTokenSource _shutdownTokenSource = new(); private readonly IDisposable _dbOwnershipLock; - private readonly IPersistentStorageFaultInjector? _faultInjectorOpt; + private readonly IPersistentStorageFaultInjector? _faultInjector; // Accessors that allow us to retrieve/store data into specific DB tables. The // core Accessor type has logic that we to share across all reading/writing, while @@ -134,11 +134,11 @@ public SQLitePersistentStorage( string solutionFilePath, string databaseFile, IDisposable dbOwnershipLock, - IPersistentStorageFaultInjector? faultInjectorOpt) + IPersistentStorageFaultInjector? faultInjector) : base(workingFolderPath, solutionFilePath, databaseFile) { _dbOwnershipLock = dbOwnershipLock; - _faultInjectorOpt = faultInjectorOpt; + _faultInjector = faultInjector; _solutionAccessor = new SolutionAccessor(this); _projectAccessor = new ProjectAccessor(this); @@ -168,7 +168,7 @@ private SqlConnection GetConnection() } // Otherwise create a new connection. - return SqlConnection.Create(_faultInjectorOpt, DatabaseFile); + return SqlConnection.Create(_faultInjector, DatabaseFile); } private void ReleaseConnection(SqlConnection connection) diff --git a/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_Helpers.cs b/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_Helpers.cs index 7f9a00b960b07..7ca499f7a5aa4 100644 --- a/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_Helpers.cs +++ b/src/Workspaces/Core/Portable/Storage/SQLite/v2/SQLitePersistentStorage_Helpers.cs @@ -23,13 +23,13 @@ private static long CombineInt32ValuesToInt64(int v1, int v2) => ((long)v1 << 32) | (long)v2; private static (byte[] bytes, int length, bool fromPool) GetBytes( - Checksum? checksumOpt, CancellationToken cancellationToken) + Checksum? checksum, CancellationToken cancellationToken) { // If we weren't passed a checksum, just pass the singleton empty byte array. // Note: we don't add this to/from our pool. But it likely wouldn't be a problem // for us to do that as this instance can't actually be mutated since it's just // an empty array. - if (checksumOpt == null) + if (checksum == null) { return (Array.Empty(), length: 0, fromPool: false); } @@ -38,7 +38,7 @@ private static (byte[] bytes, int length, bool fromPool) GetBytes( using (var writer = new ObjectWriter(stream, leaveOpen: true, cancellationToken)) { - checksumOpt.WriteTo(writer); + checksum.WriteTo(writer); } stream.Position = 0; From c9e2ee66450d35d7bf26696aa1720e99129b2059 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 09:14:54 -0700 Subject: [PATCH 214/295] Expose option to enable/disable ctrl-alt handling. --- Roslyn.sln | 4 ++ .../InlineHintsKeyProcessorProvider.cs | 47 +++++++++---------- .../InlineHints/InlineHintsOptions.cs | 6 +++ .../Options/AdvancedOptionPageControl.xaml | 6 +++ .../Options/AdvancedOptionPageControl.xaml.cs | 1 + .../Impl/Options/AdvancedOptionPageStrings.cs | 9 ++-- .../Core/Def/ServicesVSResources.resx | 7 ++- .../Core/Def/xlf/ServicesVSResources.cs.xlf | 11 +++-- .../Core/Def/xlf/ServicesVSResources.de.xlf | 11 +++-- .../Core/Def/xlf/ServicesVSResources.es.xlf | 11 +++-- .../Core/Def/xlf/ServicesVSResources.fr.xlf | 11 +++-- .../Core/Def/xlf/ServicesVSResources.it.xlf | 11 +++-- .../Core/Def/xlf/ServicesVSResources.ja.xlf | 11 +++-- .../Core/Def/xlf/ServicesVSResources.ko.xlf | 11 +++-- .../Core/Def/xlf/ServicesVSResources.pl.xlf | 11 +++-- .../Def/xlf/ServicesVSResources.pt-BR.xlf | 11 +++-- .../Core/Def/xlf/ServicesVSResources.ru.xlf | 11 +++-- .../Core/Def/xlf/ServicesVSResources.tr.xlf | 11 +++-- .../Def/xlf/ServicesVSResources.zh-Hans.xlf | 11 +++-- .../Def/xlf/ServicesVSResources.zh-Hant.xlf | 11 +++-- .../Options/AdvancedOptionPageControl.xaml | 6 +++ .../Options/AdvancedOptionPageControl.xaml.vb | 1 + .../Impl/Options/AdvancedOptionPageStrings.vb | 12 ++--- 23 files changed, 166 insertions(+), 76 deletions(-) diff --git a/Roslyn.sln b/Roslyn.sln index 7150215f42caf..abe1a82b59ef5 100644 --- a/Roslyn.sln +++ b/Roslyn.sln @@ -1880,8 +1880,12 @@ Global {2801F82B-78CE-4BAE-B06F-537574751E2E}.Release|x86.Build.0 = Release|x86 {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|x86.ActiveCfg = Debug|Any CPU + {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|x86.Build.0 = Debug|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|Any CPU.ActiveCfg = Release|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|Any CPU.Build.0 = Release|Any CPU + {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|x86.ActiveCfg = Release|Any CPU + {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs index 6fc1ac4c32601..8c26ca481f1f4 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using System.ComponentModel.Composition; using System.Linq; @@ -55,7 +53,7 @@ public InlineHintsKeyProcessor(IWpfTextView view) private static bool IsCtrlOrAlt(KeyEventArgs args) => args.Key is Key.LeftCtrl or Key.RightCtrl or Key.LeftAlt or Key.RightAlt; - private Workspace GetWorkspace() + private Document? GetDocument() { var document = _view.BufferGraph.GetTextBuffers(b => true) @@ -63,7 +61,7 @@ private Workspace GetWorkspace() .WhereNotNull() .FirstOrDefault(); - return document?.Project.Solution.Workspace; + return document; } private void OnViewClosed(object sender, EventArgs e) @@ -77,20 +75,14 @@ private void OnLostFocus(object sender, EventArgs e) { // if focus is lost (which can happen for shortcuts that include ctrl-alt...) then go back to normal // inline-hint processing. - var workspace = GetWorkspace(); - if (workspace == null) - return; - - ToggleOff(workspace); + ToggleOff(GetDocument()); } public override void KeyDown(KeyEventArgs args) { base.KeyDown(args); - var workspace = GetWorkspace(); - if (workspace == null) - return; + var document = GetDocument(); // if this is either the ctrl or alt key, and only ctrl-alt is down, then toggle on. // otherwise toggle off if anything else is pressed down. @@ -98,39 +90,44 @@ public override void KeyDown(KeyEventArgs args) { if (args.KeyboardDevice.Modifiers == (ModifierKeys.Control | ModifierKeys.Alt)) { - ToggleOn(workspace); + ToggleOn(document); return; } } - ToggleOff(workspace); + ToggleOff(document); } public override void KeyUp(KeyEventArgs args) { base.KeyUp(args); - var workspace = GetWorkspace(); - if (workspace == null) - return; - - // If we've lifted a key up turn of the inline hints. - ToggleOff(workspace); + // If we've lifted a key up, then turn off the inline hints. + ToggleOff(GetDocument()); } - private static void ToggleOn(Workspace workspace) - => Toggle(workspace, on: true); + private static void ToggleOn(Document? document) + => Toggle(document, on: true); - private static void ToggleOff(Workspace workspace) - => Toggle(workspace, on: false); + private static void ToggleOff(Document? document) + => Toggle(document, on: false); - private static void Toggle(Workspace workspace, bool on) + private static void Toggle(Document? document, bool on) { + if (document == null) + return; + + var workspace = document.Project.Solution.Workspace; + // No need to do anything if we're already in the requested state var state = workspace.Options.GetOption(InlineHintsOptions.DisplayAllOverride); if (state == on) return; + // We can only enter the on-state if the user has the ctrl-alt feature enabled. We can always enter the + // off state though. + on = on && workspace.Options.GetOption(InlineHintsOptions.DisplayAllHintsWhilePressingCtrlAlt, document.Project.Language); + workspace.TryApplyChanges( workspace.CurrentSolution.WithOptions( workspace.CurrentSolution.Options.WithChangedOption(InlineHintsOptions.DisplayAllOverride, on))); diff --git a/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs b/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs index 95af3889fa944..e7ad0d6967332 100644 --- a/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs +++ b/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs @@ -15,6 +15,12 @@ namespace Microsoft.CodeAnalysis.InlineHints { internal static class InlineHintsOptions { + public static readonly PerLanguageOption2 DisplayAllHintsWhilePressingCtrlAlt = + new(nameof(InlineHintsOptions), + nameof(DisplayAllHintsWhilePressingCtrlAlt), + defaultValue: true, + storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.DisplayAllHintsWhilePressingCtrlAlt")); + /// /// Non-persisted option used to switch to displaying everything while the user is holding ctrl-alt. /// diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml index b909bec9d4435..4f25d0f1f5619 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml @@ -110,17 +110,23 @@ + + + + + diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs index 13b949a3c2f2e..053ae3cfe52aa 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs @@ -65,6 +65,7 @@ public AdvancedOptionPageControl(OptionStore optionStore, IComponentModel compon BindToOption(InsertSlashSlashAtTheStartOfNewLinesWhenWritingSingleLineComments, SplitStringLiteralOptions.Enabled, LanguageNames.CSharp); BindToOption(InsertAsteriskAtTheStartOfNewLinesWhenWritingBlockComments, FeatureOnOffOptions.AutoInsertBlockCommentStartString, LanguageNames.CSharp); + BindToOption(DisplayAllHintsWhilePressingCtrlAlt, InlineHintsOptions.DisplayAllHintsWhilePressingCtrlAlt, LanguageNames.CSharp); BindToOption(DisplayInlineParameterNameHints, InlineHintsOptions.EnabledForParameters, LanguageNames.CSharp); BindToOption(ShowHintsForLiterals, InlineHintsOptions.ForLiteralParameters, LanguageNames.CSharp); BindToOption(ShowHintsForNewExpressions, InlineHintsOptions.ForObjectCreationParameters, LanguageNames.CSharp); diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs index fea679a6ce539..cf47e86701d73 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageStrings.cs @@ -32,7 +32,10 @@ public static string Option_use_64bit_analysis_process => ServicesVSResources.Use_64_bit_process_for_code_analysis_requires_restart; public static string Option_Inline_Hints_experimental - => ServicesVSResources.Inline_Hints_experimental_Hold_ctrl_alt_to_show_all; + => ServicesVSResources.Inline_Hints_experimental; + + public static string Option_Display_all_hints_while_pressing_ctrl_alt + => ServicesVSResources.Display_all_hints_while_pressing_ctrl_alt; public static string Option_Display_inline_parameter_name_hints => ServicesVSResources.Display_inline_parameter_name_hints; @@ -75,9 +78,7 @@ public static string Option_EnableHighlightReferences } public static string Option_EnterOutliningMode - { - get { return CSharpVSResources.Enter_outlining_mode_when_files_open; } - } + => CSharpVSResources.Enter_outlining_mode_when_files_open; public static string Option_ExtractMethod => CSharpVSResources.Extract_Method; diff --git a/src/VisualStudio/Core/Def/ServicesVSResources.resx b/src/VisualStudio/Core/Def/ServicesVSResources.resx index c5337bf7721ff..871723217cad8 100644 --- a/src/VisualStudio/Core/Def/ServicesVSResources.resx +++ b/src/VisualStudio/Core/Def/ServicesVSResources.resx @@ -1557,8 +1557,8 @@ I agree to all of the foregoing: Comments - - Inline Hints (experimental): Hold ctrl-alt to show all + + Inline Hints (experimental) Show hints for everything else @@ -1566,4 +1566,7 @@ I agree to all of the foregoing: Show hints for literals + + Display all hints while pressing 'ctrl-alt' + \ No newline at end of file diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf index 21d8903b31a3b..4bc95abc0b1fc 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf @@ -177,6 +177,11 @@ Aktuální parametr + + Display all hints while pressing 'ctrl-alt' + Display all hints while pressing 'ctrl-alt' + + Disp_lay inline parameter name hints Zobrazovat nápovědy k názvům v_ložených parametrů (experimentální) @@ -272,9 +277,9 @@ Indexováno v úložišti - - Inline Hints (experimental): Hold ctrl-alt to show all - Inline Hints (experimental): Hold ctrl-alt to show all + + Inline Hints (experimental) + Inline Hints (experimental) diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf index 998c6440afa64..6ab5ad5933144 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf @@ -177,6 +177,11 @@ Aktueller Parameter + + Display all hints while pressing 'ctrl-alt' + Display all hints while pressing 'ctrl-alt' + + Disp_lay inline parameter name hints Disp_lay inline parameter name hints @@ -272,9 +277,9 @@ In Repository indiziert - - Inline Hints (experimental): Hold ctrl-alt to show all - Inline Hints (experimental): Hold ctrl-alt to show all + + Inline Hints (experimental) + Inline Hints (experimental) diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf index f935a1e75045f..49cbccc66e957 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf @@ -177,6 +177,11 @@ Parámetro actual + + Display all hints while pressing 'ctrl-alt' + Display all hints while pressing 'ctrl-alt' + + Disp_lay inline parameter name hints Disp_lay inline parameter name hints @@ -272,9 +277,9 @@ Indexado en el repositorio - - Inline Hints (experimental): Hold ctrl-alt to show all - Inline Hints (experimental): Hold ctrl-alt to show all + + Inline Hints (experimental) + Inline Hints (experimental) diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf index 821554df64a36..e46ee0b206a43 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf @@ -177,6 +177,11 @@ Paramètre actuel + + Display all hints while pressing 'ctrl-alt' + Display all hints while pressing 'ctrl-alt' + + Disp_lay inline parameter name hints Disp_lay inline parameter name hints @@ -272,9 +277,9 @@ Indexé dans le dépôt - - Inline Hints (experimental): Hold ctrl-alt to show all - Inline Hints (experimental): Hold ctrl-alt to show all + + Inline Hints (experimental) + Inline Hints (experimental) diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf index 049a195af3904..76b8d38390a9f 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf @@ -177,6 +177,11 @@ Parametro corrente + + Display all hints while pressing 'ctrl-alt' + Display all hints while pressing 'ctrl-alt' + + Disp_lay inline parameter name hints Disp_lay inline parameter name hints @@ -272,9 +277,9 @@ Indicizzata nel repository - - Inline Hints (experimental): Hold ctrl-alt to show all - Inline Hints (experimental): Hold ctrl-alt to show all + + Inline Hints (experimental) + Inline Hints (experimental) diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf index 2333a96ed8cf5..441e0c70a4aac 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf @@ -177,6 +177,11 @@ 現在のパラメーター + + Display all hints while pressing 'ctrl-alt' + Display all hints while pressing 'ctrl-alt' + + Disp_lay inline parameter name hints Disp_lay inline parameter name hints @@ -272,9 +277,9 @@ リポジトリ内でインデックス付け - - Inline Hints (experimental): Hold ctrl-alt to show all - Inline Hints (experimental): Hold ctrl-alt to show all + + Inline Hints (experimental) + Inline Hints (experimental) diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf index df4e663412bf2..3f01eb6d72947 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf @@ -177,6 +177,11 @@ 현재 매개 변수 + + Display all hints while pressing 'ctrl-alt' + Display all hints while pressing 'ctrl-alt' + + Disp_lay inline parameter name hints Disp_lay inline parameter name hints @@ -272,9 +277,9 @@ 리포지토리에서 인덱싱됨 - - Inline Hints (experimental): Hold ctrl-alt to show all - Inline Hints (experimental): Hold ctrl-alt to show all + + Inline Hints (experimental) + Inline Hints (experimental) diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf index 784edc43b2053..2b81c850e268a 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf @@ -177,6 +177,11 @@ Bieżący parametr + + Display all hints while pressing 'ctrl-alt' + Display all hints while pressing 'ctrl-alt' + + Disp_lay inline parameter name hints Disp_lay inline parameter name hints @@ -272,9 +277,9 @@ Indeksowane w repozytorium - - Inline Hints (experimental): Hold ctrl-alt to show all - Inline Hints (experimental): Hold ctrl-alt to show all + + Inline Hints (experimental) + Inline Hints (experimental) diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf index 80c036b92c337..f591040ba2c41 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf @@ -177,6 +177,11 @@ Parâmetro atual + + Display all hints while pressing 'ctrl-alt' + Display all hints while pressing 'ctrl-alt' + + Disp_lay inline parameter name hints Disp_lay inline parameter name hints @@ -272,9 +277,9 @@ Indexado no repositório - - Inline Hints (experimental): Hold ctrl-alt to show all - Inline Hints (experimental): Hold ctrl-alt to show all + + Inline Hints (experimental) + Inline Hints (experimental) diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf index 6acb4eba4f4fa..34d7c68bbf2bd 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf @@ -177,6 +177,11 @@ Текущий параметр + + Display all hints while pressing 'ctrl-alt' + Display all hints while pressing 'ctrl-alt' + + Disp_lay inline parameter name hints Disp_lay inline parameter name hints @@ -272,9 +277,9 @@ Индексированный в репозитории - - Inline Hints (experimental): Hold ctrl-alt to show all - Inline Hints (experimental): Hold ctrl-alt to show all + + Inline Hints (experimental) + Inline Hints (experimental) diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf index dc715bb004c59..0bf3b70996609 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf @@ -177,6 +177,11 @@ Geçerli parametre + + Display all hints while pressing 'ctrl-alt' + Display all hints while pressing 'ctrl-alt' + + Disp_lay inline parameter name hints Disp_lay inline parameter name hints @@ -272,9 +277,9 @@ Depo içinde dizini oluşturulmuş - - Inline Hints (experimental): Hold ctrl-alt to show all - Inline Hints (experimental): Hold ctrl-alt to show all + + Inline Hints (experimental) + Inline Hints (experimental) diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf index 72f78408ce8e4..253af87c05d49 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf @@ -177,6 +177,11 @@ 当前参数 + + Display all hints while pressing 'ctrl-alt' + Display all hints while pressing 'ctrl-alt' + + Disp_lay inline parameter name hints 显示内联参数名称提示(实验)(_L) @@ -272,9 +277,9 @@ 已在存储库中编入索引 - - Inline Hints (experimental): Hold ctrl-alt to show all - Inline Hints (experimental): Hold ctrl-alt to show all + + Inline Hints (experimental) + Inline Hints (experimental) diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf index 5dcdfcc554714..c22b0203cf82e 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf @@ -177,6 +177,11 @@ 目前的參數 + + Display all hints while pressing 'ctrl-alt' + Display all hints while pressing 'ctrl-alt' + + Disp_lay inline parameter name hints Disp_lay inline parameter name hints @@ -272,9 +277,9 @@ 已在存放庫中編制索引 - - Inline Hints (experimental): Hold ctrl-alt to show all - Inline Hints (experimental): Hold ctrl-alt to show all + + Inline Hints (experimental) + Inline Hints (experimental) diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml index 658c84224b421..22e6cf79c540d 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml @@ -104,17 +104,23 @@ + + + + + diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb index c08f5cd60258b..f21c82874105c 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb @@ -59,6 +59,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options BindToOption(GenerateXmlDocCommentsForTripleApostrophes, FeatureOnOffOptions.AutoXmlDocCommentGeneration, LanguageNames.VisualBasic) BindToOption(InsertApostropheAtTheStartOfNewLinesWhenWritingApostropheComments, SplitCommentOptions.Enabled, LanguageNames.VisualBasic) + BindToOption(DisplayAllHintsWhilePressingCtrlAlt, InlineHintsOptions.DisplayAllHintsWhilePressingCtrlAlt, LanguageNames.VisualBasic) BindToOption(DisplayInlineParameterNameHints, InlineHintsOptions.EnabledForParameters, LanguageNames.VisualBasic) BindToOption(ShowHintsForLiterals, InlineHintsOptions.ForLiteralParameters, LanguageNames.VisualBasic) BindToOption(ShowHintsForNewExpressions, InlineHintsOptions.ForObjectCreationParameters, LanguageNames.VisualBasic) diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb index 96f21f50d4471..7ed7e6f1fb177 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageStrings.vb @@ -33,8 +33,11 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options Public ReadOnly Property Option_DisplayLineSeparators As String = BasicVSResources.Show_procedure_line_separators + Public ReadOnly Property Option_Display_all_hints_while_pressing_ctrl_alt As String = + ServicesVSResources.Display_all_hints_while_pressing_ctrl_alt + Public ReadOnly Property Option_Inline_Hints_experimental As String = - ServicesVSResources.Inline_Hints_experimental_Hold_ctrl_alt_to_show_all + ServicesVSResources.Inline_Hints_experimental Public ReadOnly Property Option_Display_inline_parameter_name_hints As String = ServicesVSResources.Display_inline_parameter_name_hints @@ -48,11 +51,8 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options Public ReadOnly Property Option_Show_hints_for_everything_else As String = ServicesVSResources.Show_hints_for_everything_else - Public ReadOnly Property Option_DontPutOutOrRefOnStruct As String - Get - Return BasicVSResources.Don_t_put_ByRef_on_custom_structure - End Get - End Property + Public ReadOnly Property Option_DontPutOutOrRefOnStruct As String = + BasicVSResources.Don_t_put_ByRef_on_custom_structure Public ReadOnly Property Option_EditorHelp As String Get From e2f14e66e9354b70b4173952699af4a265a44794 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 09:17:47 -0700 Subject: [PATCH 215/295] Simplify code. --- .../InlineHintsKeyProcessorProvider.cs | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs index 8c26ca481f1f4..147ba813bc811 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs @@ -69,33 +69,34 @@ private void OnViewClosed(object sender, EventArgs e) // Disconnect our callbacks. _view.Closed -= OnViewClosed; _view.LostAggregateFocus -= OnLostFocus; + + // Go back to off-mode just so we don't somehow get stuck in on-mode if the option was on when the view closed. + ToggleOff(); } private void OnLostFocus(object sender, EventArgs e) { // if focus is lost (which can happen for shortcuts that include ctrl-alt...) then go back to normal // inline-hint processing. - ToggleOff(GetDocument()); + ToggleOff(); } public override void KeyDown(KeyEventArgs args) { base.KeyDown(args); - var document = GetDocument(); - // if this is either the ctrl or alt key, and only ctrl-alt is down, then toggle on. // otherwise toggle off if anything else is pressed down. if (IsCtrlOrAlt(args)) { if (args.KeyboardDevice.Modifiers == (ModifierKeys.Control | ModifierKeys.Alt)) { - ToggleOn(document); + ToggleOn(); return; } } - ToggleOff(document); + ToggleOff(); } public override void KeyUp(KeyEventArgs args) @@ -103,17 +104,19 @@ public override void KeyUp(KeyEventArgs args) base.KeyUp(args); // If we've lifted a key up, then turn off the inline hints. - ToggleOff(GetDocument()); + ToggleOff(); } - private static void ToggleOn(Document? document) - => Toggle(document, on: true); + private void ToggleOn() + => Toggle(on: true); - private static void ToggleOff(Document? document) - => Toggle(document, on: false); + private void ToggleOff() + => Toggle(on: false); - private static void Toggle(Document? document, bool on) + private void Toggle(bool on) { + // Only relevant if this is a roslyn document. + var document = GetDocument(); if (document == null) return; From 57c0cc751ea44a2c8606d8e144d6b3ec3917e25a Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 09:29:01 -0700 Subject: [PATCH 216/295] Use global option service. --- .../InlineHintsKeyProcessorProvider.cs | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs index 147ba813bc811..4ec5861a7bd1a 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs @@ -9,6 +9,7 @@ using System.Windows.Input; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.InlineHints; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.Text.Editor; using Microsoft.VisualStudio.Utilities; @@ -28,23 +29,28 @@ internal class InlineHintsKeyProcessorProvider : IKeyProcessorProvider { private static readonly ConditionalWeakTable s_viewToProcessor = new(); + private readonly IGlobalOptionService _globalOptionService; + [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public InlineHintsKeyProcessorProvider() + public InlineHintsKeyProcessorProvider(IGlobalOptionService globalOptionService) { + _globalOptionService = globalOptionService; } public KeyProcessor GetAssociatedProcessor(IWpfTextView wpfTextView) { - return s_viewToProcessor.GetValue(wpfTextView, v => new InlineHintsKeyProcessor(v)); + return s_viewToProcessor.GetValue(wpfTextView, v => new InlineHintsKeyProcessor(_globalOptionService, v)); } private class InlineHintsKeyProcessor : KeyProcessor { + private readonly IGlobalOptionService _globalOptionService; private readonly IWpfTextView _view; - public InlineHintsKeyProcessor(IWpfTextView view) + public InlineHintsKeyProcessor(IGlobalOptionService globalOptionService, IWpfTextView view) { + _globalOptionService = globalOptionService; _view = view; _view.Closed += OnViewClosed; _view.LostAggregateFocus += OnLostFocus; @@ -120,20 +126,15 @@ private void Toggle(bool on) if (document == null) return; - var workspace = document.Project.Solution.Workspace; - // No need to do anything if we're already in the requested state - var state = workspace.Options.GetOption(InlineHintsOptions.DisplayAllOverride); + var state = _globalOptionService.GetOption(InlineHintsOptions.DisplayAllOverride); if (state == on) return; // We can only enter the on-state if the user has the ctrl-alt feature enabled. We can always enter the // off state though. - on = on && workspace.Options.GetOption(InlineHintsOptions.DisplayAllHintsWhilePressingCtrlAlt, document.Project.Language); - - workspace.TryApplyChanges( - workspace.CurrentSolution.WithOptions( - workspace.CurrentSolution.Options.WithChangedOption(InlineHintsOptions.DisplayAllOverride, on))); + on = on && _globalOptionService.GetOption(InlineHintsOptions.DisplayAllHintsWhilePressingCtrlAlt, document.Project.Language); + _globalOptionService.RefreshOption(new OptionKey(InlineHintsOptions.DisplayAllOverride), on); } } } From cb62525b7a5ec33655ec4083f6e8d6b4e65c6725 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 09:31:31 -0700 Subject: [PATCH 217/295] Update loc string --- src/VisualStudio/Core/Def/ServicesVSResources.resx | 4 ++-- src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf | 6 +++--- src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf | 6 +++--- src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf | 6 +++--- src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf | 6 +++--- src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf | 6 +++--- src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf | 6 +++--- src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf | 6 +++--- src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf | 6 +++--- src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf | 6 +++--- src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf | 6 +++--- src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf | 6 +++--- .../Core/Def/xlf/ServicesVSResources.zh-Hans.xlf | 6 +++--- .../Core/Def/xlf/ServicesVSResources.zh-Hant.xlf | 6 +++--- 14 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/VisualStudio/Core/Def/ServicesVSResources.resx b/src/VisualStudio/Core/Def/ServicesVSResources.resx index 871723217cad8..c0bbe21bc1aa1 100644 --- a/src/VisualStudio/Core/Def/ServicesVSResources.resx +++ b/src/VisualStudio/Core/Def/ServicesVSResources.resx @@ -1566,7 +1566,7 @@ I agree to all of the foregoing: Show hints for literals - - Display all hints while pressing 'ctrl-alt' + + Display all hints while pressing Ctrl+Alt \ No newline at end of file diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf index 4bc95abc0b1fc..bf540cc0a6f9f 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf @@ -177,9 +177,9 @@ Aktuální parametr - - Display all hints while pressing 'ctrl-alt' - Display all hints while pressing 'ctrl-alt' + + Display all hints while pressing Ctrl+Alt + Display all hints while pressing Ctrl+Alt diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf index 6ab5ad5933144..fd6162ff46c5c 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf @@ -177,9 +177,9 @@ Aktueller Parameter - - Display all hints while pressing 'ctrl-alt' - Display all hints while pressing 'ctrl-alt' + + Display all hints while pressing Ctrl+Alt + Display all hints while pressing Ctrl+Alt diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf index 49cbccc66e957..704da508c46e1 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf @@ -177,9 +177,9 @@ Parámetro actual - - Display all hints while pressing 'ctrl-alt' - Display all hints while pressing 'ctrl-alt' + + Display all hints while pressing Ctrl+Alt + Display all hints while pressing Ctrl+Alt diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf index e46ee0b206a43..82ce4402c42e7 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf @@ -177,9 +177,9 @@ Paramètre actuel - - Display all hints while pressing 'ctrl-alt' - Display all hints while pressing 'ctrl-alt' + + Display all hints while pressing Ctrl+Alt + Display all hints while pressing Ctrl+Alt diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf index 76b8d38390a9f..aa8fb105a80bc 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf @@ -177,9 +177,9 @@ Parametro corrente - - Display all hints while pressing 'ctrl-alt' - Display all hints while pressing 'ctrl-alt' + + Display all hints while pressing Ctrl+Alt + Display all hints while pressing Ctrl+Alt diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf index 441e0c70a4aac..71c008b8abff8 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf @@ -177,9 +177,9 @@ 現在のパラメーター - - Display all hints while pressing 'ctrl-alt' - Display all hints while pressing 'ctrl-alt' + + Display all hints while pressing Ctrl+Alt + Display all hints while pressing Ctrl+Alt diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf index 3f01eb6d72947..a07b08f5b78b4 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf @@ -177,9 +177,9 @@ 현재 매개 변수 - - Display all hints while pressing 'ctrl-alt' - Display all hints while pressing 'ctrl-alt' + + Display all hints while pressing Ctrl+Alt + Display all hints while pressing Ctrl+Alt diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf index 2b81c850e268a..2a03a04b0cfdf 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf @@ -177,9 +177,9 @@ Bieżący parametr - - Display all hints while pressing 'ctrl-alt' - Display all hints while pressing 'ctrl-alt' + + Display all hints while pressing Ctrl+Alt + Display all hints while pressing Ctrl+Alt diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf index f591040ba2c41..b4f0f56603c35 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf @@ -177,9 +177,9 @@ Parâmetro atual - - Display all hints while pressing 'ctrl-alt' - Display all hints while pressing 'ctrl-alt' + + Display all hints while pressing Ctrl+Alt + Display all hints while pressing Ctrl+Alt diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf index 34d7c68bbf2bd..b84757b728780 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf @@ -177,9 +177,9 @@ Текущий параметр - - Display all hints while pressing 'ctrl-alt' - Display all hints while pressing 'ctrl-alt' + + Display all hints while pressing Ctrl+Alt + Display all hints while pressing Ctrl+Alt diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf index 0bf3b70996609..342561540f62e 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf @@ -177,9 +177,9 @@ Geçerli parametre - - Display all hints while pressing 'ctrl-alt' - Display all hints while pressing 'ctrl-alt' + + Display all hints while pressing Ctrl+Alt + Display all hints while pressing Ctrl+Alt diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf index 253af87c05d49..f6334c11986ec 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf @@ -177,9 +177,9 @@ 当前参数 - - Display all hints while pressing 'ctrl-alt' - Display all hints while pressing 'ctrl-alt' + + Display all hints while pressing Ctrl+Alt + Display all hints while pressing Ctrl+Alt diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf index c22b0203cf82e..d843ddae83acc 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf @@ -177,9 +177,9 @@ 目前的參數 - - Display all hints while pressing 'ctrl-alt' - Display all hints while pressing 'ctrl-alt' + + Display all hints while pressing Ctrl+Alt + Display all hints while pressing Ctrl+Alt From cfcc3058914298406d74257d1634a60a08492040 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 10:53:31 -0700 Subject: [PATCH 218/295] Support coloring inline hints --- .../Core.Wpf/InlineHints/InlineHintsTag.cs | 38 ++++++++++++++++--- .../Core.Wpf/InlineHints/InlineHintsTagger.cs | 7 +++- .../InlineHints/InlineHintsTaggerProvider.cs | 3 ++ .../Core/InlineHints/InlineHintDataTag.cs | 11 +++--- .../InlineHintsDataTaggerProvider.cs | 26 +++++++------ .../InlineHints/InlineHintsOptions.cs | 13 ++++++- .../Options/AdvancedOptionPageControl.xaml | 3 ++ .../Options/AdvancedOptionPageControl.xaml.cs | 2 + .../Impl/Options/AdvancedOptionPageStrings.cs | 3 ++ .../Core/Def/ServicesVSResources.resx | 3 ++ .../Core/Def/xlf/ServicesVSResources.cs.xlf | 5 +++ .../Core/Def/xlf/ServicesVSResources.de.xlf | 5 +++ .../Core/Def/xlf/ServicesVSResources.es.xlf | 5 +++ .../Core/Def/xlf/ServicesVSResources.fr.xlf | 5 +++ .../Core/Def/xlf/ServicesVSResources.it.xlf | 5 +++ .../Core/Def/xlf/ServicesVSResources.ja.xlf | 5 +++ .../Core/Def/xlf/ServicesVSResources.ko.xlf | 5 +++ .../Core/Def/xlf/ServicesVSResources.pl.xlf | 5 +++ .../Def/xlf/ServicesVSResources.pt-BR.xlf | 5 +++ .../Core/Def/xlf/ServicesVSResources.ru.xlf | 5 +++ .../Core/Def/xlf/ServicesVSResources.tr.xlf | 5 +++ .../Def/xlf/ServicesVSResources.zh-Hans.xlf | 5 +++ .../Def/xlf/ServicesVSResources.zh-Hant.xlf | 5 +++ .../Options/AdvancedOptionPageControl.xaml | 3 ++ .../Options/AdvancedOptionPageControl.xaml.vb | 2 + .../Impl/Options/AdvancedOptionPageStrings.vb | 3 ++ 26 files changed, 157 insertions(+), 25 deletions(-) diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs index 09047240b0c73..78330b8246c75 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs @@ -10,16 +10,19 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; +using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using Microsoft.CodeAnalysis.DocumentationComments; using Microsoft.CodeAnalysis.Editor.Host; +using Microsoft.CodeAnalysis.Editor.Shared.Extensions; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Adornments; +using Microsoft.VisualStudio.Text.Classification; using Microsoft.VisualStudio.Text.Editor; using Microsoft.VisualStudio.Text.Formatting; @@ -70,14 +73,18 @@ private InlineHintsTag( /// The span that has the location of the hint /// The symbolkey associated with each parameter public static InlineHintsTag Create( - string text, + ImmutableArray parts, TextFormattingRunProperties format, IWpfTextView textView, SnapshotSpan span, SymbolKey? key, - InlineHintsTaggerProvider taggerProvider) + InlineHintsTaggerProvider taggerProvider, + IClassificationFormatMap formatMap, + bool classify) { - return new InlineHintsTag(CreateElement(text, textView, format), textView, span, key, taggerProvider); + return new InlineHintsTag( + CreateElement(parts, textView, format, formatMap, taggerProvider.TypeMap, classify), + textView, span, key, taggerProvider); } public async Task> CreateDescriptionAsync(CancellationToken cancellationToken) @@ -132,11 +139,17 @@ public async Task> CreateDescriptionAsync(Cancellati return Array.Empty(); } - private static FrameworkElement CreateElement(string text, IWpfTextView textView, TextFormattingRunProperties format) + private static FrameworkElement CreateElement( + ImmutableArray parts, + IWpfTextView textView, + TextFormattingRunProperties format, + IClassificationFormatMap formatMap, + ClassificationTypeMap typeMap, + bool classify) { // Constructs the hint block which gets assigned parameter name and fontstyles according to the options // page. Calculates a font size 1/4 smaller than the font size of the rest of the editor - var right = text.EndsWith(":") ? 0 : 1; + var right = parts.Last().ToString().EndsWith(":") ? 0 : 1; var block = new TextBlock { FontFamily = format.Typeface.FontFamily, @@ -147,10 +160,23 @@ private static FrameworkElement CreateElement(string text, IWpfTextView textView // Adds a little bit of padding to the left of the text relative to the border // to make the text seem more balanced in the border Padding = new Thickness(left: 1, top: 0, right: right, bottom: 0), - Text = text, VerticalAlignment = VerticalAlignment.Center, }; + var taggedTexts = parts.ToTaggedText(); + foreach (var taggedText in taggedTexts) + { + var run = new Run(taggedText.ToVisibleDisplayString(includeLeftToRightMarker: true)); + + if (classify) + { + var properties = formatMap.GetTextProperties(typeMap.GetClassificationType(taggedText.Tag.ToClassificationTypeName())); + run.Foreground = properties.ForegroundBrush; + } + + block.Inlines.Add(run); + } + // Encapsulates the textblock within a border. Sets the height of the border to be 3/4 of the original // height. Gets foreground/background colors from the options menu. The margin is the distance from the // adornment to the text and pushing the adornment upwards to create a separation when on a specific line diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTagger.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTagger.cs index 6d21bc756a864..4bff3c6e8eb41 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTagger.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTagger.cs @@ -6,6 +6,8 @@ using System.Collections.Generic; using System.Composition; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; +using Microsoft.CodeAnalysis.InlineHints; +using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Classification; using Microsoft.VisualStudio.Text.Editor; @@ -114,6 +116,9 @@ public IEnumerable> GetTags(NormalizedSnapshotSp _cache.Clear(); _cacheSnapshot = snapshot; + var document = snapshot.GetOpenDocumentInCurrentContextWithChanges(); + var classify = document?.Project.Solution.Workspace.Options.GetOption(InlineHintsOptions.ColorHints, document?.Project.Language) ?? false; + // Calling into the InlineParameterNameHintsDataTaggerProvider which only responds with the current // active view and disregards and requests for tags not in that view var fullSpan = new SnapshotSpan(snapshot, 0, snapshot.Length); @@ -130,7 +135,7 @@ public IEnumerable> GetTags(NormalizedSnapshotSp var dataTagSpan = dataTagSpans[0]; var parameterHintSnapshotSpan = new SnapshotSpan(dataTagSpan.Start, 0); var parameterHintUITag = InlineHintsTag.Create( - textTag.Text, Format, _textView, dataTagSpan, textTag.SymbolKey, _taggerProvider); + textTag.Parts, Format, _textView, dataTagSpan, textTag.SymbolKey, _taggerProvider, _formatMap, classify); _cache.Add(new TagSpan(parameterHintSnapshotSpan, parameterHintUITag)); } diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTaggerProvider.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTaggerProvider.cs index ece2016751fa0..7744549c70ba8 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTaggerProvider.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTaggerProvider.cs @@ -32,6 +32,7 @@ internal class InlineHintsTaggerProvider : IViewTaggerProvider public readonly IClassificationTypeRegistryService ClassificationTypeRegistryService; public readonly IThreadingContext ThreadingContext; public readonly IToolTipService ToolTipService; + public readonly ClassificationTypeMap TypeMap; public readonly Lazy StreamingFindUsagesPresenter; [ImportingConstructor] @@ -42,6 +43,7 @@ public InlineHintsTaggerProvider( IClassificationTypeRegistryService classificationTypeRegistryService, IThreadingContext threadingContext, IToolTipService toolTipService, + ClassificationTypeMap typeMap, Lazy streamingFindUsagesPresenter) { _viewTagAggregatorFactoryService = viewTagAggregatorFactoryService; @@ -50,6 +52,7 @@ public InlineHintsTaggerProvider( this.ThreadingContext = threadingContext; this.ToolTipService = toolTipService; this.StreamingFindUsagesPresenter = streamingFindUsagesPresenter; + this.TypeMap = typeMap; } public ITagger? CreateTagger(ITextView textView, ITextBuffer buffer) where T : ITag diff --git a/src/EditorFeatures/Core/InlineHints/InlineHintDataTag.cs b/src/EditorFeatures/Core/InlineHints/InlineHintDataTag.cs index a87110780723c..0324d32bb28c7 100644 --- a/src/EditorFeatures/Core/InlineHints/InlineHintDataTag.cs +++ b/src/EditorFeatures/Core/InlineHints/InlineHintDataTag.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; +using System.Collections.Immutable; using Microsoft.VisualStudio.Text.Tagging; namespace Microsoft.CodeAnalysis.Editor.InlineHints @@ -13,15 +14,15 @@ namespace Microsoft.CodeAnalysis.Editor.InlineHints /// internal class InlineHintDataTag : ITag { - public readonly string Text; + public readonly ImmutableArray Parts; public readonly SymbolKey? SymbolKey; - public InlineHintDataTag(string text, SymbolKey? symbolKey) + public InlineHintDataTag(ImmutableArray parts, SymbolKey? symbolKey) { - if (text.Length == 0) - throw new ArgumentException("Must have a length greater than 0", nameof(text)); + if (parts.Length == 0) + throw new ArgumentException("Must have a length greater than 0", nameof(parts)); - Text = text; + Parts = parts; SymbolKey = symbolKey; } } diff --git a/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs b/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs index 1b8579eef6db4..b79b18cb9bcfe 100644 --- a/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs +++ b/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.ComponentModel.Composition; using System.Threading; using System.Threading.Tasks; @@ -14,13 +15,14 @@ using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.InlineHints; using Microsoft.CodeAnalysis.LanguageServices; +using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Editor; using Microsoft.VisualStudio.Text.Tagging; -using Microsoft.VisualStudio.Utilities; using Roslyn.Utilities; +using VSUtilities = Microsoft.VisualStudio.Utilities; namespace Microsoft.CodeAnalysis.Editor.InlineHints { @@ -28,9 +30,9 @@ namespace Microsoft.CodeAnalysis.Editor.InlineHints /// The TaggerProvider that calls upon the service in order to locate the spans and names /// [Export(typeof(IViewTaggerProvider))] - [ContentType(ContentTypeNames.RoslynContentType)] + [VSUtilities.ContentType(ContentTypeNames.RoslynContentType)] [TagType(typeof(InlineHintDataTag))] - [Name(nameof(InlineHintsDataTaggerProvider))] + [VSUtilities.Name(nameof(InlineHintsDataTaggerProvider))] internal class InlineHintsDataTaggerProvider : AsynchronousViewTaggerProvider { private static readonly SymbolDisplayFormat s_minimalTypeStyle = new SymbolDisplayFormat( @@ -106,24 +108,24 @@ private async Task AddTypeHintsAsync(TaggerContext context, D { Contract.ThrowIfNull(hint.Type); - var sb = PooledStringBuilder.GetInstance(); + using var _ = ArrayBuilder.GetInstance(out var finalParts); var parts = hint.Type.ToDisplayParts(s_minimalTypeStyle); - AddParts(anonymousTypeService, sb, parts, semanticModel, position); + AddParts(anonymousTypeService, finalParts, parts, semanticModel, position); cancellationToken.ThrowIfCancellationRequested(); context.AddTag(new TagSpan( new SnapshotSpan(snapshotSpan.Snapshot, hint.Position, 0), new InlineHintDataTag( - sb.ToStringAndFree(), + finalParts.ToImmutable(), hint.Type.GetSymbolKey(cancellationToken)))); } } private void AddParts( IAnonymousTypeDisplayService anonymousTypeService, - PooledStringBuilder sb, - System.Collections.Immutable.ImmutableArray parts, + ArrayBuilder finalParts, + ImmutableArray parts, SemanticModel semanticModel, int position, HashSet? seenSymbols = null) @@ -137,17 +139,17 @@ private void AddParts( if (seenSymbols.Add(anonymousType)) { var anonymousParts = anonymousTypeService.GetAnonymousTypeParts(anonymousType, semanticModel, position); - AddParts(anonymousTypeService, sb, anonymousParts, semanticModel, position, seenSymbols); + AddParts(anonymousTypeService, finalParts, anonymousParts, semanticModel, position, seenSymbols); seenSymbols.Remove(anonymousType); } else { - sb.Builder.Append("..."); + finalParts.Add(new SymbolDisplayPart(SymbolDisplayPartKind.Text, symbol: null, "...")); } } else { - sb.Builder.Append(part.ToString()); + finalParts.Add(part); } } } @@ -169,7 +171,7 @@ private static async Task AddParameterNameHintsAsync(TaggerContext( new SnapshotSpan(snapshotSpan.Snapshot, hint.Position, 0), new InlineHintDataTag( - hint.Parameter.Name + ":", + ImmutableArray.Create(new SymbolDisplayPart(SymbolDisplayPartKind.Text, hint.Parameter, hint.Parameter.Name + ":")), hint.Parameter.GetSymbolKey(cancellationToken)))); } } diff --git a/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs b/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs index ee558cb603158..41930e04b32d2 100644 --- a/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs +++ b/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs @@ -19,6 +19,12 @@ internal static class InlineHintsOptions defaultValue: true, storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.DisplayAllHintsWhilePressingCtrlAlt")); + public static readonly PerLanguageOption2 ColorHints = + new(nameof(InlineHintsOptions), + nameof(ColorHints), + defaultValue: true, + storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.ColorHints")); + /// /// Non-persisted option used to switch to displaying everything while the user is holding ctrl-alt. /// @@ -92,9 +98,14 @@ public InlineHintsOptionsProvider() } public ImmutableArray Options { get; } = ImmutableArray.Create( + InlineHintsOptions.DisplayAllHintsWhilePressingCtrlAlt, + InlineHintsOptions.ColorHints, InlineHintsOptions.EnabledForParameters, InlineHintsOptions.ForLiteralParameters, InlineHintsOptions.ForObjectCreationParameters, - InlineHintsOptions.ForOtherParameters); + InlineHintsOptions.ForOtherParameters, + InlineHintsOptions.EnabledForTypes, + InlineHintsOptions.ForImplicitVariableTypes, + InlineHintsOptions.ForLambdaParameterTypes); } } diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml index 87117d0017100..2a71be74326af 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml @@ -193,6 +193,9 @@ + + ServicesVSResources.Display_all_hints_while_pressing_Ctrl_Alt; + public static string Option_Color_hints + => ServicesVSResources.Color_hints; + public static string Option_Display_inline_parameter_name_hints => ServicesVSResources.Display_inline_parameter_name_hints; diff --git a/src/VisualStudio/Core/Def/ServicesVSResources.resx b/src/VisualStudio/Core/Def/ServicesVSResources.resx index 0670892d58ec1..c09ce14da9e43 100644 --- a/src/VisualStudio/Core/Def/ServicesVSResources.resx +++ b/src/VisualStudio/Core/Def/ServicesVSResources.resx @@ -1584,4 +1584,7 @@ I agree to all of the foregoing: Display all hints while pressing Ctrl+Alt + + Color hints + \ No newline at end of file diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf index 2f00fca94deb2..d404bd54b66e5 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf @@ -147,6 +147,11 @@ Analýza kódu pro řešení se ukončila dříve, než se dokončila. + + Color hints + Color hints + + Colorize regular expressions Obarvit regulární výrazy diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf index f42378a31aabf..44f606a44713e 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf @@ -147,6 +147,11 @@ Die Codeanalyse wurde für die Projektmappe vorzeitig beendet. + + Color hints + Color hints + + Colorize regular expressions Reguläre Ausdrücke farbig hervorheben diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf index ec12649630cfd..7f538f23c3710 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf @@ -147,6 +147,11 @@ El análisis de código terminó antes de completarse para la solución. + + Color hints + Color hints + + Colorize regular expressions Colorear expresiones regulares diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf index a2c88f325a7bf..50228db4a5386 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf @@ -147,6 +147,11 @@ L'analyse du code s'est terminée avant la fin de la solution. + + Color hints + Color hints + + Colorize regular expressions Coloriser les expressions régulières diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf index 1484ca0421587..c9373307fd587 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf @@ -147,6 +147,11 @@ L'esecuzione di Code Analysis è stata terminata prima del completamento per la soluzione. + + Color hints + Color hints + + Colorize regular expressions Colora espressioni regolari diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf index 7585a432b17fa..bd927e2639bd9 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf @@ -147,6 +147,11 @@ コード分析が、ソリューションでの完了前に終了しました。 + + Color hints + Color hints + + Colorize regular expressions 正規表現をカラー化 diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf index a87ce575d5aeb..488a20465c683 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf @@ -147,6 +147,11 @@ 솔루션 완료 전에 코드 분석이 종료되었습니다. + + Color hints + Color hints + + Colorize regular expressions 정규식 색 지정 diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf index 949ceaec32f27..3c46f6e52d967 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf @@ -147,6 +147,11 @@ Analiza kodu zakończyła się przed zakończeniem dla rozwiązania. + + Color hints + Color hints + + Colorize regular expressions Koloruj wyrażenia regularne diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf index e4ae79e60daa0..64656cc66014a 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf @@ -147,6 +147,11 @@ Análise de código terminada antes da conclusão da Solução. + + Color hints + Color hints + + Colorize regular expressions Colorir expressões regulares diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf index 9f24f4d992314..a6aa2ebdc90ed 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf @@ -147,6 +147,11 @@ Анализ кода прерван до завершения решения. + + Color hints + Color hints + + Colorize regular expressions Выделить регулярные выражения цветом diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf index 8e9cb62a5cf7f..708352976dfff 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf @@ -147,6 +147,11 @@ Kod analizi, Çözüm için tamamlanmadan önce sonlandırıldı. + + Color hints + Color hints + + Colorize regular expressions Normal ifadeleri renklendir diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf index 362b133e91292..37c114cc6c96c 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf @@ -147,6 +147,11 @@ 解决方案的代码分析在完成之前终止。 + + Color hints + Color hints + + Colorize regular expressions 为正规表达式着色 diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf index 89c95594574a1..108704fa0dff8 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf @@ -147,6 +147,11 @@ 程式碼分析在解決方案完成前終止。 + + Color hints + Color hints + + Colorize regular expressions 為規則運算式添加色彩 diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml index 876542180a966..ce1aa076580aa 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml @@ -199,6 +199,9 @@ + + Date: Thu, 8 Oct 2020 10:54:36 -0700 Subject: [PATCH 219/295] Add option checks --- .../Core/InlineHints/InlineHintsDataTaggerProvider.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs b/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs index b79b18cb9bcfe..983438ae6d1c4 100644 --- a/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs +++ b/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs @@ -65,7 +65,10 @@ protected override ITaggerEventSource CreateEventSource(ITextView textViewOpt, I TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.ForObjectCreationParameters, TaggerDelay.NearImmediate), TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.ForOtherParameters, TaggerDelay.NearImmediate), TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.SuppressForParametersThatMatchMethodIntent, TaggerDelay.NearImmediate), - TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.SuppressForParametersThatDifferOnlyBySuffix, TaggerDelay.NearImmediate)); + TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.SuppressForParametersThatDifferOnlyBySuffix, TaggerDelay.NearImmediate), + TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.EnabledForTypes, TaggerDelay.NearImmediate), + TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.ForImplicitVariableTypes, TaggerDelay.NearImmediate), + TaggerEventSources.OnOptionChanged(subjectBuffer, InlineHintsOptions.ForLambdaParameterTypes, TaggerDelay.NearImmediate)); } protected override IEnumerable GetSpansToTag(ITextView textView, ITextBuffer subjectBuffer) From 12f0268e067fa170c011a36cd7a9bb9c30fa98d3 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 11:01:55 -0700 Subject: [PATCH 220/295] Support in foreach --- .../Portable/InlineHints/CSharpInlineTypeHintsService.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs b/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs index 4d9c9bbc86e97..7082502c01ebc 100644 --- a/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs +++ b/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs @@ -46,6 +46,14 @@ public CSharpInlineTypeHintsService() if (IsValidType(type)) return new InlineTypeHint(type, variableDesignation.Identifier.SpanStart); } + else if (node is ForEachStatementSyntax forEachStatement && + forEachStatement.Type.IsVar) + { + var info = semanticModel.GetForEachStatementInfo(forEachStatement); + var type = info.ElementType; + if (IsValidType(type)) + return new InlineTypeHint(type, forEachStatement.Identifier.SpanStart); + } } if (forLambdaParameterTypes) From 2ad91afdf0ecd461e51a9c30805d94b401607eda Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 11:06:55 -0700 Subject: [PATCH 221/295] Don't show for declaration patterns (since they specify their type) --- .../CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs b/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs index 7082502c01ebc..74eabd4640186 100644 --- a/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs +++ b/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs @@ -39,7 +39,7 @@ public CSharpInlineTypeHintsService() if (IsValidType(type)) return new InlineTypeHint(type, variableDeclaration.Variables[0].Identifier.SpanStart); } - else if (node is SingleVariableDesignationSyntax variableDesignation) + else if (node is SingleVariableDesignationSyntax { Parent: not DeclarationPatternSyntax } variableDesignation) { var local = semanticModel.GetDeclaredSymbol(variableDesignation, cancellationToken) as ILocalSymbol; var type = local?.Type; From 657b6c67b07467c8d607ebdc1a8cbb59e87dd95d Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 11:17:23 -0700 Subject: [PATCH 222/295] Rename base type --- ...eterNameHintsTests.vb => AbstractInlineHintsTests.vb} | 9 ++++----- .../InlineHints/CSharpInlineParameterNameHintsTests.vb | 2 +- .../VisualBasicInlineParameterNameHintsTests.vb | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) rename src/EditorFeatures/Test2/InlineHints/{AbstractInlineParameterNameHintsTests.vb => AbstractInlineHintsTests.vb} (90%) diff --git a/src/EditorFeatures/Test2/InlineHints/AbstractInlineParameterNameHintsTests.vb b/src/EditorFeatures/Test2/InlineHints/AbstractInlineHintsTests.vb similarity index 90% rename from src/EditorFeatures/Test2/InlineHints/AbstractInlineParameterNameHintsTests.vb rename to src/EditorFeatures/Test2/InlineHints/AbstractInlineHintsTests.vb index a032b961f399e..3040bff88faf5 100644 --- a/src/EditorFeatures/Test2/InlineHints/AbstractInlineParameterNameHintsTests.vb +++ b/src/EditorFeatures/Test2/InlineHints/AbstractInlineHintsTests.vb @@ -8,11 +8,10 @@ Imports Microsoft.CodeAnalysis.InlineHints Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints <[UseExportProvider]> - Public MustInherit Class AbstractInlineParameterNameHintsTests - + Public MustInherit Class AbstractInlineHintsTests Protected Async Function VerifyParamHints(test As XElement, Optional optionIsEnabled As Boolean = True) As Task Using workspace = TestWorkspace.Create(test) - WpfTestRunner.RequireWpfFact($"{NameOf(AbstractInlineParameterNameHintsTests)}.{NameOf(Me.VerifyParamHints)} creates asynchronous taggers") + WpfTestRunner.RequireWpfFact($"{NameOf(AbstractInlineHintsTests)}.{NameOf(Me.VerifyParamHints)} creates asynchronous taggers") workspace.TryApplyChanges(workspace.CurrentSolution.WithOptions(workspace.Options.WithChangedOption( InlineHintsOptions.EnabledForParameters, @@ -34,8 +33,8 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Function(name) name.Value, Function(name, span) New With {.Name = name.Key, span}) - For Each nameAndSpan In nameAndSpansList.OrderBy(Function(x) x.Span.Start) - expectedTags.Add(nameAndSpan.Name + ":" + nameAndSpan.Span.Start.ToString()) + For Each nameAndSpan In nameAndSpansList.OrderBy(Function(x) x.span.Start) + expectedTags.Add(nameAndSpan.Name + ":" + nameAndSpan.span.Start.ToString()) Next AssertEx.Equal(expectedTags, producedTags) diff --git a/src/EditorFeatures/Test2/InlineHints/CSharpInlineParameterNameHintsTests.vb b/src/EditorFeatures/Test2/InlineHints/CSharpInlineParameterNameHintsTests.vb index d6a929902f2af..3625795b263bd 100644 --- a/src/EditorFeatures/Test2/InlineHints/CSharpInlineParameterNameHintsTests.vb +++ b/src/EditorFeatures/Test2/InlineHints/CSharpInlineParameterNameHintsTests.vb @@ -4,7 +4,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Public Class CSharpInlineParameterNameHintsTests - Inherits AbstractInlineParameterNameHintsTests + Inherits AbstractInlineHintsTests Public Async Function TestNoParameterSimpleCase() As Task diff --git a/src/EditorFeatures/Test2/InlineHints/VisualBasicInlineParameterNameHintsTests.vb b/src/EditorFeatures/Test2/InlineHints/VisualBasicInlineParameterNameHintsTests.vb index e1169778b55ec..3ca19b506936e 100644 --- a/src/EditorFeatures/Test2/InlineHints/VisualBasicInlineParameterNameHintsTests.vb +++ b/src/EditorFeatures/Test2/InlineHints/VisualBasicInlineParameterNameHintsTests.vb @@ -4,7 +4,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Public Class VisualBasicInlineParameterNameHintsTests - Inherits AbstractInlineParameterNameHintsTests + Inherits AbstractInlineHintsTests Public Async Function TestNoParameterSimpleCase() As Task From 3982eb14330d3805ad3cb1ef84c955de533a65fa Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 11:35:42 -0700 Subject: [PATCH 223/295] Compute all data in hte service. --- .../InlineHintsDataTaggerProvider.cs | 56 +----------------- .../InlineHints/AbstractInlineHintsTests.vb | 33 +++++++++++ .../CSharpInlineTypeHintsService.cs | 12 ++-- .../AbstractInlineTypeHintsService.cs | 57 +++++++++++++++++-- .../Portable/InlineHints/InlineTypeHint.cs | 12 ++-- 5 files changed, 101 insertions(+), 69 deletions(-) diff --git a/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs b/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs index 983438ae6d1c4..bc66711a96013 100644 --- a/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs +++ b/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs @@ -14,8 +14,6 @@ using Microsoft.CodeAnalysis.Editor.Tagging; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.InlineHints; -using Microsoft.CodeAnalysis.LanguageServices; -using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.VisualStudio.Text; @@ -35,10 +33,6 @@ namespace Microsoft.CodeAnalysis.Editor.InlineHints [VSUtilities.Name(nameof(InlineHintsDataTaggerProvider))] internal class InlineHintsDataTaggerProvider : AsynchronousViewTaggerProvider { - private static readonly SymbolDisplayFormat s_minimalTypeStyle = new SymbolDisplayFormat( - genericsOptions: SymbolDisplayGenericsOptions.IncludeTypeParameters, - miscellaneousOptions: SymbolDisplayMiscellaneousOptions.AllowDefaultLiteral | SymbolDisplayMiscellaneousOptions.IncludeNullableReferenceTypeModifier | SymbolDisplayMiscellaneousOptions.UseSpecialTypes); - private readonly IAsynchronousOperationListener _listener; protected override SpanTrackingMode SpanTrackingMode => SpanTrackingMode.EdgeInclusive; @@ -94,66 +88,20 @@ protected override async Task ProduceTagsAsync(TaggerContext await AddParameterNameHintsAsync(context, documentSnapshotSpan, cancellationToken).ConfigureAwait(false); } - private async Task AddTypeHintsAsync(TaggerContext context, DocumentSnapshotSpan documentSnapshotSpan, CancellationToken cancellationToken) + private static async Task AddTypeHintsAsync(TaggerContext context, DocumentSnapshotSpan documentSnapshotSpan, CancellationToken cancellationToken) { var document = documentSnapshotSpan.Document; var service = document.GetLanguageService(); if (service == null) return; - var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); - var anonymousTypeService = document.GetRequiredLanguageService(); - var snapshotSpan = documentSnapshotSpan.SnapshotSpan; - var position = snapshotSpan.Span.Start; var hints = await service.GetInlineTypeHintsAsync(document, snapshotSpan.Span.ToTextSpan(), cancellationToken).ConfigureAwait(false); foreach (var hint in hints) { - Contract.ThrowIfNull(hint.Type); - - using var _ = ArrayBuilder.GetInstance(out var finalParts); - var parts = hint.Type.ToDisplayParts(s_minimalTypeStyle); - - AddParts(anonymousTypeService, finalParts, parts, semanticModel, position); - - cancellationToken.ThrowIfCancellationRequested(); context.AddTag(new TagSpan( new SnapshotSpan(snapshotSpan.Snapshot, hint.Position, 0), - new InlineHintDataTag( - finalParts.ToImmutable(), - hint.Type.GetSymbolKey(cancellationToken)))); - } - } - - private void AddParts( - IAnonymousTypeDisplayService anonymousTypeService, - ArrayBuilder finalParts, - ImmutableArray parts, - SemanticModel semanticModel, - int position, - HashSet? seenSymbols = null) - { - seenSymbols ??= new(); - - foreach (var part in parts) - { - if (part.Symbol is INamedTypeSymbol { IsAnonymousType: true } anonymousType) - { - if (seenSymbols.Add(anonymousType)) - { - var anonymousParts = anonymousTypeService.GetAnonymousTypeParts(anonymousType, semanticModel, position); - AddParts(anonymousTypeService, finalParts, anonymousParts, semanticModel, position, seenSymbols); - seenSymbols.Remove(anonymousType); - } - else - { - finalParts.Add(new SymbolDisplayPart(SymbolDisplayPartKind.Text, symbol: null, "...")); - } - } - else - { - finalParts.Add(part); - } + new InlineHintDataTag(hint.Parts, hint.SymbolKey))); } } diff --git a/src/EditorFeatures/Test2/InlineHints/AbstractInlineHintsTests.vb b/src/EditorFeatures/Test2/InlineHints/AbstractInlineHintsTests.vb index 3040bff88faf5..a6ca0b2c121eb 100644 --- a/src/EditorFeatures/Test2/InlineHints/AbstractInlineHintsTests.vb +++ b/src/EditorFeatures/Test2/InlineHints/AbstractInlineHintsTests.vb @@ -40,5 +40,38 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints AssertEx.Equal(expectedTags, producedTags) End Using End Function + + Protected Async Function VerifyTypeHints(test As XElement, Optional optionIsEnabled As Boolean = True) As Task + Using workspace = TestWorkspace.Create(test) + WpfTestRunner.RequireWpfFact($"{NameOf(AbstractInlineHintsTests)}.{NameOf(Me.VerifyTypeHints)} creates asynchronous taggers") + + workspace.TryApplyChanges(workspace.CurrentSolution.WithOptions(workspace.Options.WithChangedOption( + InlineHintsOptions.EnabledForTypes, + workspace.CurrentSolution.Projects().First().Language, + optionIsEnabled))) + + Dim hostDocument = workspace.Documents.Single() + Dim snapshot = hostDocument.GetTextBuffer().CurrentSnapshot + Dim document = workspace.CurrentSolution.GetDocument(hostDocument.Id) + Dim tagService = document.GetRequiredLanguageService(Of IInlineTypeHintsService) + Dim typeHints = Await tagService.GetInlineTypeHintsAsync(document, New Text.TextSpan(0, snapshot.Length), New CancellationToken()) + + Dim producedTags = From hint In typeHints + Select hint.Type + + Dim expectedTags As New List(Of String) + + Dim nameAndSpansList = hostDocument.AnnotatedSpans.SelectMany( + Function(name) name.Value, + Function(name, span) New With {.Name = name.Key, span}) + + For Each nameAndSpan In nameAndSpansList.OrderBy(Function(x) x.span.Start) + expectedTags.Add(nameAndSpan.Name + ":" + nameAndSpan.span.Start.ToString()) + Next + + AssertEx.Equal(expectedTags, producedTags) + End Using + End Function + End Class End Namespace diff --git a/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs b/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs index 74eabd4640186..8f169d682654e 100644 --- a/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs +++ b/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs @@ -21,7 +21,7 @@ public CSharpInlineTypeHintsService() { } - protected override InlineTypeHint? TryGetTypeHint( + protected override (ITypeSymbol type, int position)? TryGetTypeHint( SemanticModel semanticModel, SyntaxNode node, bool forImplicitVariableTypes, @@ -37,14 +37,14 @@ public CSharpInlineTypeHintsService() { var type = semanticModel.GetTypeInfo(variableDeclaration.Type, cancellationToken).Type; if (IsValidType(type)) - return new InlineTypeHint(type, variableDeclaration.Variables[0].Identifier.SpanStart); + return (type, variableDeclaration.Variables[0].Identifier.SpanStart); } else if (node is SingleVariableDesignationSyntax { Parent: not DeclarationPatternSyntax } variableDesignation) { var local = semanticModel.GetDeclaredSymbol(variableDesignation, cancellationToken) as ILocalSymbol; var type = local?.Type; if (IsValidType(type)) - return new InlineTypeHint(type, variableDesignation.Identifier.SpanStart); + return (type, variableDesignation.Identifier.SpanStart); } else if (node is ForEachStatementSyntax forEachStatement && forEachStatement.Type.IsVar) @@ -52,7 +52,7 @@ public CSharpInlineTypeHintsService() var info = semanticModel.GetForEachStatementInfo(forEachStatement); var type = info.ElementType; if (IsValidType(type)) - return new InlineTypeHint(type, forEachStatement.Identifier.SpanStart); + return (type, forEachStatement.Identifier.SpanStart); } } @@ -62,13 +62,13 @@ public CSharpInlineTypeHintsService() { var parameter = semanticModel.GetDeclaredSymbol(simpleLambda.Parameter, cancellationToken); if (IsValidType(parameter?.Type)) - return new InlineTypeHint(parameter.Type, simpleLambda.Parameter.Identifier.SpanStart); + return (parameter.Type, simpleLambda.Parameter.Identifier.SpanStart); } else if (node is ParameterSyntax { Type: null } parameterNode) { var parameter = semanticModel.GetDeclaredSymbol(parameterNode, cancellationToken); if (IsValidType(parameter?.Type)) - return new InlineTypeHint(parameter.Type, parameterNode.Identifier.SpanStart); + return (parameter.Type, parameterNode.Identifier.SpanStart); } } diff --git a/src/Features/Core/Portable/InlineHints/AbstractInlineTypeHintsService.cs b/src/Features/Core/Portable/InlineHints/AbstractInlineTypeHintsService.cs index ee8a4e750c5bf..2e75b46c7e905 100644 --- a/src/Features/Core/Portable/InlineHints/AbstractInlineTypeHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/AbstractInlineTypeHintsService.cs @@ -3,9 +3,11 @@ // See the LICENSE file in the project root for more information. using System; +using System.Collections.Generic; using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; @@ -14,7 +16,11 @@ namespace Microsoft.CodeAnalysis.InlineHints { internal abstract class AbstractInlineTypeHintsService : IInlineTypeHintsService { - protected abstract InlineTypeHint? TryGetTypeHint( + private static readonly SymbolDisplayFormat s_minimalTypeStyle = new SymbolDisplayFormat( + genericsOptions: SymbolDisplayGenericsOptions.IncludeTypeParameters, + miscellaneousOptions: SymbolDisplayMiscellaneousOptions.AllowDefaultLiteral | SymbolDisplayMiscellaneousOptions.IncludeNullableReferenceTypeModifier | SymbolDisplayMiscellaneousOptions.UseSpecialTypes); + + protected abstract (ITypeSymbol type, int position)? TryGetTypeHint( SemanticModel semanticModel, SyntaxNode node, bool forImplicitVariableTypes, bool forLambdaParameterTypes, @@ -35,20 +41,63 @@ public async Task> GetInlineTypeHintsAsync( if (!forImplicitVariableTypes && !forLambdaParameterTypes) return ImmutableArray.Empty; + var anonymousTypeService = document.GetRequiredLanguageService(); var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); - using var _ = ArrayBuilder.GetInstance(out var result); + using var _1 = ArrayBuilder.GetInstance(out var result); foreach (var node in root.DescendantNodes(n => n.Span.IntersectsWith(textSpan))) { - result.AddIfNotNull(TryGetTypeHint( + var hintOpt = TryGetTypeHint( semanticModel, node, forImplicitVariableTypes, - forLambdaParameterTypes, cancellationToken)); + forLambdaParameterTypes, cancellationToken); + if (hintOpt == null) + continue; + + var (type, position) = hintOpt.Value; + + using var _2 = ArrayBuilder.GetInstance(out var finalParts); + var parts = type.ToDisplayParts(s_minimalTypeStyle); + + AddParts(anonymousTypeService, finalParts, parts, semanticModel, position); + result.Add(new InlineTypeHint(position, finalParts.ToImmutable(), type.GetSymbolKey(cancellationToken))); } return result.ToImmutable(); } + + private void AddParts( + IAnonymousTypeDisplayService anonymousTypeService, + ArrayBuilder finalParts, + ImmutableArray parts, + SemanticModel semanticModel, + int position, + HashSet? seenSymbols = null) + { + seenSymbols ??= new(); + + foreach (var part in parts) + { + if (part.Symbol is INamedTypeSymbol { IsAnonymousType: true } anonymousType) + { + if (seenSymbols.Add(anonymousType)) + { + var anonymousParts = anonymousTypeService.GetAnonymousTypeParts(anonymousType, semanticModel, position); + AddParts(anonymousTypeService, finalParts, anonymousParts, semanticModel, position, seenSymbols); + seenSymbols.Remove(anonymousType); + } + else + { + finalParts.Add(new SymbolDisplayPart(SymbolDisplayPartKind.Text, symbol: null, "...")); + } + } + else + { + finalParts.Add(part); + } + } + } } } diff --git a/src/Features/Core/Portable/InlineHints/InlineTypeHint.cs b/src/Features/Core/Portable/InlineHints/InlineTypeHint.cs index 689b1aec40864..7e37d9ca1640f 100644 --- a/src/Features/Core/Portable/InlineHints/InlineTypeHint.cs +++ b/src/Features/Core/Portable/InlineHints/InlineTypeHint.cs @@ -2,19 +2,21 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Collections.Immutable; + namespace Microsoft.CodeAnalysis.InlineHints { internal readonly struct InlineTypeHint { - public readonly ITypeSymbol Type; public readonly int Position; + public readonly ImmutableArray Parts; + public readonly SymbolKey SymbolKey; - public InlineTypeHint( - ITypeSymbol type, - int position) + public InlineTypeHint(int position, ImmutableArray parts, SymbolKey symbolKey) { - Type = type; Position = position; + Parts = parts; + SymbolKey = symbolKey; } } } From 9796485cdafaa7a78013f3f5f23f5f23ff2502b2 Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Thu, 8 Oct 2020 11:42:27 -0700 Subject: [PATCH 224/295] Skip binary for determinism checking This adds Microsoft.CodeAnalysis.EditorFeatures2.UnitTests.dll since right now that binary is impacted by https://github.com/dotnet/roslyn/issues/48417. --- eng/test-determinism.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/eng/test-determinism.ps1 b/eng/test-determinism.ps1 index 9ecac2ecd91e6..40f32a0cf53c1 100644 --- a/eng/test-determinism.ps1 +++ b/eng/test-determinism.ps1 @@ -24,7 +24,10 @@ if ($help) { # List of binary names that should be skipped because they have a known issue that # makes them non-deterministic. -$script:skipList = @() +$script:skipList = @( + # Added to work around https://github.com/dotnet/roslyn/issues/48417 + "Microsoft.CodeAnalysis.EditorFeatures2.UnitTests.dll" +) function Run-Build([string]$rootDir, [string]$logFileName) { # Clean out the previous run From 29851f1b682689bf1c10633435e59a8c98ca65f1 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 11:46:34 -0700 Subject: [PATCH 225/295] Add tests --- .../InlineHints/AbstractInlineHintsTests.vb | 2 +- .../CSharpInlineParameterNameHintsTests.vb | 54 ++++----- .../InlineHints/CSharpInlineTypeHintsTests.vb | 109 ++++++++++++++++++ ...isualBasicInlineParameterNameHintsTests.vb | 52 ++++----- src/Test/Utilities/Portable/Traits/Traits.cs | 2 +- 5 files changed, 164 insertions(+), 55 deletions(-) create mode 100644 src/EditorFeatures/Test2/InlineHints/CSharpInlineTypeHintsTests.vb diff --git a/src/EditorFeatures/Test2/InlineHints/AbstractInlineHintsTests.vb b/src/EditorFeatures/Test2/InlineHints/AbstractInlineHintsTests.vb index a6ca0b2c121eb..fc782199e2715 100644 --- a/src/EditorFeatures/Test2/InlineHints/AbstractInlineHintsTests.vb +++ b/src/EditorFeatures/Test2/InlineHints/AbstractInlineHintsTests.vb @@ -57,7 +57,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Dim typeHints = Await tagService.GetInlineTypeHintsAsync(document, New Text.TextSpan(0, snapshot.Length), New CancellationToken()) Dim producedTags = From hint In typeHints - Select hint.Type + Select hint.Parts.GetFullText() + ":" + hint.Position.ToString() Dim expectedTags As New List(Of String) diff --git a/src/EditorFeatures/Test2/InlineHints/CSharpInlineParameterNameHintsTests.vb b/src/EditorFeatures/Test2/InlineHints/CSharpInlineParameterNameHintsTests.vb index 3625795b263bd..d54da8061cdd1 100644 --- a/src/EditorFeatures/Test2/InlineHints/CSharpInlineParameterNameHintsTests.vb +++ b/src/EditorFeatures/Test2/InlineHints/CSharpInlineParameterNameHintsTests.vb @@ -6,7 +6,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Public Class CSharpInlineParameterNameHintsTests Inherits AbstractInlineHintsTests - + Public Async Function TestNoParameterSimpleCase() As Task Dim input = @@ -30,7 +30,7 @@ class A Await VerifyParamHints(input) End Function - + Public Async Function TestOneParameterSimpleCase() As Task Dim input = @@ -54,7 +54,7 @@ class A Await VerifyParamHints(input) End Function - + Public Async Function TestTwoParametersSimpleCase() As Task Dim input = @@ -78,7 +78,7 @@ class A Await VerifyParamHints(input) End Function - + Public Async Function TestNegativeNumberParametersSimpleCase() As Task Dim input = @@ -102,7 +102,7 @@ class A Await VerifyParamHints(input) End Function - + Public Async Function TestLiteralNestedCastParametersSimpleCase() As Task Dim input = @@ -126,7 +126,7 @@ class A Await VerifyParamHints(input) End Function - + Public Async Function TestObjectCreationParametersSimpleCase() As Task Dim input = @@ -150,7 +150,7 @@ class A Await VerifyParamHints(input) End Function - + Public Async Function TestCastingANegativeSimpleCase() As Task Dim input = @@ -174,7 +174,7 @@ class A Await VerifyParamHints(input) End Function - + Public Async Function TestNegatingACastSimpleCase() As Task Dim input = @@ -198,7 +198,7 @@ class A Await VerifyParamHints(input) End Function - + Public Async Function TestMissingParameterNameSimpleCase() As Task Dim input = @@ -222,7 +222,7 @@ class A Await VerifyParamHints(input) End Function - + Public Async Function TestDelegateParameter() As Task Dim input = @@ -250,7 +250,7 @@ class Test Await VerifyParamHints(input) End Function - + Public Async Function TestFunctionPointerNoParameter() As Task Dim input = @@ -268,7 +268,7 @@ unsafe class Example { Await VerifyParamHints(input) End Function - + Public Async Function TestParamsArgument() As Task Dim input = @@ -292,7 +292,7 @@ class A Await VerifyParamHints(input) End Function - + Public Async Function TestAttributesArgument() As Task Dim input = @@ -313,7 +313,7 @@ class Foo Await VerifyParamHints(input) End Function - + Public Async Function TestIncompleteFunctionCall() As Task Dim input = @@ -337,7 +337,7 @@ class A Await VerifyParamHints(input) End Function - + Public Async Function TestInterpolatedString() As Task Dim input = @@ -361,7 +361,7 @@ class A Await VerifyParamHints(input) End Function - + Public Async Function TestRecordBaseType() As Task Dim input = @@ -377,7 +377,7 @@ record Derived(int Other) : Base({|Alice:2|}, {|Bob:2|}); Await VerifyParamHints(input) End Function - + Public Async Function TestClassBaseType() As Task Dim input = @@ -400,7 +400,7 @@ class Derived : Base End Function - + Public Async Function TestNotOnEnableDisableBoolean1() As Task Dim input = @@ -425,7 +425,7 @@ class A End Function - + Public Async Function TestNotOnEnableDisableBoolean2() As Task Dim input = @@ -450,7 +450,7 @@ class A End Function - + Public Async Function TestOnEnableDisableNonBoolean1() As Task Dim input = @@ -475,7 +475,7 @@ class A End Function - + Public Async Function TestOnEnableDisableNonBoolean2() As Task Dim input = @@ -500,7 +500,7 @@ class A End Function - + Public Async Function TestOnSetMethodWithClearContext() As Task Dim input = @@ -525,7 +525,7 @@ class A End Function - + Public Async Function TestOnSetMethodWithUnclearContext() As Task Dim input = @@ -550,7 +550,7 @@ class A End Function - + Public Async Function TestMethodWithAlphaSuffix1() As Task Dim input = @@ -575,7 +575,7 @@ class A End Function - + Public Async Function TestMethodWithNonAlphaSuffix1() As Task Dim input = @@ -600,7 +600,7 @@ class A End Function - + Public Async Function TestMethodWithNumericSuffix1() As Task Dim input = @@ -625,7 +625,7 @@ class A End Function - + Public Async Function TestMethodWithNonNumericSuffix1() As Task Dim input = diff --git a/src/EditorFeatures/Test2/InlineHints/CSharpInlineTypeHintsTests.vb b/src/EditorFeatures/Test2/InlineHints/CSharpInlineTypeHintsTests.vb new file mode 100644 index 0000000000000..3f5ea3e52f544 --- /dev/null +++ b/src/EditorFeatures/Test2/InlineHints/CSharpInlineTypeHintsTests.vb @@ -0,0 +1,109 @@ +' Licensed to the .NET Foundation under one or more agreements. +' The .NET Foundation licenses this file to you under the MIT license. +' See the LICENSE file in the project root for more information. + +Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints + Public Class CSharpInlineTypeHintsTests + Inherits AbstractInlineHintsTests + + + Public Async Function TestNotOnLocalVariableWithType() As Task + Dim input = + + + +class A +{ + void Main() + { + int i = 0; + } +} + + + + + Await VerifyTypeHints(input) + End Function + + + Public Async Function TestOnLocalVariableWithVarType() As Task + Dim input = + + + +class A +{ + void Main() + { + var {|int:|}i = 0; + } +} + + + + + Await VerifyTypeHints(input) + End Function + + + Public Async Function TestOnDeconstruction() As Task + Dim input = + + + +class A +{ + void Main() + { + var ({|int:|}i, {|string:|}j = (0, ""); + } +} + + + + + Await VerifyTypeHints(input) + End Function + + + Public Async Function TestWithForeachVar() As Task + Dim input = + + + +class A +{ + void Main(string[] args) + { + foreach (var {|string:|}j in args) {} + } +} + + + + + Await VerifyTypeHints(input) + End Function + + + Public Async Function TestNotWithForeachType() As Task + Dim input = + + + +class A +{ + void Main(string[] args) + { + foreach (string j in args) {} + } +} + + + + + Await VerifyTypeHints(input) + End Function + End Class +End Namespace diff --git a/src/EditorFeatures/Test2/InlineHints/VisualBasicInlineParameterNameHintsTests.vb b/src/EditorFeatures/Test2/InlineHints/VisualBasicInlineParameterNameHintsTests.vb index 3ca19b506936e..f499754d9c4e0 100644 --- a/src/EditorFeatures/Test2/InlineHints/VisualBasicInlineParameterNameHintsTests.vb +++ b/src/EditorFeatures/Test2/InlineHints/VisualBasicInlineParameterNameHintsTests.vb @@ -6,7 +6,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Public Class VisualBasicInlineParameterNameHintsTests Inherits AbstractInlineHintsTests - + Public Async Function TestNoParameterSimpleCase() As Task Dim input = @@ -28,7 +28,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Await VerifyParamHints(input) End Function - + Public Async Function TestOneParameterSimpleCase() As Task Dim input = @@ -50,7 +50,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Await VerifyParamHints(input) End Function - + Public Async Function TestTwoParametersSimpleCase() As Task Dim input = @@ -72,7 +72,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Await VerifyParamHints(input) End Function - + Public Async Function TestNegativeNumberParametersSimpleCase() As Task Dim input = @@ -94,7 +94,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Await VerifyParamHints(input) End Function - + Public Async Function TestCIntCast() As Task Dim input = @@ -116,7 +116,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Await VerifyParamHints(input) End Function - + Public Async Function TestCTypeCast() As Task Dim input = @@ -138,7 +138,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Await VerifyParamHints(input) End Function - + Public Async Function TestTryCastCase() As Task Dim input = @@ -160,7 +160,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Await VerifyParamHints(input) End Function - + Public Async Function TestDirectCastCase() As Task Dim input = @@ -182,7 +182,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Await VerifyParamHints(input) End Function - + Public Async Function TestCastingANegativeSimpleCase() As Task Dim input = @@ -204,7 +204,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Await VerifyParamHints(input) End Function - + Public Async Function TestObjectCreationParametersSimpleCase() As Task Dim input = @@ -226,7 +226,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Await VerifyParamHints(input) End Function - + Public Async Function TestMissingParameterNameSimpleCase() As Task Dim input = @@ -248,7 +248,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Await VerifyParamHints(input) End Function - + Public Async Function TestDelegateParameter() As Task Dim input = @@ -268,7 +268,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Await VerifyParamHints(input) End Function - + Public Async Function TestParamsArgument() As Task Dim input = @@ -290,7 +290,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Await VerifyParamHints(input) End Function - + Public Async Function TestAttributesArgument() As Task Dim input = @@ -309,7 +309,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Await VerifyParamHints(input) End Function - + Public Async Function TestIncompleteFunctionCall() As Task Dim input = @@ -331,7 +331,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Await VerifyParamHints(input) End Function - + Public Async Function TestInterpolatedString() As Task Dim input = @@ -354,7 +354,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints End Function - + Public Async Function TestNotOnEnableDisableBoolean1() As Task Dim input = @@ -376,7 +376,7 @@ end class End Function - + Public Async Function TestNotOnEnableDisableBoolean2() As Task Dim input = @@ -398,7 +398,7 @@ end class End Function - + Public Async Function TestOnEnableDisableNonBoolean1() As Task Dim input = @@ -420,7 +420,7 @@ end class End Function - + Public Async Function TestOnEnableDisableNonBoolean2() As Task Dim input = @@ -442,7 +442,7 @@ end class End Function - + Public Async Function TestOnSetMethodWithClearContext() As Task Dim input = @@ -464,7 +464,7 @@ end class End Function - + Public Async Function TestOnSetMethodWithUnclearContext() As Task Dim input = @@ -486,7 +486,7 @@ end class End Function - + Public Async Function TestMethodWithAlphaSuffix1() As Task Dim input = @@ -508,7 +508,7 @@ end class End Function - + Public Async Function TestMethodWithNonAlphaSuffix1() As Task Dim input = @@ -530,7 +530,7 @@ end class End Function - + Public Async Function TestMethodWithNumericSuffix1() As Task Dim input = @@ -552,7 +552,7 @@ end class End Function - + Public Async Function TestMethodWithNonNumericSuffix1() As Task Dim input = diff --git a/src/Test/Utilities/Portable/Traits/Traits.cs b/src/Test/Utilities/Portable/Traits/Traits.cs index d7f63fee3987e..fe5b3a444eb70 100644 --- a/src/Test/Utilities/Portable/Traits/Traits.cs +++ b/src/Test/Utilities/Portable/Traits/Traits.cs @@ -240,7 +240,7 @@ public static class Features public const string GoToBase = nameof(GoToBase); public const string GoToDefinition = nameof(GoToDefinition); public const string GoToImplementation = nameof(GoToImplementation); - public const string InlineParameterNameHints = nameof(InlineParameterNameHints); + public const string InlineHints = nameof(InlineHints); public const string Interactive = nameof(Interactive); public const string InteractiveHost = nameof(InteractiveHost); public const string KeywordHighlighting = nameof(KeywordHighlighting); From b5c0119407f2fb504555a14e7f116726d27adccd Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 11:47:46 -0700 Subject: [PATCH 226/295] Add tests --- .../Test2/InlineHints/CSharpInlineTypeHintsTests.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EditorFeatures/Test2/InlineHints/CSharpInlineTypeHintsTests.vb b/src/EditorFeatures/Test2/InlineHints/CSharpInlineTypeHintsTests.vb index 3f5ea3e52f544..dfbd5ef53f3e1 100644 --- a/src/EditorFeatures/Test2/InlineHints/CSharpInlineTypeHintsTests.vb +++ b/src/EditorFeatures/Test2/InlineHints/CSharpInlineTypeHintsTests.vb @@ -56,7 +56,7 @@ class A { void Main() { - var ({|int:|}i, {|string:|}j = (0, ""); + var ({|int:|}i, {|string:|}j) = (0, ""); } } From acfa08073eb6a75053fe411c094055cecfae8001 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 11:54:06 -0700 Subject: [PATCH 227/295] Add tests --- .../InlineHints/CSharpInlineTypeHintsTests.vb | 103 ++++++++++++++++++ .../CSharpInlineTypeHintsService.cs | 13 +-- 2 files changed, 108 insertions(+), 8 deletions(-) diff --git a/src/EditorFeatures/Test2/InlineHints/CSharpInlineTypeHintsTests.vb b/src/EditorFeatures/Test2/InlineHints/CSharpInlineTypeHintsTests.vb index dfbd5ef53f3e1..99a6f55896fe8 100644 --- a/src/EditorFeatures/Test2/InlineHints/CSharpInlineTypeHintsTests.vb +++ b/src/EditorFeatures/Test2/InlineHints/CSharpInlineTypeHintsTests.vb @@ -105,5 +105,108 @@ class A Await VerifyTypeHints(input) End Function + + + Public Async Function TestWithPatternVar() As Task + Dim input = + + + +class A +{ + void Main(string[] args) + { + if (args is { Length: var {|int:|}goo }) { } + } +} + + + + + Await VerifyTypeHints(input) + End Function + + + Public Async Function TestNotWithPatternType() As Task + Dim input = + + + +class A +{ + void Main(string[] args) + { + if (args is { Length: int goo }) { } + } +} + + + + + Await VerifyTypeHints(input) + End Function + + + Public Async Function TestWithSimpleLambda() As Task + Dim input = + + + +using System.Linq; +class A +{ + void Main(string[] args) + { + args.Where({|string:|}a => a.Length > 0); + } +} + + + + + Await VerifyTypeHints(input) + End Function + + + Public Async Function TestWithParenthesizedLambda() As Task + Dim input = + + + +using System.Linq; +class A +{ + void Main(string[] args) + { + args.Where(({|string:|}a) => a.Length > 0); + } +} + + + + + Await VerifyTypeHints(input) + End Function + + + Public Async Function TestNotWithParenthesizedLambdaWithType() As Task + Dim input = + + + +using System.Linq; +class A +{ + void Main(string[] args) + { + args.Where((string a) => a.Length > 0); + } +} + + + + + Await VerifyTypeHints(input) + End Function End Class End Namespace diff --git a/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs b/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs index 8f169d682654e..11f534bbdc3ba 100644 --- a/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs +++ b/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs @@ -58,17 +58,14 @@ protected override (ITypeSymbol type, int position)? TryGetTypeHint( if (forLambdaParameterTypes) { - if (node is SimpleLambdaExpressionSyntax simpleLambda) - { - var parameter = semanticModel.GetDeclaredSymbol(simpleLambda.Parameter, cancellationToken); - if (IsValidType(parameter?.Type)) - return (parameter.Type, simpleLambda.Parameter.Identifier.SpanStart); - } - else if (node is ParameterSyntax { Type: null } parameterNode) + if (node is ParameterSyntax { Type: null } parameterNode) { var parameter = semanticModel.GetDeclaredSymbol(parameterNode, cancellationToken); - if (IsValidType(parameter?.Type)) + if (parameter?.ContainingSymbol is IMethodSymbol { MethodKind: MethodKind.AnonymousFunction } && + IsValidType(parameter?.Type)) + { return (parameter.Type, parameterNode.Identifier.SpanStart); + } } } From b5c16495952ced7074fc5c84291b580a6ee5d1a2 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 12:04:50 -0700 Subject: [PATCH 228/295] Simplify --- .../InlineHintsDataTaggerProvider.cs | 10 ++--- .../InlineHints/AbstractInlineHintsTests.vb | 45 ++++++++----------- ...AbstractInlineParameterNameHintsService.cs | 15 ++++--- .../AbstractInlineTypeHintsService.cs | 10 ++--- .../IInlineParameterNameHintsService.cs | 2 +- .../InlineHints/IInlineTypeHintsService.cs | 2 +- .../Portable/InlineHints/InlineTypeHint.cs | 6 +-- 7 files changed, 42 insertions(+), 48 deletions(-) diff --git a/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs b/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs index bc66711a96013..47a4ef5454e30 100644 --- a/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs +++ b/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs @@ -96,7 +96,7 @@ private static async Task AddTypeHintsAsync(TaggerContext con return; var snapshotSpan = documentSnapshotSpan.SnapshotSpan; - var hints = await service.GetInlineTypeHintsAsync(document, snapshotSpan.Span.ToTextSpan(), cancellationToken).ConfigureAwait(false); + var hints = await service.GetInlineHintsAsync(document, snapshotSpan.Span.ToTextSpan(), cancellationToken).ConfigureAwait(false); foreach (var hint in hints) { context.AddTag(new TagSpan( @@ -113,17 +113,13 @@ private static async Task AddParameterNameHintsAsync(TaggerContext( new SnapshotSpan(snapshotSpan.Snapshot, hint.Position, 0), - new InlineHintDataTag( - ImmutableArray.Create(new SymbolDisplayPart(SymbolDisplayPartKind.Text, hint.Parameter, hint.Parameter.Name + ":")), - hint.Parameter.GetSymbolKey(cancellationToken)))); + new InlineHintDataTag(hint.Parts, hint.SymbolKey))); } } } diff --git a/src/EditorFeatures/Test2/InlineHints/AbstractInlineHintsTests.vb b/src/EditorFeatures/Test2/InlineHints/AbstractInlineHintsTests.vb index fc782199e2715..127f51138542a 100644 --- a/src/EditorFeatures/Test2/InlineHints/AbstractInlineHintsTests.vb +++ b/src/EditorFeatures/Test2/InlineHints/AbstractInlineHintsTests.vb @@ -22,24 +22,28 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Dim snapshot = hostDocument.GetTextBuffer().CurrentSnapshot Dim document = workspace.CurrentSolution.GetDocument(hostDocument.Id) Dim tagService = document.GetRequiredLanguageService(Of IInlineParameterNameHintsService) - Dim paramNameHintSpans = Await tagService.GetInlineParameterNameHintsAsync(document, New Text.TextSpan(0, snapshot.Length), New CancellationToken()) + Dim inlineHints = Await tagService.GetInlineHintsAsync(document, New Text.TextSpan(0, snapshot.Length), New CancellationToken()) - Dim producedTags = From tag In paramNameHintSpans - Select tag.Parameter.Name + ":" + tag.Position.ToString + Dim producedTags = From hint In inlineHints + Select hint.Parts.GetFullText() + hint.Position.ToString - Dim expectedTags As New List(Of String) + ValidateSpans(hostDocument, producedTags) + End Using + End Function - Dim nameAndSpansList = hostDocument.AnnotatedSpans.SelectMany( - Function(name) name.Value, - Function(name, span) New With {.Name = name.Key, span}) + Private Shared Sub ValidateSpans(hostDocument As TestHostDocument, producedTags As IEnumerable(Of String)) + Dim expectedTags As New List(Of String) - For Each nameAndSpan In nameAndSpansList.OrderBy(Function(x) x.span.Start) - expectedTags.Add(nameAndSpan.Name + ":" + nameAndSpan.span.Start.ToString()) - Next + Dim nameAndSpansList = hostDocument.AnnotatedSpans.SelectMany( + Function(name) name.Value, + Function(name, span) New With {.Name = name.Key, span}) - AssertEx.Equal(expectedTags, producedTags) - End Using - End Function + For Each nameAndSpan In nameAndSpansList.OrderBy(Function(x) x.span.Start) + expectedTags.Add(nameAndSpan.Name + ":" + nameAndSpan.span.Start.ToString()) + Next + + AssertEx.Equal(expectedTags, producedTags) + End Sub Protected Async Function VerifyTypeHints(test As XElement, Optional optionIsEnabled As Boolean = True) As Task Using workspace = TestWorkspace.Create(test) @@ -54,24 +58,13 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Dim snapshot = hostDocument.GetTextBuffer().CurrentSnapshot Dim document = workspace.CurrentSolution.GetDocument(hostDocument.Id) Dim tagService = document.GetRequiredLanguageService(Of IInlineTypeHintsService) - Dim typeHints = Await tagService.GetInlineTypeHintsAsync(document, New Text.TextSpan(0, snapshot.Length), New CancellationToken()) + Dim typeHints = Await tagService.GetInlineHintsAsync(document, New Text.TextSpan(0, snapshot.Length), New CancellationToken()) Dim producedTags = From hint In typeHints Select hint.Parts.GetFullText() + ":" + hint.Position.ToString() - Dim expectedTags As New List(Of String) - - Dim nameAndSpansList = hostDocument.AnnotatedSpans.SelectMany( - Function(name) name.Value, - Function(name, span) New With {.Name = name.Key, span}) - - For Each nameAndSpan In nameAndSpansList.OrderBy(Function(x) x.span.Start) - expectedTags.Add(nameAndSpan.Name + ":" + nameAndSpan.span.Start.ToString()) - Next - - AssertEx.Equal(expectedTags, producedTags) + ValidateSpans(hostDocument, producedTags) End Using End Function - End Class End Namespace diff --git a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs index 4e76b6257480d..98cebfb49dec7 100644 --- a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs @@ -21,7 +21,7 @@ protected abstract void AddAllParameterNameHintLocations( ArrayBuilder buffer, CancellationToken cancellationToken); - public async Task> GetInlineParameterNameHintsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken) + public async Task> GetInlineHintsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken) { var options = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); @@ -29,13 +29,13 @@ public async Task> GetInlineParameterNameHin var enabledForParameters = displayAllOverride || options.GetOption(InlineHintsOptions.EnabledForParameters); if (!enabledForParameters) - return ImmutableArray.Empty; + return ImmutableArray.Empty; var literalParameters = displayAllOverride || options.GetOption(InlineHintsOptions.ForLiteralParameters); var objectCreationParameters = displayAllOverride || options.GetOption(InlineHintsOptions.ForObjectCreationParameters); var otherParameters = displayAllOverride || options.GetOption(InlineHintsOptions.ForOtherParameters); if (!literalParameters && !objectCreationParameters && !otherParameters) - return ImmutableArray.Empty; + return ImmutableArray.Empty; var suppressForParametersThatDifferOnlyBySuffix = !displayAllOverride && options.GetOption(InlineHintsOptions.SuppressForParametersThatDifferOnlyBySuffix); var suppressForParametersThatMatchMethodIntent = !displayAllOverride && options.GetOption(InlineHintsOptions.SuppressForParametersThatMatchMethodIntent); @@ -43,7 +43,7 @@ public async Task> GetInlineParameterNameHin var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); - using var _1 = ArrayBuilder.GetInstance(out var result); + using var _1 = ArrayBuilder.GetInstance(out var result); using var _2 = ArrayBuilder.GetInstance(out var buffer); foreach (var node in root.DescendantNodes(textSpan, n => n.Span.IntersectsWith(textSpan))) @@ -74,7 +74,12 @@ void AddHintsIfAppropriate() continue; if (HintMatches(hint, literalParameters, objectCreationParameters, otherParameters)) - result.Add(hint); + { + result.Add(new InlineHint( + hint.Position, + ImmutableArray.Create(new SymbolDisplayPart(SymbolDisplayPartKind.Text, hint.Parameter, hint.Parameter.Name + ":")), + hint.Parameter.GetSymbolKey(cancellationToken))); + } } } } diff --git a/src/Features/Core/Portable/InlineHints/AbstractInlineTypeHintsService.cs b/src/Features/Core/Portable/InlineHints/AbstractInlineTypeHintsService.cs index 2e75b46c7e905..6d421a022b9e5 100644 --- a/src/Features/Core/Portable/InlineHints/AbstractInlineTypeHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/AbstractInlineTypeHintsService.cs @@ -26,7 +26,7 @@ protected abstract (ITypeSymbol type, int position)? TryGetTypeHint( bool forLambdaParameterTypes, CancellationToken cancellationToken); - public async Task> GetInlineTypeHintsAsync( + public async Task> GetInlineHintsAsync( Document document, TextSpan textSpan, CancellationToken cancellationToken) { var options = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); @@ -34,18 +34,18 @@ public async Task> GetInlineTypeHintsAsync( var displayAllOverride = options.GetOption(InlineHintsOptions.DisplayAllOverride); var enabledForTypes = displayAllOverride || options.GetOption(InlineHintsOptions.EnabledForTypes); if (!enabledForTypes) - return ImmutableArray.Empty; + return ImmutableArray.Empty; var forImplicitVariableTypes = displayAllOverride || options.GetOption(InlineHintsOptions.ForImplicitVariableTypes); var forLambdaParameterTypes = displayAllOverride || options.GetOption(InlineHintsOptions.ForLambdaParameterTypes); if (!forImplicitVariableTypes && !forLambdaParameterTypes) - return ImmutableArray.Empty; + return ImmutableArray.Empty; var anonymousTypeService = document.GetRequiredLanguageService(); var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); - using var _1 = ArrayBuilder.GetInstance(out var result); + using var _1 = ArrayBuilder.GetInstance(out var result); foreach (var node in root.DescendantNodes(n => n.Span.IntersectsWith(textSpan))) { @@ -62,7 +62,7 @@ public async Task> GetInlineTypeHintsAsync( var parts = type.ToDisplayParts(s_minimalTypeStyle); AddParts(anonymousTypeService, finalParts, parts, semanticModel, position); - result.Add(new InlineTypeHint(position, finalParts.ToImmutable(), type.GetSymbolKey(cancellationToken))); + result.Add(new InlineHint(position, finalParts.ToImmutable(), type.GetSymbolKey(cancellationToken))); } return result.ToImmutable(); diff --git a/src/Features/Core/Portable/InlineHints/IInlineParameterNameHintsService.cs b/src/Features/Core/Portable/InlineHints/IInlineParameterNameHintsService.cs index 58083b276ef4d..b94f7d6e7e5b3 100644 --- a/src/Features/Core/Portable/InlineHints/IInlineParameterNameHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/IInlineParameterNameHintsService.cs @@ -12,6 +12,6 @@ namespace Microsoft.CodeAnalysis.InlineHints { internal interface IInlineParameterNameHintsService : ILanguageService { - Task> GetInlineParameterNameHintsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken); + Task> GetInlineHintsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken); } } diff --git a/src/Features/Core/Portable/InlineHints/IInlineTypeHintsService.cs b/src/Features/Core/Portable/InlineHints/IInlineTypeHintsService.cs index cf43cc1956d60..3860b4dca4ba5 100644 --- a/src/Features/Core/Portable/InlineHints/IInlineTypeHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/IInlineTypeHintsService.cs @@ -12,6 +12,6 @@ namespace Microsoft.CodeAnalysis.InlineHints { internal interface IInlineTypeHintsService : ILanguageService { - Task> GetInlineTypeHintsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken); + Task> GetInlineHintsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken); } } diff --git a/src/Features/Core/Portable/InlineHints/InlineTypeHint.cs b/src/Features/Core/Portable/InlineHints/InlineTypeHint.cs index 7e37d9ca1640f..1278c945b5229 100644 --- a/src/Features/Core/Portable/InlineHints/InlineTypeHint.cs +++ b/src/Features/Core/Portable/InlineHints/InlineTypeHint.cs @@ -6,13 +6,13 @@ namespace Microsoft.CodeAnalysis.InlineHints { - internal readonly struct InlineTypeHint + internal readonly struct InlineHint { public readonly int Position; public readonly ImmutableArray Parts; - public readonly SymbolKey SymbolKey; + public readonly SymbolKey? SymbolKey; - public InlineTypeHint(int position, ImmutableArray parts, SymbolKey symbolKey) + public InlineHint(int position, ImmutableArray parts, SymbolKey? symbolKey) { Position = position; Parts = parts; From 8232d949a2ac8374e20dc09abc000a77cdaa935a Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 12:11:40 -0700 Subject: [PATCH 229/295] Cleanup --- .../CSharpInlineParameterNameHintsService.cs | 32 ++++----- ...AbstractInlineParameterNameHintsService.cs | 65 +++++++++++-------- .../InlineHints/InlineParameterHint.cs | 23 ------- .../InlineHints/InlineParameterHintKind.cs | 13 ---- ...ualBasicInlineParameterNameHintsService.vb | 15 ++--- 5 files changed, 60 insertions(+), 88 deletions(-) delete mode 100644 src/Features/Core/Portable/InlineHints/InlineParameterHint.cs delete mode 100644 src/Features/Core/Portable/InlineHints/InlineParameterHintKind.cs diff --git a/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs b/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs index 78d12b863157a..6221036b5fb08 100644 --- a/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs +++ b/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs @@ -29,7 +29,7 @@ public CSharpInlineParameterNameHintsService() protected override void AddAllParameterNameHintLocations( SemanticModel semanticModel, SyntaxNode node, - ArrayBuilder buffer, + ArrayBuilder<(int position, IParameterSymbol? parameter, HintKind kind)> buffer, CancellationToken cancellationToken) { if (node is BaseArgumentListSyntax argumentList) @@ -42,7 +42,11 @@ protected override void AddAllParameterNameHintLocations( } } - private static void AddArguments(SemanticModel semanticModel, ArrayBuilder buffer, AttributeArgumentListSyntax argumentList, CancellationToken cancellationToken) + private static void AddArguments( + SemanticModel semanticModel, + ArrayBuilder<(int position, IParameterSymbol? parameter, HintKind kind)> buffer, + AttributeArgumentListSyntax argumentList, + CancellationToken cancellationToken) { foreach (var argument in argumentList.Arguments) { @@ -50,14 +54,15 @@ private static void AddArguments(SemanticModel semanticModel, ArrayBuilder buffer, BaseArgumentListSyntax argumentList, CancellationToken cancellationToken) + private static void AddArguments( + SemanticModel semanticModel, + ArrayBuilder<(int position, IParameterSymbol? parameter, HintKind kind)> buffer, + BaseArgumentListSyntax argumentList, + CancellationToken cancellationToken) { foreach (var argument in argumentList.Arguments) { @@ -65,21 +70,18 @@ private static void AddArguments(SemanticModel semanticModel, ArrayBuilder arg switch { - LiteralExpressionSyntax or InterpolatedStringExpressionSyntax => InlineParameterHintKind.Literal, - ObjectCreationExpressionSyntax => InlineParameterHintKind.ObjectCreation, + LiteralExpressionSyntax or InterpolatedStringExpressionSyntax => HintKind.Literal, + ObjectCreationExpressionSyntax => HintKind.ObjectCreation, CastExpressionSyntax cast => GetKind(cast.Expression), PrefixUnaryExpressionSyntax prefix => GetKind(prefix.Operand), - _ => InlineParameterHintKind.Other, + _ => HintKind.Other, }; } } diff --git a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs index 98cebfb49dec7..95c6e6288a53a 100644 --- a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs @@ -15,10 +15,17 @@ namespace Microsoft.CodeAnalysis.InlineHints { internal abstract class AbstractInlineParameterNameHintsService : IInlineParameterNameHintsService { + protected enum HintKind + { + Literal, + ObjectCreation, + Other + } + protected abstract void AddAllParameterNameHintLocations( SemanticModel semanticModel, SyntaxNode node, - ArrayBuilder buffer, + ArrayBuilder<(int position, IParameterSymbol? parameter, HintKind kind)> buffer, CancellationToken cancellationToken); public async Task> GetInlineHintsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken) @@ -44,7 +51,7 @@ public async Task> GetInlineHintsAsync(Document docum var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); using var _1 = ArrayBuilder.GetInstance(out var result); - using var _2 = ArrayBuilder.GetInstance(out var buffer); + using var _2 = ArrayBuilder<(int position, IParameterSymbol? parameter, HintKind kind)>.GetInstance(out var buffer); foreach (var node in root.DescendantNodes(textSpan, n => n.Span.IntersectsWith(textSpan))) { @@ -65,26 +72,27 @@ void AddHintsIfAppropriate() if (suppressForParametersThatDifferOnlyBySuffix && ParametersDifferOnlyBySuffix(buffer)) return; - foreach (var hint in buffer) + foreach (var (position, parameter, kind) in buffer) { - if (string.IsNullOrEmpty(hint.Parameter?.Name)) + if (string.IsNullOrEmpty(parameter?.Name)) continue; - if (suppressForParametersThatMatchMethodIntent && MatchesMethodIntent(hint)) + if (suppressForParametersThatMatchMethodIntent && MatchesMethodIntent(parameter)) continue; - if (HintMatches(hint, literalParameters, objectCreationParameters, otherParameters)) + if (HintMatches(kind, literalParameters, objectCreationParameters, otherParameters)) { result.Add(new InlineHint( - hint.Position, - ImmutableArray.Create(new SymbolDisplayPart(SymbolDisplayPartKind.Text, hint.Parameter, hint.Parameter.Name + ":")), - hint.Parameter.GetSymbolKey(cancellationToken))); + position, + ImmutableArray.Create(new SymbolDisplayPart(SymbolDisplayPartKind.Text, parameter, parameter.Name + ":")), + parameter.GetSymbolKey(cancellationToken))); } } } } - private static bool ParametersDifferOnlyBySuffix(ArrayBuilder parameterHints) + private static bool ParametersDifferOnlyBySuffix( + ArrayBuilder<(int position, IParameterSymbol? parameter, HintKind kind)> parameterHints) { // Only relevant if we have two or more parameters. if (parameterHints.Count <= 1) @@ -93,14 +101,15 @@ private static bool ParametersDifferOnlyBySuffix(ArrayBuilder parameterHints) + static bool ParametersDifferOnlyByAlphaSuffix( + ArrayBuilder<(int position, IParameterSymbol? parameter, HintKind kind)> parameterHints) { - if (!HasAlphaSuffix(parameterHints[0], out var firstPrefix)) + if (!HasAlphaSuffix(parameterHints[0].parameter, out var firstPrefix)) return false; for (var i = 1; i < parameterHints.Count; i++) { - if (!HasAlphaSuffix(parameterHints[i], out var nextPrefix)) + if (!HasAlphaSuffix(parameterHints[i].parameter, out var nextPrefix)) return false; if (!firstPrefix.Span.Equals(nextPrefix.Span, StringComparison.Ordinal)) @@ -110,14 +119,15 @@ static bool ParametersDifferOnlyByAlphaSuffix(ArrayBuilder return true; } - static bool ParametersDifferOnlyByNumericSuffix(ArrayBuilder parameterHints) + static bool ParametersDifferOnlyByNumericSuffix( + ArrayBuilder<(int position, IParameterSymbol? parameter, HintKind kind)> parameterHints) { - if (!HasNumericSuffix(parameterHints[0], out var firstPrefix)) + if (!HasNumericSuffix(parameterHints[0].parameter, out var firstPrefix)) return false; for (var i = 1; i < parameterHints.Count; i++) { - if (!HasNumericSuffix(parameterHints[i], out var nextPrefix)) + if (!HasNumericSuffix(parameterHints[i].parameter, out var nextPrefix)) return false; if (!firstPrefix.Span.Equals(nextPrefix.Span, StringComparison.Ordinal)) @@ -127,9 +137,9 @@ static bool ParametersDifferOnlyByNumericSuffix(ArrayBuilder prefix) + static bool HasAlphaSuffix(IParameterSymbol? parameter, out ReadOnlyMemory prefix) { - var name = hint.Parameter?.Name; + var name = parameter?.Name; // Has to end with A-Z // That A-Z can't be following another A-Z (that's just a capitalized word). @@ -145,9 +155,9 @@ static bool HasAlphaSuffix(InlineParameterHint hint, out ReadOnlyMemory pr return false; } - static bool HasNumericSuffix(InlineParameterHint hint, out ReadOnlyMemory prefix) + static bool HasNumericSuffix(IParameterSymbol? parameter, out ReadOnlyMemory prefix) { - var name = hint.Parameter?.Name; + var name = parameter?.Name; // Has to end with 0-9. only handles single-digit numeric suffix for now for simplicity if (name?.Length >= 2 && @@ -168,22 +178,21 @@ static bool IsNumeric(char c) => c is >= '0' and <= '9'; } - private static bool HintMatches(InlineParameterHint hint, bool literalParameters, bool objectCreationParameters, bool otherParameters) - => hint.Kind switch + private static bool HintMatches(HintKind kind, bool literalParameters, bool objectCreationParameters, bool otherParameters) + => kind switch { - InlineParameterHintKind.Literal => literalParameters, - InlineParameterHintKind.ObjectCreation => objectCreationParameters, - InlineParameterHintKind.Other => otherParameters, - _ => throw ExceptionUtilities.UnexpectedValue(hint.Kind), + HintKind.Literal => literalParameters, + HintKind.ObjectCreation => objectCreationParameters, + HintKind.Other => otherParameters, + _ => throw ExceptionUtilities.UnexpectedValue(kind), }; - protected static bool MatchesMethodIntent(InlineParameterHint hint) + protected static bool MatchesMethodIntent(IParameterSymbol? parameter) { // Methods like `SetColor(color: "y")` `FromResult(result: "x")` `Enable/DisablePolling(bool)` don't need // parameter names to improve clarity. The parameter is clear from the context of the method name. // First, this only applies to methods (as we're looking at the method name itself) so filter down to those. - var parameter = hint.Parameter; if (parameter is not { ContainingSymbol: IMethodSymbol { MethodKind: MethodKind.Ordinary } method }) return false; diff --git a/src/Features/Core/Portable/InlineHints/InlineParameterHint.cs b/src/Features/Core/Portable/InlineHints/InlineParameterHint.cs deleted file mode 100644 index 92f9dec88bf06..0000000000000 --- a/src/Features/Core/Portable/InlineHints/InlineParameterHint.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.CodeAnalysis.InlineHints -{ - internal readonly struct InlineParameterHint - { - public readonly IParameterSymbol? Parameter; - public readonly int Position; - public readonly InlineParameterHintKind Kind; - - public InlineParameterHint( - IParameterSymbol? parameter, - int position, - InlineParameterHintKind kind) - { - Parameter = parameter; - Position = position; - Kind = kind; - } - } -} diff --git a/src/Features/Core/Portable/InlineHints/InlineParameterHintKind.cs b/src/Features/Core/Portable/InlineHints/InlineParameterHintKind.cs deleted file mode 100644 index 2c6f5bbadf674..0000000000000 --- a/src/Features/Core/Portable/InlineHints/InlineParameterHintKind.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.CodeAnalysis.InlineHints -{ - internal enum InlineParameterHintKind - { - Literal, - ObjectCreation, - Other - } -} diff --git a/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb b/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb index 598773234cb78..890cf1b0e9d03 100644 --- a/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb +++ b/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb @@ -22,7 +22,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.InlineParameterNameHints Protected Overrides Sub AddAllParameterNameHintLocations( semanticModel As SemanticModel, node As SyntaxNode, - buffer As ArrayBuilder(Of InlineParameterHint), + buffer As ArrayBuilder(Of (position As Integer, parameter As IParameterSymbol, kind As HintKind)), cancellationToken As CancellationToken) Dim argumentList = TryCast(node, ArgumentListSyntax) @@ -49,21 +49,18 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.InlineParameterNameHints Continue For End If - buffer.Add(New InlineParameterHint( - parameter, - argument.Span.Start, - GetKind(argument.Expression))) + buffer.Add((argument.Span.Start, parameter, GetKind(argument.Expression))) Next End Sub - Private Function GetKind(arg As ExpressionSyntax) As InlineParameterHintKind + Private Function GetKind(arg As ExpressionSyntax) As HintKind If TypeOf arg Is LiteralExpressionSyntax OrElse TypeOf arg Is InterpolatedStringExpressionSyntax Then - Return InlineParameterHintKind.Literal + Return HintKind.Literal End If If TypeOf arg Is ObjectCreationExpressionSyntax Then - Return InlineParameterHintKind.ObjectCreation + Return HintKind.ObjectCreation End If Dim predefinedCast = TryCast(arg, PredefinedCastExpressionSyntax) @@ -87,7 +84,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.InlineParameterNameHints Return GetKind(unary.Operand) End If - Return InlineParameterHintKind.Other + Return HintKind.Other End Function End Class End Namespace From d04a909a5626c36e73c37df3a89252ce3c7195cd Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Thu, 8 Oct 2020 08:25:48 -0700 Subject: [PATCH 230/295] Clear variables set by CI builds --- .../TestUtilities/VisualStudioInstanceFactory.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs b/src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs index 0dea824e6bc37..6ab73d28d6ae7 100644 --- a/src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs +++ b/src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs @@ -354,7 +354,15 @@ private static Process StartNewVisualStudioProcess(string installationPath, int IntegrationHelper.KillProcess("VsJITDebugger"); IntegrationHelper.KillProcess("dexplore"); - var process = Process.Start(vsExeFile, VsLaunchArgs); + var processStartInfo = new ProcessStartInfo(vsExeFile, VsLaunchArgs) { UseShellExecute = false }; + + // Clear variables set by CI builds which are known to affect IDE behavior. Integration tests should show + // correct behavior for default IDE installations, without Roslyn-, Arcade-, or Azure Pipelines-specific + // influences. + processStartInfo.Environment.Remove("DOTNET_MULTILEVEL_LOOKUP"); + processStartInfo.Environment.Remove("DOTNET_INSTALL_DIR"); + + var process = Process.Start(processStartInfo); Debug.WriteLine($"Launched a new instance of Visual Studio. (ID: {process.Id})"); return process; From a6bb158994fcffb87dff4a0ab374e78ee7980a0c Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Thu, 8 Oct 2020 19:22:46 +0000 Subject: [PATCH 231/295] Fix graph query for records --- Roslyn.sln | 4 ++++ .../Impl/Progression/CSharpProgressionLanguageService.cs | 1 + .../Core/Test/Progression/ContainsGraphQueryTests.vb | 6 ++++++ 3 files changed, 11 insertions(+) diff --git a/Roslyn.sln b/Roslyn.sln index 7150215f42caf..abe1a82b59ef5 100644 --- a/Roslyn.sln +++ b/Roslyn.sln @@ -1880,8 +1880,12 @@ Global {2801F82B-78CE-4BAE-B06F-537574751E2E}.Release|x86.Build.0 = Release|x86 {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|x86.ActiveCfg = Debug|Any CPU + {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|x86.Build.0 = Debug|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|Any CPU.ActiveCfg = Release|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|Any CPU.Build.0 = Release|Any CPU + {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|x86.ActiveCfg = Release|Any CPU + {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/VisualStudio/CSharp/Impl/Progression/CSharpProgressionLanguageService.cs b/src/VisualStudio/CSharp/Impl/Progression/CSharpProgressionLanguageService.cs index d5118e2c6156f..563dbc5fc85dd 100644 --- a/src/VisualStudio/CSharp/Impl/Progression/CSharpProgressionLanguageService.cs +++ b/src/VisualStudio/CSharp/Impl/Progression/CSharpProgressionLanguageService.cs @@ -67,6 +67,7 @@ public IEnumerable GetTopLevelNodesFromDocument(SyntaxNode root, Can if (!cancellationToken.IsCancellationRequested) { if (node.Kind() == SyntaxKind.ClassDeclaration || + node.Kind() == SyntaxKind.RecordDeclaration || node.Kind() == SyntaxKind.DelegateDeclaration || node.Kind() == SyntaxKind.EnumDeclaration || node.Kind() == SyntaxKind.InterfaceDeclaration || diff --git a/src/VisualStudio/Core/Test/Progression/ContainsGraphQueryTests.vb b/src/VisualStudio/Core/Test/Progression/ContainsGraphQueryTests.vb index 39a8085cb86cc..6c84ddc7fe5c8 100644 --- a/src/VisualStudio/Core/Test/Progression/ContainsGraphQueryTests.vb +++ b/src/VisualStudio/Core/Test/Progression/ContainsGraphQueryTests.vb @@ -21,6 +21,8 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Progression enum E { } interface I { } struct S { } + record R1 { } + record R2; ) @@ -36,12 +38,16 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Progression + + + + From 438df05110cb391fa3cd9962faf7635778931c87 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 12:24:49 -0700 Subject: [PATCH 232/295] Only interactive docs --- .../Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs index 4ec5861a7bd1a..0882219c2fd0f 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs @@ -21,10 +21,9 @@ namespace Microsoft.CodeAnalysis.Editor.InlineHints /// Key processor that allows us to toggle inline hints when a user hits ctrl-alt. /// [Export(typeof(IKeyProcessorProvider))] - [TextViewRole(PredefinedTextViewRoles.Document)] + [TextViewRole(PredefinedTextViewRoles.Interactive)] [ContentType(ContentTypeNames.RoslynContentType)] [Name(nameof(InlineHintsKeyProcessorProvider))] - [Order(Before = "default")] internal class InlineHintsKeyProcessorProvider : IKeyProcessorProvider { private static readonly ConditionalWeakTable s_viewToProcessor = new(); From cc7823f8a89c8dcfabaadf52b9e006f5eb7c262c Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 12:25:16 -0700 Subject: [PATCH 233/295] Remove cache --- .../Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs index 0882219c2fd0f..ea890c8de8a8b 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs @@ -26,8 +26,6 @@ namespace Microsoft.CodeAnalysis.Editor.InlineHints [Name(nameof(InlineHintsKeyProcessorProvider))] internal class InlineHintsKeyProcessorProvider : IKeyProcessorProvider { - private static readonly ConditionalWeakTable s_viewToProcessor = new(); - private readonly IGlobalOptionService _globalOptionService; [ImportingConstructor] @@ -38,9 +36,7 @@ public InlineHintsKeyProcessorProvider(IGlobalOptionService globalOptionService) } public KeyProcessor GetAssociatedProcessor(IWpfTextView wpfTextView) - { - return s_viewToProcessor.GetValue(wpfTextView, v => new InlineHintsKeyProcessor(_globalOptionService, v)); - } + => new InlineHintsKeyProcessor(_globalOptionService, wpfTextView); private class InlineHintsKeyProcessor : KeyProcessor { From f2e7d6482ae42b4c20c189087f841d80e681d8fb Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 12:29:31 -0700 Subject: [PATCH 234/295] No need to get the document with the changes applied to it. --- .../Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs index ea890c8de8a8b..d50f231a64bad 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs @@ -58,7 +58,7 @@ private static bool IsCtrlOrAlt(KeyEventArgs args) { var document = _view.BufferGraph.GetTextBuffers(b => true) - .Select(b => b.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges()) + .Select(b => b.AsTextContainer().GetOpenDocumentInCurrentContext()) .WhereNotNull() .FirstOrDefault(); From 3d060c1deb741a17f7d127c11af969479a9eb7be Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 12:30:36 -0700 Subject: [PATCH 235/295] Revert --- Roslyn.sln | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Roslyn.sln b/Roslyn.sln index abe1a82b59ef5..7150215f42caf 100644 --- a/Roslyn.sln +++ b/Roslyn.sln @@ -1880,12 +1880,8 @@ Global {2801F82B-78CE-4BAE-B06F-537574751E2E}.Release|x86.Build.0 = Release|x86 {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|x86.ActiveCfg = Debug|Any CPU - {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|x86.Build.0 = Debug|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|Any CPU.ActiveCfg = Release|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|Any CPU.Build.0 = Release|Any CPU - {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|x86.ActiveCfg = Release|Any CPU - {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 436a7bc0c481e9aa74e057af463141d967ead6d5 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 12:32:15 -0700 Subject: [PATCH 236/295] inline --- .../InlineHintsKeyProcessorProvider.cs | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs index d50f231a64bad..20bb174f22da4 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs @@ -54,17 +54,6 @@ public InlineHintsKeyProcessor(IGlobalOptionService globalOptionService, IWpfTex private static bool IsCtrlOrAlt(KeyEventArgs args) => args.Key is Key.LeftCtrl or Key.RightCtrl or Key.LeftAlt or Key.RightAlt; - private Document? GetDocument() - { - var document = - _view.BufferGraph.GetTextBuffers(b => true) - .Select(b => b.AsTextContainer().GetOpenDocumentInCurrentContext()) - .WhereNotNull() - .FirstOrDefault(); - - return document; - } - private void OnViewClosed(object sender, EventArgs e) { // Disconnect our callbacks. @@ -116,9 +105,15 @@ private void ToggleOff() private void Toggle(bool on) { + var document = + _view.BufferGraph.GetTextBuffers(b => true) + .Select(b => b.AsTextContainer().GetOpenDocumentInCurrentContext()) + .WhereNotNull() + .FirstOrDefault(); + // Only relevant if this is a roslyn document. - var document = GetDocument(); - if (document == null) + var project = document?.Project; + if (project == null) return; // No need to do anything if we're already in the requested state @@ -128,7 +123,7 @@ private void Toggle(bool on) // We can only enter the on-state if the user has the ctrl-alt feature enabled. We can always enter the // off state though. - on = on && _globalOptionService.GetOption(InlineHintsOptions.DisplayAllHintsWhilePressingCtrlAlt, document.Project.Language); + on = on && _globalOptionService.GetOption(InlineHintsOptions.DisplayAllHintsWhilePressingCtrlAlt, project.Language); _globalOptionService.RefreshOption(new OptionKey(InlineHintsOptions.DisplayAllOverride), on); } } From f6aae475a4dfb320cccce7b808bcbe2a99756ede Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 12:33:50 -0700 Subject: [PATCH 237/295] Fix loc string --- .../CSharp/Impl/Options/AdvancedOptionPageControl.xaml | 2 +- .../CSharp/Impl/Options/AdvancedOptionPageStrings.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml index 4f25d0f1f5619..da8f390f80b35 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml @@ -111,7 +111,7 @@ Header="{x:Static local:AdvancedOptionPageStrings.Option_Inline_Hints_experimental}"> + Content="{x:Static local:AdvancedOptionPageStrings.Option_Display_all_hints_while_pressing_Ctrl_Alt}" /> ServicesVSResources.Inline_Hints_experimental; - public static string Option_Display_all_hints_while_pressing_ctrl_alt - => ServicesVSResources.Display_all_hints_while_pressing_ctrl_alt; + public static string Option_Display_all_hints_while_pressing_Ctrl_Alt + => ServicesVSResources.Display_all_hints_while_pressing_Ctrl_Alt; public static string Option_Display_inline_parameter_name_hints => ServicesVSResources.Display_inline_parameter_name_hints; From 150c78c8931d97cb5b6f8688c5441d7236134462 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 12:35:04 -0700 Subject: [PATCH 238/295] blank line --- .../InlineHints/InlineParameterNameHintsTaggerProvider.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTaggerProvider.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTaggerProvider.cs index ce7da400203c3..3d1c90e354f7c 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTaggerProvider.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineParameterNameHintsTaggerProvider.cs @@ -18,7 +18,6 @@ namespace Microsoft.CodeAnalysis.Editor.InlineHints { - /// /// The provider that is used as a middleman to create the tagger so that the data tag /// can be used to create the UI tag From 9bd8947d0625e9d6bb9673cc1b82afb50b7aa3b3 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 12:37:06 -0700 Subject: [PATCH 239/295] Only toggle off when lifting up from ctrl-alt --- .../Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs index 20bb174f22da4..d6ac4b31c7bd3 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs @@ -93,8 +93,9 @@ public override void KeyUp(KeyEventArgs args) { base.KeyUp(args); - // If we've lifted a key up, then turn off the inline hints. - ToggleOff(); + // If we've lifted a key up from ctrl/alt, then turn off the inline hints. + if (IsCtrlOrAlt(args)) + ToggleOff(); } private void ToggleOn() From e4d0baa240551414f5a4c3beb3749e1035bac9b0 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 12:38:05 -0700 Subject: [PATCH 240/295] Simplify --- .../Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs index d6ac4b31c7bd3..7a460bff67c65 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs @@ -108,8 +108,7 @@ private void Toggle(bool on) { var document = _view.BufferGraph.GetTextBuffers(b => true) - .Select(b => b.AsTextContainer().GetOpenDocumentInCurrentContext()) - .WhereNotNull() + .SelectMany(b => b.AsTextContainer().GetRelatedDocuments()) .FirstOrDefault(); // Only relevant if this is a roslyn document. From c394144ffc6a043242113ce76a83f53757e40fa7 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 12:39:52 -0700 Subject: [PATCH 241/295] Revert --- .../Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs index 7a460bff67c65..d6ac4b31c7bd3 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs @@ -108,7 +108,8 @@ private void Toggle(bool on) { var document = _view.BufferGraph.GetTextBuffers(b => true) - .SelectMany(b => b.AsTextContainer().GetRelatedDocuments()) + .Select(b => b.AsTextContainer().GetOpenDocumentInCurrentContext()) + .WhereNotNull() .FirstOrDefault(); // Only relevant if this is a roslyn document. From 1ab17b79de5e08eaaec9c0b85ef8f2766c5f1b20 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 12:40:40 -0700 Subject: [PATCH 242/295] Remove using --- .../Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs index d6ac4b31c7bd3..9b8d6cb0480b4 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs @@ -5,7 +5,6 @@ using System; using System.ComponentModel.Composition; using System.Linq; -using System.Runtime.CompilerServices; using System.Windows.Input; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.InlineHints; From bbf1c0d9cadb4a2bf60575426fd3f06d3a40e1ad Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Thu, 8 Oct 2020 13:50:43 -0700 Subject: [PATCH 243/295] Get the current VS ThemeID without using dynamic --- .../ColorSchemes/ColorSchemeApplier.cs | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/VisualStudio/Core/Def/Implementation/ColorSchemes/ColorSchemeApplier.cs b/src/VisualStudio/Core/Def/Implementation/ColorSchemes/ColorSchemeApplier.cs index 8c2d5dd552f7c..60e44130ce7cd 100644 --- a/src/VisualStudio/Core/Def/Implementation/ColorSchemes/ColorSchemeApplier.cs +++ b/src/VisualStudio/Core/Def/Implementation/ColorSchemes/ColorSchemeApplier.cs @@ -8,6 +8,7 @@ using System.Collections.Immutable; using System.ComponentModel; using System.ComponentModel.Composition; +using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Runtime.InteropServices; @@ -29,6 +30,9 @@ namespace Microsoft.VisualStudio.LanguageServices.ColorSchemes [Export(typeof(ColorSchemeApplier))] internal sealed partial class ColorSchemeApplier : ForegroundThreadAffinitizedObject, IDisposable { + private const string ColorThemeValueName = "Microsoft.VisualStudio.ColorTheme"; + private const string ColorThemeNewValueName = "Microsoft.VisualStudio.ColorThemeNew"; + private readonly IServiceProvider _serviceProvider; private readonly ColorSchemeSettings _settings; private readonly ClassificationVerifier _classificationVerifier; @@ -168,14 +172,21 @@ public Guid GetThemeId() { AssertIsForeground(); - dynamic colorThemeService = _serviceProvider.GetService(typeof(SVsColorThemeService)); - return (Guid)colorThemeService.CurrentTheme.ThemeId; - } + var settingsManager = (ISettingsManager)_serviceProvider.GetService(typeof(SVsSettingsPersistenceManager)); - // NOTE: This service is not public or intended for use by teams/individuals outside of Microsoft. Any data stored is subject to deletion without warning. - [Guid("0d915b59-2ed7-472a-9de8-9161737ea1c5")] - private interface SVsColorThemeService - { + // Look up the value from the new roamed theme property first + // Fallback to the original roamed theme property if that fails + var currentThemeString = settingsManager.GetValueOrDefault(ColorThemeNewValueName, defaultValue: null) ?? + settingsManager.GetValueOrDefault(ColorThemeValueName, defaultValue: null); + + if (currentThemeString is null) + { + // The ColorTheme setting is unpopulated when it has never been changed from its default. + // The default VS ColorTheme is Blue + return KnownColorThemes.Blue; + } + + return Guid.Parse(currentThemeString); } // NOTE: This service is not public or intended for use by teams/individuals outside of Microsoft. Any data stored is subject to deletion without warning. From 4917bee11abd149b7422b7c919edc2a03d3df6d7 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 13:59:17 -0700 Subject: [PATCH 244/295] Share option across VB/C# --- .../InlineHints/InlineHintsKeyProcessorProvider.cs | 13 +------------ .../Core/Portable/InlineHints/InlineHintsOptions.cs | 5 +++-- .../Impl/Options/AdvancedOptionPageControl.xaml.cs | 2 +- .../Impl/Options/AdvancedOptionPageControl.xaml.vb | 2 +- 4 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs index 9b8d6cb0480b4..451fd96f3fa40 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsKeyProcessorProvider.cs @@ -105,17 +105,6 @@ private void ToggleOff() private void Toggle(bool on) { - var document = - _view.BufferGraph.GetTextBuffers(b => true) - .Select(b => b.AsTextContainer().GetOpenDocumentInCurrentContext()) - .WhereNotNull() - .FirstOrDefault(); - - // Only relevant if this is a roslyn document. - var project = document?.Project; - if (project == null) - return; - // No need to do anything if we're already in the requested state var state = _globalOptionService.GetOption(InlineHintsOptions.DisplayAllOverride); if (state == on) @@ -123,7 +112,7 @@ private void Toggle(bool on) // We can only enter the on-state if the user has the ctrl-alt feature enabled. We can always enter the // off state though. - on = on && _globalOptionService.GetOption(InlineHintsOptions.DisplayAllHintsWhilePressingCtrlAlt, project.Language); + on = on && _globalOptionService.GetOption(InlineHintsOptions.DisplayAllHintsWhilePressingCtrlAlt); _globalOptionService.RefreshOption(new OptionKey(InlineHintsOptions.DisplayAllOverride), on); } } diff --git a/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs b/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs index e7ad0d6967332..e3bdc34dab5ea 100644 --- a/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs +++ b/src/Features/Core/Portable/InlineHints/InlineHintsOptions.cs @@ -15,11 +15,11 @@ namespace Microsoft.CodeAnalysis.InlineHints { internal static class InlineHintsOptions { - public static readonly PerLanguageOption2 DisplayAllHintsWhilePressingCtrlAlt = + public static readonly Option2 DisplayAllHintsWhilePressingCtrlAlt = new(nameof(InlineHintsOptions), nameof(DisplayAllHintsWhilePressingCtrlAlt), defaultValue: true, - storageLocations: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.DisplayAllHintsWhilePressingCtrlAlt")); + storageLocations: new RoamingProfileStorageLocation("TextEditor.Specific.DisplayAllHintsWhilePressingCtrlAlt")); /// /// Non-persisted option used to switch to displaying everything while the user is holding ctrl-alt. @@ -64,6 +64,7 @@ public InlineHintsOptionsProvider() } public ImmutableArray Options { get; } = ImmutableArray.Create( + InlineHintsOptions.DisplayAllHintsWhilePressingCtrlAlt, InlineHintsOptions.EnabledForParameters, InlineHintsOptions.ForLiteralParameters, InlineHintsOptions.ForObjectCreationParameters, diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs index 053ae3cfe52aa..9bfe959d8f556 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs @@ -65,7 +65,7 @@ public AdvancedOptionPageControl(OptionStore optionStore, IComponentModel compon BindToOption(InsertSlashSlashAtTheStartOfNewLinesWhenWritingSingleLineComments, SplitStringLiteralOptions.Enabled, LanguageNames.CSharp); BindToOption(InsertAsteriskAtTheStartOfNewLinesWhenWritingBlockComments, FeatureOnOffOptions.AutoInsertBlockCommentStartString, LanguageNames.CSharp); - BindToOption(DisplayAllHintsWhilePressingCtrlAlt, InlineHintsOptions.DisplayAllHintsWhilePressingCtrlAlt, LanguageNames.CSharp); + BindToOption(DisplayAllHintsWhilePressingCtrlAlt, InlineHintsOptions.DisplayAllHintsWhilePressingCtrlAlt); BindToOption(DisplayInlineParameterNameHints, InlineHintsOptions.EnabledForParameters, LanguageNames.CSharp); BindToOption(ShowHintsForLiterals, InlineHintsOptions.ForLiteralParameters, LanguageNames.CSharp); BindToOption(ShowHintsForNewExpressions, InlineHintsOptions.ForObjectCreationParameters, LanguageNames.CSharp); diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb index f21c82874105c..95210df8676fb 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb @@ -59,7 +59,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options BindToOption(GenerateXmlDocCommentsForTripleApostrophes, FeatureOnOffOptions.AutoXmlDocCommentGeneration, LanguageNames.VisualBasic) BindToOption(InsertApostropheAtTheStartOfNewLinesWhenWritingApostropheComments, SplitCommentOptions.Enabled, LanguageNames.VisualBasic) - BindToOption(DisplayAllHintsWhilePressingCtrlAlt, InlineHintsOptions.DisplayAllHintsWhilePressingCtrlAlt, LanguageNames.VisualBasic) + BindToOption(DisplayAllHintsWhilePressingCtrlAlt, InlineHintsOptions.DisplayAllHintsWhilePressingCtrlAlt) BindToOption(DisplayInlineParameterNameHints, InlineHintsOptions.EnabledForParameters, LanguageNames.VisualBasic) BindToOption(ShowHintsForLiterals, InlineHintsOptions.ForLiteralParameters, LanguageNames.VisualBasic) BindToOption(ShowHintsForNewExpressions, InlineHintsOptions.ForObjectCreationParameters, LanguageNames.VisualBasic) From 07a0268e550012306fc8c4a2c1228c20cddaf74a Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 14:09:30 -0700 Subject: [PATCH 245/295] Fixup colors --- src/VisualStudio/CSharp/Impl/VSPackage.resx | 2 +- src/VisualStudio/CSharp/Impl/xlf/VSPackage.cs.xlf | 4 ++-- src/VisualStudio/CSharp/Impl/xlf/VSPackage.de.xlf | 4 ++-- src/VisualStudio/CSharp/Impl/xlf/VSPackage.es.xlf | 4 ++-- src/VisualStudio/CSharp/Impl/xlf/VSPackage.fr.xlf | 4 ++-- src/VisualStudio/CSharp/Impl/xlf/VSPackage.it.xlf | 4 ++-- src/VisualStudio/CSharp/Impl/xlf/VSPackage.ja.xlf | 4 ++-- src/VisualStudio/CSharp/Impl/xlf/VSPackage.ko.xlf | 4 ++-- src/VisualStudio/CSharp/Impl/xlf/VSPackage.pl.xlf | 4 ++-- src/VisualStudio/CSharp/Impl/xlf/VSPackage.pt-BR.xlf | 4 ++-- src/VisualStudio/CSharp/Impl/xlf/VSPackage.ru.xlf | 4 ++-- src/VisualStudio/CSharp/Impl/xlf/VSPackage.tr.xlf | 4 ++-- src/VisualStudio/CSharp/Impl/xlf/VSPackage.zh-Hans.xlf | 4 ++-- src/VisualStudio/CSharp/Impl/xlf/VSPackage.zh-Hant.xlf | 4 ++-- .../Core/Def/ColorSchemes/VisualStudio2017.xml | 10 +++++----- src/VisualStudio/VisualBasic/Impl/VSPackage.resx | 2 +- src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.cs.xlf | 4 ++-- src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.de.xlf | 4 ++-- src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.es.xlf | 4 ++-- src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.fr.xlf | 4 ++-- src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.it.xlf | 4 ++-- src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.ja.xlf | 4 ++-- src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.ko.xlf | 4 ++-- src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.pl.xlf | 4 ++-- .../VisualBasic/Impl/xlf/VSPackage.pt-BR.xlf | 4 ++-- src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.ru.xlf | 4 ++-- src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.tr.xlf | 4 ++-- .../VisualBasic/Impl/xlf/VSPackage.zh-Hans.xlf | 4 ++-- .../VisualBasic/Impl/xlf/VSPackage.zh-Hant.xlf | 4 ++-- 29 files changed, 59 insertions(+), 59 deletions(-) diff --git a/src/VisualStudio/CSharp/Impl/VSPackage.resx b/src/VisualStudio/CSharp/Impl/VSPackage.resx index 767f94073b7db..0bb32ed9bbe78 100644 --- a/src/VisualStudio/CSharp/Impl/VSPackage.resx +++ b/src/VisualStudio/CSharp/Impl/VSPackage.resx @@ -142,7 +142,7 @@ "C#" node help text in profile Import/Export. - Display inline parameter name hints; + Display inline hints; Show diagnostics for closed files; Colorize regular expression; Highlight related components under cursor; diff --git a/src/VisualStudio/CSharp/Impl/xlf/VSPackage.cs.xlf b/src/VisualStudio/CSharp/Impl/xlf/VSPackage.cs.xlf index 74ce3633e9e8c..83163b35b7f88 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/VSPackage.cs.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/VSPackage.cs.xlf @@ -33,7 +33,7 @@ "C#" node help text in profile Import/Export. - Display inline parameter name hints; + Display inline hints; Show diagnostics for closed files; Colorize regular expression; Highlight related components under cursor; @@ -81,7 +81,7 @@ regex; regular expression; Use enhanced colors; Editor Color Scheme; - Zobrazovat nápovědy k názvům vložených parametrů; + Zobrazovat nápovědy k názvům vložených parametrů; Zobrazit diagnostiku pro zavřené soubory; Vybarvit regulární výraz; Zvýrazňovat související komponenty pod kurzorem; diff --git a/src/VisualStudio/CSharp/Impl/xlf/VSPackage.de.xlf b/src/VisualStudio/CSharp/Impl/xlf/VSPackage.de.xlf index 7f9178b71e27c..9d0849c20149b 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/VSPackage.de.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/VSPackage.de.xlf @@ -33,7 +33,7 @@ "C#" node help text in profile Import/Export. - Display inline parameter name hints; + Display inline hints; Show diagnostics for closed files; Colorize regular expression; Highlight related components under cursor; @@ -81,7 +81,7 @@ regex; regular expression; Use enhanced colors; Editor Color Scheme; - Display inline parameter name hints; + Display inline hints; Show diagnostics for closed files; Colorize regular expression; Highlight related components under cursor; diff --git a/src/VisualStudio/CSharp/Impl/xlf/VSPackage.es.xlf b/src/VisualStudio/CSharp/Impl/xlf/VSPackage.es.xlf index 8371ae8aef1ef..e6ea6e5edbd9a 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/VSPackage.es.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/VSPackage.es.xlf @@ -33,7 +33,7 @@ "C#" node help text in profile Import/Export. - Display inline parameter name hints; + Display inline hints; Show diagnostics for closed files; Colorize regular expression; Highlight related components under cursor; @@ -81,7 +81,7 @@ regex; regular expression; Use enhanced colors; Editor Color Scheme; - Display inline parameter name hints; + Display inline hints; Show diagnostics for closed files; Colorize regular expression; Highlight related components under cursor; diff --git a/src/VisualStudio/CSharp/Impl/xlf/VSPackage.fr.xlf b/src/VisualStudio/CSharp/Impl/xlf/VSPackage.fr.xlf index c9c101eb44b46..8c5d2a7686a42 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/VSPackage.fr.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/VSPackage.fr.xlf @@ -33,7 +33,7 @@ "C#" node help text in profile Import/Export. - Display inline parameter name hints; + Display inline hints; Show diagnostics for closed files; Colorize regular expression; Highlight related components under cursor; @@ -81,7 +81,7 @@ regex; regular expression; Use enhanced colors; Editor Color Scheme; - Display inline parameter name hints; + Display inline hints; Show diagnostics for closed files; Colorize regular expression; Highlight related components under cursor; diff --git a/src/VisualStudio/CSharp/Impl/xlf/VSPackage.it.xlf b/src/VisualStudio/CSharp/Impl/xlf/VSPackage.it.xlf index bf77c0bf61970..37870cd22824e 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/VSPackage.it.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/VSPackage.it.xlf @@ -33,7 +33,7 @@ "C#" node help text in profile Import/Export. - Display inline parameter name hints; + Display inline hints; Show diagnostics for closed files; Colorize regular expression; Highlight related components under cursor; @@ -81,7 +81,7 @@ regex; regular expression; Use enhanced colors; Editor Color Scheme; - Display inline parameter name hints; + Display inline hints; Show diagnostics for closed files; Colorize regular expression; Highlight related components under cursor; diff --git a/src/VisualStudio/CSharp/Impl/xlf/VSPackage.ja.xlf b/src/VisualStudio/CSharp/Impl/xlf/VSPackage.ja.xlf index 6c8ecb99018ee..7d6a85e7ada9f 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/VSPackage.ja.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/VSPackage.ja.xlf @@ -33,7 +33,7 @@ "C#" node help text in profile Import/Export. - Display inline parameter name hints; + Display inline hints; Show diagnostics for closed files; Colorize regular expression; Highlight related components under cursor; @@ -81,7 +81,7 @@ regex; regular expression; Use enhanced colors; Editor Color Scheme; - Display inline parameter name hints; + Display inline hints; Show diagnostics for closed files; Colorize regular expression; Highlight related components under cursor; diff --git a/src/VisualStudio/CSharp/Impl/xlf/VSPackage.ko.xlf b/src/VisualStudio/CSharp/Impl/xlf/VSPackage.ko.xlf index b4bf57da9b48f..6cc8a8443bfa1 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/VSPackage.ko.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/VSPackage.ko.xlf @@ -33,7 +33,7 @@ "C#" node help text in profile Import/Export. - Display inline parameter name hints; + Display inline hints; Show diagnostics for closed files; Colorize regular expression; Highlight related components under cursor; @@ -81,7 +81,7 @@ regex; regular expression; Use enhanced colors; Editor Color Scheme; - Display inline parameter name hints; + Display inline hints; Show diagnostics for closed files; Colorize regular expression; Highlight related components under cursor; diff --git a/src/VisualStudio/CSharp/Impl/xlf/VSPackage.pl.xlf b/src/VisualStudio/CSharp/Impl/xlf/VSPackage.pl.xlf index 1af6e24183bda..4ec9e1473f742 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/VSPackage.pl.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/VSPackage.pl.xlf @@ -33,7 +33,7 @@ "C#" node help text in profile Import/Export. - Display inline parameter name hints; + Display inline hints; Show diagnostics for closed files; Colorize regular expression; Highlight related components under cursor; @@ -81,7 +81,7 @@ regex; regular expression; Use enhanced colors; Editor Color Scheme; - Display inline parameter name hints; + Display inline hints; Show diagnostics for closed files; Colorize regular expression; Highlight related components under cursor; diff --git a/src/VisualStudio/CSharp/Impl/xlf/VSPackage.pt-BR.xlf b/src/VisualStudio/CSharp/Impl/xlf/VSPackage.pt-BR.xlf index 02dadfacae528..ef6768e3c6900 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/VSPackage.pt-BR.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/VSPackage.pt-BR.xlf @@ -33,7 +33,7 @@ "C#" node help text in profile Import/Export. - Display inline parameter name hints; + Display inline hints; Show diagnostics for closed files; Colorize regular expression; Highlight related components under cursor; @@ -81,7 +81,7 @@ regex; regular expression; Use enhanced colors; Editor Color Scheme; - Display inline parameter name hints; + Display inline hints; Show diagnostics for closed files; Colorize regular expression; Highlight related components under cursor; diff --git a/src/VisualStudio/CSharp/Impl/xlf/VSPackage.ru.xlf b/src/VisualStudio/CSharp/Impl/xlf/VSPackage.ru.xlf index ce94ad6bf4864..c4e1d0e8930b3 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/VSPackage.ru.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/VSPackage.ru.xlf @@ -33,7 +33,7 @@ "C#" node help text in profile Import/Export. - Display inline parameter name hints; + Display inline hints; Show diagnostics for closed files; Colorize regular expression; Highlight related components under cursor; @@ -81,7 +81,7 @@ regex; regular expression; Use enhanced colors; Editor Color Scheme; - Display inline parameter name hints; + Display inline hints; Show diagnostics for closed files; Colorize regular expression; Highlight related components under cursor; diff --git a/src/VisualStudio/CSharp/Impl/xlf/VSPackage.tr.xlf b/src/VisualStudio/CSharp/Impl/xlf/VSPackage.tr.xlf index 99dd88e2d332b..98f51608bf14b 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/VSPackage.tr.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/VSPackage.tr.xlf @@ -33,7 +33,7 @@ "C#" node help text in profile Import/Export. - Display inline parameter name hints; + Display inline hints; Show diagnostics for closed files; Colorize regular expression; Highlight related components under cursor; @@ -81,7 +81,7 @@ regex; regular expression; Use enhanced colors; Editor Color Scheme; - Display inline parameter name hints; + Display inline hints; Show diagnostics for closed files; Colorize regular expression; Highlight related components under cursor; diff --git a/src/VisualStudio/CSharp/Impl/xlf/VSPackage.zh-Hans.xlf b/src/VisualStudio/CSharp/Impl/xlf/VSPackage.zh-Hans.xlf index 1ff009d5a91f1..cdef2b2edd32c 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/VSPackage.zh-Hans.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/VSPackage.zh-Hans.xlf @@ -33,7 +33,7 @@ "C#" node help text in profile Import/Export. - Display inline parameter name hints; + Display inline hints; Show diagnostics for closed files; Colorize regular expression; Highlight related components under cursor; @@ -81,7 +81,7 @@ regex; regular expression; Use enhanced colors; Editor Color Scheme; - 显示内联参数名称提示; + 显示内联参数名称提示; 显示对已关闭文件的诊断; 对正则表达式着色; 突出显示游标下的相关组件; diff --git a/src/VisualStudio/CSharp/Impl/xlf/VSPackage.zh-Hant.xlf b/src/VisualStudio/CSharp/Impl/xlf/VSPackage.zh-Hant.xlf index b230082a731cf..82fe530845fde 100644 --- a/src/VisualStudio/CSharp/Impl/xlf/VSPackage.zh-Hant.xlf +++ b/src/VisualStudio/CSharp/Impl/xlf/VSPackage.zh-Hant.xlf @@ -33,7 +33,7 @@ "C#" node help text in profile Import/Export. - Display inline parameter name hints; + Display inline hints; Show diagnostics for closed files; Colorize regular expression; Highlight related components under cursor; @@ -81,7 +81,7 @@ regex; regular expression; Use enhanced colors; Editor Color Scheme; - Display inline parameter name hints; + Display inline hints; Show diagnostics for closed files; Colorize regular expression; Highlight related components under cursor; diff --git a/src/VisualStudio/Core/Def/ColorSchemes/VisualStudio2017.xml b/src/VisualStudio/Core/Def/ColorSchemes/VisualStudio2017.xml index a0b2568e93983..2945143d58c88 100644 --- a/src/VisualStudio/Core/Def/ColorSchemes/VisualStudio2017.xml +++ b/src/VisualStudio/Core/Def/ColorSchemes/VisualStudio2017.xml @@ -63,7 +63,7 @@ - + @@ -218,7 +218,7 @@ - + @@ -373,7 +373,7 @@ - + @@ -528,7 +528,7 @@ - + @@ -697,7 +697,7 @@ - + diff --git a/src/VisualStudio/VisualBasic/Impl/VSPackage.resx b/src/VisualStudio/VisualBasic/Impl/VSPackage.resx index cbe26d88d7cca..fcb7042ca007c 100644 --- a/src/VisualStudio/VisualBasic/Impl/VSPackage.resx +++ b/src/VisualStudio/VisualBasic/Impl/VSPackage.resx @@ -128,7 +128,7 @@ Visual Basic Editor - Display inline parameter name hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; + Display inline hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; Advanced options page keywords diff --git a/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.cs.xlf b/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.cs.xlf index a7f9fc11aba01..8fa341ccfeaf9 100644 --- a/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.cs.xlf +++ b/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.cs.xlf @@ -18,8 +18,8 @@ - Display inline parameter name hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; - Zobrazovat nápovědy k názvům vložených parametrů;Automatické vložení koncových konstruktorů;Změnit nastavení přehledného výpisu;Změnit režim sbalení;Automatické vkládání členů Interface a MustOverride;Zobrazit nebo skrýt oddělovače řádků procedur;Zapnout nebo vypnout návrhy oprav;Zapnout nebo vypnout zvýrazňování odkazů a klíčových slov;Regex;Obarvit regulární výrazy;Zvýrazňovat související komponenty pod kurzorem;Nahlásit neplatné regulární výrazy;reg. výr.;regulární výraz;Používat rozšířené barvy;Barevné schéma editoru; + Display inline hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; + Zobrazovat nápovědy k názvům vložených parametrů;Automatické vložení koncových konstruktorů;Změnit nastavení přehledného výpisu;Změnit režim sbalení;Automatické vkládání členů Interface a MustOverride;Zobrazit nebo skrýt oddělovače řádků procedur;Zapnout nebo vypnout návrhy oprav;Zapnout nebo vypnout zvýrazňování odkazů a klíčových slov;Regex;Obarvit regulární výrazy;Zvýrazňovat související komponenty pod kurzorem;Nahlásit neplatné regulární výrazy;reg. výr.;regulární výraz;Používat rozšířené barvy;Barevné schéma editoru; Advanced options page keywords diff --git a/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.de.xlf b/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.de.xlf index ba869a31cd9aa..4f5b1f92cf7ab 100644 --- a/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.de.xlf +++ b/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.de.xlf @@ -18,8 +18,8 @@ - Display inline parameter name hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; - Display inline parameter name hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; + Display inline hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; + Display inline hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; Advanced options page keywords diff --git a/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.es.xlf b/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.es.xlf index 6a1f9d27d820b..0710c804d622e 100644 --- a/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.es.xlf +++ b/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.es.xlf @@ -18,8 +18,8 @@ - Display inline parameter name hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; - Display inline parameter name hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; + Display inline hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; + Display inline hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; Advanced options page keywords diff --git a/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.fr.xlf b/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.fr.xlf index 9eb69b129f2e5..eec726572e906 100644 --- a/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.fr.xlf +++ b/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.fr.xlf @@ -18,8 +18,8 @@ - Display inline parameter name hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; - Display inline parameter name hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; + Display inline hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; + Display inline hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; Advanced options page keywords diff --git a/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.it.xlf b/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.it.xlf index e35382f914f14..39ace602d6674 100644 --- a/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.it.xlf +++ b/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.it.xlf @@ -18,8 +18,8 @@ - Display inline parameter name hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; - Display inline parameter name hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; + Display inline hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; + Display inline hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; Advanced options page keywords diff --git a/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.ja.xlf b/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.ja.xlf index 29744b9181139..ee623db1f5ba1 100644 --- a/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.ja.xlf +++ b/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.ja.xlf @@ -18,8 +18,8 @@ - Display inline parameter name hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; - Display inline parameter name hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; + Display inline hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; + Display inline hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; Advanced options page keywords diff --git a/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.ko.xlf b/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.ko.xlf index 401af72647b04..27718e45189f3 100644 --- a/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.ko.xlf +++ b/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.ko.xlf @@ -18,8 +18,8 @@ - Display inline parameter name hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; - Display inline parameter name hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; + Display inline hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; + Display inline hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; Advanced options page keywords diff --git a/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.pl.xlf b/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.pl.xlf index dc251dd07694b..e4867ebc0ec0b 100644 --- a/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.pl.xlf +++ b/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.pl.xlf @@ -18,8 +18,8 @@ - Display inline parameter name hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; - Display inline parameter name hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; + Display inline hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; + Display inline hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; Advanced options page keywords diff --git a/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.pt-BR.xlf b/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.pt-BR.xlf index a1444e19554fe..fe122bfcf8c84 100644 --- a/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.pt-BR.xlf +++ b/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.pt-BR.xlf @@ -18,8 +18,8 @@ - Display inline parameter name hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; - Display inline parameter name hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; + Display inline hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; + Display inline hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; Advanced options page keywords diff --git a/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.ru.xlf b/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.ru.xlf index d70f2d52f0cc6..93f35c9239f93 100644 --- a/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.ru.xlf +++ b/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.ru.xlf @@ -18,8 +18,8 @@ - Display inline parameter name hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; - Display inline parameter name hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; + Display inline hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; + Display inline hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; Advanced options page keywords diff --git a/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.tr.xlf b/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.tr.xlf index 80554fdd07888..41ac1587168d3 100644 --- a/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.tr.xlf +++ b/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.tr.xlf @@ -18,8 +18,8 @@ - Display inline parameter name hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; - Display inline parameter name hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; + Display inline hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; + Display inline hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; Advanced options page keywords diff --git a/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.zh-Hans.xlf b/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.zh-Hans.xlf index f61fcc1477cdb..8666a8099d652 100644 --- a/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.zh-Hans.xlf +++ b/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.zh-Hans.xlf @@ -18,8 +18,8 @@ - Display inline parameter name hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; - 显示内联参数名称提示;自动插入 End 构造;更改整齐排列设置;更改大纲模式;自动插入 Interface 和 MustOverride 成员;显示或隐藏过程行分隔符;打开或关闭错误纠正建议;打开或关闭引用和关键字的突出显示;正则表达式;对正则表达式着色;突出显示光标下的相关部分;报告无效正则表达式;regex;正则表达式;使用增强色;编辑器配色方案; + Display inline hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; + 显示内联参数名称提示;自动插入 End 构造;更改整齐排列设置;更改大纲模式;自动插入 Interface 和 MustOverride 成员;显示或隐藏过程行分隔符;打开或关闭错误纠正建议;打开或关闭引用和关键字的突出显示;正则表达式;对正则表达式着色;突出显示光标下的相关部分;报告无效正则表达式;regex;正则表达式;使用增强色;编辑器配色方案; Advanced options page keywords diff --git a/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.zh-Hant.xlf b/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.zh-Hant.xlf index f26086ccac5cb..8aa6fe3ca5148 100644 --- a/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.zh-Hant.xlf +++ b/src/VisualStudio/VisualBasic/Impl/xlf/VSPackage.zh-Hant.xlf @@ -18,8 +18,8 @@ - Display inline parameter name hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; - Display inline parameter name hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; + Display inline hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; + Display inline hints;Automatic insertion of end constructs;Change pretty listing settings;Change outlining mode;Automatic insertion of Interface and MustOverride members;Show or hide procedure line separators;Turn error correction suggestions on or off;Turn highlighting of references and keywords on or off;Regex;Colorize regular expressions;Highlight related components under cursor;Report invalid regular expressions;regex;regular expression;Use enhanced colors;Editor Color Scheme; Advanced options page keywords From ce3d8505afd5c78dbc1b1ee4c314e4742c766e02 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 14:21:40 -0700 Subject: [PATCH 246/295] Tweak display --- .../Core.Wpf/InlineHints/InlineHintsTag.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs index bc9ca2294bbad..e0bab58ac76ea 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs @@ -161,8 +161,6 @@ private static FrameworkElement CreateElement( // to make the text seem more balanced in the border Padding = new Thickness(left: 1, top: 0, right: right, bottom: 0), VerticalAlignment = VerticalAlignment.Center, - - // Text = parts.ToTaggedText().ToVisibleDisplayString(includeLeftToRightMarker: true), }; var taggedTexts = parts.ToTaggedText(); @@ -173,11 +171,9 @@ private static FrameworkElement CreateElement( if (classify && taggedText.Tag != TextTags.Text) { var properties = formatMap.GetTextProperties(typeMap.GetClassificationType(taggedText.Tag.ToClassificationTypeName())); - run.Foreground = properties.ForegroundBrush; - } - else - { - run.Foreground = format.ForegroundBrush; + var brush = properties.ForegroundBrush.Clone(); + brush.Opacity = 0.8; + run.Foreground = brush; } block.Inlines.Add(run); From 0698634371565965e4b6bdbb3cc2339461ae3d7c Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 14:40:13 -0700 Subject: [PATCH 247/295] Replace var in place --- .../Core.Wpf/InlineHints/InlineHintsTagger.cs | 3 +-- .../InlineHints/InlineHintsDataTaggerProvider.cs | 5 +++-- .../InlineHints/CSharpInlineTypeHintsService.cs | 16 +++++++++++----- .../AbstractInlineParameterNameHintsService.cs | 2 +- .../AbstractInlineTypeHintsService.cs | 13 ++++++++----- .../Core/Portable/InlineHints/InlineTypeHint.cs | 7 ++++--- 6 files changed, 28 insertions(+), 18 deletions(-) diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTagger.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTagger.cs index 4bff3c6e8eb41..998031077ae7c 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTagger.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTagger.cs @@ -133,11 +133,10 @@ public IEnumerable> GetTags(NormalizedSnapshotSp if (dataTagSpans.Count == 1) { var dataTagSpan = dataTagSpans[0]; - var parameterHintSnapshotSpan = new SnapshotSpan(dataTagSpan.Start, 0); var parameterHintUITag = InlineHintsTag.Create( textTag.Parts, Format, _textView, dataTagSpan, textTag.SymbolKey, _taggerProvider, _formatMap, classify); - _cache.Add(new TagSpan(parameterHintSnapshotSpan, parameterHintUITag)); + _cache.Add(new TagSpan(dataTagSpan, parameterHintUITag)); } } } diff --git a/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs b/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs index 47a4ef5454e30..acea7da202f09 100644 --- a/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs +++ b/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs @@ -16,6 +16,7 @@ using Microsoft.CodeAnalysis.InlineHints; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Shared.TestHooks; +using Microsoft.CodeAnalysis.Text.Shared.Extensions; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Editor; using Microsoft.VisualStudio.Text.Tagging; @@ -100,7 +101,7 @@ private static async Task AddTypeHintsAsync(TaggerContext con foreach (var hint in hints) { context.AddTag(new TagSpan( - new SnapshotSpan(snapshotSpan.Snapshot, hint.Position, 0), + new SnapshotSpan(snapshotSpan.Snapshot, hint.Span.ToSpan()), new InlineHintDataTag(hint.Parts, hint.SymbolKey))); } } @@ -118,7 +119,7 @@ private static async Task AddParameterNameHintsAsync(TaggerContext( - new SnapshotSpan(snapshotSpan.Snapshot, hint.Position, 0), + new SnapshotSpan(snapshotSpan.Snapshot, hint.Span.ToSpan()), new InlineHintDataTag(hint.Parts, hint.SymbolKey))); } } diff --git a/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs b/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs index 11f534bbdc3ba..f308b6f44bef5 100644 --- a/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs +++ b/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs @@ -9,6 +9,7 @@ using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.InlineHints; +using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.CSharp.InlineHints { @@ -21,9 +22,10 @@ public CSharpInlineTypeHintsService() { } - protected override (ITypeSymbol type, int position)? TryGetTypeHint( + protected override (ITypeSymbol type, TextSpan span)? TryGetTypeHint( SemanticModel semanticModel, SyntaxNode node, + bool displayAllOverride, bool forImplicitVariableTypes, bool forLambdaParameterTypes, CancellationToken cancellationToken) @@ -37,14 +39,18 @@ protected override (ITypeSymbol type, int position)? TryGetTypeHint( { var type = semanticModel.GetTypeInfo(variableDeclaration.Type, cancellationToken).Type; if (IsValidType(type)) - return (type, variableDeclaration.Variables[0].Identifier.SpanStart); + return (type, displayAllOverride ? variableDeclaration.Type.Span : new TextSpan(variableDeclaration.Variables[0].Identifier.SpanStart, 0)); } else if (node is SingleVariableDesignationSyntax { Parent: not DeclarationPatternSyntax } variableDesignation) { var local = semanticModel.GetDeclaredSymbol(variableDesignation, cancellationToken) as ILocalSymbol; var type = local?.Type; if (IsValidType(type)) - return (type, variableDesignation.Identifier.SpanStart); + { + return node.Parent is VarPatternSyntax varPattern && displayAllOverride + ? (type, varPattern.VarKeyword.Span) + : (type, new TextSpan(variableDesignation.Identifier.SpanStart, 0)); + } } else if (node is ForEachStatementSyntax forEachStatement && forEachStatement.Type.IsVar) @@ -52,7 +58,7 @@ protected override (ITypeSymbol type, int position)? TryGetTypeHint( var info = semanticModel.GetForEachStatementInfo(forEachStatement); var type = info.ElementType; if (IsValidType(type)) - return (type, forEachStatement.Identifier.SpanStart); + return (type, displayAllOverride ? forEachStatement.Type.Span : new TextSpan(forEachStatement.Identifier.SpanStart, 0)); } } @@ -64,7 +70,7 @@ protected override (ITypeSymbol type, int position)? TryGetTypeHint( if (parameter?.ContainingSymbol is IMethodSymbol { MethodKind: MethodKind.AnonymousFunction } && IsValidType(parameter?.Type)) { - return (parameter.Type, parameterNode.Identifier.SpanStart); + return (parameter.Type, new TextSpan(parameterNode.Identifier.SpanStart, 0)); } } } diff --git a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs index 95c6e6288a53a..0befce3b479f5 100644 --- a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs @@ -83,7 +83,7 @@ void AddHintsIfAppropriate() if (HintMatches(kind, literalParameters, objectCreationParameters, otherParameters)) { result.Add(new InlineHint( - position, + new TextSpan(position, 0), ImmutableArray.Create(new SymbolDisplayPart(SymbolDisplayPartKind.Text, parameter, parameter.Name + ":")), parameter.GetSymbolKey(cancellationToken))); } diff --git a/src/Features/Core/Portable/InlineHints/AbstractInlineTypeHintsService.cs b/src/Features/Core/Portable/InlineHints/AbstractInlineTypeHintsService.cs index 6d421a022b9e5..0b578bfdcb31d 100644 --- a/src/Features/Core/Portable/InlineHints/AbstractInlineTypeHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/AbstractInlineTypeHintsService.cs @@ -20,8 +20,9 @@ internal abstract class AbstractInlineTypeHintsService : IInlineTypeHintsService genericsOptions: SymbolDisplayGenericsOptions.IncludeTypeParameters, miscellaneousOptions: SymbolDisplayMiscellaneousOptions.AllowDefaultLiteral | SymbolDisplayMiscellaneousOptions.IncludeNullableReferenceTypeModifier | SymbolDisplayMiscellaneousOptions.UseSpecialTypes); - protected abstract (ITypeSymbol type, int position)? TryGetTypeHint( + protected abstract (ITypeSymbol type, TextSpan span)? TryGetTypeHint( SemanticModel semanticModel, SyntaxNode node, + bool displayAllOverride, bool forImplicitVariableTypes, bool forLambdaParameterTypes, CancellationToken cancellationToken); @@ -51,18 +52,20 @@ public async Task> GetInlineHintsAsync( { var hintOpt = TryGetTypeHint( semanticModel, node, + displayAllOverride, forImplicitVariableTypes, - forLambdaParameterTypes, cancellationToken); + forLambdaParameterTypes, + cancellationToken); if (hintOpt == null) continue; - var (type, position) = hintOpt.Value; + var (type, span) = hintOpt.Value; using var _2 = ArrayBuilder.GetInstance(out var finalParts); var parts = type.ToDisplayParts(s_minimalTypeStyle); - AddParts(anonymousTypeService, finalParts, parts, semanticModel, position); - result.Add(new InlineHint(position, finalParts.ToImmutable(), type.GetSymbolKey(cancellationToken))); + AddParts(anonymousTypeService, finalParts, parts, semanticModel, span.Start); + result.Add(new InlineHint(span, finalParts.ToImmutable(), type.GetSymbolKey(cancellationToken))); } return result.ToImmutable(); diff --git a/src/Features/Core/Portable/InlineHints/InlineTypeHint.cs b/src/Features/Core/Portable/InlineHints/InlineTypeHint.cs index 1278c945b5229..c903d49e84d79 100644 --- a/src/Features/Core/Portable/InlineHints/InlineTypeHint.cs +++ b/src/Features/Core/Portable/InlineHints/InlineTypeHint.cs @@ -3,18 +3,19 @@ // See the LICENSE file in the project root for more information. using System.Collections.Immutable; +using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.InlineHints { internal readonly struct InlineHint { - public readonly int Position; + public readonly TextSpan Span; public readonly ImmutableArray Parts; public readonly SymbolKey? SymbolKey; - public InlineHint(int position, ImmutableArray parts, SymbolKey? symbolKey) + public InlineHint(TextSpan span, ImmutableArray parts, SymbolKey? symbolKey) { - Position = position; + Span = span; Parts = parts; SymbolKey = symbolKey; } From ca4a5e69ae17d36bb374becdf3f8d280dfead8ae Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 15:37:19 -0700 Subject: [PATCH 248/295] Replace var in place --- Roslyn.sln | 4 +++ .../Core.Wpf/InlineHints/InlineHintsTag.cs | 10 ++++--- .../CSharpInlineTypeHintsService.cs | 30 +++++++++++++++---- .../AbstractInlineTypeHintsService.cs | 10 +++---- 4 files changed, 39 insertions(+), 15 deletions(-) diff --git a/Roslyn.sln b/Roslyn.sln index 7150215f42caf..abe1a82b59ef5 100644 --- a/Roslyn.sln +++ b/Roslyn.sln @@ -1880,8 +1880,12 @@ Global {2801F82B-78CE-4BAE-B06F-537574751E2E}.Release|x86.Build.0 = Release|x86 {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|x86.ActiveCfg = Debug|Any CPU + {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|x86.Build.0 = Debug|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|Any CPU.ActiveCfg = Release|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|Any CPU.Build.0 = Release|Any CPU + {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|x86.ActiveCfg = Release|Any CPU + {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs index e0bab58ac76ea..6287ab10cdc35 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs @@ -83,7 +83,7 @@ public static InlineHintsTag Create( bool classify) { return new InlineHintsTag( - CreateElement(parts, textView, format, formatMap, taggerProvider.TypeMap, classify), + CreateElement(parts, textView, span, format, formatMap, taggerProvider.TypeMap, classify), textView, span, key, taggerProvider); } @@ -142,6 +142,7 @@ public async Task> CreateDescriptionAsync(Cancellati private static FrameworkElement CreateElement( ImmutableArray parts, IWpfTextView textView, + SnapshotSpan span, TextFormattingRunProperties format, IClassificationFormatMap formatMap, ClassificationTypeMap typeMap, @@ -149,7 +150,6 @@ private static FrameworkElement CreateElement( { // Constructs the hint block which gets assigned parameter name and fontstyles according to the options // page. Calculates a font size 1/4 smaller than the font size of the rest of the editor - var right = parts.Last().ToString().EndsWith(":") ? 0 : 1; var block = new TextBlock { FontFamily = format.Typeface.FontFamily, @@ -159,7 +159,7 @@ private static FrameworkElement CreateElement( // Adds a little bit of padding to the left of the text relative to the border // to make the text seem more balanced in the border - Padding = new Thickness(left: 1, top: 0, right: right, bottom: 0), + Padding = new Thickness(left: 1, top: 0, right: 1, bottom: 0), VerticalAlignment = VerticalAlignment.Center, }; @@ -182,6 +182,8 @@ private static FrameworkElement CreateElement( // Encapsulates the textblock within a border. Sets the height of the border to be 3/4 of the original // height. Gets foreground/background colors from the options menu. The margin is the distance from the // adornment to the text and pushing the adornment upwards to create a separation when on a specific line + var right = span.End < span.Snapshot.Length && char.IsWhiteSpace(span.End.GetChar()) ? 0 : 5; + var border = new Border { Background = format.BackgroundBrush, @@ -189,7 +191,7 @@ private static FrameworkElement CreateElement( CornerRadius = new CornerRadius(2), Height = textView.LineHeight - (0.25 * textView.LineHeight), HorizontalAlignment = HorizontalAlignment.Center, - Margin = new Thickness(left: 0, top: -0.20 * textView.LineHeight, right: 5, bottom: 0), + Margin = new Thickness(left: 0, top: -0.20 * textView.LineHeight, right, bottom: 0), Padding = new Thickness(1), // Need to set SnapsToDevicePixels and UseLayoutRounding to avoid unnecessary reformatting diff --git a/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs b/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs index f308b6f44bef5..2c9624ee4915c 100644 --- a/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs +++ b/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs @@ -10,6 +10,7 @@ using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.InlineHints; using Microsoft.CodeAnalysis.Text; +using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.InlineHints { @@ -30,7 +31,7 @@ protected override (ITypeSymbol type, TextSpan span)? TryGetTypeHint( bool forLambdaParameterTypes, CancellationToken cancellationToken) { - if (forImplicitVariableTypes) + if (forImplicitVariableTypes || displayAllOverride) { if (node is VariableDeclarationSyntax variableDeclaration && variableDeclaration.Type.IsVar && @@ -39,7 +40,7 @@ protected override (ITypeSymbol type, TextSpan span)? TryGetTypeHint( { var type = semanticModel.GetTypeInfo(variableDeclaration.Type, cancellationToken).Type; if (IsValidType(type)) - return (type, displayAllOverride ? variableDeclaration.Type.Span : new TextSpan(variableDeclaration.Variables[0].Identifier.SpanStart, 0)); + return (type, GetSpan(displayAllOverride, forImplicitVariableTypes, variableDeclaration.Type, variableDeclaration.Variables[0].Identifier)); } else if (node is SingleVariableDesignationSyntax { Parent: not DeclarationPatternSyntax } variableDesignation) { @@ -47,8 +48,8 @@ protected override (ITypeSymbol type, TextSpan span)? TryGetTypeHint( var type = local?.Type; if (IsValidType(type)) { - return node.Parent is VarPatternSyntax varPattern && displayAllOverride - ? (type, varPattern.VarKeyword.Span) + return node.Parent is VarPatternSyntax varPattern + ? (type, GetSpan(displayAllOverride, forImplicitVariableTypes, varPattern.VarKeyword, variableDesignation.Identifier)) : (type, new TextSpan(variableDesignation.Identifier.SpanStart, 0)); } } @@ -58,11 +59,11 @@ protected override (ITypeSymbol type, TextSpan span)? TryGetTypeHint( var info = semanticModel.GetForEachStatementInfo(forEachStatement); var type = info.ElementType; if (IsValidType(type)) - return (type, displayAllOverride ? forEachStatement.Type.Span : new TextSpan(forEachStatement.Identifier.SpanStart, 0)); + return (type, GetSpan(displayAllOverride, forImplicitVariableTypes, forEachStatement.Type, forEachStatement.Identifier)); } } - if (forLambdaParameterTypes) + if (forLambdaParameterTypes || displayAllOverride) { if (node is ParameterSyntax { Type: null } parameterNode) { @@ -78,6 +79,23 @@ protected override (ITypeSymbol type, TextSpan span)? TryGetTypeHint( return null; } + private static TextSpan GetSpan( + bool displayAllOverride, + bool normalOption, + SyntaxNodeOrToken displayAllSpan, + SyntaxNodeOrToken normalSpan) + { + // If we're showing this because the normal option is on, then place the hint prior to the node being marked. + if (normalOption) + return new TextSpan(normalSpan.SpanStart, 0); + + // Otherwise, we're showing because the user explicitly asked to see all hints. In that case, overwrite the + // provided span (i.e. overwrite 'var' with 'int') as this provides a cleaner view while the user is in this + // mode. + Contract.ThrowIfFalse(displayAllOverride); + return displayAllSpan.Span; + } + private static bool IsValidType([NotNullWhen(true)] ITypeSymbol? type) { return type is not null or IErrorTypeSymbol && type.Name != "var"; diff --git a/src/Features/Core/Portable/InlineHints/AbstractInlineTypeHintsService.cs b/src/Features/Core/Portable/InlineHints/AbstractInlineTypeHintsService.cs index 0b578bfdcb31d..4020934e1c4b5 100644 --- a/src/Features/Core/Portable/InlineHints/AbstractInlineTypeHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/AbstractInlineTypeHintsService.cs @@ -33,13 +33,13 @@ public async Task> GetInlineHintsAsync( var options = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); var displayAllOverride = options.GetOption(InlineHintsOptions.DisplayAllOverride); - var enabledForTypes = displayAllOverride || options.GetOption(InlineHintsOptions.EnabledForTypes); - if (!enabledForTypes) + var enabledForTypes = options.GetOption(InlineHintsOptions.EnabledForTypes); + if (!enabledForTypes && !displayAllOverride) return ImmutableArray.Empty; - var forImplicitVariableTypes = displayAllOverride || options.GetOption(InlineHintsOptions.ForImplicitVariableTypes); - var forLambdaParameterTypes = displayAllOverride || options.GetOption(InlineHintsOptions.ForLambdaParameterTypes); - if (!forImplicitVariableTypes && !forLambdaParameterTypes) + var forImplicitVariableTypes = enabledForTypes && options.GetOption(InlineHintsOptions.ForImplicitVariableTypes); + var forLambdaParameterTypes = enabledForTypes && options.GetOption(InlineHintsOptions.ForLambdaParameterTypes); + if (!forImplicitVariableTypes && !forLambdaParameterTypes && !displayAllOverride) return ImmutableArray.Empty; var anonymousTypeService = document.GetRequiredLanguageService(); From a8dd4eb0cf38a3e84458b5fc0624305959f7efb9 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 15:49:46 -0700 Subject: [PATCH 249/295] Update vlaues --- .../Core/Def/ColorSchemes/VisualStudio2017.xml | 2 +- .../Core/Def/ColorSchemes/VisualStudio2019.xml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/VisualStudio/Core/Def/ColorSchemes/VisualStudio2017.xml b/src/VisualStudio/Core/Def/ColorSchemes/VisualStudio2017.xml index 2945143d58c88..7b48076a54ba1 100644 --- a/src/VisualStudio/Core/Def/ColorSchemes/VisualStudio2017.xml +++ b/src/VisualStudio/Core/Def/ColorSchemes/VisualStudio2017.xml @@ -529,7 +529,7 @@ - + diff --git a/src/VisualStudio/Core/Def/ColorSchemes/VisualStudio2019.xml b/src/VisualStudio/Core/Def/ColorSchemes/VisualStudio2019.xml index f8cace4c701bf..4bfbd3e9893bb 100644 --- a/src/VisualStudio/Core/Def/ColorSchemes/VisualStudio2019.xml +++ b/src/VisualStudio/Core/Def/ColorSchemes/VisualStudio2019.xml @@ -69,7 +69,7 @@ - + @@ -230,7 +230,7 @@ - + @@ -391,7 +391,7 @@ - + @@ -552,8 +552,8 @@ - - + + From df953b368cb018dd511bc601f2d6b90c8d25c1b5 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 16:00:05 -0700 Subject: [PATCH 250/295] Don't touch --- src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs index 6287ab10cdc35..34bf85ab3bf6c 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs @@ -172,7 +172,6 @@ private static FrameworkElement CreateElement( { var properties = formatMap.GetTextProperties(typeMap.GetClassificationType(taggedText.Tag.ToClassificationTypeName())); var brush = properties.ForegroundBrush.Clone(); - brush.Opacity = 0.8; run.Foreground = brush; } From ea13ee69fa5caac0ac80dbb29245a4f7c52972c8 Mon Sep 17 00:00:00 2001 From: Youssef Victor <31348972+Youssef1313@users.noreply.github.com> Date: Fri, 9 Oct 2020 01:46:16 +0200 Subject: [PATCH 251/295] Revert Roslyn.sln change --- Roslyn.sln | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Roslyn.sln b/Roslyn.sln index abe1a82b59ef5..7150215f42caf 100644 --- a/Roslyn.sln +++ b/Roslyn.sln @@ -1880,12 +1880,8 @@ Global {2801F82B-78CE-4BAE-B06F-537574751E2E}.Release|x86.Build.0 = Release|x86 {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|x86.ActiveCfg = Debug|Any CPU - {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Debug|x86.Build.0 = Debug|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|Any CPU.ActiveCfg = Release|Any CPU {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|Any CPU.Build.0 = Release|Any CPU - {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|x86.ActiveCfg = Release|Any CPU - {9B25E472-DF94-4E24-9F5D-E487CE5A91FB}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From d51593e91bfc2c3c5bdf6dfa0409a9297761a133 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Thu, 8 Oct 2020 14:15:39 -0700 Subject: [PATCH 252/295] Fix NullReferenceException in GetSuggestedActionCategoriesAsync --- .../Core.Wpf/Suggestions/SuggestedActionsSource.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActionsSource.cs b/src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActionsSource.cs index 5f2bb844854d7..3b91e3a9778ab 100644 --- a/src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActionsSource.cs +++ b/src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActionsSource.cs @@ -623,6 +623,17 @@ private void OnSuggestedActionsChanged(Workspace currentWorkspace, DocumentId? c } var provider = _owner; + + // The _owner flag is cleared on Dispose. This should only occur when cancellation has already been + // requested, but at least in 16.8 Preview 3.0 it was not always the case. + cancellationToken.ThrowIfCancellationRequested(); + //Assumes.Present(provider); + if (provider is null) + { + // The object was unexpectedly disposed while still in use (caller error) + return null; + } + using var asyncToken = provider.OperationListener.BeginAsyncOperation(nameof(GetSuggestedActionCategoriesAsync)); var document = range.Snapshot.GetOpenDocumentInCurrentContextWithChanges(); if (document == null) From 5fdf3684de5ed22a30d47e2552af2e7ec49240b6 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Thu, 8 Oct 2020 17:29:11 -0700 Subject: [PATCH 253/295] Capture the activity log for test failures --- .../TestUtilities/ActivityLogCollector.cs | 39 +++++++++++++++++++ .../VisualStudioInstanceFactory.cs | 1 + 2 files changed, 40 insertions(+) create mode 100644 src/VisualStudio/IntegrationTest/TestUtilities/ActivityLogCollector.cs diff --git a/src/VisualStudio/IntegrationTest/TestUtilities/ActivityLogCollector.cs b/src/VisualStudio/IntegrationTest/TestUtilities/ActivityLogCollector.cs new file mode 100644 index 0000000000000..a950b41aaeb58 --- /dev/null +++ b/src/VisualStudio/IntegrationTest/TestUtilities/ActivityLogCollector.cs @@ -0,0 +1,39 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.IO; +using System.Text; + +namespace Microsoft.VisualStudio.IntegrationTest.Utilities +{ + internal static class ActivityLogCollector + { + internal static void TryWriteActivityLogToFile(string filePath) + { + var vsAppDataDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Microsoft", "VisualStudio"); + if (!Directory.Exists(vsAppDataDirectory)) + return; + + var content = new StringBuilder(); + foreach (var folder in Directory.GetDirectories(vsAppDataDirectory, $"{Settings.Default.VsProductVersion}*{Settings.Default.VsRootSuffix}")) + { + var activityLog = Path.Combine(folder, "ActivityLog.xml"); + if (File.Exists(activityLog)) + { + try + { + content.AppendLine(File.ReadAllText(activityLog)); + } + catch (Exception e) + { + content.AppendLine(e.ToString()); + } + } + } + + File.WriteAllText(filePath, content.ToString(), Encoding.UTF8); + } + } +} diff --git a/src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs b/src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs index 6ab73d28d6ae7..63855e7342a44 100644 --- a/src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs +++ b/src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs @@ -80,6 +80,7 @@ private static void FirstChanceExceptionHandler(object sender, FirstChanceExcept File.WriteAllText(Path.Combine(logDir, $"{baseFileName}.log"), eventArgs.Exception.ToString()); + ActivityLogCollector.TryWriteActivityLogToFile(Path.Combine(logDir, $"{baseFileName}.Actvty.log")); EventLogCollector.TryWriteDotNetEntriesToFile(Path.Combine(logDir, $"{baseFileName}.DotNet.log")); EventLogCollector.TryWriteWatsonEntriesToFile(Path.Combine(logDir, $"{baseFileName}.Watson.log")); From 9d7effb7c3101ea0716347e6b95d5b834488d796 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Thu, 8 Oct 2020 17:29:40 -0700 Subject: [PATCH 254/295] Update primary Roslyn processes for test diagnostics --- src/Tools/Source/RunTests/Program.cs | 4 +++- .../IntegrationTest/TestUtilities/EventLogCollector.cs | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Tools/Source/RunTests/Program.cs b/src/Tools/Source/RunTests/Program.cs index f1cafabc69808..f5a1f5519a91c 100644 --- a/src/Tools/Source/RunTests/Program.cs +++ b/src/Tools/Source/RunTests/Program.cs @@ -21,7 +21,9 @@ internal sealed partial class Program StringComparer.OrdinalIgnoreCase, "devenv", "xunit.console", - "xunit.console.x86"); + "xunit.console.x86", + "ServiceHub.RoslynCodeAnalysisService", + "ServiceHub.RoslynCodeAnalysisService32"); internal const int ExitSuccess = 0; internal const int ExitFailure = 1; diff --git a/src/VisualStudio/IntegrationTest/TestUtilities/EventLogCollector.cs b/src/VisualStudio/IntegrationTest/TestUtilities/EventLogCollector.cs index 45affd6fec0a4..033bc6e13021f 100644 --- a/src/VisualStudio/IntegrationTest/TestUtilities/EventLogCollector.cs +++ b/src/VisualStudio/IntegrationTest/TestUtilities/EventLogCollector.cs @@ -96,6 +96,7 @@ internal static class EventLogCollector "ServiceHub.Host.CLR.x64.exe", "ServiceHub.Host.CLR.x86.exe", "ServiceHub.IdentityHost.exe", + "ServiceHub.RoslynCodeAnalysisService.exe", "ServiceHub.RoslynCodeAnalysisService32.exe", "ServiceHub.SettingsHost.exe", "ServiceHub.VSDetouredHost.exe", From 40c57617307347a77cf6f85b4324b389f7bb046d Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 8 Oct 2020 20:09:16 -0700 Subject: [PATCH 255/295] Update colors --- .../Core.Wpf/InlineHints/InlineHintsFormatDefinition.cs | 4 ++-- src/VisualStudio/Core/Def/ColorSchemes/VisualStudio2017.xml | 4 ++-- src/VisualStudio/Core/Def/ColorSchemes/VisualStudio2019.xml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsFormatDefinition.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsFormatDefinition.cs index de151b1710d38..f3e8d3cde7568 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsFormatDefinition.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsFormatDefinition.cs @@ -32,8 +32,8 @@ internal sealed class InlineHintsFormatDefinition : EditorFormatDefinition public InlineHintsFormatDefinition() { this.DisplayName = EditorFeaturesResources.Inline_Hints; - this.ForegroundBrush = Brushes.Black; - this.BackgroundBrush = Brushes.LightGray; + this.ForegroundBrush = new SolidColorBrush(Color.FromRgb(104, 104, 104)); + this.BackgroundBrush = new SolidColorBrush(Color.FromRgb(230, 230, 230)); } } } diff --git a/src/VisualStudio/Core/Def/ColorSchemes/VisualStudio2017.xml b/src/VisualStudio/Core/Def/ColorSchemes/VisualStudio2017.xml index 7b48076a54ba1..18e8bd5139c29 100644 --- a/src/VisualStudio/Core/Def/ColorSchemes/VisualStudio2017.xml +++ b/src/VisualStudio/Core/Def/ColorSchemes/VisualStudio2017.xml @@ -529,8 +529,8 @@ - - + + diff --git a/src/VisualStudio/Core/Def/ColorSchemes/VisualStudio2019.xml b/src/VisualStudio/Core/Def/ColorSchemes/VisualStudio2019.xml index 4bfbd3e9893bb..7525c9bf68ee4 100644 --- a/src/VisualStudio/Core/Def/ColorSchemes/VisualStudio2019.xml +++ b/src/VisualStudio/Core/Def/ColorSchemes/VisualStudio2019.xml @@ -553,8 +553,8 @@ - - + + From 6b43c8820f321a23f5f8d66f97e2e6f78ac8b920 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Thu, 8 Oct 2020 21:54:36 -0700 Subject: [PATCH 256/295] Work around editor dismissing our light bulbs --- .../InProcess/TextViewWindow_InProc.cs | 35 +++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/TextViewWindow_InProc.cs b/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/TextViewWindow_InProc.cs index 19714891f9f35..e9dc9131a35b6 100644 --- a/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/TextViewWindow_InProc.cs +++ b/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/TextViewWindow_InProc.cs @@ -66,17 +66,32 @@ public string GetCurrentCompletionItem() public void ShowLightBulb() { - InvokeOnUIThread(cancellationToken => + InvokeSmartTasks(); + + // The editor has an asynchronous background operation that dismisses the light bulb if it was shown within + // 500ms of the operation starting. Wait 600ms and make sure the menu is still present. + // https://devdiv.visualstudio.com/DevDiv/_git/VS-Platform/pullrequest/268277 + Thread.Sleep(600); + + if (!IsLightBulbSessionExpanded()) { - var shell = GetGlobalService(); - var cmdGroup = typeof(VSConstants.VSStd2KCmdID).GUID; - var cmdExecOpt = OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER; - - const VSConstants.VSStd2KCmdID ECMD_SMARTTASKS = (VSConstants.VSStd2KCmdID)147; - var cmdID = ECMD_SMARTTASKS; - object obj = null; - shell.PostExecCommand(cmdGroup, (uint)cmdID, (uint)cmdExecOpt, ref obj); - }); + InvokeSmartTasks(); + } + + void InvokeSmartTasks() + { + InvokeOnUIThread(cancellationToken => + { + var shell = GetGlobalService(); + var cmdGroup = typeof(VSConstants.VSStd2KCmdID).GUID; + var cmdExecOpt = OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER; + + const VSConstants.VSStd2KCmdID ECMD_SMARTTASKS = (VSConstants.VSStd2KCmdID)147; + var cmdID = ECMD_SMARTTASKS; + object obj = null; + shell.PostExecCommand(cmdGroup, (uint)cmdID, (uint)cmdExecOpt, ref obj); + }); + } } public void WaitForLightBulbSession() From 5cdf42ad5c990823c847a6a8cf43c0429564e894 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Thu, 8 Oct 2020 22:27:51 -0700 Subject: [PATCH 257/295] Remove the .dotnet PATH element before launching integration tests --- .../TestUtilities/VisualStudioInstanceFactory.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs b/src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs index 63855e7342a44..d4e006c837b8b 100644 --- a/src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs +++ b/src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs @@ -14,7 +14,9 @@ using EnvDTE; using Microsoft.VisualStudio.Setup.Configuration; using Microsoft.Win32; +using Roslyn.Utilities; using RunTests; +using Xunit; using Process = System.Diagnostics.Process; namespace Microsoft.VisualStudio.IntegrationTest.Utilities @@ -363,6 +365,19 @@ private static Process StartNewVisualStudioProcess(string installationPath, int processStartInfo.Environment.Remove("DOTNET_MULTILEVEL_LOOKUP"); processStartInfo.Environment.Remove("DOTNET_INSTALL_DIR"); + // The first element of the path in CI is a .dotnet used for the Roslyn build. Make sure to remove that. + if (processStartInfo.Environment.TryGetValue("BUILD_SOURCESDIRECTORY", out var sourcesDirectory)) + { + var environmentPath = processStartInfo.Environment["PATH"]; + + // Assert that the PATH still has the form we are expecting since we're about to modify it + var firstPath = environmentPath.Substring(0, environmentPath.IndexOf(';')); + Assert.Equal(Path.Combine(sourcesDirectory, ".dotnet") + '\\', firstPath); + + // Drop the first path element + processStartInfo.Environment["PATH"] = environmentPath.Substring(environmentPath.IndexOf(';') + 1); + } + var process = Process.Start(processStartInfo); Debug.WriteLine($"Launched a new instance of Visual Studio. (ID: {process.Id})"); From fd0e161f46d3bdceb26cfab8f49d47174e4e6f5d Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Fri, 9 Oct 2020 08:30:25 -0700 Subject: [PATCH 258/295] Hook up doc links to IDExxxx rules Fixes #41324 I have also done some additional refactoring to combine `AbstractBuiltInCodeStyleDiagnosticAnalyzer` and `AbstractCodeStyleDiagnosticAnalyzer` into a single type. --- ...eConfusingSuppressionDiagnosticAnalyzer.cs | 5 +++- ...tractBuiltInCodeStyleDiagnosticAnalyzer.cs | 24 +++++++------------ ...uiltInCodeStyleDiagnosticAnalyzer_Core.cs} | 0 .../AbstractCodeStyleDiagnosticAnalyzer.cs | 16 ++++++++----- .../AbstractParenthesesDiagnosticAnalyzer.cs | 11 ++++----- .../Core/Analyzers/Analyzers.projitems | 4 ++-- ...nnecessaryParenthesesDiagnosticAnalyzer.cs | 17 ++++--------- .../Analyzers/AbstractFormattingAnalyzer.cs | 3 ++- 8 files changed, 35 insertions(+), 45 deletions(-) rename src/Analyzers/Core/Analyzers/{AbstractCodeQualityDiagnosticAnalyzer.cs => AbstractBuiltInCodeStyleDiagnosticAnalyzer_Core.cs} (100%) diff --git a/src/Analyzers/CSharp/Analyzers/RemoveConfusingSuppression/CSharpRemoveConfusingSuppressionDiagnosticAnalyzer.cs b/src/Analyzers/CSharp/Analyzers/RemoveConfusingSuppression/CSharpRemoveConfusingSuppressionDiagnosticAnalyzer.cs index e79f777a2d475..0b2c2793c14da 100644 --- a/src/Analyzers/CSharp/Analyzers/RemoveConfusingSuppression/CSharpRemoveConfusingSuppressionDiagnosticAnalyzer.cs +++ b/src/Analyzers/CSharp/Analyzers/RemoveConfusingSuppression/CSharpRemoveConfusingSuppressionDiagnosticAnalyzer.cs @@ -11,15 +11,18 @@ namespace Microsoft.CodeAnalysis.CSharp.RemoveConfusingSuppression { [DiagnosticAnalyzer(LanguageNames.CSharp)] - internal class CSharpRemoveConfusingSuppressionDiagnosticAnalyzer : AbstractCodeStyleDiagnosticAnalyzer + internal sealed class CSharpRemoveConfusingSuppressionDiagnosticAnalyzer : AbstractBuiltInCodeStyleDiagnosticAnalyzer { public CSharpRemoveConfusingSuppressionDiagnosticAnalyzer() : base(IDEDiagnosticIds.RemoveConfusingSuppressionForIsExpressionDiagnosticId, + option: null, new LocalizableResourceString(nameof(CSharpAnalyzersResources.Remove_unnecessary_suppression_operator), CSharpAnalyzersResources.ResourceManager, typeof(CSharpAnalyzersResources)), new LocalizableResourceString(nameof(CSharpAnalyzersResources.Suppression_operator_has_no_effect_and_can_be_misinterpreted), CSharpAnalyzersResources.ResourceManager, typeof(CSharpAnalyzersResources))) { } + public override DiagnosticAnalyzerCategory GetAnalyzerCategory() => DiagnosticAnalyzerCategory.SemanticSpanAnalysis; + protected override void InitializeWorker(AnalysisContext context) => context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.IsExpression, SyntaxKind.IsPatternExpression); diff --git a/src/Analyzers/Core/Analyzers/AbstractBuiltInCodeStyleDiagnosticAnalyzer.cs b/src/Analyzers/Core/Analyzers/AbstractBuiltInCodeStyleDiagnosticAnalyzer.cs index cbe365ad790b3..aca20279aa343 100644 --- a/src/Analyzers/Core/Analyzers/AbstractBuiltInCodeStyleDiagnosticAnalyzer.cs +++ b/src/Analyzers/Core/Analyzers/AbstractBuiltInCodeStyleDiagnosticAnalyzer.cs @@ -15,7 +15,7 @@ namespace Microsoft.CodeAnalysis.CodeStyle { - internal abstract class AbstractBuiltInCodeStyleDiagnosticAnalyzer : AbstractCodeStyleDiagnosticAnalyzer, IBuiltInAnalyzer + internal abstract partial class AbstractBuiltInCodeStyleDiagnosticAnalyzer { /// /// Constructor for a code style analyzer with a single diagnostic descriptor and @@ -40,7 +40,7 @@ protected AbstractBuiltInCodeStyleDiagnosticAnalyzer( LocalizableString? messageFormat = null, bool isUnnecessary = false, bool configurable = true) - : base(diagnosticId, title, messageFormat, isUnnecessary, configurable) + : this(diagnosticId, title, messageFormat, isUnnecessary, configurable) { AddDiagnosticIdToOptionMapping(diagnosticId, option); } @@ -70,7 +70,7 @@ protected AbstractBuiltInCodeStyleDiagnosticAnalyzer( LocalizableString? messageFormat = null, bool isUnnecessary = false, bool configurable = true) - : base(diagnosticId, title, messageFormat, isUnnecessary, configurable) + : this(diagnosticId, title, messageFormat, isUnnecessary, configurable) { AddDiagnosticIdToOptionMapping(diagnosticId, option, language); } @@ -97,7 +97,7 @@ protected AbstractBuiltInCodeStyleDiagnosticAnalyzer( LocalizableString? messageFormat = null, bool isUnnecessary = false, bool configurable = true) - : base(diagnosticId, title, messageFormat, isUnnecessary, configurable) + : this(diagnosticId, title, messageFormat, isUnnecessary, configurable) { RoslynDebug.Assert(options != null); Debug.Assert(options.Count > 1); @@ -128,7 +128,7 @@ protected AbstractBuiltInCodeStyleDiagnosticAnalyzer( LocalizableString? messageFormat = null, bool isUnnecessary = false, bool configurable = true) - : base(diagnosticId, title, messageFormat, isUnnecessary, configurable) + : this(diagnosticId, title, messageFormat, isUnnecessary, configurable) { RoslynDebug.Assert(options != null); Debug.Assert(options.Count > 1); @@ -139,7 +139,7 @@ protected AbstractBuiltInCodeStyleDiagnosticAnalyzer( /// Constructor for a code style analyzer with a multiple diagnostic descriptors with per-language options that can be used to configure each descriptor. /// protected AbstractBuiltInCodeStyleDiagnosticAnalyzer(ImmutableDictionary supportedDiagnosticsWithOptions) - : base(supportedDiagnosticsWithOptions.Keys.ToImmutableArray()) + : this(supportedDiagnosticsWithOptions.Keys.ToImmutableArray()) { foreach (var kvp in supportedDiagnosticsWithOptions) { @@ -153,7 +153,7 @@ protected AbstractBuiltInCodeStyleDiagnosticAnalyzer(ImmutableDictionary supportedDiagnosticsWithOptions, string language) - : base(supportedDiagnosticsWithOptions.Keys.ToImmutableArray()) + : this(supportedDiagnosticsWithOptions.Keys.ToImmutableArray()) { foreach (var kvp in supportedDiagnosticsWithOptions) { @@ -168,7 +168,7 @@ protected AbstractBuiltInCodeStyleDiagnosticAnalyzer( ImmutableDictionary supportedDiagnosticsWithLangaugeSpecificOptions, ImmutableDictionary supportedDiagnosticsWithPerLanguageOptions, string language) - : base(supportedDiagnosticsWithLangaugeSpecificOptions.Keys.Concat(supportedDiagnosticsWithPerLanguageOptions.Keys).ToImmutableArray()) + : this(supportedDiagnosticsWithLangaugeSpecificOptions.Keys.Concat(supportedDiagnosticsWithPerLanguageOptions.Keys).ToImmutableArray()) { foreach (var kvp in supportedDiagnosticsWithLangaugeSpecificOptions) { @@ -181,14 +181,6 @@ protected AbstractBuiltInCodeStyleDiagnosticAnalyzer( } } - /// - /// Constructor for a code style analyzer with a multiple diagnostic descriptors such that all the descriptors have no unique code style option to configure the descriptors. - /// - protected AbstractBuiltInCodeStyleDiagnosticAnalyzer(ImmutableArray supportedDiagnosticsWithoutOptions) - : base(supportedDiagnosticsWithoutOptions) - { - } - private static void AddDiagnosticIdToOptionMapping(string diagnosticId, IPerLanguageOption? option) { if (option != null) diff --git a/src/Analyzers/Core/Analyzers/AbstractCodeQualityDiagnosticAnalyzer.cs b/src/Analyzers/Core/Analyzers/AbstractBuiltInCodeStyleDiagnosticAnalyzer_Core.cs similarity index 100% rename from src/Analyzers/Core/Analyzers/AbstractCodeQualityDiagnosticAnalyzer.cs rename to src/Analyzers/Core/Analyzers/AbstractBuiltInCodeStyleDiagnosticAnalyzer_Core.cs diff --git a/src/Analyzers/Core/Analyzers/AbstractCodeStyleDiagnosticAnalyzer.cs b/src/Analyzers/Core/Analyzers/AbstractCodeStyleDiagnosticAnalyzer.cs index 80f3ba8379510..61c0ac7217a2b 100644 --- a/src/Analyzers/Core/Analyzers/AbstractCodeStyleDiagnosticAnalyzer.cs +++ b/src/Analyzers/Core/Analyzers/AbstractCodeStyleDiagnosticAnalyzer.cs @@ -7,7 +7,7 @@ namespace Microsoft.CodeAnalysis.CodeStyle { - internal abstract class AbstractCodeStyleDiagnosticAnalyzer : DiagnosticAnalyzer + internal abstract partial class AbstractBuiltInCodeStyleDiagnosticAnalyzer : DiagnosticAnalyzer, IBuiltInAnalyzer { protected readonly string? DescriptorId; @@ -16,11 +16,11 @@ internal abstract class AbstractCodeStyleDiagnosticAnalyzer : DiagnosticAnalyzer protected readonly LocalizableString _localizableTitle; protected readonly LocalizableString _localizableMessageFormat; - protected AbstractCodeStyleDiagnosticAnalyzer( + private AbstractBuiltInCodeStyleDiagnosticAnalyzer( string descriptorId, LocalizableString title, - LocalizableString? messageFormat = null, - bool isUnnecessary = false, - bool configurable = true) + LocalizableString? messageFormat, + bool isUnnecessary, + bool configurable) { DescriptorId = descriptorId; _localizableTitle = title; @@ -30,7 +30,10 @@ protected AbstractCodeStyleDiagnosticAnalyzer( SupportedDiagnostics = ImmutableArray.Create(Descriptor); } - protected AbstractCodeStyleDiagnosticAnalyzer(ImmutableArray supportedDiagnostics) + /// + /// Constructor for a code style analyzer with a multiple diagnostic descriptors such that all the descriptors have no unique code style option to configure the descriptors. + /// + protected AbstractBuiltInCodeStyleDiagnosticAnalyzer(ImmutableArray supportedDiagnostics) { SupportedDiagnostics = supportedDiagnostics; @@ -55,6 +58,7 @@ protected static DiagnosticDescriptor CreateDescriptorWithId( DiagnosticSeverity.Hidden, isEnabledByDefault: true, description: description, + helpLinkUri: $"https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/{id}", customTags: DiagnosticCustomTags.Create(isUnnecessary, isConfigurable, customTags)); public sealed override void Initialize(AnalysisContext context) diff --git a/src/Analyzers/Core/Analyzers/AbstractParenthesesDiagnosticAnalyzer.cs b/src/Analyzers/Core/Analyzers/AbstractParenthesesDiagnosticAnalyzer.cs index f09595484554d..b5c45b509595b 100644 --- a/src/Analyzers/Core/Analyzers/AbstractParenthesesDiagnosticAnalyzer.cs +++ b/src/Analyzers/Core/Analyzers/AbstractParenthesesDiagnosticAnalyzer.cs @@ -15,15 +15,12 @@ namespace Microsoft.CodeAnalysis.RemoveUnnecessaryParentheses internal abstract class AbstractParenthesesDiagnosticAnalyzer : AbstractBuiltInCodeStyleDiagnosticAnalyzer { protected AbstractParenthesesDiagnosticAnalyzer( - string descriptorId, LocalizableString title, LocalizableString message) + string descriptorId, LocalizableString title, LocalizableString message, bool isUnnecessary = false) : base(descriptorId, options: ImmutableHashSet.Create(CodeStyleOptions2.ArithmeticBinaryParentheses, CodeStyleOptions2.RelationalBinaryParentheses, CodeStyleOptions2.OtherBinaryParentheses, CodeStyleOptions2.OtherParentheses), - title, message) - { - } - - protected AbstractParenthesesDiagnosticAnalyzer(ImmutableArray diagnosticDescriptors) - : base(diagnosticDescriptors) + title, + message, + isUnnecessary: isUnnecessary) { } diff --git a/src/Analyzers/Core/Analyzers/Analyzers.projitems b/src/Analyzers/Core/Analyzers/Analyzers.projitems index 4bdc2d70b5a2f..b6df19785c0da 100644 --- a/src/Analyzers/Core/Analyzers/Analyzers.projitems +++ b/src/Analyzers/Core/Analyzers/Analyzers.projitems @@ -14,7 +14,7 @@ - + @@ -91,4 +91,4 @@ - + \ No newline at end of file diff --git a/src/Analyzers/Core/Analyzers/RemoveUnnecessaryParentheses/AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs b/src/Analyzers/Core/Analyzers/RemoveUnnecessaryParentheses/AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs index 4924a35467277..8725b7caa3b0c 100644 --- a/src/Analyzers/Core/Analyzers/RemoveUnnecessaryParentheses/AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs +++ b/src/Analyzers/Core/Analyzers/RemoveUnnecessaryParentheses/AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs @@ -21,18 +21,11 @@ internal abstract class AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer< where TLanguageKindEnum : struct where TParenthesizedExpressionSyntax : SyntaxNode { - - /// - /// A diagnostic descriptor used to squiggle and message the span. - /// - private static readonly DiagnosticDescriptor s_diagnosticDescriptor = CreateDescriptorWithId( - IDEDiagnosticIds.RemoveUnnecessaryParenthesesDiagnosticId, - new LocalizableResourceString(nameof(AnalyzersResources.Remove_unnecessary_parentheses), AnalyzersResources.ResourceManager, typeof(AnalyzersResources)), - new LocalizableResourceString(nameof(AnalyzersResources.Parentheses_can_be_removed), AnalyzersResources.ResourceManager, typeof(AnalyzersResources)), - isUnnecessary: true); - protected AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer() - : base(ImmutableArray.Create(s_diagnosticDescriptor)) + : base(IDEDiagnosticIds.RemoveUnnecessaryParenthesesDiagnosticId, + new LocalizableResourceString(nameof(AnalyzersResources.Remove_unnecessary_parentheses), AnalyzersResources.ResourceManager, typeof(AnalyzersResources)), + new LocalizableResourceString(nameof(AnalyzersResources.Parentheses_can_be_removed), AnalyzersResources.ResourceManager, typeof(AnalyzersResources)), + isUnnecessary: true) { } @@ -117,7 +110,7 @@ private void AnalyzeSyntax(SyntaxNodeAnalysisContext context) parenthesizedExpression.GetLastToken().GetLocation()); context.ReportDiagnostic(DiagnosticHelper.CreateWithLocationTags( - s_diagnosticDescriptor, + Descriptor, GetDiagnosticSquiggleLocation(parenthesizedExpression, context.CancellationToken), severity, additionalLocations, diff --git a/src/CodeStyle/Core/Analyzers/AbstractFormattingAnalyzer.cs b/src/CodeStyle/Core/Analyzers/AbstractFormattingAnalyzer.cs index dfbdc27beb796..00d7a7121f5c5 100644 --- a/src/CodeStyle/Core/Analyzers/AbstractFormattingAnalyzer.cs +++ b/src/CodeStyle/Core/Analyzers/AbstractFormattingAnalyzer.cs @@ -11,11 +11,12 @@ namespace Microsoft.CodeAnalysis.CodeStyle { internal abstract class AbstractFormattingAnalyzer - : AbstractCodeStyleDiagnosticAnalyzer + : AbstractBuiltInCodeStyleDiagnosticAnalyzer { protected AbstractFormattingAnalyzer() : base( IDEDiagnosticIds.FormattingDiagnosticId, + option: null, new LocalizableResourceString(nameof(CodeStyleResources.Fix_formatting), CodeStyleResources.ResourceManager, typeof(CodeStyleResources)), new LocalizableResourceString(nameof(CodeStyleResources.Fix_formatting), CodeStyleResources.ResourceManager, typeof(CodeStyleResources))) { From e65c66cc47ee44b709ade1cd9bb182681af03691 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Fri, 9 Oct 2020 07:28:40 -0700 Subject: [PATCH 259/295] Disable assertion UI in ServiceHub for debug builds --- .../Services/Host/RemoteHostService.cs | 6 +++ .../Services/Host/ThrowingTraceListener.cs | 49 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 src/Workspaces/Remote/ServiceHub/Services/Host/ThrowingTraceListener.cs diff --git a/src/Workspaces/Remote/ServiceHub/Services/Host/RemoteHostService.cs b/src/Workspaces/Remote/ServiceHub/Services/Host/RemoteHostService.cs index 7577d7cd826bd..f715981f3f5c6 100644 --- a/src/Workspaces/Remote/ServiceHub/Services/Host/RemoteHostService.cs +++ b/src/Workspaces/Remote/ServiceHub/Services/Host/RemoteHostService.cs @@ -54,6 +54,12 @@ static RemoteHostService() // we set up logger here RoslynLogger.SetLogger(new EtwLogger(s_logChecker)); +#if DEBUG + // Make sure debug assertions in ServiceHub result in exceptions instead of the assertion UI + Trace.Listeners.Clear(); + Trace.Listeners.Add(new ThrowingTraceListener()); +#endif + SetNativeDllSearchDirectories(); } diff --git a/src/Workspaces/Remote/ServiceHub/Services/Host/ThrowingTraceListener.cs b/src/Workspaces/Remote/ServiceHub/Services/Host/ThrowingTraceListener.cs new file mode 100644 index 0000000000000..3df706365872a --- /dev/null +++ b/src/Workspaces/Remote/ServiceHub/Services/Host/ThrowingTraceListener.cs @@ -0,0 +1,49 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Diagnostics; + +namespace Microsoft.CodeAnalysis.Remote +{ + internal sealed class ThrowingTraceListener : TraceListener + { + public override void Fail(string message, string detailMessage) + { + throw new InvalidOperationException(message + Environment.NewLine + detailMessage); + } + + public override void Write(object o) + { + } + + public override void Write(object o, string category) + { + } + + public override void Write(string message) + { + } + + public override void Write(string message, string category) + { + } + + public override void WriteLine(object o) + { + } + + public override void WriteLine(object o, string category) + { + } + + public override void WriteLine(string message) + { + } + + public override void WriteLine(string message, string category) + { + } + } +} From 21af0cb32d1670c3676b2be054888ac8e2bb9c72 Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Fri, 9 Oct 2020 09:44:28 -0700 Subject: [PATCH 260/295] Fix build --- src/CodeStyle/Core/Analyzers/AbstractFormattingAnalyzer.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/CodeStyle/Core/Analyzers/AbstractFormattingAnalyzer.cs b/src/CodeStyle/Core/Analyzers/AbstractFormattingAnalyzer.cs index 00d7a7121f5c5..5100ebd0c6b8c 100644 --- a/src/CodeStyle/Core/Analyzers/AbstractFormattingAnalyzer.cs +++ b/src/CodeStyle/Core/Analyzers/AbstractFormattingAnalyzer.cs @@ -22,12 +22,15 @@ protected AbstractFormattingAnalyzer() { } - public override ImmutableArray SupportedDiagnostics + public sealed override ImmutableArray SupportedDiagnostics => ImmutableArray.Create(Descriptor); + public sealed override DiagnosticAnalyzerCategory GetAnalyzerCategory() + => DiagnosticAnalyzerCategory.SyntaxTreeWithoutSemanticsAnalysis; + protected abstract ISyntaxFormattingService SyntaxFormattingService { get; } - protected override void InitializeWorker(AnalysisContext context) + protected sealed override void InitializeWorker(AnalysisContext context) => context.RegisterSyntaxTreeAction(AnalyzeSyntaxTree); private void AnalyzeSyntaxTree(SyntaxTreeAnalysisContext context) From 582a7607fbaefe971ecaae9749e469eac03fcca7 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 9 Oct 2020 11:42:15 -0700 Subject: [PATCH 261/295] Remove C#/VB dependency on inline hints. --- .../Core.Wpf/InlineHints/InlineHintsTag.cs | 66 ++++--------------- .../Core.Wpf/InlineHints/InlineHintsTagger.cs | 9 ++- .../Core/InlineHints/InlineHintDataTag.cs | 14 ++-- .../InlineHintsDataTaggerProvider.cs | 4 +- ...AbstractInlineParameterNameHintsService.cs | 5 +- .../AbstractInlineTypeHintsService.cs | 4 +- .../Core/Portable/InlineHints/InlineHint.cs | 40 +++++++++++ .../Portable/InlineHints/InlineHintHelpers.cs | 64 ++++++++++++++++++ .../Portable/InlineHints/InlineTypeHint.cs | 23 ------- 9 files changed, 134 insertions(+), 95 deletions(-) create mode 100644 src/Features/Core/Portable/InlineHints/InlineHint.cs create mode 100644 src/Features/Core/Portable/InlineHints/InlineHintHelpers.cs delete mode 100644 src/Features/Core/Portable/InlineHints/InlineTypeHint.cs diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs index 34bf85ab3bf6c..e6cab305df58b 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTag.cs @@ -17,6 +17,7 @@ using Microsoft.CodeAnalysis.Editor.Host; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; +using Microsoft.CodeAnalysis.InlineHints; using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; @@ -39,7 +40,7 @@ internal class InlineHintsTag : IntraTextAdornmentTag private readonly IToolTipService _toolTipService; private readonly ITextView _textView; private readonly SnapshotSpan _span; - private readonly SymbolKey? _key; + private readonly InlineHint _hint; private readonly IThreadingContext _threadingContext; private readonly Lazy _streamingPresenter; @@ -47,13 +48,13 @@ private InlineHintsTag( FrameworkElement adornment, ITextView textView, SnapshotSpan span, - SymbolKey? key, + InlineHint hint, InlineHintsTaggerProvider taggerProvider) : base(adornment, removalCallback: null, PositionAffinity.Predecessor) { _textView = textView; _span = span; - _key = key; + _hint = hint; _streamingPresenter = taggerProvider.StreamingFindUsagesPresenter; _threadingContext = taggerProvider.ThreadingContext; _toolTipService = taggerProvider.ToolTipService; @@ -71,68 +72,30 @@ private InlineHintsTag( /// /// The view of the editor /// The span that has the location of the hint - /// The symbolkey associated with each parameter public static InlineHintsTag Create( - ImmutableArray parts, + InlineHint hint, TextFormattingRunProperties format, IWpfTextView textView, SnapshotSpan span, - SymbolKey? key, InlineHintsTaggerProvider taggerProvider, IClassificationFormatMap formatMap, bool classify) { return new InlineHintsTag( - CreateElement(parts, textView, span, format, formatMap, taggerProvider.TypeMap, classify), - textView, span, key, taggerProvider); + CreateElement(hint.DisplayParts, textView, span, format, formatMap, taggerProvider.TypeMap, classify), + textView, span, hint, taggerProvider); } public async Task> CreateDescriptionAsync(CancellationToken cancellationToken) { - if (_key != null) + var document = _span.Snapshot.GetOpenDocumentInCurrentContextWithChanges(); + if (document != null) { - var document = _span.Snapshot.TextBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges(); - - if (document != null) + var taggedText = await _hint.GetDescriptionAsync(document, cancellationToken).ConfigureAwait(false); + if (!taggedText.IsDefaultOrEmpty) { - var compilation = await document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false); - var symbol = _key.Value.Resolve(compilation, cancellationToken: cancellationToken).Symbol; - - if (symbol != null) - { - var textContentBuilder = new List(); - - var workspace = document.Project.Solution.Workspace; - var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); - var symbolDisplayService = document.GetRequiredLanguageService(); - var formatter = document.GetRequiredLanguageService(); - var sections = await symbolDisplayService.ToDescriptionGroupsAsync(workspace, semanticModel, _span.Start, ImmutableArray.Create(symbol), cancellationToken).ConfigureAwait(false); - textContentBuilder.AddRange(sections[SymbolDescriptionGroups.MainDescription]); - if (formatter != null) - { - var documentation = symbol.GetDocumentationParts(semanticModel, _span.Start, formatter, cancellationToken); - - if (documentation.Any()) - { - textContentBuilder.AddLineBreak(); - textContentBuilder.AddRange(documentation); - } - } - - if (sections.TryGetValue(SymbolDescriptionGroups.AnonymousTypes, out var parts)) - { - if (!parts.IsDefaultOrEmpty) - { - textContentBuilder.AddLineBreak(); - textContentBuilder.AddLineBreak(); - textContentBuilder.AddRange(parts); - } - } - - var uiCollection = Implementation.IntelliSense.Helpers.BuildInteractiveTextElements(textContentBuilder.ToImmutableArray(), - document, _threadingContext, _streamingPresenter); - return uiCollection; - } + return Implementation.IntelliSense.Helpers.BuildInteractiveTextElements( + taggedText, document, _threadingContext, _streamingPresenter); } } @@ -140,7 +103,7 @@ public async Task> CreateDescriptionAsync(Cancellati } private static FrameworkElement CreateElement( - ImmutableArray parts, + ImmutableArray taggedTexts, IWpfTextView textView, SnapshotSpan span, TextFormattingRunProperties format, @@ -163,7 +126,6 @@ private static FrameworkElement CreateElement( VerticalAlignment = VerticalAlignment.Center, }; - var taggedTexts = parts.ToTaggedText(); foreach (var taggedText in taggedTexts) { var run = new Run(taggedText.ToVisibleDisplayString(includeLeftToRightMarker: true)); diff --git a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTagger.cs b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTagger.cs index 998031077ae7c..8bcf4daf765f1 100644 --- a/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTagger.cs +++ b/src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTagger.cs @@ -122,19 +122,18 @@ public IEnumerable> GetTags(NormalizedSnapshotSp // Calling into the InlineParameterNameHintsDataTaggerProvider which only responds with the current // active view and disregards and requests for tags not in that view var fullSpan = new SnapshotSpan(snapshot, 0, snapshot.Length); - var dataTags = _tagAggregator.GetTags(new NormalizedSnapshotSpanCollection(fullSpan)); - foreach (var dataTag in dataTags) + var tags = _tagAggregator.GetTags(new NormalizedSnapshotSpanCollection(fullSpan)); + foreach (var tag in tags) { // Gets the associated span from the snapshot span and creates the IntraTextAdornmentTag from the data // tags. Only dealing with the dataTagSpans if the count is 1 because we do not see a multi-buffer case // occuring - var dataTagSpans = dataTag.Span.GetSpans(snapshot); - var textTag = dataTag.Tag; + var dataTagSpans = tag.Span.GetSpans(snapshot); if (dataTagSpans.Count == 1) { var dataTagSpan = dataTagSpans[0]; var parameterHintUITag = InlineHintsTag.Create( - textTag.Parts, Format, _textView, dataTagSpan, textTag.SymbolKey, _taggerProvider, _formatMap, classify); + tag.Tag.Hint, Format, _textView, dataTagSpan, _taggerProvider, _formatMap, classify); _cache.Add(new TagSpan(dataTagSpan, parameterHintUITag)); } diff --git a/src/EditorFeatures/Core/InlineHints/InlineHintDataTag.cs b/src/EditorFeatures/Core/InlineHints/InlineHintDataTag.cs index 0324d32bb28c7..33a2ee3c0bf1c 100644 --- a/src/EditorFeatures/Core/InlineHints/InlineHintDataTag.cs +++ b/src/EditorFeatures/Core/InlineHints/InlineHintDataTag.cs @@ -2,8 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; -using System.Collections.Immutable; +using Microsoft.CodeAnalysis.InlineHints; using Microsoft.VisualStudio.Text.Tagging; namespace Microsoft.CodeAnalysis.Editor.InlineHints @@ -14,16 +13,11 @@ namespace Microsoft.CodeAnalysis.Editor.InlineHints /// internal class InlineHintDataTag : ITag { - public readonly ImmutableArray Parts; - public readonly SymbolKey? SymbolKey; + public readonly InlineHint Hint; - public InlineHintDataTag(ImmutableArray parts, SymbolKey? symbolKey) + public InlineHintDataTag(InlineHint hint) { - if (parts.Length == 0) - throw new ArgumentException("Must have a length greater than 0", nameof(parts)); - - Parts = parts; - SymbolKey = symbolKey; + Hint = hint; } } } diff --git a/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs b/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs index acea7da202f09..0b302afd6c85f 100644 --- a/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs +++ b/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs @@ -102,7 +102,7 @@ private static async Task AddTypeHintsAsync(TaggerContext con { context.AddTag(new TagSpan( new SnapshotSpan(snapshotSpan.Snapshot, hint.Span.ToSpan()), - new InlineHintDataTag(hint.Parts, hint.SymbolKey))); + new InlineHintDataTag(hint))); } } @@ -120,7 +120,7 @@ private static async Task AddParameterNameHintsAsync(TaggerContext( new SnapshotSpan(snapshotSpan.Snapshot, hint.Span.ToSpan()), - new InlineHintDataTag(hint.Parts, hint.SymbolKey))); + new InlineHintDataTag(hint))); } } } diff --git a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs index 0befce3b479f5..e9e2bf7c71bd2 100644 --- a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs @@ -6,6 +6,7 @@ using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; @@ -84,8 +85,8 @@ void AddHintsIfAppropriate() { result.Add(new InlineHint( new TextSpan(position, 0), - ImmutableArray.Create(new SymbolDisplayPart(SymbolDisplayPartKind.Text, parameter, parameter.Name + ":")), - parameter.GetSymbolKey(cancellationToken))); + ImmutableArray.Create(new TaggedText(TextTags.Text, parameter.Name + ":")), + InlineHintHelpers.GetDescriptionFunction(position, parameter.GetSymbolKey()))); } } } diff --git a/src/Features/Core/Portable/InlineHints/AbstractInlineTypeHintsService.cs b/src/Features/Core/Portable/InlineHints/AbstractInlineTypeHintsService.cs index 4020934e1c4b5..13dd151c752d7 100644 --- a/src/Features/Core/Portable/InlineHints/AbstractInlineTypeHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/AbstractInlineTypeHintsService.cs @@ -65,7 +65,9 @@ public async Task> GetInlineHintsAsync( var parts = type.ToDisplayParts(s_minimalTypeStyle); AddParts(anonymousTypeService, finalParts, parts, semanticModel, span.Start); - result.Add(new InlineHint(span, finalParts.ToImmutable(), type.GetSymbolKey(cancellationToken))); + result.Add(new InlineHint( + span, finalParts.ToTaggedText(), + InlineHintHelpers.GetDescriptionFunction(span.Start, type.GetSymbolKey()))); } return result.ToImmutable(); diff --git a/src/Features/Core/Portable/InlineHints/InlineHint.cs b/src/Features/Core/Portable/InlineHints/InlineHint.cs new file mode 100644 index 0000000000000..ae68b3553ec1c --- /dev/null +++ b/src/Features/Core/Portable/InlineHints/InlineHint.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Immutable; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Text; +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.InlineHints +{ + internal readonly struct InlineHint + { + public readonly TextSpan Span; + public readonly ImmutableArray DisplayParts; + private readonly Func>>? _getDescriptionAsync; + + public InlineHint( + TextSpan span, + ImmutableArray displayParts, + Func>>? getDescriptionAsync = null) + { + if (displayParts.Length == 0) + throw new ArgumentException($"{nameof(displayParts)} must be non-empty"); + + Span = span; + DisplayParts = displayParts; + _getDescriptionAsync = getDescriptionAsync; + } + + /// + /// Gets a description for the inline hint, suitable to show when a user hovers over the editor adornment. The + /// will represent the file at the time this hint was created. + /// + public Task> GetDescriptionAsync(Document document, CancellationToken cancellationToken) + => _getDescriptionAsync?.Invoke(document, cancellationToken) ?? SpecializedTasks.EmptyImmutableArray(); + } +} diff --git a/src/Features/Core/Portable/InlineHints/InlineHintHelpers.cs b/src/Features/Core/Portable/InlineHints/InlineHintHelpers.cs new file mode 100644 index 0000000000000..d384e413cfdb8 --- /dev/null +++ b/src/Features/Core/Portable/InlineHints/InlineHintHelpers.cs @@ -0,0 +1,64 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.DocumentationComments; +using Microsoft.CodeAnalysis.LanguageServices; +using Microsoft.CodeAnalysis.Shared.Extensions; + +namespace Microsoft.CodeAnalysis.InlineHints +{ + internal static class InlineHintHelpers + { + public static Func>>? GetDescriptionFunction(int position, SymbolKey symbolKey) + => (document, cancellationToken) => GetDescriptionAsync(document, position, symbolKey, cancellationToken); + + private static async Task> GetDescriptionAsync(Document document, int position, SymbolKey symbolKey, CancellationToken cancellationToken) + { + var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); + + var symbol = symbolKey.Resolve(semanticModel.Compilation, cancellationToken: cancellationToken).Symbol; + if (symbol != null) + { + var workspace = document.Project.Solution.Workspace; + var symbolDisplayService = document.GetRequiredLanguageService(); + + var parts = new List(); + + var groups = await symbolDisplayService.ToDescriptionGroupsAsync( + workspace, semanticModel, position, ImmutableArray.Create(symbol), cancellationToken).ConfigureAwait(false); + + parts.AddRange(groups[SymbolDescriptionGroups.MainDescription]); + + var formatter = document.GetRequiredLanguageService(); + var documentation = symbol.GetDocumentationParts(semanticModel, position, formatter, cancellationToken); + + if (documentation.Any()) + { + parts.AddLineBreak(); + parts.AddRange(documentation); + } + + if (groups.TryGetValue(SymbolDescriptionGroups.AnonymousTypes, out var anonymousTypes)) + { + if (!anonymousTypes.IsDefaultOrEmpty) + { + parts.AddLineBreak(); + parts.AddLineBreak(); + parts.AddRange(anonymousTypes); + } + } + + return parts.ToImmutableArray(); + } + + return default; + } + } +} diff --git a/src/Features/Core/Portable/InlineHints/InlineTypeHint.cs b/src/Features/Core/Portable/InlineHints/InlineTypeHint.cs deleted file mode 100644 index c903d49e84d79..0000000000000 --- a/src/Features/Core/Portable/InlineHints/InlineTypeHint.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Immutable; -using Microsoft.CodeAnalysis.Text; - -namespace Microsoft.CodeAnalysis.InlineHints -{ - internal readonly struct InlineHint - { - public readonly TextSpan Span; - public readonly ImmutableArray Parts; - public readonly SymbolKey? SymbolKey; - - public InlineHint(TextSpan span, ImmutableArray parts, SymbolKey? symbolKey) - { - Span = span; - Parts = parts; - SymbolKey = symbolKey; - } - } -} From 4088137c89f1bd63f3c39cd6be8bdc01336f8b08 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 9 Oct 2020 11:52:23 -0700 Subject: [PATCH 262/295] Update tests --- .../Test2/InlineHints/AbstractInlineHintsTests.vb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/EditorFeatures/Test2/InlineHints/AbstractInlineHintsTests.vb b/src/EditorFeatures/Test2/InlineHints/AbstractInlineHintsTests.vb index 127f51138542a..6e4b3af834a4e 100644 --- a/src/EditorFeatures/Test2/InlineHints/AbstractInlineHintsTests.vb +++ b/src/EditorFeatures/Test2/InlineHints/AbstractInlineHintsTests.vb @@ -25,7 +25,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Dim inlineHints = Await tagService.GetInlineHintsAsync(document, New Text.TextSpan(0, snapshot.Length), New CancellationToken()) Dim producedTags = From hint In inlineHints - Select hint.Parts.GetFullText() + hint.Position.ToString + Select hint.DisplayParts.GetFullText() + hint.Span.Start.ToString ValidateSpans(hostDocument, producedTags) End Using @@ -39,7 +39,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Function(name, span) New With {.Name = name.Key, span}) For Each nameAndSpan In nameAndSpansList.OrderBy(Function(x) x.span.Start) - expectedTags.Add(nameAndSpan.Name + ":" + nameAndSpan.span.Start.ToString()) + expectedTags.Add(nameAndSpan.Name + ":" + nameAndSpan.ToString()) Next AssertEx.Equal(expectedTags, producedTags) @@ -61,7 +61,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Dim typeHints = Await tagService.GetInlineHintsAsync(document, New Text.TextSpan(0, snapshot.Length), New CancellationToken()) Dim producedTags = From hint In typeHints - Select hint.Parts.GetFullText() + ":" + hint.Position.ToString() + Select hint.DisplayParts.GetFullText() + ":" + hint.Span.ToString() ValidateSpans(hostDocument, producedTags) End Using From a41ed35b06f986899baa0a73d368fd914eac31bf Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 9 Oct 2020 12:06:09 -0700 Subject: [PATCH 263/295] Expose a single service for other languages to plug into. --- .../InlineHintsDataTaggerProvider.cs | 30 ++--------------- .../InlineHints/CSharpInlineHintsService.cs | 24 ++++++++++++++ .../CSharpInlineParameterNameHintsService.cs | 1 + .../InlineHints/AbstractInlineHintsService.cs | 33 +++++++++++++++++++ ...AbstractInlineParameterNameHintsService.cs | 1 - .../InlineHints/IInlineHintsService.cs | 18 ++++++++++ .../IInlineParameterNameHintsService.cs | 4 +++ .../InlineHints/IInlineTypeHintsService.cs | 4 +++ .../VisualBasicInlineHintsService.vb | 22 +++++++++++++ ...ualBasicInlineParameterNameHintsService.vb | 2 +- 10 files changed, 109 insertions(+), 30 deletions(-) create mode 100644 src/Features/CSharp/Portable/InlineHints/CSharpInlineHintsService.cs create mode 100644 src/Features/Core/Portable/InlineHints/AbstractInlineHintsService.cs create mode 100644 src/Features/Core/Portable/InlineHints/IInlineHintsService.cs create mode 100644 src/Features/VisualBasic/Portable/InlineHints/VisualBasicInlineHintsService.vb rename src/Features/VisualBasic/Portable/{InlineParameterNameHints => InlineHints}/VisualBasicInlineParameterNameHintsService.vb (98%) diff --git a/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs b/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs index 0b302afd6c85f..d1e4ca9ba81b0 100644 --- a/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs +++ b/src/EditorFeatures/Core/InlineHints/InlineHintsDataTaggerProvider.cs @@ -4,9 +4,7 @@ using System; using System.Collections.Generic; -using System.Collections.Immutable; using System.ComponentModel.Composition; -using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Editor.Shared.Extensions; using Microsoft.CodeAnalysis.Editor.Shared.Tagging; @@ -85,31 +83,8 @@ protected override IEnumerable GetSpansToTag(ITextView textView, I protected override async Task ProduceTagsAsync(TaggerContext context, DocumentSnapshotSpan documentSnapshotSpan, int? caretPosition) { var cancellationToken = context.CancellationToken; - await AddTypeHintsAsync(context, documentSnapshotSpan, cancellationToken).ConfigureAwait(false); - await AddParameterNameHintsAsync(context, documentSnapshotSpan, cancellationToken).ConfigureAwait(false); - } - - private static async Task AddTypeHintsAsync(TaggerContext context, DocumentSnapshotSpan documentSnapshotSpan, CancellationToken cancellationToken) - { - var document = documentSnapshotSpan.Document; - var service = document.GetLanguageService(); - if (service == null) - return; - - var snapshotSpan = documentSnapshotSpan.SnapshotSpan; - var hints = await service.GetInlineHintsAsync(document, snapshotSpan.Span.ToTextSpan(), cancellationToken).ConfigureAwait(false); - foreach (var hint in hints) - { - context.AddTag(new TagSpan( - new SnapshotSpan(snapshotSpan.Snapshot, hint.Span.ToSpan()), - new InlineHintDataTag(hint))); - } - } - - private static async Task AddParameterNameHintsAsync(TaggerContext context, DocumentSnapshotSpan documentSnapshotSpan, CancellationToken cancellationToken) - { var document = documentSnapshotSpan.Document; - var service = document.GetLanguageService(); + var service = document.GetLanguageService(); if (service == null) return; @@ -117,9 +92,8 @@ private static async Task AddParameterNameHintsAsync(TaggerContext( - new SnapshotSpan(snapshotSpan.Snapshot, hint.Span.ToSpan()), + hint.Span.ToSnapshotSpan(snapshotSpan.Snapshot), new InlineHintDataTag(hint))); } } diff --git a/src/Features/CSharp/Portable/InlineHints/CSharpInlineHintsService.cs b/src/Features/CSharp/Portable/InlineHints/CSharpInlineHintsService.cs new file mode 100644 index 0000000000000..27d1eefde90bb --- /dev/null +++ b/src/Features/CSharp/Portable/InlineHints/CSharpInlineHintsService.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Composition; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.InlineHints; + +namespace Microsoft.CodeAnalysis.CSharp.InlineHints +{ + /// + /// The service to locate all positions where inline hints should be placed. + /// + [ExportLanguageService(typeof(IInlineHintsService), LanguageNames.CSharp), Shared] + internal class CSharpInlineHintsService : AbstractInlineHintsService + { + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public CSharpInlineHintsService() + { + } + } +} diff --git a/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs b/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs index 6221036b5fb08..898e982bf8697 100644 --- a/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs +++ b/src/Features/CSharp/Portable/InlineHints/CSharpInlineParameterNameHintsService.cs @@ -13,6 +13,7 @@ namespace Microsoft.CodeAnalysis.CSharp.InlineHints { + /// /// The service to locate the positions in which the adornments should appear /// as well as associate the adornments back to the parameter name diff --git a/src/Features/Core/Portable/InlineHints/AbstractInlineHintsService.cs b/src/Features/Core/Portable/InlineHints/AbstractInlineHintsService.cs new file mode 100644 index 0000000000000..ae8ecbaff3699 --- /dev/null +++ b/src/Features/Core/Portable/InlineHints/AbstractInlineHintsService.cs @@ -0,0 +1,33 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Immutable; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Host; +using Microsoft.CodeAnalysis.Shared.Extensions; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.InlineHints +{ + internal abstract class AbstractInlineHintsService : IInlineHintsService + { + public async Task> GetInlineHintsAsync( + Document document, TextSpan textSpan, CancellationToken cancellationToken) + { + var inlineParameterService = document.GetLanguageService(); + var inlineTypeService = document.GetLanguageService(); + + var parameters = inlineParameterService == null + ? ImmutableArray.Empty + : await inlineParameterService.GetInlineHintsAsync(document, textSpan, cancellationToken).ConfigureAwait(false); + + var types = inlineTypeService == null + ? ImmutableArray.Empty + : await inlineTypeService.GetInlineHintsAsync(document, textSpan, cancellationToken).ConfigureAwait(false); + + return parameters.Concat(types); + } + } +} diff --git a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs index e9e2bf7c71bd2..862027e8e0800 100644 --- a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs @@ -6,7 +6,6 @@ using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; -using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; diff --git a/src/Features/Core/Portable/InlineHints/IInlineHintsService.cs b/src/Features/Core/Portable/InlineHints/IInlineHintsService.cs new file mode 100644 index 0000000000000..4952e0d0e0c4f --- /dev/null +++ b/src/Features/Core/Portable/InlineHints/IInlineHintsService.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Immutable; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Host; +using Microsoft.CodeAnalysis.Shared.Extensions; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.InlineHints +{ + internal interface IInlineHintsService : ILanguageService + { + Task> GetInlineHintsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken); + } +} diff --git a/src/Features/Core/Portable/InlineHints/IInlineParameterNameHintsService.cs b/src/Features/Core/Portable/InlineHints/IInlineParameterNameHintsService.cs index b94f7d6e7e5b3..63cb8906d01f3 100644 --- a/src/Features/Core/Portable/InlineHints/IInlineParameterNameHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/IInlineParameterNameHintsService.cs @@ -10,6 +10,10 @@ namespace Microsoft.CodeAnalysis.InlineHints { + /// + /// Gets inline hints for type locations. This is an internal service only for C# and VB. Use for other languages. + /// internal interface IInlineParameterNameHintsService : ILanguageService { Task> GetInlineHintsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken); diff --git a/src/Features/Core/Portable/InlineHints/IInlineTypeHintsService.cs b/src/Features/Core/Portable/InlineHints/IInlineTypeHintsService.cs index 3860b4dca4ba5..87f6b64be5f13 100644 --- a/src/Features/Core/Portable/InlineHints/IInlineTypeHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/IInlineTypeHintsService.cs @@ -10,6 +10,10 @@ namespace Microsoft.CodeAnalysis.InlineHints { + /// + /// Gets inline hints for type locations. This is an internal service only for C# and VB. Use for other languages. + /// internal interface IInlineTypeHintsService : ILanguageService { Task> GetInlineHintsAsync(Document document, TextSpan textSpan, CancellationToken cancellationToken); diff --git a/src/Features/VisualBasic/Portable/InlineHints/VisualBasicInlineHintsService.vb b/src/Features/VisualBasic/Portable/InlineHints/VisualBasicInlineHintsService.vb new file mode 100644 index 0000000000000..642cb370019ee --- /dev/null +++ b/src/Features/VisualBasic/Portable/InlineHints/VisualBasicInlineHintsService.vb @@ -0,0 +1,22 @@ +' Licensed to the .NET Foundation under one or more agreements. +' The .NET Foundation licenses this file to you under the MIT license. +' See the LICENSE file in the project root for more information. + +Imports System.Composition +Imports Microsoft.CodeAnalysis.Host.Mef +Imports Microsoft.CodeAnalysis.InlineHints + +Namespace Microsoft.CodeAnalysis.VisualBasic.InlineHints + ''' + ''' The service to locate all positions where inline hints should be placed. + ''' + + Friend Class VisualBasicInlineHintsService + Inherits AbstractInlineHintsService + + + + Public Sub New() + End Sub + End Class +End Namespace diff --git a/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb b/src/Features/VisualBasic/Portable/InlineHints/VisualBasicInlineParameterNameHintsService.vb similarity index 98% rename from src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb rename to src/Features/VisualBasic/Portable/InlineHints/VisualBasicInlineParameterNameHintsService.vb index 890cf1b0e9d03..f0a52f3e7853b 100644 --- a/src/Features/VisualBasic/Portable/InlineParameterNameHints/VisualBasicInlineParameterNameHintsService.vb +++ b/src/Features/VisualBasic/Portable/InlineHints/VisualBasicInlineParameterNameHintsService.vb @@ -9,7 +9,7 @@ Imports Microsoft.CodeAnalysis.InlineHints Imports Microsoft.CodeAnalysis.PooledObjects Imports Microsoft.CodeAnalysis.VisualBasic.Syntax -Namespace Microsoft.CodeAnalysis.VisualBasic.InlineParameterNameHints +Namespace Microsoft.CodeAnalysis.VisualBasic.InlineHints Friend Class VisualBasicInlineParameterNameHintsService Inherits AbstractInlineParameterNameHintsService From 8f7eec6d80b5ed32cb30623f5b1af97f89c6852e Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Fri, 9 Oct 2020 10:22:57 -0700 Subject: [PATCH 264/295] Fix failure of ChangedText.Merge to handle multiply-overlapping ranges --- .../Core/Portable/Text/ChangedText.cs | 59 ++++++++++++++----- 1 file changed, 43 insertions(+), 16 deletions(-) diff --git a/src/Compilers/Core/Portable/Text/ChangedText.cs b/src/Compilers/Core/Portable/Text/ChangedText.cs index 87f8db3c9986e..5e617d93b51c2 100644 --- a/src/Compilers/Core/Portable/Text/ChangedText.cs +++ b/src/Compilers/Core/Portable/Text/ChangedText.cs @@ -248,27 +248,42 @@ private static ImmutableArray Merge(ImmutableArray Merge(ImmutableArray oldChange.Span.Start + oldDelta + oldChange.NewLength) @@ -285,6 +301,7 @@ private static ImmutableArray Merge(ImmutableArray Merge(ImmutableArray Merge(ImmutableArray Merge(ImmutableArray Date: Fri, 9 Oct 2020 12:28:55 -0700 Subject: [PATCH 265/295] Ensure that tokens are re-fetched to the position in the reset point in SyntaxParser.Reset (#48393) * Ensure that tokens are refetched to the position in the reset point in SyntaxParser.Reset Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1179569. * Fix spacing * Change number for ERR_UnexpectedVarianceStaticMember --- .../CSharp/Portable/Errors/ErrorCode.cs | 4 +- .../CSharp/Portable/Parser/SyntaxParser.cs | 13 +++- .../Semantics/TopLevelStatementsTests.cs | 73 +++++++++++++++++++ .../DefaultInterfaceImplementationTests.cs | 12 +-- .../UpgradeProject/UpgradeProjectTests.cs | 2 +- .../CSharpUpgradeProjectCodeFixProvider.cs | 2 +- 6 files changed, 95 insertions(+), 11 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs b/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs index 13eca3594545e..7a75337c206c3 100644 --- a/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs +++ b/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs @@ -1916,9 +1916,9 @@ internal enum ErrorCode ERR_InitCannotBeReadonly = 8903, - #endregion diagnostics introduced for C# 9.0 + ERR_UnexpectedVarianceStaticMember = 8904, - ERR_UnexpectedVarianceStaticMember = 9100, + #endregion diagnostics introduced for C# 9.0 // Note: you will need to re-generate compiler code after adding warnings (eng\generate-compiler-code.cmd) } diff --git a/src/Compilers/CSharp/Portable/Parser/SyntaxParser.cs b/src/Compilers/CSharp/Portable/Parser/SyntaxParser.cs index 880b80566efec..2a7d5593540a8 100644 --- a/src/Compilers/CSharp/Portable/Parser/SyntaxParser.cs +++ b/src/Compilers/CSharp/Portable/Parser/SyntaxParser.cs @@ -150,8 +150,19 @@ protected ResetPoint GetResetPoint() protected void Reset(ref ResetPoint point) { - _mode = point.Mode; var offset = point.Position - _firstToken; + Debug.Assert(offset >= 0); + + if (offset >= _tokenCount) + { + // Re-fetch tokens to the position in the reset point + PeekToken(offset - _tokenOffset); + + // Re-calculate new offset in case tokens got shifted to the left while we were peeking. + offset = point.Position - _firstToken; + } + + _mode = point.Mode; Debug.Assert(offset >= 0 && offset < _tokenCount); _tokenOffset = offset; _currentToken = null; diff --git a/src/Compilers/CSharp/Test/Semantic/Semantics/TopLevelStatementsTests.cs b/src/Compilers/CSharp/Test/Semantic/Semantics/TopLevelStatementsTests.cs index 69891681339ac..b95668ae95125 100644 --- a/src/Compilers/CSharp/Test/Semantic/Semantics/TopLevelStatementsTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Semantics/TopLevelStatementsTests.cs @@ -8602,5 +8602,78 @@ public void Span_02() Diagnostic(ErrorCode.ERR_EscapeLocal, "inner").WithArguments("inner").WithLocation(7, 13) ); } + + [Fact] + [WorkItem(1179569, "https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1179569")] + public void Issue1179569() + { + var text1 = +@"Task v0123456789012345678901234567() +{ + Console.Write(""start v0123456789012345678901234567""); + await Task.Delay(2 * 1000); + Console.Write(""end v0123456789012345678901234567""); +} + +Task On01234567890123456() +{ + return v0123456789012345678901234567(); +} + +string + +return Task.WhenAll( + Task.WhenAll(this.c01234567890123456789012345678.Select(v01234567 => On01234567890123456(v01234567))), + Task.WhenAll(this.c01234567890123456789.Select(v01234567 => v01234567.U0123456789012345678901234()))); +"; + + var oldTree = Parse(text: text1, options: TestOptions.RegularDefault); + + var text2 = +@"Task v0123456789012345678901234567() +{ + Console.Write(""start v0123456789012345678901234567""); + await Task.Delay(2 * 1000); + Console.Write(""end v0123456789012345678901234567""); +} + +Task On01234567890123456() +{ + return v0123456789012345678901234567(); +} + +string[ + +return Task.WhenAll( + Task.WhenAll(this.c01234567890123456789012345678.Select(v01234567 => On01234567890123456(v01234567))), + Task.WhenAll(this.c01234567890123456789.Select(v01234567 => v01234567.U0123456789012345678901234()))); +"; + + var newText = Microsoft.CodeAnalysis.Text.StringText.From(text2, System.Text.Encoding.UTF8); + using var lexer = new Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.Lexer(newText, TestOptions.RegularDefault); + using var parser = new Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LanguageParser(lexer, + (CSharpSyntaxNode)oldTree.GetRoot(), new[] { new Microsoft.CodeAnalysis.Text.TextChangeRange(new Microsoft.CodeAnalysis.Text.TextSpan(282, 0), 1) }); + + var compilationUnit = (CompilationUnitSyntax)parser.ParseCompilationUnit().CreateRed(); + var tree = CSharpSyntaxTree.Create(compilationUnit, TestOptions.RegularDefault, encoding: System.Text.Encoding.UTF8); + Assert.Equal(text2, tree.GetText().ToString()); + tree.VerifySource(); + + var fullParseTree = Parse(text: text2, options: TestOptions.RegularDefault); + var nodes1 = tree.GetRoot().DescendantNodesAndTokensAndSelf(descendIntoTrivia: true).ToArray(); + var nodes2 = fullParseTree.GetRoot().DescendantNodesAndTokensAndSelf(descendIntoTrivia: true).ToArray(); + Assert.Equal(nodes1.Length, nodes2.Length); + + for (int i = 0; i < nodes1.Length; i++) + { + var node1 = nodes1[i]; + var node2 = nodes2[i]; + Assert.Equal(node1.RawKind, node2.RawKind); + Assert.Equal(node1.Span, node2.Span); + Assert.Equal(node1.FullSpan, node2.FullSpan); + Assert.Equal(node1.ToString(), node2.ToString()); + Assert.Equal(node1.ToFullString(), node2.ToFullString()); + } + } } } diff --git a/src/Compilers/CSharp/Test/Symbol/Symbols/DefaultInterfaceImplementationTests.cs b/src/Compilers/CSharp/Test/Symbol/Symbols/DefaultInterfaceImplementationTests.cs index 21f4c3e71d015..c52bb7983c56e 100644 --- a/src/Compilers/CSharp/Test/Symbol/Symbols/DefaultInterfaceImplementationTests.cs +++ b/src/Compilers/CSharp/Test/Symbol/Symbols/DefaultInterfaceImplementationTests.cs @@ -59275,10 +59275,10 @@ interface I2 parseOptions: TestOptions.Regular8, targetFramework: TargetFramework.NetStandardLatest); compilation1.VerifyDiagnostics( - // (15,12): error CS9100: Invalid variance: The type parameter 'T1' must be invariantly valid on 'I2.P1' unless language version 'preview' or greater is used. 'T1' is covariant. + // (15,12): error CS8904: Invalid variance: The type parameter 'T1' must be invariantly valid on 'I2.P1' unless language version 'preview' or greater is used. 'T1' is covariant. // static T1 P1 { get; set; } Diagnostic(ErrorCode.ERR_UnexpectedVarianceStaticMember, "T1").WithArguments("I2.P1", "T1", "covariant", "invariantly", "preview").WithLocation(15, 12), - // (16,12): error CS9100: Invalid variance: The type parameter 'T2' must be invariantly valid on 'I2.P2' unless language version 'preview' or greater is used. 'T2' is contravariant. + // (16,12): error CS8904: Invalid variance: The type parameter 'T2' must be invariantly valid on 'I2.P2' unless language version 'preview' or greater is used. 'T2' is contravariant. // static T2 P2 { get; set; } Diagnostic(ErrorCode.ERR_UnexpectedVarianceStaticMember, "T2").WithArguments("I2.P2", "T2", "contravariant", "invariantly", "preview").WithLocation(16, 12) ); @@ -59321,10 +59321,10 @@ interface I2 parseOptions: TestOptions.Regular8, targetFramework: TargetFramework.NetStandardLatest); compilation1.VerifyDiagnostics( - // (13,18): error CS9100: Invalid variance: The type parameter 'T1' must be contravariantly valid on 'I2.M1(T1)' unless language version 'preview' or greater is used. 'T1' is covariant. + // (13,18): error CS8904: Invalid variance: The type parameter 'T1' must be contravariantly valid on 'I2.M1(T1)' unless language version 'preview' or greater is used. 'T1' is covariant. // static T1 M1(T1 x) => x; Diagnostic(ErrorCode.ERR_UnexpectedVarianceStaticMember, "T1").WithArguments("I2.M1(T1)", "T1", "covariant", "contravariantly", "preview").WithLocation(13, 18), - // (14,12): error CS9100: Invalid variance: The type parameter 'T2' must be covariantly valid on 'I2.M2(T2)' unless language version 'preview' or greater is used. 'T2' is contravariant. + // (14,12): error CS8904: Invalid variance: The type parameter 'T2' must be covariantly valid on 'I2.M2(T2)' unless language version 'preview' or greater is used. 'T2' is contravariant. // static T2 M2(T2 x) => x; Diagnostic(ErrorCode.ERR_UnexpectedVarianceStaticMember, "T2").WithArguments("I2.M2(T2)", "T2", "contravariant", "covariantly", "preview").WithLocation(14, 12) ); @@ -59389,10 +59389,10 @@ static T3 Print(T3 x) parseOptions: TestOptions.Regular8, targetFramework: TargetFramework.NetStandardLatest); compilation1.VerifyDiagnostics( - // (24,53): error CS9100: Invalid variance: The type parameter 'T1' must be contravariantly valid on 'I2.E1' unless language version 'preview' or greater is used. 'T1' is covariant. + // (24,53): error CS8904: Invalid variance: The type parameter 'T1' must be contravariantly valid on 'I2.E1' unless language version 'preview' or greater is used. 'T1' is covariant. // static event System.Action> E1; Diagnostic(ErrorCode.ERR_UnexpectedVarianceStaticMember, "E1").WithArguments("I2.E1", "T1", "covariant", "contravariantly", "preview").WithLocation(24, 53), - // (25,53): error CS9100: Invalid variance: The type parameter 'T2' must be covariantly valid on 'I2.E2' unless language version 'preview' or greater is used. 'T2' is contravariant. + // (25,53): error CS8904: Invalid variance: The type parameter 'T2' must be covariantly valid on 'I2.E2' unless language version 'preview' or greater is used. 'T2' is contravariant. // static event System.Action> E2; Diagnostic(ErrorCode.ERR_UnexpectedVarianceStaticMember, "E2").WithArguments("I2.E2", "T2", "contravariant", "covariantly", "preview").WithLocation(25, 53) ); diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/UpgradeProject/UpgradeProjectTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/UpgradeProject/UpgradeProjectTests.cs index cdee72e43129e..fa2c9ec1e8f6d 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/UpgradeProject/UpgradeProjectTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/UpgradeProject/UpgradeProjectTests.cs @@ -989,7 +989,7 @@ public void N() } [Fact] - public async Task UpgradeProjectForVarianceSafetyForStaticInterfaceMembers_CS9100() + public async Task UpgradeProjectForVarianceSafetyForStaticInterfaceMembers_CS8904() { await TestLanguageVersionUpgradedAsync( @" diff --git a/src/Features/CSharp/Portable/UpgradeProject/CSharpUpgradeProjectCodeFixProvider.cs b/src/Features/CSharp/Portable/UpgradeProject/CSharpUpgradeProjectCodeFixProvider.cs index 7fc1d13077aa4..f15b89a345f4f 100644 --- a/src/Features/CSharp/Portable/UpgradeProject/CSharpUpgradeProjectCodeFixProvider.cs +++ b/src/Features/CSharp/Portable/UpgradeProject/CSharpUpgradeProjectCodeFixProvider.cs @@ -47,7 +47,7 @@ public CSharpUpgradeProjectCodeFixProvider() "CS8652", // error CS8652: The feature '' is currently in Preview and *unsupported*. To use Preview features, use the 'preview' language version. "CS8703", // error CS8703: The modifier '{0}' is not valid for this item in C# {1}. Please use language version '{2}' or greater. "CS8706", // error CS8706: '{0}' cannot implement interface member '{1}' in type '{2}' because feature '{3}' is not available in C# {4}. Please use language version '{5}' or greater. - "CS9100", // error CS9100: Invalid variance: The type parameter 'T1' must be contravariantly valid on 'I2.M1(T1)' unless language version 'preview' or greater is used. 'T1' is covariant. + "CS8904", // error CS8904: Invalid variance: The type parameter 'T1' must be contravariantly valid on 'I2.M1(T1)' unless language version 'preview' or greater is used. 'T1' is covariant. }); public override string UpgradeThisProjectResource => CSharpFeaturesResources.Upgrade_this_project_to_csharp_language_version_0; From 35cda3853b2d78aedf5b73965aac6467bd4ac2e4 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 9 Oct 2020 12:46:45 -0700 Subject: [PATCH 266/295] Fix --- .../Test2/InlineHints/AbstractInlineHintsTests.vb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/EditorFeatures/Test2/InlineHints/AbstractInlineHintsTests.vb b/src/EditorFeatures/Test2/InlineHints/AbstractInlineHintsTests.vb index 127f51138542a..7fca9ce729a89 100644 --- a/src/EditorFeatures/Test2/InlineHints/AbstractInlineHintsTests.vb +++ b/src/EditorFeatures/Test2/InlineHints/AbstractInlineHintsTests.vb @@ -25,7 +25,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Dim inlineHints = Await tagService.GetInlineHintsAsync(document, New Text.TextSpan(0, snapshot.Length), New CancellationToken()) Dim producedTags = From hint In inlineHints - Select hint.Parts.GetFullText() + hint.Position.ToString + Select hint.Parts.GetFullText() + hint.Span.ToString ValidateSpans(hostDocument, producedTags) End Using @@ -39,7 +39,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Function(name, span) New With {.Name = name.Key, span}) For Each nameAndSpan In nameAndSpansList.OrderBy(Function(x) x.span.Start) - expectedTags.Add(nameAndSpan.Name + ":" + nameAndSpan.span.Start.ToString()) + expectedTags.Add(nameAndSpan.Name + ":" + nameAndSpan.span.ToString()) Next AssertEx.Equal(expectedTags, producedTags) @@ -61,7 +61,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Dim typeHints = Await tagService.GetInlineHintsAsync(document, New Text.TextSpan(0, snapshot.Length), New CancellationToken()) Dim producedTags = From hint In typeHints - Select hint.Parts.GetFullText() + ":" + hint.Position.ToString() + Select hint.Parts.GetFullText() + ":" + hint.Span.ToString() ValidateSpans(hostDocument, producedTags) End Using From c6b16e1431c42b7b4f1da80409cf1d463a3caed6 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 9 Oct 2020 12:54:09 -0700 Subject: [PATCH 267/295] Fix tests --- .../CSharpInlineParameterNameHintsTests.vb | 38 +++++++++---------- ...isualBasicInlineParameterNameHintsTests.vb | 38 +++++++++---------- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/EditorFeatures/Test2/InlineHints/CSharpInlineParameterNameHintsTests.vb b/src/EditorFeatures/Test2/InlineHints/CSharpInlineParameterNameHintsTests.vb index d54da8061cdd1..340a7e821f067 100644 --- a/src/EditorFeatures/Test2/InlineHints/CSharpInlineParameterNameHintsTests.vb +++ b/src/EditorFeatures/Test2/InlineHints/CSharpInlineParameterNameHintsTests.vb @@ -44,7 +44,7 @@ class A } void Main() { - testMethod({|x:5|}); + testMethod({|x:|}5); } } @@ -68,7 +68,7 @@ class A } void Main() { - testMethod({|x:5|}, {|y:2|}); + testMethod({|x:|}5, {|y:|}2); } } @@ -92,7 +92,7 @@ class A } void Main() { - testMethod({|x:-5|}, {|y:2|}); + testMethod({|x:|}-5, {|y:|}2); } } @@ -116,7 +116,7 @@ class A } void Main() { - testMethod({|x:(int)(double)(int)5.5|}, {|y:2|}); + testMethod({|x:|}(int)(double)(int)5.5, {|y:|}2); } } @@ -140,7 +140,7 @@ class A } void Main() { - testMethod({|x:(int)5.5|}, {|y:new object()|}); + testMethod({|x:|}(int)5.5, {|y:|}new object()); } } @@ -164,7 +164,7 @@ class A } void Main() { - testMethod({|x:(int)-5.5|}, {|y:new object()|}); + testMethod({|x:|}(int)-5.5, {|y:|}new object()); } } @@ -188,7 +188,7 @@ class A } void Main() { - testMethod({|x:-(int)5.5|}, {|y:new object()|}); + testMethod({|x:|}-(int)5.5, {|y:|}new object()); } } @@ -240,7 +240,7 @@ class Test static void Main() { D cd1 = new D(C.M1); - cd1({|x:-1|}); + cd1({|x:|}-1); } } @@ -282,7 +282,7 @@ class A public void Main(string[] args) { - UseParams({|list:1|}, 2, 3, 4, 5, 6); + UseParams({|list:|}1, 2, 3, 4, 5, 6); } } @@ -300,7 +300,7 @@ class A using System; -[Obsolete({|message:"test"|})] +[Obsolete({|message:|}"test")] class Foo { @@ -327,7 +327,7 @@ class A } void Main() { - testMethod({|x:-(int)5.5|},); + testMethod({|x:|}-(int)5.5,); } } @@ -351,7 +351,7 @@ class A } void Main() { - testMethod({|x:$""|}); + testMethod({|x:|}$""); } } @@ -369,7 +369,7 @@ class A record Base(int Alice, int Bob); -record Derived(int Other) : Base({|Alice:2|}, {|Bob:2|}); +record Derived(int Other) : Base({|Alice:|}2, {|Bob:|}2); @@ -390,7 +390,7 @@ class Base } class Derived : Base { - public Derived() : base({|paramName:20|}) {} + public Derived() : base({|paramName:|}20) {} } @@ -464,7 +464,7 @@ class A void Main() { - EnableLogging({|value:"IO"|}); + EnableLogging({|value:|}"IO"); } } @@ -489,7 +489,7 @@ class A void Main() { - DisableLogging({|value:"IO"|}); + DisableLogging({|value:|}"IO"); } } @@ -539,7 +539,7 @@ class A void Main() { - SetClassification({|values:"IO"|}); + SetClassification({|values:|}"IO"); } } @@ -589,7 +589,7 @@ class A void Main() { - Goo({|objA:1|}, {|objB:2|}, {|nonobjC:3|}); + Goo({|objA:|}1, {|objB:|}2, {|nonobjC:|}3); } } @@ -639,7 +639,7 @@ class A void Main() { - Goo({|obj1:1|}, {|obj2:2|}, {|nonobj3:3|}); + Goo({|obj1:|}1, {|obj2:|}2, {|nonobj3:|}3); } } diff --git a/src/EditorFeatures/Test2/InlineHints/VisualBasicInlineParameterNameHintsTests.vb b/src/EditorFeatures/Test2/InlineHints/VisualBasicInlineParameterNameHintsTests.vb index f499754d9c4e0..2bc85485d97ec 100644 --- a/src/EditorFeatures/Test2/InlineHints/VisualBasicInlineParameterNameHintsTests.vb +++ b/src/EditorFeatures/Test2/InlineHints/VisualBasicInlineParameterNameHintsTests.vb @@ -36,7 +36,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Class Foo Sub Main(args As String()) - TestMethod({|x:5|}) + TestMethod({|x:|}5) End Sub Sub TestMethod(x As Integer) @@ -58,7 +58,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Class Foo Sub Main(args As String()) - TestMethod({|x:5|}, {|y:2.2|}) + TestMethod({|x:|}5, {|y:|}2.2) End Sub Sub TestMethod(x As Integer, y As Double) @@ -80,7 +80,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Class Foo Sub Main(args As String()) - TestMethod({|x:-5|}, {|y:2.2|}) + TestMethod({|x:|}-5, {|y:|}2.2) End Sub Sub TestMethod(x As Integer, y As Double) @@ -102,7 +102,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Class Foo Sub Main(args As String()) - TestMethod({|x:CInt(5.5)|}, {|y:2.2|}) + TestMethod({|x:|}CInt(5.5), {|y:|}2.2) End Sub Sub TestMethod(x As Integer, y As Double) @@ -124,7 +124,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Class Foo Sub Main(args As String()) - TestMethod({|x:CType(5.5, Integer)|}, {|y:2.2|}) + TestMethod({|x:|}CType(5.5, Integer), {|y:|}2.2) End Sub Sub TestMethod(x As Integer, y As Double) @@ -150,7 +150,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints End Sub Public Sub Main() - test({|x:TryCast(New Object(), String)|}) + test({|x:|}TryCast(New Object(), String)) End Sub End Class @@ -172,7 +172,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints End Sub Public Sub Main() - test({|x:DirectCast(New Object(), String)|}) + test({|x:|}DirectCast(New Object(), String)) End Sub End Class @@ -190,7 +190,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Class Foo Sub Main(args As String()) - TestMethod({|x:CInt(-5.5)|}, {|y:2.2|}) + TestMethod({|x:|}CInt(-5.5), {|y:|}2.2) End Sub Sub TestMethod(x As Integer, y As Double) @@ -212,7 +212,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Class Foo Sub Main(args As String()) - TestMethod({|x:CInt(-5.5)|}, {|y:2.2|}, {|obj:New Object()|}) + TestMethod({|x:|}CInt(-5.5), {|y:|}2.2, {|obj:|}New Object()) End Sub Sub TestMethod(x As Integer, y As Double, obj As Object) @@ -258,7 +258,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Public Delegate Sub TestDelegate(ByVal str As String) Public Sub TestTheDelegate(ByVal test As TestDelegate) - test({|str:"Test"|}) + test({|str:|}"Test") End Sub End Class @@ -280,7 +280,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints End Sub Public Sub Main() - UseParams({|args:1|}, 2, 3, 4, 5) + UseParams({|args:|}1, 2, 3, 4, 5) End Sub End Class @@ -296,7 +296,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints - <Obsolete({|message:"test"|})> + <Obsolete({|message:|}"test")> Public Class Foo Sub TestMethod() @@ -317,7 +317,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Class Foo Sub Main(args As String()) - TestMethod({|x:5|},) + TestMethod({|x:|}5,) End Sub Sub TestMethod(x As Integer, y As Double) @@ -339,7 +339,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.InlineHints Class Foo Sub Main(args As String()) - TestMethod({|x:$""|}) + TestMethod({|x:|}$"") End Sub Sub TestMethod(x As String) @@ -409,7 +409,7 @@ class A end sub sub Main() - EnableLogging({|value:"IO"|}) + EnableLogging({|value:|}"IO") end sub end class @@ -431,7 +431,7 @@ class A end sub sub Main() - DisableLogging({|value:"IO"|}) + DisableLogging({|value:|}"IO") end sub end class @@ -475,7 +475,7 @@ class A end sub sub Main() - SetClassification({|values:"IO"|}) + SetClassification({|values:|}"IO") end sub end class @@ -519,7 +519,7 @@ class A end sub sub Main() - Goo({|objA:1|}, {|objB:2|}, {|nonobjC:3|}) + Goo({|objA:|}1, {|objB:|}2, {|nonobjC:|}3) end sub end class @@ -563,7 +563,7 @@ class A end sub sub Main() - Goo({|obj1:1|}, {|obj2:2|}, {|nonobj3:3|}) + Goo({|obj1:|}1, {|obj2:|}2, {|nonobj3:|}3) end sub end class From 428d82f9d86fcece5289195b6fb8f9f982a34636 Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Fri, 9 Oct 2020 13:00:03 -0700 Subject: [PATCH 268/295] Fix tests --- .../IDEDiagnosticIDConfigurationTests.cs | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/EditorFeatures/Test/Diagnostics/IDEDiagnosticIDConfigurationTests.cs b/src/EditorFeatures/Test/Diagnostics/IDEDiagnosticIDConfigurationTests.cs index ae25354ec66bb..ee3e1a24a96bd 100644 --- a/src/EditorFeatures/Test/Diagnostics/IDEDiagnosticIDConfigurationTests.cs +++ b/src/EditorFeatures/Test/Diagnostics/IDEDiagnosticIDConfigurationTests.cs @@ -833,8 +833,17 @@ No editorconfig based code style option # IDE0046, PreferConditionalExpressionOverReturn dotnet_style_prefer_conditional_expression_over_return = true:silent -# IDE0047 -No editorconfig based code style option +# IDE0047, ArithmeticBinaryParentheses +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent + +# IDE0047, OtherBinaryParentheses +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent + +# IDE0047, OtherParentheses +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent + +# IDE0047, RelationalBinaryParentheses +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent # IDE0048, ArithmeticBinaryParentheses dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent @@ -1066,8 +1075,17 @@ No editorconfig based code style option # IDE0046, PreferConditionalExpressionOverReturn dotnet_style_prefer_conditional_expression_over_return = true:silent -# IDE0047 -No editorconfig based code style option +# IDE0047, ArithmeticBinaryParentheses +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent + +# IDE0047, OtherBinaryParentheses +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent + +# IDE0047, OtherParentheses +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent + +# IDE0047, RelationalBinaryParentheses +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent # IDE0048, ArithmeticBinaryParentheses dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent From a92505ed7c6fcf534f4ce2095164e0f5cd1a5617 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Fri, 9 Oct 2020 15:24:07 -0700 Subject: [PATCH 269/295] Fix failure to merge overlapping ranges --- .../CodeAnalysisTest/Text/TextChangeTests.cs | 28 +++++++++++++++++++ .../Core/Portable/Text/ChangedText.cs | 13 +++++++-- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/src/Compilers/Core/CodeAnalysisTest/Text/TextChangeTests.cs b/src/Compilers/Core/CodeAnalysisTest/Text/TextChangeTests.cs index e93487499d966..1ef73c4ec509d 100644 --- a/src/Compilers/Core/CodeAnalysisTest/Text/TextChangeTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/Text/TextChangeTests.cs @@ -880,6 +880,34 @@ public void TestMergeChanges_NoMiddleMan() Assert.Equal("o World", changes[0].NewText); } + [Fact] + public void TestMergeChanges_IntegrationTestCase1() + { + var oldChanges = ImmutableArray.Create( + new TextChangeRange(new TextSpan(919, 10), 466), + new TextChangeRange(new TextSpan(936, 33), 29), + new TextChangeRange(new TextSpan(1098, 0), 70), + new TextChangeRange(new TextSpan(1125, 4), 34), + new TextChangeRange(new TextSpan(1138, 0), 47)); + var newChanges = ImmutableArray.Create( + new TextChangeRange(new TextSpan(997, 0), 2), + new TextChangeRange(new TextSpan(1414, 0), 2), + new TextChangeRange(new TextSpan(1419, 0), 2), + new TextChangeRange(new TextSpan(1671, 5), 5), + new TextChangeRange(new TextSpan(1681, 0), 4)); + + var merged = ChangedText.TestAccessor.Merge(oldChanges, newChanges); + + var expected = ImmutableArray.Create( + new TextChangeRange(new TextSpan(919, 10), 468), + new TextChangeRange(new TextSpan(936, 33), 33), + new TextChangeRange(new TextSpan(1098, 0), 70), + new TextChangeRange(new TextSpan(1125, 4), 34), + new TextChangeRange(new TextSpan(1134, 0), 4), + new TextChangeRange(new TextSpan(1138, 0), 47)); + Assert.Equal(expected, merged); + } + private SourceText GetChangesWithoutMiddle( SourceText original, Func fnChange1, diff --git a/src/Compilers/Core/Portable/Text/ChangedText.cs b/src/Compilers/Core/Portable/Text/ChangedText.cs index 5e617d93b51c2..d85d25992c184 100644 --- a/src/Compilers/Core/Portable/Text/ChangedText.cs +++ b/src/Compilers/Core/Portable/Text/ChangedText.cs @@ -339,10 +339,11 @@ private static ImmutableArray Merge(ImmutableArray Merge(ImmutableArray oldChanges, ImmutableArray newChanges) + => ChangedText.Merge(oldChanges, newChanges); + } } } From dc7b96524dd6ba6d110dd6e26b75b29eb6a26754 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Fri, 9 Oct 2020 15:51:24 -0700 Subject: [PATCH 270/295] Suppress assertion failures coming from ChangedText.Merge See #47234 --- .../ServiceHub/Services/Host/ThrowingTraceListener.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Workspaces/Remote/ServiceHub/Services/Host/ThrowingTraceListener.cs b/src/Workspaces/Remote/ServiceHub/Services/Host/ThrowingTraceListener.cs index 3df706365872a..33ccb37e77a88 100644 --- a/src/Workspaces/Remote/ServiceHub/Services/Host/ThrowingTraceListener.cs +++ b/src/Workspaces/Remote/ServiceHub/Services/Host/ThrowingTraceListener.cs @@ -11,6 +11,16 @@ internal sealed class ThrowingTraceListener : TraceListener { public override void Fail(string message, string detailMessage) { + var stackTrace = new StackTrace(); + foreach (var frame in stackTrace.GetFrames()) + { + if (frame.GetMethod()?.DeclaringType?.FullName?.Contains("ChangedText") ?? false) + { + // 😢 https://github.com/dotnet/roslyn/issues/47234 + return; + } + } + throw new InvalidOperationException(message + Environment.NewLine + detailMessage); } From a6c6908d70413a43be9b29e53531faced216edc4 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 9 Oct 2020 15:57:01 -0700 Subject: [PATCH 271/295] Update PreRelease version for Preview 5 --- eng/Versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index 9a535d4a8f89f..d32f03963551b 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -8,7 +8,7 @@ 3 8 0 - 4 + 5 $(MajorVersion).$(MinorVersion).$(PatchVersion) @@ -57,7 +57,6 @@ 5.7.0 16.7.50 -