Skip to content

Commit 5e4908a

Browse files
committed
save
1 parent d487484 commit 5e4908a

File tree

8 files changed

+34
-26
lines changed

8 files changed

+34
-26
lines changed

CONTRIBUTING.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ Example:
427427
}
428428
```
429429

430-
<a name="amazonqLsp-settings">Overrides specifically for the Amazon Q language server can be set using the `aws.dev.amazonqLsp` setting. This is a JSON object consisting of keys/values required to override language server: `manifestUrl`, `supportedVersions`, `id`, and `locationOverride`.</a>
430+
<a name="amazonqLsp-settings">Overrides specifically for the Amazon Q language server</a> can be set using the `aws.dev.amazonqLsp` setting. This is a JSON object consisting of keys/values required to override language server: `manifestUrl`, `supportedVersions`, `id`, and `path`.
431431

432432
Example:
433433

@@ -436,11 +436,11 @@ Example:
436436
"manifestUrl": "https://custom.url/manifest.json",
437437
"supportedVersions": "4.0.0",
438438
"id": "AmazonQ",
439-
"locationOverride": "/custom/path/to/local/lsp/folder",
439+
"path": "/custom/path/to/local/lsp/folder",
440440
}
441441
```
442442

443-
<a name="amazonqWorkspaceLsp-settings">Overrides specifically for the Amazon Q Workspace Context language server can be set using the `aws.dev.amazonqWorkspaceLsp` setting. This is a JSON object consisting of keys/values required to override language server: `manifestUrl`, `supportedVersions`, `id`, and `locationOverride`.</a>
443+
<a name="amazonqWorkspaceLsp-settings">Overrides specifically for the Amazon Q Workspace Context language server</a> can be set using the `aws.dev.amazonqWorkspaceLsp` setting. This is a JSON object consisting of keys/values required to override language server: `manifestUrl`, `supportedVersions`, `id`, and `path`.
444444

445445
Example:
446446

