Skip to content

Commit 07aabd6

Browse files
authored
speed up loading the context commands (#12)
1 parent 777f04e commit 07aabd6

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

packages/core/src/amazonq/lsp/lspClient.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import { CodeWhispererSettings } from '../../codewhisperer/util/codewhispererSet
4040
import { fs } from '../../shared/fs/fs'
4141
import { getLogger } from '../../shared/logger/logger'
4242
import globals from '../../shared/extensionGlobals'
43-
import { sleep, waitUntil } from '../../shared/utilities/timeoutUtils'
43+
import { waitUntil } from '../../shared/utilities/timeoutUtils'
4444

4545
const localize = nls.loadMessageBundle()
4646

@@ -225,13 +225,6 @@ export class LspClient {
225225
async waitUntilReady() {
226226
return waitUntil(
227227
async () => {
228-
for (let i = 0; i < 5; i++) {
229-
if (this.client !== undefined) {
230-
break
231-
} else {
232-
await sleep(5_000)
233-
}
234-
}
235228
if (this.client === undefined) {
236229
return false
237230
}

packages/core/src/amazonq/lsp/lspController.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { ToolkitError } from '../../shared/errors'
2424
import { isWeb } from '../../shared/extensionGlobals'
2525
import { getUserAgent } from '../../shared/telemetry/util'
2626
import { isAmazonInternalOs } from '../../shared/vscode/env'
27+
import { sleep } from '../../shared/utilities/timeoutUtils'
2728

2829
export interface Chunk {
2930
readonly filePath: string
@@ -399,7 +400,8 @@ export class LspController {
399400
try {
400401
await activateLsp(context)
401402
getLogger().info('LspController: LSP activated')
402-
void LspController.instance.buildIndex(buildIndexConfig)
403+
await vscode.commands.executeCommand(`aws.amazonq.updateContextCommandItems`)
404+
await sleep(5_000).then(void LspController.instance.buildIndex(buildIndexConfig))
403405
// log the LSP server CPU and Memory usage per 30 minutes.
404406
globals.clock.setInterval(
405407
async () => {

0 commit comments

Comments
 (0)