Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions app/aws-lsp-codewhisperer-runtimes/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ const webworkerConfig = {
fs: path.resolve(__dirname, 'src/mock-fs.js'),
child_process: false,
vm: false,
dns: false,
zlib: false,
net: false,
tls: false,
http2: false,
},
extensions: ['.ts', '.tsx', '.js', '.jsx'],
},
Expand Down
17 changes: 11 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions server/aws-lsp-codewhisperer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"adm-zip": "^0.5.10",
"archiver": "^7.0.1",
"aws-sdk": "^2.1403.0",
"axios": "^1.9.0",
"chokidar": "^4.0.3",
"deepmerge": "^4.3.1",
"diff": "^7.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import { getOrThrowBaseTokenServiceManager } from '../../shared/amazonQServiceMa
import { AmazonQWorkspaceConfig } from '../../shared/amazonQServiceManager/configurationUtils'
import { hasConnectionExpired } from '../../shared/utils'
import { getOrThrowBaseIAMServiceManager } from '../../shared/amazonQServiceManager/AmazonQIAMServiceManager'
// import { WorkspaceFolderManager } from '../workspaceContext/workspaceFolderManager'
import { WorkspaceFolderManager } from '../workspaceContext/workspaceFolderManager'
import path = require('path')
import { getRelativePath } from '../workspaceContext/util'
import { UserWrittenCodeTracker } from '../../shared/userWrittenCodeTracker'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need line 84-89 or is that logic no longer relevant?

    // const workspaceFolder = WorkspaceFolderManager.getInstance()?.getWorkspaceFolder(params.textDocument.uri)
    // if (workspaceFolder) {
    // relativeFileName = getRelativePath(workspaceFolder, params.textDocument.uri)
    // } else {
    // relativeFileName = path.basename(params.textDocument.uri)
    // }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For our workspace context capability, this filename logic won't be relevant, since we would use the fileUri field instead of the filename field:

Also, I noticed other discrepancies as well between VSCode and Flare inline completion behavior regarding this filename. The team tracking inline completion generation migration to Flare probably would want another deeper look:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is not relevant, let's remove the commented out part.

And let's discuss the filename discrepancy that you mentioned and decide on next steps

Expand Down Expand Up @@ -346,8 +346,10 @@ export const CodewhispererServerFactory =
const maxResults = isAutomaticLspTriggerKind ? 1 : 5
const selectionRange = params.context.selectedCompletionInfo?.range
const fileContext = getFileContext({ textDocument, inferredLanguageId, position: params.position })
// const workspaceFolder = WorkspaceFolderManager.getInstance()?.getWorkspaceFolder(params.textDocument.uri)
// const workspaceId = WorkspaceFolderManager.getInstance()?.getWorkspaceId(workspaceFolder)
const workspaceState = WorkspaceFolderManager.getInstance()?.getWorkspaceState()
const workspaceId = workspaceState?.webSocketClient?.isConnected()
? workspaceState.workspaceId
: undefined
// TODO: Can we get this derived from a keyboard event in the future?
// This picks the last non-whitespace character, if any, before the cursor
const triggerCharacter = fileContext.leftFileContent.trim().at(-1) ?? ''
Expand Down Expand Up @@ -450,7 +452,7 @@ export const CodewhispererServerFactory =
.slice(0, CONTEXT_CHARACTERS_LIMIT)
.replaceAll('\r\n', '\n'),
},
// workspaceId: workspaceId,
...(workspaceId ? { workspaceId: workspaceId } : {}),
})
.then(async suggestionResponse => {
return processSuggestionResponse(suggestionResponse, newSession, true, selectionRange)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { CredentialsProvider, WorkspaceFolder } from '@aws/language-server-runtimes/server-interface'
import { CreateUploadUrlResponse } from '../../client/token/codewhispererbearertokenclient'
import got from 'got'
import { URI } from 'vscode-uri'
import * as fs from 'fs'
import * as crypto from 'crypto'
import * as path from 'path'
import axios from 'axios'

export const findWorkspaceRootFolder = (
fileUri: string,
Expand Down Expand Up @@ -47,10 +47,7 @@ export const uploadArtifactToS3 = async (content: Buffer, resp: CreateUploadUrlR
'x-amz-server-side-encryption-context': Buffer.from(encryptionContext, 'utf8').toString('base64'),
})
}
await got.put(resp.uploadUrl, {
body: content,
headers: headersObj,
})
await axios.put(resp.uploadUrl, { body: content, headers: headersObj })
}

export const isDirectory = (path: string): boolean => {
Expand Down
Loading