Skip to content

Commit

Permalink
Use new version of symf with expanded query param (#3967)
Browse files Browse the repository at this point in the history
  • Loading branch information
janhartman committed May 10, 2024
1 parent c49642c commit b7364df
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion vscode/src/local-context/download-symf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { logDebug } from '../log'
import { getOSArch } from '../os'
import { captureException } from '../services/sentry/sentry'

const symfVersion = 'v0.0.9'
const symfVersion = 'v0.0.10'

/**
* Get the path to `symf`. If the symf binary is not found, download it.
Expand Down
15 changes: 11 additions & 4 deletions vscode/src/local-context/symf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export class SymfRunner implements IndexedKeywordContextFetcher, vscode.Disposab
return Promise.resolve(
scopeDirs
.filter(isFileURI)
.map(scopeDir => this.getResultsForScopeDir(expandedQuery, scopeDir))
.map(scopeDir => this.getResultsForScopeDir(userQuery, expandedQuery, scopeDir))
)
}

Expand All @@ -124,6 +124,7 @@ export class SymfRunner implements IndexedKeywordContextFetcher, vscode.Disposab
* operation that is best done concurrently with querying and (re)building the index.
*/
private async getResultsForScopeDir(
userQuery: PromptString,
keywordQuery: Promise<string>,
scopeDir: FileURI
): Promise<Result[]> {
Expand All @@ -145,7 +146,7 @@ export class SymfRunner implements IndexedKeywordContextFetcher, vscode.Disposab
indexNotFound = true
return ''
}
return this.unsafeRunQuery(await keywordQuery, scopeDir)
return this.unsafeRunQuery(userQuery, await keywordQuery, scopeDir)
})
if (indexNotFound) {
continue
Expand Down Expand Up @@ -258,7 +259,11 @@ export class SymfRunner implements IndexedKeywordContextFetcher, vscode.Disposab
return lock
}

private async unsafeRunQuery(keywordQuery: string, scopeDir: FileURI): Promise<string> {
private async unsafeRunQuery(
userQuery: PromptString,
keywordQuery: string,
scopeDir: FileURI
): Promise<string> {
const { indexDir } = this.getIndexDir(scopeDir)
const { accessToken, symfPath, serverEndpoint } = await this.getSymfInfo()
try {
Expand All @@ -272,7 +277,9 @@ export class SymfRunner implements IndexedKeywordContextFetcher, vscode.Disposab
scopeDir.fsPath,
'--fmt',
'json',
keywordQuery,
'--expanded-query',
`"${keywordQuery}"`,
`${userQuery}`,
],
{
env: {
Expand Down

0 comments on commit b7364df

Please sign in to comment.