-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Add Copilot EA for language server #77047
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
Conversation
...uageServer/ExternalAccess/Copilot/Handler/AbstractCopilotLspServiceDocumentRequestHandler.cs
Outdated
Show resolved
Hide resolved
src/LanguageServer/ExternalAccess/Copilot/Handler/RequestContext.cs
Outdated
Show resolved
Hide resolved
src/LanguageServer/ExternalAccess/Copilot/Handler/RequestContext.cs
Outdated
Show resolved
Hide resolved
| /// <inheritdoc cref="LspRequestContext.GetRequiredDocument()"/> | ||
| internal Document GetRequiredDocument() => context.GetRequiredDocument(); | ||
|
|
||
| internal T GetRequiredService<T>() where T : class => context.GetRequiredService<T>(); |
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.
This feels very broad in exposing everything
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 necessarily opposed to this - they'd still be limited to accessing services that are directly made available by external access (since they have to pass the generic type to this call)
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.
but they have access to the solution. So they can do solution.Services.GetService<T>. So i don't see why we need to broaden the surface area here. We should make EA as minimal as possible. only what is absolutley necessary to expose.
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.
With this we can MEF export services and use them in the language server extension itself, right (like this)? I think it provides more flexibility
966bccf to
55cdd6f
Compare
...uageServer/ExternalAccess/Copilot/Handler/AbstractCopilotLspServiceDocumentRequestHandler.cs
Outdated
Show resolved
Hide resolved
...uageServer/ExternalAccess/Copilot/Handler/AbstractCopilotLspServiceDocumentRequestHandler.cs
Outdated
Show resolved
Hide resolved
src/LanguageServer/ExternalAccess/Copilot/Handler/AbstractCopilotLspServiceRequestHandler.cs
Outdated
Show resolved
Hide resolved
src/LanguageServer/ExternalAccess/Copilot/Handler/RequestContext.cs
Outdated
Show resolved
Hide resolved
| /// <inheritdoc cref="LspRequestContext.GetRequiredDocument()"/> | ||
| internal Document GetRequiredDocument() => context.GetRequiredDocument(); | ||
|
|
||
| internal T GetRequiredService<T>() where T : class => context.GetRequiredService<T>(); |
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 necessarily opposed to this - they'd still be limited to accessing services that are directly made available by external access (since they have to pass the generic type to this call)
...uageServer/ExternalAccess/Copilot/Handler/AbstractCopilotLspServiceDocumentRequestHandler.cs
Outdated
Show resolved
Hide resolved
...uageServer/ExternalAccess/Copilot/Handler/AbstractCopilotLspServiceDocumentRequestHandler.cs
Show resolved
Hide resolved
src/LanguageServer/ExternalAccess/Copilot/Handler/AbstractCopilotLspServiceRequestHandler.cs
Outdated
Show resolved
Hide resolved
src/LanguageServer/ExternalAccess/Copilot/Handler/RequestContext.cs
Outdated
Show resolved
Hide resolved
src/LanguageServer/ExternalAccess/Copilot/LspServices/AbstractCopilotLspService.cs
Outdated
Show resolved
Hide resolved
src/LanguageServer/ExternalAccess/Copilot/LspServices/CopilotLspServices.cs
Outdated
Show resolved
Hide resolved
src/LanguageServer/ExternalAccess/Copilot/LspServices/CopilotMethodAttribute.cs
Outdated
Show resolved
Hide resolved
...LanguageServer/ExternalAccess/Copilot/LspServices/ExportCopilotLspServiceFactoryAttribute.cs
Outdated
Show resolved
Hide resolved
...nguageServer/ExternalAccess/Copilot/LspServices/ExportCopilotStatelessLspServiceAttribute.cs
Outdated
Show resolved
Hide resolved
c3eec79 to
c196fae
Compare
| internal readonly struct CopilotRequestContext(RequestContext context) | ||
| { | ||
| /// <inheritdoc cref="RequestContext.Solution"/> | ||
| public Solution? Solution => context.Solution; |
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.
since we have requireslspsolution this should always be not null (would potentially throw here if context.Solution is null)
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.
| public Solution? Solution => context.Solution; | |
| public Solution Solution => context.Solution ?? throw new InvalidOperationException(); |
You meant something like this?
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.
yup
|
|
||
| namespace Microsoft.CodeAnalysis.LanguageServer.ExternalAccess.Copilot; | ||
|
|
||
| internal abstract class AbstractCopilotLspServiceFactory : ILspServiceFactory |
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.
do you need the factory right now? If not I would avoid exposing it as at some point I may want to remove the factory entirely.
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.
No, I can remove it, included it since I saw compiler-dev-sdk uses it. Just to make sure, I could away use ExportCopilotStatelessLspServiceAttribute to export single instance services in the server, right?
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.
Yup thats right
No description provided.