Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port new rename UI to release/dev17.2 #59841

Merged
merged 65 commits into from
Mar 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
30a35e1
Split old rename UI into folder and add basic new rename UI
ryzngard Nov 9, 2021
6c87d0a
Update to use an if to leave code compiling instead of pragma. Switch…
ryzngard Nov 11, 2021
450167f
Merge branch 'main' into features/rename_ui
ryzngard Nov 19, 2021
739f45e
Merge pull request #57686 from ryzngard/features/rename_ui
ryzngard Nov 19, 2021
1c07b7f
Merge pull request #58068 from dotnet/main
JoeRobich Dec 2, 2021
ab0af20
Merge pull request #58111 from dotnet/merges/main-to-features/rename_…
dotnet-bot Dec 4, 2021
d48d670
Merge pull request #58118 from dotnet/merges/main-to-features/rename_…
dotnet-bot Dec 5, 2021
6cea3dc
Merge pull request #58124 from dotnet/merges/main-to-features/rename_…
dotnet-bot Dec 6, 2021
225f6cd
Merge pull request #58144 from dotnet/merges/main-to-features/rename_…
dotnet-bot Dec 7, 2021
7b5dd02
Merge pull request #58181 from dotnet/merges/main-to-features/rename_…
dotnet-bot Dec 8, 2021
9a8ebfa
Merge pull request #58207 from dotnet/merges/main-to-features/rename_…
dotnet-bot Dec 9, 2021
87811fd
Merge pull request #58236 from dotnet/merges/main-to-features/rename_…
dotnet-bot Dec 10, 2021
f6416d5
Merge pull request #58266 from dotnet/merges/main-to-features/rename_…
dotnet-bot Dec 11, 2021
3861fa6
Merge pull request #58284 from dotnet/merges/main-to-features/rename_…
dotnet-bot Dec 12, 2021
2e9e63e
Merge pull request #58294 from dotnet/merges/main-to-features/rename_…
dotnet-bot Dec 13, 2021
b0f1a6d
Merge pull request #58314 from dotnet/merges/main-to-features/rename_…
dotnet-bot Dec 14, 2021
2f8a90c
Merge pull request #58334 from dotnet/merges/main-to-features/rename_…
dotnet-bot Dec 15, 2021
5de646e
Merge pull request #58362 from dotnet/merges/main-to-features/rename_…
dotnet-bot Dec 16, 2021
6166298
Merge pull request #58383 from dotnet/merges/main-to-features/rename_…
dotnet-bot Dec 17, 2021
12ca3fc
Merge https://github.com/dotnet/roslyn into features/rename_ui_rework
ryzngard Jan 19, 2022
bac6292
Merge pull request #59201 from ryzngard/features/rename_ui_rework
Feb 2, 2022
4db8861
Add option in feature flags to control which UI is shown (#59238)
ryzngard Feb 3, 2022
7faeb50
Merge pull request #58989 from dotnet/merges/main-to-features/rename_…
dotnet-bot Feb 8, 2022
7912899
Merge branch 'main' into merge/rename_ui_rework
ryzngard Feb 8, 2022
dbca90b
Merge pull request #59372 from ryzngard/merge/rename_ui_rework
Feb 8, 2022
891bbbf
Merge remote-tracking branch 'origin/features/rename_ui_rework' into …
JoeRobich Feb 11, 2022
b5d0d17
Add EditorFeatures.WPF dependency on VisualStudio.Shell
JoeRobich Feb 11, 2022
d3e2815
Use new Inline Session Options
JoeRobich Feb 11, 2022
7805a51
Merge pull request #59400 from dotnet/merges/main-to-features/rename_…
dotnet-bot Feb 12, 2022
e692e87
Merge pull request #59521 from dotnet/merges/main-to-features/rename_…
dotnet-bot Feb 13, 2022
5148c1d
Merge pull request #59527 from dotnet/merges/main-to-features/rename_…
dotnet-bot Feb 14, 2022
717d19f
Merge pull request #59551 from dotnet/merges/main-to-features/rename_…
dotnet-bot Feb 15, 2022
ce6ac71
Merge pull request #59572 from dotnet/merges/main-to-features/rename_…
dotnet-bot Feb 16, 2022
f198b0d
Finalize New Inline Rename UI (#59351)
ryzngard Feb 24, 2022
187975a
Account for new dirty modifier
sharwell Feb 25, 2022
c5faf23
Unify test namespaces
sharwell Feb 25, 2022
98d15dd
Use SVsUIShell instead of DTE
sharwell Feb 25, 2022
8982ab4
Port CSharpGoToImplementation and BasicGoToImplementation to the new …
sharwell Feb 25, 2022
4b837a7
Port CSharpAddMissingReference to the new test harness
sharwell Feb 25, 2022
c97a6f7
Removed navigation target and navigation hint from namespaces
DoctorKrolic Feb 26, 2022
7d853c9
Fixed formatting
DoctorKrolic Feb 27, 2022
4119e5d
Unify our test artifacts directory to upload more stuff on failure
jasonmalinowski Feb 28, 2022
ebac581
Merge pull request #59824 from dotnet/dev/rigibson/snap-17.2p2
RikkiGibson Mar 1, 2022
5138447
Merge pull request #59833 from dotnet/merges/release/dev17.2-to-main
dotnet-bot Mar 1, 2022
4883e4c
Merge pull request #59779 from dotnet/features/rename_ui_rework
ryzngard Mar 1, 2022
1ce9c9b
Adjust checklist for merging new compiler feature (#59816)
jcouv Mar 1, 2022
ec17e2f
Increase single-test timeout to 25 minutes
sharwell Mar 1, 2022
44956a2
Produce specific error for misplaced 'record' keyword (#59622)
jcouv Mar 1, 2022
d07f2b1
Disallow converted string as default argument value (#59806)
jcouv Mar 1, 2022
20c936d
Add feature to fixup code when user transposes 'record' in a declaration
CyrusNajmabadi Feb 18, 2022
602b4c1
Export with name
CyrusNajmabadi Feb 18, 2022
53b9b37
Rename string
CyrusNajmabadi Feb 21, 2022
c06644e
In progress
CyrusNajmabadi Feb 21, 2022
a1dd95c
Simplify trivia handling
CyrusNajmabadi Feb 21, 2022
2f9d843
Remove inaccurate section of doc comment (#59821)
RikkiGibson Mar 1, 2022
b86265f
Don't get nullable slot if property sub-pattern has error (#59813)
jcouv Mar 1, 2022
d254f00
Merge pull request #59783 from sharwell/port-more-tests
sharwell Mar 1, 2022
ce1461d
Produce a specific error for 'enum' as constraint (#59612)
jcouv Mar 1, 2022
4abc3dd
Merge pull request #59852 from dotnet/merges/release/dev17.2-to-main
dotnet-bot Mar 1, 2022
d9261bc
Remove unnecessary components from devcontainer (#59825)
333fred Mar 1, 2022
160a894
Add OmniSharpCompletionService.GetDescriptionAsync (#59782)
tmat Mar 1, 2022
e9b15a1
Merge pull request #59822 from jasonmalinowski/upload-more-test-results
jasonmalinowski Mar 1, 2022
53b34d4
Merge pull request #59652 from CyrusNajmabadi/offerToSwapMisplacedKey…
CyrusNajmabadi Mar 1, 2022
a638290
Merge pull request #59793 from DoctorKrolic/remove-navigation-target-…
CyrusNajmabadi Mar 2, 2022
cacc9eb
Merge pull request #59867 from dotnet/merges/main-to-features/rename_…
dotnet-bot Mar 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,4 @@ FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT}

# Set up machine requirements to build the repo
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends cmake llvm-9 clang-9 \
build-essential python curl git lldb-6.0 liblldb-6.0-dev \
libunwind8 libunwind8-dev gettext libicu-dev liblttng-ust-dev \
libssl-dev libnuma-dev libkrb5-dev zlib1g-dev ninja-build

# Install V8 Engine
SHELL ["/bin/bash", "-c"]

RUN curl -sSL "https://netcorenativeassets.blob.core.windows.net/resource-packages/external/linux/chromium-v8/v8-linux64-rel-8.5.183.zip" -o ./v8.zip \
&& unzip ./v8.zip -d /usr/local/v8 \
&& echo $'#!/usr/bin/env bash\n\
"/usr/local/v8/d8" --snapshot_blob="/usr/local/v8/snapshot_blob.bin" "$@"\n' > /usr/local/bin/v8 \
&& chmod +x /usr/local/bin/v8
&& apt-get -y install --no-install-recommends curl git
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,11 @@ https://github.com/dotnet/roslyn/issues/57750
public S() { Y = 0; } // ok
}
```

7. <a name="7"></a>Before Visual Studio 17.2, the C# compiler would accept incorrect default argument values involving a reference conversion of a string constant, and would emit `null` as the constant value instead of the default value specified in source. In Visual Studio 17.2, this becomes an error. See [roslyn#59806](https://github.com/dotnet/roslyn/pull/59806).

For instance, the following results in an error in 17.2:
```csharp
void M(IEnumerable<char> s = "hello")
```

3 changes: 2 additions & 1 deletion docs/contributing/Compiler Test Plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ This document provides guidance for thinking about language interactions and tes

# General concerns:
- Completeness of the specification as a guide for testing (is the spec complete enough to suggest what the compiler should do in each scenario?)
- Other external documentation
- *Ping* for new breaking changes and general ping for partner teams (Bill, Kathleen, Mads, IDE, Razor)
- Help review external documentation
- Backward and forward compatibility (interoperation with previous and future compilers, each in both directions)
- Error handling/recovery (missing libraries, including missing types in mscorlib; errors in parsing, ambiguous lookup, inaccessible lookup, wrong kind of thing found, instance vs static thing found, wrong type for the context, value vs variable)
- BCL (including mono) and other customer impact
Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<MajorVersion>4</MajorVersion>
<MinorVersion>2</MinorVersion>
<PatchVersion>0</PatchVersion>
<PreReleaseVersionLabel>2</PreReleaseVersionLabel>
<PreReleaseVersionLabel>3</PreReleaseVersionLabel>
<VersionPrefix>$(MajorVersion).$(MinorVersion).$(PatchVersion)</VersionPrefix>
<!--
By default the assembly version in official builds is "$(MajorVersion).$(MinorVersion).0.0".
Expand Down
8 changes: 4 additions & 4 deletions eng/config/PublishData.json
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,9 @@
"version": "4.2.*",
"packageFeeds": "default",
"channels": [],
"vsBranch": "rel/d17.2",
"vsBranch": "main",
"vsMajorVersion": 17,
"insertionTitlePrefix": "[d17.2p1]"
"insertionTitlePrefix": "[d17.2p2]"
},
"main": {
"nugetKind": [
Expand All @@ -234,8 +234,8 @@
"channels": [],
"vsBranch": "main",
"vsMajorVersion": 17,
"insertionCreateDraftPR": false,
"insertionTitlePrefix": "[d17.2p2]"
"insertionCreateDraftPR": true,
"insertionTitlePrefix": "[d17.2p3]"
},
"features/NullableReferenceTypes": {
"nugetKind": "PerBuildPreRelease",
Expand Down
4 changes: 2 additions & 2 deletions eng/pipelines/test-integration-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ steps:
condition: not(succeeded())

- task: PublishBuildArtifacts@1
displayName: Publish Screenshots
displayName: Publish Screenshots and Test Attachments
inputs:
PathtoPublish: '$(Build.SourcesDirectory)\artifacts\bin\Microsoft.VisualStudio.LanguageServices.IntegrationTests\${{ parameters.configuration }}\net472\xUnitResults'
PathtoPublish: '$(Build.SourcesDirectory)\artifacts\bin\Microsoft.VisualStudio.LanguageServices.IntegrationTests\${{ parameters.configuration }}\net472\TestResults'
ArtifactName: '$(System.JobAttempt)-Screenshots ${{ parameters.configuration }} OOP64_${{ parameters.oop64bit }} OOPCoreClr_${{ parameters.oopCoreClr }} LspEditor_${{ parameters.lspEditor }} $(Build.BuildNumber)'
publishLocation: Container
continueOnError: true
Expand Down
4 changes: 1 addition & 3 deletions src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<Compile Include="$(MSBuildThisFileDirectory)SimplifyInterpolation\CSharpSimplifyInterpolationCodeFixProvider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)SimplifyLinqExpression\CSharpSimplifyLinqExpressionCodeFixProvider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)SimplifyPropertyPattern\CSharpSimplifyPropertyPatternCodeFixProvider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)TransposeRecordKeyword\CSharpTransposeRecordKeywordCodeFixProvider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UseCompoundAssignment\CSharpUseCompoundAssignmentCodeFixProvider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs" />
Expand Down Expand Up @@ -79,7 +80,4 @@
<ItemGroup Condition="'$(DefaultLanguageSourceExtension)' != '' AND '$(BuildingInsideVisualStudio)' != 'true'">
<ExpectedCompile Include="$(MSBuildThisFileDirectory)**\*$(DefaultLanguageSourceExtension)" />
</ItemGroup>
<ItemGroup>
<Folder Include="$(MSBuildThisFileDirectory)ConvertNamespace\" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,7 @@
<data name="Place_colon_on_following_line" xml:space="preserve">
<value>Place colon on following line</value>
</data>
<data name="Fix_record_declaration" xml:space="preserve">
<value>Fix_record_declaration</value>
</data>
</root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
// 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.Composition;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Editing;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Shared.Extensions;

namespace Microsoft.CodeAnalysis.CSharp.CodeFixes.TransposeRecordKeyword
{
[ExportCodeFixProvider(LanguageNames.CSharp, Name = PredefinedCodeFixProviderNames.TransposeRecordKeyword), Shared]
internal class CSharpTransposeRecordKeywordCodeFixProvider : SyntaxEditorBasedCodeFixProvider
{
private const string CS9012 = nameof(CS9012); // Unexpected keyword 'record'. Did you mean 'record struct' or 'record class'?

[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public CSharpTransposeRecordKeywordCodeFixProvider()
{
}

public override ImmutableArray<string> FixableDiagnosticIds
=> ImmutableArray.Create(CS9012);

internal override CodeFixCategory CodeFixCategory
=> CodeFixCategory.Compile;

private static bool TryGetRecordDeclaration(
Diagnostic diagnostic, CancellationToken cancellationToken, [NotNullWhen(true)] out RecordDeclarationSyntax? recordDeclaration)
{
recordDeclaration = diagnostic.Location.FindNode(cancellationToken) as RecordDeclarationSyntax;
return recordDeclaration != null;
}

private static bool TryGetTokens(
RecordDeclarationSyntax recordDeclaration,
out SyntaxToken classOrStructKeyword,
out SyntaxToken recordKeyword)
{
recordKeyword = recordDeclaration.Keyword;
if (!recordKeyword.IsMissing)
{
var leadingTrivia = recordKeyword.LeadingTrivia;
var skippedTriviaIndex = leadingTrivia.IndexOf(SyntaxKind.SkippedTokensTrivia);
if (skippedTriviaIndex >= 0)
{
var skippedTrivia = leadingTrivia[skippedTriviaIndex];
var structure = (SkippedTokensTriviaSyntax)skippedTrivia.GetStructure()!;
var tokens = structure.Tokens;
if (tokens.Count == 1)
{
classOrStructKeyword = tokens.Single();
if (classOrStructKeyword.Kind() is SyntaxKind.ClassKeyword or SyntaxKind.StructKeyword)
{
// Because the class/struct keyword is skipped trivia on the record keyword, it will
// not have trivia of it's own. So we need to move the other trivia appropriate trivia
// on the record keyword to it.
var remainingLeadingTrivia = SyntaxFactory.TriviaList(leadingTrivia.Skip(skippedTriviaIndex + 1));
var trailingTriviaTakeUntil = remainingLeadingTrivia.IndexOf(SyntaxKind.EndOfLineTrivia) is >= 0 and var eolIndex
? eolIndex + 1
: remainingLeadingTrivia.Count;

classOrStructKeyword = classOrStructKeyword
.WithLeadingTrivia(SyntaxFactory.TriviaList(remainingLeadingTrivia.Skip(trailingTriviaTakeUntil)))
.WithTrailingTrivia(recordKeyword.TrailingTrivia);
recordKeyword = recordKeyword
.WithLeadingTrivia(leadingTrivia.Take(skippedTriviaIndex))
.WithTrailingTrivia(SyntaxFactory.TriviaList(remainingLeadingTrivia.Take(trailingTriviaTakeUntil)));

return true;
}
}
}
}

classOrStructKeyword = default;
return false;
}

public override Task RegisterCodeFixesAsync(CodeFixContext context)
{
var document = context.Document;
var cancellationToken = context.CancellationToken;

var diagnostic = context.Diagnostics.First();
if (TryGetRecordDeclaration(diagnostic, cancellationToken, out var recordDeclaration) &&
TryGetTokens(recordDeclaration, out _, out _))
{
context.RegisterCodeFix(
new MyCodeAction(c => this.FixAsync(document, diagnostic, c)),
diagnostic);
}

return Task.CompletedTask;
}

protected override Task FixAllAsync(
Document document, ImmutableArray<Diagnostic> diagnostics,
SyntaxEditor editor, CancellationToken cancellationToken)
{
foreach (var diagnostic in diagnostics)
{
if (TryGetRecordDeclaration(diagnostic, cancellationToken, out var recordDeclaration))
{
editor.ReplaceNode(
recordDeclaration,
(current, _) =>
{
var currentRecordDeclaration = (RecordDeclarationSyntax)current;
if (!TryGetTokens(currentRecordDeclaration, out var classOrStructKeyword, out var recordKeyword))
return currentRecordDeclaration;

return currentRecordDeclaration
.WithClassOrStructKeyword(classOrStructKeyword)
.WithKeyword(recordKeyword);
});
}
}

return Task.CompletedTask;
}

private class MyCodeAction : CustomCodeActions.DocumentChangeAction
{
public MyCodeAction(
Func<CancellationToken, Task<Document>> createChangedDocument)
: base(CSharpCodeFixesResources.Fix_record_declaration, createChangedDocument, nameof(CSharpTransposeRecordKeywordCodeFixProvider))
{
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading