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 fileUri #1672

Merged
merged 2 commits into from
Nov 10, 2023
Merged

add fileUri #1672

merged 2 commits into from
Nov 10, 2023

Conversation

abeatrix
Copy link
Contributor

@abeatrix abeatrix commented Nov 7, 2023

Test plan

@abeatrix abeatrix changed the base branch from main to dantup/codyignore November 7, 2023 16:38
@abeatrix abeatrix requested a review from DanTup November 7, 2023 16:43
Comment on lines +43 to +46
// Skip embeddings results as they should be filtered when it was indexed
if (message.file.source === 'embeddings') {
continue
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Will embeddings have fileUri at all? If not (if it's made a rule that fileUri is only ever set if it's absolute) then the if condition above might handle this?

@@ -9,6 +11,9 @@ export type ContextFileSource = 'embeddings'

export interface ContextFile {
fileName: string

fileUri?: URI
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we should just call this uri? In future, maybe documents aren't all from the file system with a file path (VS Code supports various schemes and workspaces without files), so it might be less to change later even if today they're all file:// URIs?

// return early if the file is on ignore list
if (isCodyIgnoredFile(match.fileName)) {
// TODO: makes sure fileUri is included for all context snippets
if (match.fileUri?.fsPath && isCodyIgnoredFile(match.fileUri?.fsPath)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I also wonder if we should make isCodyIgnoredFile take a URI? 🤔

One one hand, it's harder to pass a relative path (it's probably more obvious that a file URI should be absolute than a path), but on the other hand you're less likely to pass a non-file URI this way (and the implementation would have to throw for non-file URIs for now if we accepted URIs).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea I like this idea a lot. It's much clear than passing in a string that could be anything and much less confusing for the caller and the users! Will update it first thing tomorrow!

@@ -37,7 +38,7 @@ export class AgentEditor implements Editor {
if (this.agent.workspace.activeDocumentFilePath === null) {
return undefined
}
if (isCodyIgnoredFile(this.agent.workspace.activeDocumentFilePath)) {
if (isCodyIgnoredFile(URI.parse(this.agent.workspace.activeDocumentFilePath))) {
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 these will need to be URI.file() to work on Windows.

I'll merge this into my branch and fix up there and see what the tests are like (it might also be easier than having so many layers or PRs 😄)

@DanTup DanTup marked this pull request as ready for review November 10, 2023 10:44
@DanTup DanTup merged commit 1192f0c into dantup/codyignore Nov 10, 2023
13 of 25 checks passed
@DanTup DanTup deleted the bee/danny-codyignore branch November 10, 2023 10:44
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.

None yet

2 participants