-
Notifications
You must be signed in to change notification settings - Fork 29.3k
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
TS extension: register call to CopilotRelated with copilot extension #228610
TS extension: register call to CopilotRelated with copilot extension #228610
Conversation
registerRelatedFilesProvider is a new method on the copilot extension. CopilotRelated is a new tsserver command that provides information from tsserver to copilot. (The information is not necessarily copilot-specific, of course.)
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.
sandersn:typescript-relatedfiles-imports
extensions/typescript-language-features/src/typeScriptServiceClientHost.ts
Outdated
Show resolved
Hide resolved
extensions/typescript-language-features/src/typeScriptServiceClientHost.ts
Outdated
Show resolved
Hide resolved
extensions/typescript-language-features/src/typeScriptServiceClientHost.ts
Outdated
Show resolved
Hide resolved
extensions/typescript-language-features/src/typeScriptServiceClientHost.ts
Outdated
Show resolved
Hide resolved
callback: (uri: vscode.Uri) => Promise<{ entries: vscode.Uri[]; traits?: { name: string; value: string }[] }> | ||
): void; | ||
} | undefined; | ||
if (relatedAPI) { |
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.
Does this also need to be gated on the TS server version?
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 expect it to ship in 5.7. Gating it is a good idea. How do I do that? I saw a lot of // @ts-expect-error until ts 5.6
in the code base, accompanied by if (event.body.entries)
kinds of checks. Is that the right 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.
Ah, the language features are gated on API.v560 (for example). Is it OK to add API.v570?
extensions/typescript-language-features/src/typeScriptServiceClientHost.ts
Outdated
Show resolved
Hide resolved
It is now in its own file. Also address other PR comments.
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.
Looking good! Just a few comments. Looks like the call to register
may also be missing
extensions/typescript-language-features/src/languageFeatures/copilotRelated.ts
Outdated
Show resolved
Hide resolved
extensions/typescript-language-features/src/languageFeatures/copilotRelated.ts
Outdated
Show resolved
Hide resolved
The select provided at registration contains the correct list of languages to register for the provider.
My latest commit now has the API that we intend to use in the short- and medium-term. |
registerRelatedFilesProvider is a new method on the copilot extension. CopilotRelated is a new tsserver command that provides information from tsserver to copilot. (The information is not necessarily copilot-specific, of course.)
Depends on microsoft/TypeScript#59963 to be available -- the typescript protocol doesn't include CopilotRelated yet.
Needs a follow-up to update the copilot API: