Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
Will-ShaoHua committed Nov 13, 2024
1 parent cca4746 commit 380d12c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 27 deletions.
28 changes: 2 additions & 26 deletions packages/core/src/amazonq/lsp/lspClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,39 +103,15 @@ export class LspClient {
}
}

async queryInlineProjectContext(query: string, path: string) {
async queryInlineProjectContext(query: string, path: string, target: 'default' | 'codemap' | 'bm25') {
try {
getLogger().info('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!')
const request = JSON.stringify({
query: query,
filePath: path,
target: 'default',
target,
})

const repomapRequest = await this.encrypt(
JSON.stringify({
query: query,
filePath: path,
target: 'codemap',
})
)

const bm25Request = await this.encrypt(
JSON.stringify({
query: query,
filePath: path,
target: 'bm25',
})
)

const repomapResponse = await this.client?.sendRequest(QueryInlineProjectContextRequestType, repomapRequest)
getLogger().info(`repomap: ${JSON.stringify(repomapResponse)}`)
const bm25Response = await this.client?.sendRequest(QueryInlineProjectContextRequestType, bm25Request)
getLogger().info(`bm25: ${JSON.stringify(bm25Response)}`)

const encrypted = await this.encrypt(request)
const resp: any = await this.client?.sendRequest(QueryInlineProjectContextRequestType, encrypted)
getLogger().info(`ALL: ${JSON.stringify(resp)}`)
return resp
} catch (e) {
getLogger().error(`LspClient: queryInlineProjectContext error: ${e}`)
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/amazonq/lsp/lspController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,11 @@ export class LspController {

async queryInlineProjectContext(query: string, path: string, target: 'bm25' | 'codemap' | 'default') {
try {
return await LspClient.instance.queryInlineProjectContext(query, path)
return await LspClient.instance.queryInlineProjectContext(query, path, target)
} catch (e) {
if (e instanceof Error) {
getLogger().error(`unexpected error while querying inline project context, e=${e.message}`)
}
return []
}
}
Expand Down

0 comments on commit 380d12c

Please sign in to comment.