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

Expose Go To Impl and Spell Check to Razor #74978

Merged

Conversation

davidwengier
Copy link
Contributor

@davidwengier davidwengier requested a review from a team September 3, 2024 06:22
@davidwengier davidwengier requested a review from a team as a code owner September 3, 2024 06:22
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Sep 3, 2024
@@ -33,26 +34,32 @@ public FindImplementationsHandler(IGlobalOptionService globalOptions)

public LSP.TextDocumentIdentifier GetTextDocumentIdentifier(LSP.TextDocumentPositionParams request) => request.TextDocument;

public async Task<LSP.Location[]> HandleRequestAsync(LSP.TextDocumentPositionParams request, RequestContext context, CancellationToken cancellationToken)
public Task<LSP.Location[]> HandleRequestAsync(LSP.TextDocumentPositionParams request, RequestContext context, CancellationToken cancellationToken)
Copy link
Member

@maryamariyan maryamariyan Sep 3, 2024

Choose a reason for hiding this comment

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

assuming you intentionally dropped async here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed it would be a compiler warning if I left it in place.

If an async method only has a single await at the end, it is usually better to remove it, and the async modifier, and just return the Task directly. This avoids the creation of a state machine and so gives a slight perf bump. It does however change the call stack for exceptions that might be thrown so I wouldn't say its a hard and fast rule.

{
public readonly record struct SpellCheckSpan(int StartIndex, int Length, VSInternalSpellCheckableRangeKind Kind);

public static async Task<ImmutableArray<SpellCheckSpan>> GetSpellCheckSpansAsync(Document document, CancellationToken cancellationToken)
Copy link
Member

Choose a reason for hiding this comment

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

would it be helpful to include try catch block in the GetSpellCheckSpansAsync method here?

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 for our purposes we're better off letting the exception bubble out of the ExternalAccess layer here, and if necessary then we can handle it in Razor. If we handled the exceptions here it would go through Roslyn's exception reporting and telemetry, which might make it harder to get in front of the right team.

@davidwengier
Copy link
Contributor Author

@dibarbet @JoeRobich strictly speaking with Andrew's approval I could merge this, but that feels a little hollow. Would love a second sign-off :)

@davidwengier davidwengier merged commit 077642f into dotnet:main Sep 4, 2024
25 checks passed
@davidwengier davidwengier deleted the CohostImplemenationAndSpellCheck branch September 4, 2024 04:11
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Sep 4, 2024
davidwengier added a commit to dotnet/razor that referenced this pull request Sep 6, 2024
Needs dotnet/roslyn#74978
Fixes #10695
Part of #9519

Pretty straightforward. A tiny bit of code moved to be shared with Go To
Def, but that's it.
davidwengier added a commit to dotnet/razor that referenced this pull request Sep 6, 2024
@akhera99 akhera99 modified the milestones: Next, 17.12 P3 Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead VSCode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants