Skip to content

Commit 9a793ee

Browse files
authored
Merge pull request #7275 from jpinkney-aws/remove3
## Problem we no longer need local workspace context, since it's now provided through flare ## Solution deprecate it
2 parents 6995107 + 079bb52 commit 9a793ee

File tree

20 files changed

+177
-1320
lines changed

20 files changed

+177
-1320
lines changed

packages/amazonq/src/app/chat/activation.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,14 @@
66
import * as vscode from 'vscode'
77
import { ExtensionContext } from 'vscode'
88
import { telemetry } from 'aws-core-vscode/telemetry'
9-
import { AuthUtil, CodeWhispererSettings } from 'aws-core-vscode/codewhisperer'
10-
import { Commands, placeholder, funcUtil } from 'aws-core-vscode/shared'
9+
import { AuthUtil } from 'aws-core-vscode/codewhisperer'
10+
import { Commands, placeholder } from 'aws-core-vscode/shared'
1111
import * as amazonq from 'aws-core-vscode/amazonq'
1212

1313
export async function activate(context: ExtensionContext) {
1414
const appInitContext = amazonq.DefaultAmazonQAppInitContext.instance
1515
await amazonq.TryChatCodeLensProvider.register(appInitContext.onDidChangeAmazonQVisibility.event)
1616

17-
const setupLsp = funcUtil.debounce(async () => {
18-
void amazonq.LspController.instance.trySetupLsp(context, {
19-
startUrl: AuthUtil.instance.startUrl,
20-
maxIndexSize: CodeWhispererSettings.instance.getMaxIndexSize(),
21-
isVectorIndexEnabled: false,
22-
})
23-
}, 5000)
24-
2517
context.subscriptions.push(
2618
amazonq.focusAmazonQChatWalkthrough.register(),
2719
amazonq.walkthroughInlineSuggestionsExample.register(),
@@ -37,7 +29,6 @@ export async function activate(context: ExtensionContext) {
3729
void vscode.env.openExternal(vscode.Uri.parse(amazonq.amazonQHelpUrl))
3830
})
3931

40-
void setupLsp()
4132
void setupAuthNotification()
4233
}
4334

packages/amazonq/src/lsp/config.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55
import * as vscode from 'vscode'
6-
import { DevSettings, getServiceEnvVarConfig } from 'aws-core-vscode/shared'
7-
import { LspConfig } from 'aws-core-vscode/amazonq'
6+
import { DevSettings, getServiceEnvVarConfig, BaseLspInstaller } from 'aws-core-vscode/shared'
87

