-
Notifications
You must be signed in to change notification settings - Fork 331
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
Add capability information to the metamodel #1591
base: main
Are you sure you want to change the base?
Conversation
@@ -25,6 +25,7 @@ export namespace ConfigurationRequest { | |||
export const type = new ProtocolRequestType<ConfigurationParams, LSPAny[], never, void, void>(method); | |||
export type HandlerSignature = RequestHandler<ConfigurationParams, LSPAny[], void>; | |||
export type MiddlewareSignature = (params: ConfigurationParams, token: CancellationToken, next: HandlerSignature) => HandlerResult<LSPAny[], void>; | |||
export const capabilities: { client: 'workspace.configuration'; server: 'workspace' } = { client: 'workspace.configuration', server: 'workspace' }; |
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.
@dbaeumer The spec doesn't mention a server capability for the workspace/configuration
request so I'm unsure about this. Since this is requested by the server it seems like there's no server capability needed here?
@@ -59,6 +59,7 @@ export namespace CallHierarchyPrepareRequest { | |||
export const messageDirection: MessageDirection = MessageDirection.clientToServer; | |||
export const type = new ProtocolRequestType<CallHierarchyPrepareParams, CallHierarchyItem[] | null, never, void, CallHierarchyRegistrationOptions>(method); | |||
export type HandlerSignature = RequestHandler<CallHierarchyPrepareParams, CallHierarchyItem[] | null, void>; | |||
export const capabilities: { client: 'textDocument.callHierarchy'; server: 'callHierarchyProvider' } = { client: 'textDocument.callHierarchy', server: 'callHierarchyProvider' }; |
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.
@dbaeumer Do you think we should add capability information for requests like callHierarchy/incomingCalls
that don't define their own capabilities and instead depend on whether the server supports other methods (in this case textDocument/prepareCallHierarchy
)?
24151f6
to
9dce9a9
Compare
@microsoft-github-policy-service agree |
@MariaSolOs just a heads up. We have house keeping month in Dezember. New features have to wait until next year. |
Thanks for the heads-up. Although this isn't user facing so I wouldn't consider it a new feature per se, I understand. I'll wait until January then! |
@dbaeumer happy new year! Are you available to take a look at this PR? :) |
Yes. Will look into it this week. |
The change looks good to me. The only thing I am wondering is that we have a lot of repetition and if we want to change something we need to use find / replace. Alternatively we could investigate something like this: Current export const capabilities: { client: 'textDocument.selectionRange'; server: 'selectionRangeProvider' } = { client: 'textDocument.selectionRange', server: 'selectionRangeProvider' } New type CM<C extends string, S extends string> = { client: C; server: S };
namespace CM {
export function create<C extends string, S extends string>(client: C, server: S): CM<C, S> {
return { client, server };
}
}
export const capabilities: CM<'textDocument.selectionRange', 'selectionRangeProvider'> = CM.create('textDocument.selectionRange', 'selectionRangeProvider'); Then if we every want to change something we can either do that inside the type definition / or function or at least can use find all references to see where it is used. What do you think? |
That sounds like a good idea. I'll update the PR. |
Hmm @dbaeumer how do you want this solution to handle the cases were only a single capability has been documented? Take the |
We could define the type parameters as |
Yeah the thing is that if we do that I think we would lose the literal typing. But I'll play with it. |
You don't need to invoke the call expression. You need to look at the arguments of the call expression and then take the arguments and use them in the meta model. |
9dce9a9
to
c4dbf7e
Compare
Thank you for the hint. I've updated the code to follow your suggested approach :) |
c4dbf7e
to
7c0bc9b
Compare
Closes microsoft/language-server-protocol#2059.