Skip to content

Commit 09b5557

Browse files
authored
test(amazonq): add language server activation tests (#6773)
## Problem - we have tests for the amazon q lsp installer but not the workspace context lsp installer ## Solution - add tests for the workspace context lsp installer - add a test for language server activation --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 02c3b99 commit 09b5557

File tree

9 files changed

+373
-294
lines changed

9 files changed

+373
-294
lines changed

packages/amazonq/src/lsp/lspInstaller.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
import { fs, getNodeExecutableName, BaseLspInstaller, ResourcePaths } from 'aws-core-vscode/shared'
77
import path from 'path'
88
import { getAmazonQLspConfig } from './config'
9+
import { LspConfig } from 'aws-core-vscode/amazonq'
910

1011
export class AmazonQLspInstaller extends BaseLspInstaller.BaseLspInstaller {
11-
constructor() {
12-
super(getAmazonQLspConfig(), 'amazonqLsp')
12+
constructor(lspConfig: LspConfig = getAmazonQLspConfig()) {
13+
super(lspConfig, 'amazonqLsp')
1314
}
1415

1516
protected override async postInstall(assetDirectory: string): Promise<void> {
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*!
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import { AmazonQLspInstaller } from '../../../src/lsp/lspInstaller'
7+
import { defaultAmazonQLspConfig } from '../../../src/lsp/config'
8+
import { createLspInstallerTests } from './lspInstallerUtil'
9+
import { LspConfig } from 'aws-core-vscode/amazonq'
10+
11+
describe('AmazonQLSP', () => {
12+
createLspInstallerTests({
13+
suiteName: 'AmazonQLSPInstaller',
14+
lspConfig: defaultAmazonQLspConfig,
15+
createInstaller: (lspConfig?: LspConfig) => new AmazonQLspInstaller(lspConfig),
16+
targetContents: [
17+
{
18+
bytes: 0,
19+
filename: 'servers.zip',
20+
hashes: [],
21+
url: 'http://fakeurl',
22+
},
23+
],
24+
setEnv: (path: string) => {
25+
process.env.__AMAZONQLSP_PATH = path
26+
},
27+
resetEnv: () => {
28+
delete process.env.__AMAZONQLSP_PATH
29+
},
30+
})
31+
})

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

Lines changed: 0 additions & 282 deletions
This file was deleted.

0 commit comments

Comments
 (0)