Skip to content

Commit 562128a

Browse files
authored
feat(amazonq): Decouple LSP from vector index creation; start LSP by default (aws#5702)
## Problem Current LSP start is coupled with vector index creation, this should be decoupled. We will be having new releases in the LSP to build some other indexes for everyone very soon ( not computation expensive as vector index), therefore we need to start LSP by default. The vector indexing, as a computational expensive index, will be only enabled if opt-in. ## Solution Decouple LSP from vector index creation; start LSP by default --- <!--- REMINDER: Ensure that your PR meets the guidelines in CONTRIBUTING.md --> License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent d697f44 commit 562128a

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "Start language server by default"
4+
}

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

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ export class LspController {
304304
}
305305

306306
async buildIndex() {
307-
getLogger().info(`LspController: Starting to build vector index of project`)
307+
getLogger().info(`LspController: Starting to build index of project`)
308308
const start = performance.now()
309309
const projPaths = getProjectPaths()
310310
projPaths.sort()
@@ -331,7 +331,7 @@ export class LspController {
331331
false
332332
)
333333
if (resp) {
334-
getLogger().debug(`LspController: Finish building vector index of project`)
334+
getLogger().debug(`LspController: Finish building index of project`)
335335
const usage = await LspClient.instance.getLspServerUsage()
336336
telemetry.amazonq_indexWorkspace.emit({
337337
duration: performance.now() - start,
@@ -343,7 +343,7 @@ export class LspController {
343343
credentialStartUrl: AuthUtil.instance.startUrl,
344344
})
345345
} else {
346-
getLogger().error(`LspController: Failed to build vector index of project`)
346+
getLogger().error(`LspController: Failed to build index of project`)
347347
telemetry.amazonq_indexWorkspace.emit({
348348
duration: performance.now() - start,
349349
result: 'Failed',
@@ -352,7 +352,7 @@ export class LspController {
352352
})
353353
}
354354
} catch (e) {
355-
getLogger().error(`LspController: Failed to build vector index of project`)
355+
getLogger().error(`LspController: Failed to build index of project`)
356356
telemetry.amazonq_indexWorkspace.emit({
357357
duration: performance.now() - start,
358358
result: 'Failed',
@@ -371,20 +371,16 @@ export class LspController {
371371
return
372372
}
373373
setImmediate(async () => {
374-
if (!CodeWhispererSettings.instance.isLocalIndexEnabled()) {
375-
// only download LSP for users who did not turn on this feature
376-
// do not start LSP server
377-
await LspController.instance.tryInstallLsp(context)
378-
return
379-
}
380374
const ok = await LspController.instance.tryInstallLsp(context)
381375
if (!ok) {
382376
return
383377
}
384378
try {
385379
await activateLsp(context)
386380
getLogger().info('LspController: LSP activated')
387-
void LspController.instance.buildIndex()
381+
if (CodeWhispererSettings.instance.isLocalIndexEnabled()) {
382+
void LspController.instance.buildIndex()
383+
}
388384
// log the LSP server CPU and Memory usage per 30 minutes.
389385
globals.clock.setInterval(
390386
async () => {

0 commit comments

Comments
 (0)