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

Rybrande/o#upgrade v2 #2439

Merged
merged 21 commits into from
Aug 31, 2020
Merged

Rybrande/o#upgrade v2 #2439

merged 21 commits into from
Aug 31, 2020

Conversation

ryanbrandenburg
Copy link
Contributor

Fixes https://github.com/dotnet/aspnetcore/issues/20320.

This is a huge change with lots to clean up, putting it up early so yall can play with it, but let me know if you find any functional or code-style problems.

NuGet.config Outdated Show resolved Hide resolved
Copy link
Contributor

@ajaybhargavb ajaybhargavb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Nothing major. Some questions and the rest of it is just cleanups.

eng/Build.props Outdated Show resolved Hide resolved
eng/Signing.props Show resolved Hide resolved
// OldVersionLowerBound = "8.0.0.0",
// OldVersionUpperBound = "8.1.0.0",
// NewVersion = "8.1.0.0")]
[assembly: ProvideBindingRedirection(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This definitely isn't ideal. @david-driscoll is this requirement introduced based on a dependency that O# depends on outside of our control?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I've bumped all of Msft.Ext to 3.1

I'm not using any new features so technically they can drop back down to 2.1 if you need.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that would be really helpful for us, otherwise we need this redirect and it might cause big problems.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something we can get access to early? Only asking because it's gonna be an ngen pain to insert this 😄

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this apply to logging as well, or just DI?

Currently we have these:

    <PackageReference Update="Microsoft.Extensions.Logging" Version="3.1.0" />
    <PackageReference Update="Microsoft.Extensions.Logging.Abstractions" Version="3.1.0" />
    <PackageReference Update="Microsoft.Extensions.Logging.Debug" Version="3.1.0" />
    <PackageReference Update="Microsoft.Extensions.Configuration.Abstractions" Version="3.1.0" />
    <PackageReference Update="Microsoft.Extensions.Configuration" Version="3.1.0" />
    <PackageReference Update="Microsoft.Extensions.DependencyInjection" Version="3.1.0" />
    <PackageReference Update="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.0" />

I can drop all or some of them. down to 2.1 or 2.0?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we don't necessarily care about which version they are as long as the dependency graph is coherent. Given we run our language server in VS which is a .NET framework app it relies on a hugeeee set of binding redirects to ensure that every dependency uses the correct version of a dll; however, every time we have to include a binding redirect we essentially restrict what versions of an assembly can exist for other teams because we then binding redirect it to our own. Hope that makes sense 😄

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you hit me up on Teams or Slack I can figure out the best solution.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this works for you guys, heres the proposed change: OmniSharp/csharp-language-server-protocol#342

throw new ArgumentNullException(nameof(documentUri));
}

return documentUri.ToUri().GetAbsoluteOrUNCPath();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is still doing ToUri and creating additional objects, but getting the detection of UNC and absolute paths correct is harder than I think we want to deal with in this PR, to I used extension methods to wrap everything so we can deal with it later.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya that's fine

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DocumentUri should support unc and other paths, it's based off the vscode implementation with a suite of tests. This was important for @TylerLeonhardt .

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test suite was shamelessly pilfered from vscode. And there are some additional ones as well just ensuring it works with various different character types.

If there is one thing I'm an expert of, I'm not an expert of anything (I'm not...) it's converting C# to TypeScript. or TypeScript to C#, lol.

{
if (documentSnapshot == null)
{
throw new ArgumentNullException(nameof(documentSnapshot));
}

if (version < 0)
if (version is null)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We basically already had the null version handling, it was just using -1, so I converted anywhere that handled -1 to use int?

@ryanbrandenburg
Copy link
Contributor Author

🆙📅

@@ -65,9 +66,17 @@ internal class RazorFormattingEndpoint : IDocumentFormattingHandler, IDocumentRa
_logger = loggerFactory.CreateLogger<RazorFormattingEndpoint>();
}

public TextDocumentRegistrationOptions GetRegistrationOptions()
DocumentRangeFormattingRegistrationOptions IRegistration<DocumentRangeFormattingRegistrationOptions>.GetRegistrationOptions()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Access modifiers

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually not allowed because this method is set to only show when the object is accessed as a IRegistration<DocumentRangeFormattingRegistrationOptions>, further modifiers are forbidden.

Copy link
Contributor

@ajaybhargavb ajaybhargavb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@TanayParikh TanayParikh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏 👏 👏 👏 👏

Copy link
Contributor

@NTaylorMullen NTaylorMullen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes mostly because we can't break WTE without more thought

throw new ArgumentNullException(nameof(documentUri));
}

return documentUri.ToUri().GetAbsoluteOrUNCPath();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya that's fine

// OldVersionLowerBound = "8.0.0.0",
// OldVersionUpperBound = "8.1.0.0",
// NewVersion = "8.1.0.0")]
[assembly: ProvideBindingRedirection(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something we can get access to early? Only asking because it's gonna be an ngen pain to insert this 😄

@ryanbrandenburg ryanbrandenburg added the auto-merge Squash merge once all PR checks are complete and reviewers have approved label Aug 29, 2020
@ghost
Copy link

ghost commented Aug 29, 2020

Hello @ryanbrandenburg!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ryanbrandenburg ryanbrandenburg removed the auto-merge Squash merge once all PR checks are complete and reviewers have approved label Aug 31, 2020
@ryanbrandenburg ryanbrandenburg merged commit 6a84cf5 into master Aug 31, 2020
@ryanbrandenburg ryanbrandenburg deleted the rybrande/O#UpgradeV2 branch August 31, 2020 21:48
NTaylorMullen added a commit that referenced this pull request Sep 3, 2020
This reverts commit 6a84cf5.

# Conflicts:
#	src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpFormatter.cs
#	src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpOnTypeFormattingPass.cs
#	src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CodeBlockDirectiveFormattingPass.cs
#	src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DefaultRazorFormattingService.cs
#	src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingContentValidationPass.cs
#	src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingPassBase.cs
#	src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs
#	src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/OnTypeFormattingStructureValidationPass.cs
#	src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Refactoring/RazorComponentRenameEndpoint.cs
#	src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting/FormattingContentValidationPassTest.cs
#	src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting/FormattingLanguageServerClient.cs
#	src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting/FormattingTestBase.cs
#	src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting/OnTypeFormattingStructureValidationPassTest.cs
ghost pushed a commit that referenced this pull request Sep 3, 2020
* Revert "Rybrande/o#upgrade v2 (#2439)"

This reverts commit 6a84cf5.

# Conflicts:
#	src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpFormatter.cs
#	src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpOnTypeFormattingPass.cs
#	src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CodeBlockDirectiveFormattingPass.cs
#	src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DefaultRazorFormattingService.cs
#	src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingContentValidationPass.cs
#	src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingPassBase.cs
#	src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs
#	src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/OnTypeFormattingStructureValidationPass.cs
#	src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Refactoring/RazorComponentRenameEndpoint.cs
#	src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting/FormattingContentValidationPassTest.cs
#	src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting/FormattingLanguageServerClient.cs
#	src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting/FormattingTestBase.cs
#	src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting/OnTypeFormattingStructureValidationPassTest.cs

* Addressed code review comments and commented out all formatting tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade to latest O# LangaugeServer Extension
6 participants