9-
export interface ExtendedAmazonQLSPConfig extends LspConfig {
8+
export interface ExtendedAmazonQLSPConfig extends BaseLspInstaller.LspConfig {
109
ui?: string
1110
}
1211

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
import { AmazonQLspInstaller } from '../../../src/lsp/lspInstaller'
77
import { defaultAmazonQLspConfig } from '../../../src/lsp/config'
88
import { createLspInstallerTests } from './lspInstallerUtil'
9-
import { LspConfig } from 'aws-core-vscode/amazonq'
9+
import { BaseLspInstaller } from 'aws-core-vscode/shared'
1010

1111
describe('AmazonQLSP', () => {
1212
createLspInstallerTests({
1313
suiteName: 'AmazonQLSPInstaller',
1414
lspConfig: defaultAmazonQLspConfig,
15-
createInstaller: (lspConfig?: LspConfig) => new AmazonQLspInstaller(lspConfig),
15+
createInstaller: (lspConfig?: BaseLspInstaller.LspConfig) => new AmazonQLspInstaller(lspConfig),
1616
targetContents: [
1717
{
1818
bytes: 0,

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
} from 'aws-core-vscode/shared'
1919
import * as semver from 'semver'
2020
import { assertTelemetry } from 'aws-core-vscode/test'
21-
import { LspConfig, LspController } from 'aws-core-vscode/amazonq'
2221
import { LanguageServerSetup } from 'aws-core-vscode/telemetry'
2322

2423
function createVersion(version: string, contents: TargetContent[]) {
@@ -44,8 +43,8 @@ export function createLspInstallerTests({
4443
resetEnv,
4544
}: {
4645
suiteName: string
47-
lspConfig: LspConfig
48-
createInstaller: (lspConfig?: LspConfig) => BaseLspInstaller.BaseLspInstaller
46+
lspConfig: BaseLspInstaller.LspConfig
47+
createInstaller: (lspConfig?: BaseLspInstaller.LspConfig) => BaseLspInstaller.BaseLspInstaller
4948
targetContents: TargetContent[]
5049
setEnv: (path: string) => void
5150
resetEnv: () => void
@@ -60,8 +59,6 @@ export function createLspInstallerTests({
6059
installer = createInstaller()
6160
tempDir = await makeTemporaryToolkitFolder()
6261
sandbox.stub(LanguageServerResolver.prototype, 'defaultDownloadFolder').returns(tempDir)
63-
// Called on extension activation and can contaminate telemetry.
64-
sandbox.stub(LspController.prototype, 'trySetupLsp')
6562
})
6663

6764
afterEach(async () => {

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

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

packages/amazonq/test/unit/amazonq/lsp/config.test.ts

Lines changed: 58 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -7,97 +7,73 @@ import assert from 'assert'
77
import { DevSettings } from 'aws-core-vscode/shared'
88
import sinon from 'sinon'
99
import { defaultAmazonQLspConfig, ExtendedAmazonQLSPConfig, getAmazonQLspConfig } from '../../../../src/lsp/config'
10-
import { defaultAmazonQWorkspaceLspConfig, getAmazonQWorkspaceLspConfig, LspConfig } from 'aws-core-vscode/amazonq'
1110

12-
for (const [name, config, defaultConfig, setEnv, resetEnv] of [
13-
[
14-
'getAmazonQLspConfig',
15-
getAmazonQLspConfig,
16-
defaultAmazonQLspConfig,
17-
(envConfig: ExtendedAmazonQLSPConfig) => {
18-
process.env.__AMAZONQLSP_MANIFEST_URL = envConfig.manifestUrl
19-
process.env.__AMAZONQLSP_SUPPORTED_VERSIONS = envConfig.supportedVersions
20-
process.env.__AMAZONQLSP_ID = envConfig.id
21-
process.env.__AMAZONQLSP_PATH = envConfig.path
22-
process.env.__AMAZONQLSP_UI = envConfig.ui
23-
},
24-
() => {
25-
delete process.env.__AMAZONQLSP_MANIFEST_URL
26-
delete process.env.__AMAZONQLSP_SUPPORTED_VERSIONS
27-
delete process.env.__AMAZONQLSP_ID
28-
delete process.env.__AMAZONQLSP_PATH
29-
delete process.env.__AMAZONQLSP_UI
30-
},
31-
],
32-
[
33-
'getAmazonQWorkspaceLspConfig',
34-
getAmazonQWorkspaceLspConfig,
35-
defaultAmazonQWorkspaceLspConfig,
36-
(envConfig: LspConfig) => {
37-
process.env.__AMAZONQWORKSPACELSP_MANIFEST_URL = envConfig.manifestUrl
38-
process.env.__AMAZONQWORKSPACELSP_SUPPORTED_VERSIONS = envConfig.supportedVersions
39-
process.env.__AMAZONQWORKSPACELSP_ID = envConfig.id
40-
process.env.__AMAZONQWORKSPACELSP_PATH = envConfig.path
41-
},
42-
() => {
43-
delete process.env.__AMAZONQWORKSPACELSP_MANIFEST_URL
44-
delete process.env.__AMAZONQWORKSPACELSP_SUPPORTED_VERSIONS
45-
delete process.env.__AMAZONQWORKSPACELSP_ID
46-
delete process.env.__AMAZONQWORKSPACELSP_PATH
47-
},
48-
],
49-
] as const) {
50-
describe(name, () => {
51-
let sandbox: sinon.SinonSandbox
52-
let serviceConfigStub: sinon.SinonStub
53-
const settingConfig: LspConfig = {
54-
manifestUrl: 'https://custom.url/manifest.json',
55-
supportedVersions: '4.0.0',
56-
id: 'AmazonQSetting',
57-
suppressPromptPrefix: config().suppressPromptPrefix,
58-
path: '/custom/path',
59-
...(name === 'getAmazonQLspConfig' && { ui: '/chat/client/location' }),
60-
}
11+
describe('getAmazonQLspConfig', () => {
12+
let sandbox: sinon.SinonSandbox
13+
let serviceConfigStub: sinon.SinonStub
14+
const settingConfig: ExtendedAmazonQLSPConfig = {
15+
manifestUrl: 'https://custom.url/manifest.json',
16+
supportedVersions: '4.0.0',
17+
id: 'AmazonQSetting',
18+
suppressPromptPrefix: getAmazonQLspConfig().suppressPromptPrefix,
19+
path: '/custom/path',
20+
ui: '/chat/client/location',
21+
}
6122

62-
beforeEach(() => {
63-
sandbox = sinon.createSandbox()
23+
beforeEach(() => {
24+
sandbox = sinon.createSandbox()
6425

65-
serviceConfigStub = sandbox.stub()
66-
sandbox.stub(DevSettings, 'instance').get(() => ({
67-
getServiceConfig: serviceConfigStub,
68-
}))
69-
})
26+
serviceConfigStub = sandbox.stub()
27+
sandbox.stub(DevSettings, 'instance').get(() => ({
28+
getServiceConfig: serviceConfigStub,
29+
}))
30+
})
7031

71-
afterEach(() => {
72-
sandbox.restore()
73-
resetEnv()
74-
})
32+
afterEach(() => {
33+
sandbox.restore()
34+
resetEnv()
35+
})
7536

76-
it('uses default config', () => {
77-
serviceConfigStub.returns({})
78-
assert.deepStrictEqual(config(), defaultConfig)
79-
})
37+
it('uses default config', () => {
38+
serviceConfigStub.returns({})
39+
assert.deepStrictEqual(getAmazonQLspConfig(), defaultAmazonQLspConfig)
40+
})
8041

81-
it('overrides path', () => {
82-
const path = '/custom/path/to/lsp'
83-
serviceConfigStub.returns({ path })
42+
it('overrides path', () => {
43+
const path = '/custom/path/to/lsp'
44+
serviceConfigStub.returns({ path })
8445

85-
assert.deepStrictEqual(config(), {
86-
...defaultConfig,
87-
path,
88-
})
46+
assert.deepStrictEqual(getAmazonQLspConfig(), {
47+
...defaultAmazonQLspConfig,
48+
path,
8949
})
50+
})
9051

91-
it('overrides default settings', () => {
92-
serviceConfigStub.returns(settingConfig)
52+
it('overrides default settings', () => {
53+
serviceConfigStub.returns(settingConfig)
9354

94-
assert.deepStrictEqual(config(), settingConfig)
95-
})
55+
assert.deepStrictEqual(getAmazonQLspConfig(), settingConfig)
56+
})
9657

97-
it('environment variable takes precedence over settings', () => {
98-
setEnv(settingConfig)
99-
serviceConfigStub.returns({})
100-
assert.deepStrictEqual(config(), settingConfig)
101-
})
58+
it('environment variable takes precedence over settings', () => {
59+
setEnv(settingConfig)
60+
serviceConfigStub.returns({})
61+
assert.deepStrictEqual(getAmazonQLspConfig(), settingConfig)
10262
})
103-
}
63+
64+
function setEnv(envConfig: ExtendedAmazonQLSPConfig) {
65+
process.env.__AMAZONQLSP_MANIFEST_URL = envConfig.manifestUrl
66+
process.env.__AMAZONQLSP_SUPPORTED_VERSIONS = envConfig.supportedVersions
67+
process.env.__AMAZONQLSP_ID = envConfig.id
68+
process.env.__AMAZONQLSP_PATH = envConfig.path
69+
process.env.__AMAZONQLSP_UI = envConfig.ui
70+
}
71+
72+
function resetEnv() {
73+
delete process.env.__AMAZONQLSP_MANIFEST_URL
74+
delete process.env.__AMAZONQLSP_SUPPORTED_VERSIONS
75+
delete process.env.__AMAZONQLSP_ID
76+
delete process.env.__AMAZONQLSP_PATH
77+
delete process.env.__AMAZONQLSP_UI
78+
}
79+
})

packages/amazonq/test/unit/amazonq/lsp/lspClient.test.ts

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

packages/core/src/amazonq/index.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ export {
1515
walkthroughInlineSuggestionsExample,
1616
walkthroughSecurityScanExample,
1717
} from './onboardingPage/walkthrough'
18-
export { LspController } from './lsp/lspController'
19-
export { LspClient } from './lsp/lspClient'
20-
export * as lspClient from './lsp/lspClient'
2118
export { api } from './extApi'
2219
export { AmazonQChatViewProvider } from './webview/webView'
2320
export { amazonQHelpUrl } from '../shared/constants'
@@ -40,8 +37,6 @@ export { ExtensionMessage } from '../amazonq/webview/ui/commands'
4037
export { CodeReference } from '../codewhispererChat/view/connector/connector'
4138
export { extractAuthFollowUp } from './util/authUtils'
4239
export { Messenger } from './commons/connector/baseMessenger'
43-
export * from './lsp/config'
44-
export * as WorkspaceLspInstaller from './lsp/workspaceInstaller'
4540
export * as secondaryAuth from '../auth/secondaryAuth'
4641
export * as authConnection from '../auth/connection'
4742
export * as featureConfig from './webview/generators/featureConfig'

0 commit comments

Comments
 (0)