Skip to content

Commit 130c19d

Browse files
committed
Finish function renaming
1 parent ac29feb commit 130c19d

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

packages/amazonq/test/unit/codewhisperer/util/editorContext.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,19 +178,19 @@ describe('editorContext', function () {
178178
describe('getNotebookCellContext', function () {
179179
it('Should return cell text for python code cells when language is python', function () {
180180
const mockCodeCell = createNotebookCell(createMockDocument('def example():\n return "test"'))
181-
const result = EditorContext.extractSingleCellContext(mockCodeCell, 'python')
181+
const result = EditorContext.getNotebookCellContext(mockCodeCell, 'python')
182182
assert.strictEqual(result, 'def example():\n return "test"')
183183
})
184184

185185
it('Should return java comments for python code cells when language is java', function () {
186186
const mockCodeCell = createNotebookCell(createMockDocument('def example():\n return "test"'))
187-
const result = EditorContext.extractSingleCellContext(mockCodeCell, 'java')
187+
const result = EditorContext.getNotebookCellContext(mockCodeCell, 'java')
188188
assert.strictEqual(result, '// def example():\n// return "test"')
189189
})
190190

191191
it('Should return python comments for java code cells when language is python', function () {
192192
const mockCodeCell = createNotebookCell(createMockDocument('println(1 + 1);', 'somefile.ipynb', 'java'))
193-
const result = EditorContext.extractSingleCellContext(mockCodeCell, 'python')
193+
const result = EditorContext.getNotebookCellContext(mockCodeCell, 'python')
194194
assert.strictEqual(result, '# println(1 + 1);')
195195
})
196196

@@ -199,7 +199,7 @@ describe('editorContext', function () {
199199
createMockDocument('# Heading\nThis is a markdown cell'),
200200
vscode.NotebookCellKind.Markup
201201
)
202-
const result = EditorContext.extractSingleCellContext(mockMarkdownCell, 'python')
202+
const result = EditorContext.getNotebookCellContext(mockMarkdownCell, 'python')
203203
assert.strictEqual(result, '# # Heading\n# This is a markdown cell')
204204
})
205205

@@ -208,7 +208,7 @@ describe('editorContext', function () {
208208
createMockDocument('# Heading\nThis is a markdown cell'),
209209
vscode.NotebookCellKind.Markup
210210
)
211-
const result = EditorContext.extractSingleCellContext(mockMarkdownCell, 'java')
211+
const result = EditorContext.getNotebookCellContext(mockMarkdownCell, 'java')
212212
assert.strictEqual(result, '// # Heading\n// This is a markdown cell')
213213
})
214214
})

packages/core/src/codewhisperer/util/editorContext.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function getEnclosingNotebook(editor: vscode.TextEditor): vscode.NotebookDocumen
3737
)
3838
}
3939

40-
export function extractNotebookContext(
40+
export function getNotebookContext(
4141
notebook: vscode.NotebookDocument,
4242
editor: vscode.TextEditor,
4343
languageName: string,
@@ -74,7 +74,7 @@ export function extractNotebookContext(
7474
return { caretLeftFileContext, caretRightFileContext }
7575
}
7676

77-
export function extractSingleCellContext(cell: vscode.NotebookCell, referenceLanguage?: string): string {
77+
export function getNotebookCellContext(cell: vscode.NotebookCell, referenceLanguage?: string): string {
7878
// Extract the text verbatim if the cell is code and the cell has the same language.
7979
// Otherwise, add the correct comment string for the refeference language
8080
const cellText = cell.document.getText()
@@ -109,7 +109,7 @@ export function getNotebookCellsSliceContext(
109109
cells = cells.reverse()
110110
}
111111
cells.some((cell) => {
112-
let cellText = addNewlineIfMissing(extractSingleCellContext(cell, referenceLanguage))
112+
let cellText = addNewlineIfMissing(getNotebookCellContext(cell, referenceLanguage))
113113
if (cellText.length > 0) {
114114
if (cellText.length >= maxLength) {
115115
if (fromStart) {
@@ -161,7 +161,7 @@ export function extractContextForCodeWhisperer(editor: vscode.TextEditor): codew
161161
if (editor.document.uri.scheme === 'vscode-notebook-cell') {
162162
const notebook = getEnclosingNotebook(editor)
163163
if (notebook) {
164-
;({ caretLeftFileContext, caretRightFileContext } = extractNotebookContext(
164+
;({ caretLeftFileContext, caretRightFileContext } = getNotebookContext(
165165
notebook,
166166
editor,
167167
languageName,

0 commit comments

Comments
 (0)