-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Implement json serialization/deserialization for LSP json messages. Part 2/N #68990
Conversation
Follows the same patterns as the existing library we use. However, while the types are the same, the namespace is different so as to not conflict.
using Microsoft.VisualStudio.Text; | ||
using Microsoft.VisualStudio.Text.Tagging; | ||
using Roslyn.LanguageServer.Protocol; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a lot of fallout from switching from Microsoft.VisualStudio.LanguageServer.Protocol to Roslyn.LanguageServer.Protocol.
=> new Roslyn.Text.Adornments.ClassifiedTextRun(run.ClassificationTypeName, run.Text, run.NavigationAction, run.Tooltip, (Roslyn.Text.Adornments.ClassifiedTextRunStyle)run.Style); | ||
|
||
public static Roslyn.Text.Adornments.ClassifiedTextElement ToLSPElement(this VisualStudio.Text.Adornments.ClassifiedTextElement element) | ||
=> new Roslyn.Text.Adornments.ClassifiedTextElement(element.Runs.Select(r => r.ToLSPRun())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a few helpers for when we have some VS types to convert to LSP types.
@@ -0,0 +1,39 @@ | |||
// Licensed to the .NET Foundation under one or more agreements. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all our own versions of these lsp objects.
pros:
- follows the same approach as MS.VS.LS.Protocol.
- Is binary compatible for our code (modulo updating our namespace).
- Can be tweaked as we see fit on our own schedule
Cons:
- Newtonsoft based.
- May diverge from VS as they add support for things. Will require manual upkeep.
- Large.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be tweaked as we see fit on our own schedule
Razor has the same problem to solve with MS.VS.LS.Protocol. Would you rather us not use these so you are free to modify at will?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to do something here in regards to clasp / this with Razor. currently we basically cannot make any changes to clasp (of which I've wanted to make quite a fiew) without doing a dual insertion. I would like us to avoid more places where we need that, especially because LSP compatibility does not mean binary compat
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
without doing a dual insertion
I would block Razor using these types until we figure out how / if we can share it without dual insertions
I think we should also strongly consider using Karthik / Matteo's generation library for these (though doesn't have to be now). If we're using them,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah. we could potenitally make this a source package or something as well. it truly is just serialization goo.
does Karthik's lib handle all the extension cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though - I would also avoid putting these definitions in clasp. It should probably be a different (source-only) package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would having VS platform owned source package solve the issue we are tying to solve?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@olegtk yes. If the license for those files didn't conflict in some way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't it cause PerfDDRIT regression though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not as a source package. It wouldn't make a new dll. It would literally just me code added to Roslyn. Just maintained in one location.
@arkalyanms @dibarbet @jasonmalinowski . This should hopefully get us licensing clean. This is not my first choice at all. But absent approval and movement on unblocking these dependencies working with our license, this is the most expedient path forward. As we can see, there is literally nothing of interest here. It's all just DataContract + Newtonsoft.Json goop to give us an object model on top of the LSP protocol. |
3fb3596
to
4770338
Compare
also tagging @333fred as this may impact some downstream consumers (but in a way that should be easy to migrate to). |
It seems odd that these are part of the public API of Microsoft.CommonLanguageServerProtocol.Framework, but namespaced with "Roslyn". Additionally, CLaSP was specifically written to avoid direct dependencies on LSP protocol POCOs. I think it would make sense to either move these out into their own/another project, or keep them in CLaSP, but namespace them accordingly (and in future, we could review whether the original design decision makes sense) |
@@ -0,0 +1,59 @@ | |||
<Project> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this supposed to be here?
All this is good feedback. I will say that my #1 goal above all else is to get us first to a clean licensing position. That delivers on our own licensing being sane, and making properly consumable by downstream (as well as abiding by everything we've promised). After getting clean, i think we can update this aggressively to be in a place we want. That includes, but is not limited to:
But this can all come later IMO. |
using System.Collections.Immutable; | ||
using Roslyn.Text.Adornments; | ||
|
||
namespace Roslyn.Text.Adornments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would really like to avoid redefining the VS types if at all possible. Today using the protocol libs as-is, we can make the protocol project only depend on the public definitions by default (add more abstraction around the creation of LSP types).
However if we're using our own definitions I can see using the actual VS LSP library definitions could be hard, especially if we want a VSHover
to be a subclass of an LSP Hover
. The only workaround I can think of is object
types, but that doesn't seem super nice.
Re-defining the vs only types is going to be annoying especially since that is where a lot of the changes go (so keeping in syc could be challenging).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have been asked to hold off on this PR in favor of a holistic solution on the LSP side.
Moving forward. Speedometer showed no issues. |
Follows the same patterns as the existing library we use. However, while the types are the same, the namespace is different so as to not conflict.
Followup to #71141. Draft until that goes in. That PR introduced the types. This PR moves us onto them. We also remove our actual references entirely to the VS libs.
build: https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_build/results?buildId=8820065&view=results
PR: https://dev.azure.com/devdiv/DevDiv/_git/VS/pullrequest/517178