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

ContextProvider resolve handler improvements #13296

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

Conversation

lukka
Copy link
Member

@lukka lukka commented Feb 20, 2025

Changes:
-new feature: add traits for C++ lang version
-telemetry: fix cancellation events.
-telemetry: more diag event for registration failure.

-telemetry: fix cancellation events.
-telemetry: more diag event for registration failure.
@lukka lukka marked this pull request as ready for review February 20, 2025 18:16
@lukka lukka requested a review from a team as a code owner February 20, 2025 18:16
@lukka lukka changed the title ContextProvider resolved improvements ContextProvider resolve handler improvements Feb 20, 2025
const telemetryMetrics: Record<string, number> = {};
const projectContextPromise = (async (): Promise<ProjectContext | undefined> => {
const getProjectContextStartTime = performance.now();
const projectContext = await getProjectContext(docUri, { flags: {} }, telemetryProperties, telemetryMetrics);
Copy link
Member

Choose a reason for hiding this comment

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

I think it's fine to pass a hardcoded flags: {} here, but just wanted to double check that 1) that will pass only the language standard trait and 2) we don't expect to need to experiment with any other configuration for traits before we ship a new pre-release version. I believe both of those conditions are true.

// A new incoming snippet request from Copilot arrived and this request
// is now obsolete, give up immediately with no exception.
if (e instanceof InternalCancellationError) {
logMessage += `, (internal cancellation) `;
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI, there's a pre-existing issue with the various logMessage's ending with : or : and then having a , (internal cancellation) or other , message added. Ideally, it would not log :, or : ,

@@ -581,7 +582,7 @@ interface FilesEncodingChanged {
export interface CopilotCompletionContextResult {
requestId: number;
isResultMissing: boolean;
snippets: SnippetEntry[];
snippets: SupportedContextItem[];
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm seeing the actual data still be a SnippetEntry. Does that matter? i.e. the SupportedContextItem doesn't seem to have entries like startLine.

export interface SnippetEntry {
    uri: string;
    value: string;
    startLine: number;
    endLine: number;
    importance: number;
}

Copy link
Contributor

@sean-mcmanus sean-mcmanus left a comment

Choose a reason for hiding this comment

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

Should SnippetEntry be removed? It doesn't appear to be referenced anymore?

@kuchungmsft
Copy link
Contributor

FYI, I have a PR opened to clean up the compiler argument traits, which may impact this PR, see #13278.

@sean-mcmanus
Copy link
Contributor

FYI, I have a PR opened to clean up the compiler argument traits, which may impact this PR, see #13278.

Should your PR get checked in first, right?

const telemetryMetrics: Record<string, number> = {};
const projectContextPromise = (async (): Promise<ProjectContext | undefined> => {
const getProjectContextStartTime = performance.now();
const projectContext = await getProjectContext(docUri, { flags: {} }, telemetryProperties, telemetryMetrics);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be cached? It seems strange to re-request this on every completion. Wasn't the previous related files version cached for like 2 minutes or something like that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Pull Request
Development

Successfully merging this pull request may close these issues.

4 participants