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
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ describe('editorContext', function () {
const editor = createMockTextEditor('import math\ndef two_sum(nums, target):\n', 'test.py', 'python', 1, 17)
const actual = EditorContext.extractContextForCodeWhisperer(editor)
const expected: codewhispererClient.FileContext = {
fileUri: 'file:///test.py',
filename: 'test.py',
programmingLanguage: {
languageName: 'python',
Expand All @@ -76,6 +77,7 @@ describe('editorContext', function () {
)
const actual = EditorContext.extractContextForCodeWhisperer(editor)
const expected: codewhispererClient.FileContext = {
fileUri: 'file:///test.py',
filename: 'test.py',
programmingLanguage: {
languageName: 'python',
Expand Down Expand Up @@ -112,6 +114,7 @@ describe('editorContext', function () {

const actual = EditorContext.extractContextForCodeWhisperer(editor)
const expected: codewhispererClient.FileContext = {
fileUri: editor.document.uri.toString(),
filename: 'Untitled-1.py',
programmingLanguage: {
languageName: 'python',
Expand Down
9 changes: 9 additions & 0 deletions packages/core/src/codewhisperer/client/service-2.json
Original file line number Diff line number Diff line change
Expand Up @@ -612,11 +612,20 @@
"filename": {
"shape": "FileContextFilenameString"
},
"fileUri": {
"shape": "FileContextFileUriString"
},
"programmingLanguage": {
"shape": "ProgrammingLanguage"
}
}
},
"FileContextFileUriString": {
"type": "string",
"max": 1024,
"min": 1,
"sensitive": true
},
"FileContextFilenameString": {
"type": "string",
"max": 1024,
Expand Down
7 changes: 7 additions & 0 deletions packages/core/src/codewhisperer/client/user-service-2.json
Original file line number Diff line number Diff line change
Expand Up @@ -1852,9 +1852,16 @@
"leftFileContent": { "shape": "FileContextLeftFileContentString" },
"rightFileContent": { "shape": "FileContextRightFileContentString" },
"filename": { "shape": "FileContextFilenameString" },
"fileUri": { "shape": "FileContextFileUriString" },
"programmingLanguage": { "shape": "ProgrammingLanguage" }
}
},
"FileContextFileUriString": {
"type": "string",
"max": 1024,
"min": 1,
"sensitive": true
},
"FileContextFilenameString": {
"type": "string",
"max": 1024,
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/codewhisperer/util/editorContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ export function extractContextForCodeWhisperer(editor: vscode.TextEditor): codew
}

return {
fileUri: editor.document.uri.toString().substring(0, CodeWhispererConstants.filenameCharsLimit),
filename: getFileRelativePath(editor),
programmingLanguage: {
languageName: languageName,
Expand Down
Loading