Skip to content

feat: enable inline project context in suggestion requests #983

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

Merged
merged 3 commits into from
Apr 18, 2025

Conversation

nborges-aws
Copy link
Contributor

Problem

Supplemental Context included in suggestions requests currently does not include inline project context

Solution

Port over vscode toolkit implementation to include project context in supplemental context sent in suggestions request. Leverages vector library and local project context addition to the language server component.

Note: This code is reliant on PR #982 re-enabling the localProjectContextController's ability to find the vector library.

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@nborges-aws nborges-aws requested a review from a team as a code owner April 16, 2025 21:44
@nborges-aws nborges-aws force-pushed the nickdb/inlineCompletionLocalContext branch from d5ccc9a to d06dee8 Compare April 17, 2025 15:05
}

const controller = LocalProjectContextController.getInstance()
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we ever setInstance()? I couldn't find any code initializing the singleton.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think I found it :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The instance should be initialized on start up, but I should defensively check the instance exists for extra safety in case of failures. I'll make this change.

const supplementalContextConfig = getSupplementalContextConfig(document.languageId)

if (supplementalContextConfig === undefined) {
return supplementalContextConfig
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this intentionally returning undefined?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Undefined is indeed intentional here. The caller of this method returns undefined as well if there is no context result.

return supplementalContextConfig
}

if (supplementalContextConfig === 'OpenTabs_BM25') {
Copy link
Contributor

@kmile kmile Apr 17, 2025

Choose a reason for hiding this comment

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

This never happens? See

return isCrossFileSupported(languageId) ? 'codemap' : undefined

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, getSupplementalContextConfig should be enhanced to return different strategies once the others are implemented (others are currently no-ops), which is what this conditional was targeting. I'll remove as its unreachable in the short term.

@nborges-aws nborges-aws force-pushed the nickdb/inlineCompletionLocalContext branch from d06dee8 to 4e881e2 Compare April 18, 2025 00:31
@nborges-aws nborges-aws merged commit 501d3fe into main Apr 18, 2025
6 checks passed
@nborges-aws nborges-aws deleted the nickdb/inlineCompletionLocalContext branch April 18, 2025 14:54
nborges-aws added a commit that referenced this pull request Apr 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants