Skip to content

Commit 49a4566

Browse files
committed
feedback
1 parent efe6ef1 commit 49a4566

File tree

7 files changed

+18
-21
lines changed

7 files changed

+18
-21
lines changed

packages/amazonq/src/extension.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import {
3333
maybeShowMinVscodeWarning,
3434
Experiments,
3535
isSageMaker,
36-
isAmazonInternalOs,
36+
isAmazonLinux2,
3737
} from 'aws-core-vscode/shared'
3838
import { ExtStartUpSources } from 'aws-core-vscode/telemetry'
3939
import { VSCODE_EXTENSION_ID } from 'aws-core-vscode/utils'
@@ -123,7 +123,7 @@ export async function activateAmazonQCommon(context: vscode.ExtensionContext, is
123123
await activateCodeWhisperer(extContext as ExtContext)
124124
if (
125125
(Experiments.instance.get('amazonqLSP', true) || Auth.instance.isInternalAmazonUser()) &&
126-
(!isAmazonInternalOs() || (await getGlibcPath()))
126+
(!isAmazonLinux2() || (await getGlibcPath()))
127127
) {
128128
// start the Amazon Q LSP for internal users first
129129
// for AL2, start LSP if glibc patch is found

packages/amazonq/src/lsp/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import {
3232
getLogger,
3333
undefinedIfEmpty,
3434
getOptOutPreference,
35-
isAmazonInternalOs,
35+
isAmazonLinux2,
3636
fs,
3737
} from 'aws-core-vscode/shared'
3838
import { processUtils } from 'aws-core-vscode/shared'
@@ -78,7 +78,7 @@ export async function startLanguageServer(
7878
let executable: string[] = []
7979
// apply the GLIBC 2.28 path to node js runtime binary
8080
const glibcPath = await getGlibcPath()
81-
if (isAmazonInternalOs() && glibcPath) {
81+
if (isAmazonLinux2() && glibcPath) {
8282
executable = [glibcPath, '--library-path', '/opt/vsc-sysroot/lib64', resourcePaths.node]
8383
getLogger('amazonqLsp').info(`Patched node runtime with GLIBC to ${executable}`)
8484
} else {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { activate as activateLsp, LspClient } from './lspClient'
1111
import { telemetry } from '../../shared/telemetry/telemetry'
1212
import { isCloud9 } from '../../shared/extensionUtilities'
1313
import globals, { isWeb } from '../../shared/extensionGlobals'
14-
import { isAmazonInternalOs } from '../../shared/vscode/env'
14+
import { isAmazonLinux2 } from '../../shared/vscode/env'
1515
import { WorkspaceLspInstaller } from './workspaceInstaller'
1616
import { lspSetupStage } from '../../shared/lsp/utils/setupStage'
1717
import { RelevantTextDocumentAddition } from '../../codewhispererChat/controllers/chat/model'
@@ -165,7 +165,7 @@ export class LspController {
165165
}
166166

167167
async trySetupLsp(context: vscode.ExtensionContext, buildIndexConfig: BuildIndexConfig) {
168-
if (isCloud9() || isWeb() || isAmazonInternalOs()) {
168+
if (isCloud9() || isWeb() || isAmazonLinux2()) {
169169
this.logger.warn('Skipping LSP setup. LSP is not compatible with the current environment. ')
170170
// do not do anything if in Cloud9 or Web mode or in AL2 (AL2 does not support node v18+)
171171
return

packages/core/src/shared/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export * from './extensionUtilities'
1818
export * from './extensionStartup'
1919
export { RegionProvider } from './regions/regionProvider'
2020
export { Commands } from './vscode/commands2'
21-
export { getMachineId, getServiceEnvVarConfig, isAmazonInternalOs } from './vscode/env'
21+
export { getMachineId, getServiceEnvVarConfig, isAmazonLinux2 } from './vscode/env'
2222
export { getLogger } from './logger/logger'
2323
export { activateExtension, openUrl } from './utilities/vsCodeUtils'
2424
export { waitUntil, sleep, Timeout } from './utilities/timeoutUtils'

packages/core/src/shared/telemetry/util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
isAutomation,
1616
isRemoteWorkspace,
1717
isCloudDesktop,
18-
isAmazonInternalOs,
18+
isAmazonLinux2,
1919
} from '../vscode/env'
2020
import { addTypeName } from '../utilities/typeConstructors'
2121
import globals, { isWeb } from '../extensionGlobals'
@@ -290,7 +290,7 @@ export async function getComputeEnvType(): Promise<EnvType> {
290290
} else if (isSageMaker()) {
291291
return web ? 'sagemaker-web' : 'sagemaker'
292292
} else if (isRemoteWorkspace()) {
293-
if (isAmazonInternalOs()) {
293+
if (isAmazonLinux2()) {
294294
if (await isCloudDesktop()) {
295295
return 'cloudDesktop-amzn'
296296
}

packages/core/src/shared/vscode/env.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,15 @@ export function isRemoteWorkspace(): boolean {
133133
*
134134
* Example: `5.10.220-188.869.amzn2int.x86_64` or `5.10.236-227.928.amzn2.x86_64` (Cloud Dev Machine)
135135
*/
136-
export function isAmazonInternalOs() {
136+
export function isAmazonLinux2() {
137137
return (os.release().includes('.amzn2int.') || os.release().includes('.amzn2.')) && process.platform === 'linux'
138138
}
139139

140140
/**
141141
* Returns true if we are in an internal Amazon Cloud Desktop
142142
*/
143143
export async function isCloudDesktop() {
144-
if (!isAmazonInternalOs()) {
144+
if (!isAmazonLinux2()) {
145145
return false
146146
}
147147

packages/core/src/test/shared/vscode/env.test.ts

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

66
import assert from 'assert'
77
import path from 'path'
8-
import {
9-
isCloudDesktop,
10-
getEnvVars,
11-
getServiceEnvVarConfig,
12-
isAmazonInternalOs as isAmazonInternalOS,
13-
isBeta,
14-
} from '../../../shared/vscode/env'
8+
import { isCloudDesktop, getEnvVars, getServiceEnvVarConfig, isAmazonLinux2, isBeta } from '../../../shared/vscode/env'
159
import { ChildProcess } from '../../../shared/utilities/processUtils'
1610
import * as sinon from 'sinon'
1711
import os from 'os'
@@ -103,13 +97,16 @@ describe('env', function () {
10397
assert.strictEqual(isBeta(), expected)
10498
})
10599

106-
it('isAmazonInternalOS', function () {
100+
it('isAmazonLinux2', function () {
107101
sandbox.stub(process, 'platform').value('linux')
108102
const versionStub = stubOsVersion('5.10.220-188.869.amzn2int.x86_64')
109-
assert.strictEqual(isAmazonInternalOS(), true)
103+
assert.strictEqual(isAmazonLinux2(), true)
104+
105+
versionStub.returns('5.10.236-227.928.amzn2.x86_64')
106+
assert.strictEqual(isAmazonLinux2(), true)
110107

111108
versionStub.returns('5.10.220-188.869.NOT_INTERNAL.x86_64')
112-
assert.strictEqual(isAmazonInternalOS(), false)
109+
assert.strictEqual(isAmazonLinux2(), false)
113110
})
114111

115112
it('isCloudDesktop', async function () {

0 commit comments

Comments
 (0)