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

Bump LSP Protocol version #8847

Closed

Conversation

DustinCampbell
Copy link
Member

@DustinCampbell DustinCampbell commented Jun 20, 2023

Roslyn is using a newer version of the LSP Protocol, which results in a MissingMethodException at runtime. This is due to the fact that VS supports loading multiple versions of the LSP Protocol simultaneously. Razor compiled against an earlier version, so the LSP client passed LSP Protocol objects originating from that earlier version. However, when Razor tries to pass one of those objects to Roslyn, which is compiled against a newer version of the LSP Protocol, the type of the object doesn't match what Roslyn expects, since they originate from different versions of the LSP Protocol assembly, both of which are loaded.

This change also accounts for the new InsertReplaceEdit that has been added in this version of the protocol. It's actually due to breaking changes like this that VS supports multiple protocol versions.

@DustinCampbell DustinCampbell requested review from a team as code owners June 20, 2023 18:42
Copy link
Contributor

@allisonchou allisonchou left a comment

Choose a reason for hiding this comment

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

For tracking, I also filed #8829 for us adding support for InsertReplaceEdit

@DustinCampbell DustinCampbell force-pushed the bump-protocol-version branch from 4016557 to 38587cc Compare June 20, 2023 18:58
@@ -100,12 +100,12 @@ internal class DelegatedCompletionItemResolver : CompletionItemResolver
return resolvedCompletionItem;
}

if (resolvedCompletionItem.TextEdit is not null)
if (resolvedCompletionItem.TextEdit is { First: var textEdit })
Copy link
Member

Choose a reason for hiding this comment

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

Will First always be non-null? I ask because elsewhere in the PR you're using TryGetFirst. Is that the difference between a resolved and non-resolved item?

Copy link
Member Author

Choose a reason for hiding this comment

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

In other places, I grabbed your code, which is why it used TryGetFirst(...). I didn't think too hard, but maybe I should. 😄

Copy link
Member

Choose a reason for hiding this comment

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

Oh is this based on my async completion stuff from O#?

Copy link
Member Author

@DustinCampbell DustinCampbell Jun 20, 2023

Choose a reason for hiding this comment

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

Nope. Nothing to do with OmniSharp. I didn't realize that comment was coming from you @333fred. I thought it was coming from @allisonchou, since the two of us are working on this. Sorry to be confusing! I just misread your name. I meant Allison's code. 😄

@DustinCampbell DustinCampbell deleted the bump-protocol-version branch June 20, 2023 22:01
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.

3 participants