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

Add CopilotRelated command #59963

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sandersn
Copy link
Member

Add a command to provide information about a file for copilot.

Associated VSCode PR: (not available yet)

  • I'm not sure what to name this yet. I expect this will be a catch-all command to provide information about a file.
  • I'm also not 100% sure this is going to get all the imports. @andrewbranch I expect you are the best person to ask about that.

@genlu you were interested in seeing this.

Add a command to provide information about a file for copilot.
@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Sep 13, 2024
@typescript-bot
Copy link
Collaborator

Thanks for the PR! It looks like you've changed the TSServer protocol in some way. Please ensure that any changes here don't break consumers of the current TSServer API. For some extra review, we'll ping @sheetalkamat, @mjbvz, @zkat, and @joj for you. Feel free to loop in other consumers/maintainers if necessary.

@@ -3345,6 +3345,12 @@ export function createLanguageService(
);
}

function getImports(fileName: string): readonly string[] {
synchronizeHostData();
Copy link
Member

Choose a reason for hiding this comment

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

If you are using synchronize host data this is not syntax operation. Need to add this to invalidOperationsInPartialSemanticMode

Need to add protocol command to invalidPartialSemanticModeCommands

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know if I need to synchronize host data to call getResolvedModuleFromModuleSpecifier. How can I tell?
(I'm guessing the answer is yes, though.)

Copy link
Member

Choose a reason for hiding this comment

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

If you need to use more than open file , it needs to synchronize data .. that is anything that uses program needs to synchronize host data

@@ -2034,6 +2033,14 @@ export class Session<TMessage = string> implements EventSender {
return this.mapTextChangesToCodeEdits(changes);
}

private getCopilotRelatedInfo(args: protocol.FileRequestArgs): protocol.CopilotRelatedItems {
const { file, languageService } = this.getFileAndLanguageServiceForSyntacticOperation(args);
Copy link
Member

Choose a reason for hiding this comment

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

This doesnt look like syntax operation : need to use const { file, project } = this.getFileAndProject(args);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants