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

feat(amazonq): Decouple LSP from vector index creation; start LSP by default #5702

Merged
merged 2 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Feature",
leigaol marked this conversation as resolved.
Show resolved Hide resolved
"description": "Start language server by default"
}
18 changes: 7 additions & 11 deletions packages/core/src/amazonq/lsp/lspController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ export class LspController {
}

async buildIndex() {
getLogger().info(`LspController: Starting to build vector index of project`)
getLogger().info(`LspController: Starting to build index of project`)
const start = performance.now()
const projPaths = getProjectPaths()
projPaths.sort()
Expand All @@ -332,7 +332,7 @@ export class LspController {
false
)
if (resp) {
getLogger().debug(`LspController: Finish building vector index of project`)
getLogger().debug(`LspController: Finish building index of project`)
const usage = await LspClient.instance.getLspServerUsage()
telemetry.amazonq_indexWorkspace.emit({
duration: performance.now() - start,
Expand All @@ -344,7 +344,7 @@ export class LspController {
credentialStartUrl: AuthUtil.instance.startUrl,
})
} else {
getLogger().error(`LspController: Failed to build vector index of project`)
getLogger().error(`LspController: Failed to build index of project`)
telemetry.amazonq_indexWorkspace.emit({
duration: performance.now() - start,
result: 'Failed',
Expand All @@ -353,7 +353,7 @@ export class LspController {
})
}
} catch (e) {
getLogger().error(`LspController: Failed to build vector index of project`)
getLogger().error(`LspController: Failed to build index of project`)
telemetry.amazonq_indexWorkspace.emit({
duration: performance.now() - start,
result: 'Failed',
Expand All @@ -372,20 +372,16 @@ export class LspController {
return
}
setImmediate(async () => {
if (!CodeWhispererSettings.instance.isLocalIndexEnabled()) {
// only download LSP for users who did not turn on this feature
// do not start LSP server
await LspController.instance.tryInstallLsp(context)
return
}
const ok = await LspController.instance.tryInstallLsp(context)
if (!ok) {
return
}
try {
await activateLsp(context)
getLogger().info('LspController: LSP activated')
void LspController.instance.buildIndex()
if (CodeWhispererSettings.instance.isLocalIndexEnabled()) {
void LspController.instance.buildIndex()
}
// log the LSP server CPU and Memory usage per 30 minutes.
globals.clock.setInterval(
async () => {
Expand Down
Loading