@@ -449,7 +449,7 @@ Example:
449449
"manifestUrl": "https://custom.url/manifest.json",
450450
"supportedVersions": "4.0.0",
451451
"id": "AmazonQ",
452-
"locationOverride": "/custom/path/to/local/lsp/folder",
452+
"path": "/custom/path/to/local/lsp/folder",
453453
}
454454
```
455455

@@ -501,11 +501,11 @@ Unlike the user setting overrides, not all of these environment variables have t
501501
- `__AMAZONQLSP_MANIFEST_URL`: for aws.dev.amazonqLsp.manifestUrl
502502
- `__AMAZONQLSP_SUPPORTED_VERSIONS`: for aws.dev.amazonqLsp.supportedVersions
503503
- `__AMAZONQLSP_ID`: for aws.dev.amazonqLsp.id
504-
- `__AMAZONQLSP_LOCATION_OVERRIDE`: for aws.dev.amazonqWorkspaceLsp.locationOverride
504+
- `__AMAZONQLSP_PATH`: for aws.dev.amazonqWorkspaceLsp.locationOverride
505505
- `__AMAZONQWORKSPACELSP_MANIFEST_URL`: for aws.dev.amazonqWorkspaceLsp.manifestUrl
506506
- `__AMAZONQWORKSPACELSP_SUPPORTED_VERSIONS`: for aws.dev.amazonqWorkspaceLsp.supportedVersions
507507
- `__AMAZONQWORKSPACELSP_ID`: for aws.dev.amazonqWorkspaceLsp.id
508-
- `__AMAZONQWORKSPACELSP_LOCATION_OVERRIDE`: for aws.dev.amazonqWorkspaceLsp.locationOverride
508+
- `__AMAZONQWORKSPACELSP_PATH`: for aws.dev.amazonqWorkspaceLsp.locationOverride
509509

510510
#### Lambda
511511

packages/amazonq/src/lsp/activation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55

66
import vscode from 'vscode'
77
import { startLanguageServer } from './client'
8-
import { AmazonQLSPInstaller } from './lspInstaller'
8+
import { AmazonQLspInstaller } from './lspInstaller'
99
import { Commands, lspSetupStage, ToolkitError } from 'aws-core-vscode/shared'
1010

1111
export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
1212
try {
1313
await lspSetupStage('all', async () => {
14-
const installResult = await new AmazonQLSPInstaller().resolve()
14+
const installResult = await new AmazonQLspInstaller().resolve()
1515
await lspSetupStage('launch', async () => await startLanguageServer(ctx, installResult.resourcePaths))
1616
})
1717
ctx.subscriptions.push(

packages/amazonq/src/lsp/lspInstaller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { fs, getNodeExecutableName, BaseLspInstaller, ResourcePaths } from 'aws-
77
import path from 'path'
88
import { getAmazonQLspConfig } from './config'
99

10-
export class AmazonQLSPInstaller extends BaseLspInstaller {
10+
export class AmazonQLspInstaller extends BaseLspInstaller {
1111
constructor() {
1212
super(getAmazonQLspConfig())
1313
}

packages/amazonq/test/e2e/lsp/lspInstaller.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import assert from 'assert'
77
import sinon from 'sinon'
8-
import { AmazonQLSPInstaller } from '../../../src/lsp/lspInstaller'
8+
import { AmazonQLspInstaller } from '../../../src/lsp/lspInstaller'
99
import {
1010
DevSettings,
1111
fs,
@@ -44,7 +44,7 @@ function createVersion(version: string) {
4444
}
4545

4646
describe('AmazonQLSPInstaller', () => {
47-
let resolver: AmazonQLSPInstaller
47+
let resolver: AmazonQLspInstaller
4848
let sandbox: sinon.SinonSandbox
4949
let tempDir: string
5050
// If globalState contains an ETag that is up to date with remote, we won't fetch it resulting in inconsistent behavior.
@@ -59,7 +59,7 @@ describe('AmazonQLSPInstaller', () => {
5959

6060
beforeEach(async () => {
6161
sandbox = sinon.createSandbox()
62-
resolver = new AmazonQLSPInstaller()
62+
resolver = new AmazonQLspInstaller()
6363
tempDir = await makeTemporaryToolkitFolder()
6464
sandbox.stub(LanguageServerResolver.prototype, 'defaultDownloadFolder').returns(tempDir)
6565
// Called on extension activation and can contaminate telemetry.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ export interface LspConfig {
1010
manifestUrl: string
1111
supportedVersions: string
1212
id: string
13-
locationOverride?: string
13+
path?: string
1414
}
1515

1616
export const defaultAmazonQWorkspaceLspConfig: LspConfig = {
1717
manifestUrl: 'https://aws-toolkit-language-servers.amazonaws.com/q-context/manifest.json',
1818
supportedVersions: '0.1.35',
1919
id: 'AmazonQ-Workspace', // used for identification in global storage/local disk location. Do not change.
20-
locationOverride: undefined,
20+
path: undefined,
2121
}
2222

2323
export function getAmazonQWorkspaceLspConfig(): LspConfig {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import path from 'path'
77
import { ResourcePaths } from '../../shared/lsp/types'
88
import { getNodeExecutableName } from '../../shared/lsp/utils/platform'
99
import { fs } from '../../shared/fs/fs'
10-
import { BaseLspInstaller } from '../../shared/lsp/lspInstaller'
10+
import { BaseLspInstaller } from '../../shared/lsp/baseLspInstaller'
1111
import { getAmazonQWorkspaceLspConfig } from './config'
1212

1313
export class WorkspaceLSPInstaller extends BaseLspInstaller {

packages/core/src/shared/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,4 @@ export * from './lsp/utils/cleanup'
7070
export { default as request } from './request'
7171
export * from './lsp/utils/platform'
7272
export * as processUtils from './utilities/processUtils'
73-
export * from './lsp/lspInstaller'
73+
export * as BaseLspInstaller from './lsp/baseLspInstaller'

packages/core/src/shared/lsp/lspInstaller.ts renamed to packages/core/src/shared/lsp/baseLspInstaller.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
import path from 'path'
6+
import * as nodePath from 'path'
77
import vscode from 'vscode'
88
import { LspConfig } from '../../amazonq/lsp/config'
99
import { LanguageServerResolver } from './lspResolver'
@@ -12,18 +12,26 @@ import { LspResolution, ResourcePaths } from './types'
1212
import { cleanLspDownloads } from './utils/cleanup'
1313
import { Range } from 'semver'
1414
import { getLogger } from '../logger/logger'
15-
16-
const logger = getLogger('lsp')
15+
import type { Logger, LogTopic } from '../logger/logger'
1716

1817
export abstract class BaseLspInstaller {
19-
constructor(protected config: LspConfig) {}
18+
private logger: Logger
19+
20+
constructor(
21+
protected config: LspConfig,
22+
loggerName: Extract<LogTopic, 'amazonqLsp' | 'amazonqWorkplaceLsp'>
23+
) {
24+
this.logger = getLogger(loggerName)
25+
}
2026

2127
async resolve(): Promise<LspResolution> {
22-
const { id, manifestUrl, supportedVersions, locationOverride } = this.config
23-
if (locationOverride) {
24-
void vscode.window.showInformationMessage(`Using language server override location: ${locationOverride}`)
28+
const { id, manifestUrl, supportedVersions, path } = this.config
29+
if (path) {
30+
const overrideMsg = `Using language server override location: ${path}`
31+
this.logger.info(overrideMsg)
32+
void vscode.window.showInformationMessage(overrideMsg)
2533
return {
26-
assetDirectory: locationOverride,
34+
assetDirectory: path,
2735
location: 'override',
2836
version: '0.0.0',
2937
resourcePaths: this.resourcePaths(),
@@ -43,8 +51,8 @@ export abstract class BaseLspInstaller {
4351

4452
await this.postInstall(assetDirectory)
4553

46-
const deletedVersions = await cleanLspDownloads(manifest.versions, path.dirname(assetDirectory))
47-
logger.debug(`cleaning old LSP versions deleted ${deletedVersions.length} versions`)
54+
const deletedVersions = await cleanLspDownloads(manifest.versions, nodePath.dirname(assetDirectory))
55+
this.logger.debug(`cleaning old LSP versions deleted ${deletedVersions.length} versions`)
4856

4957
return {
5058
...installationResult,

0 commit comments

Comments
 (0)