Skip to content

Commit 7faa3ec

Browse files
committed
Revert "feat(amazonq): add inline completion support for abap language (aws#7303)"
This reverts commit 6fead6e.
1 parent 327fb56 commit 7faa3ec

File tree

6 files changed

+13
-31
lines changed

6 files changed

+13
-31
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"skippedTestReport": "ts-node ./scripts/skippedTestReport.ts ./packages/amazonq/test/e2e/"
4242
},
4343
"devDependencies": {
44-
"@aws-toolkits/telemetry": "^1.0.322",
44+
"@aws-toolkits/telemetry": "^1.0.321",
4545
"@playwright/browser-chromium": "^1.43.1",
4646
"@stylistic/eslint-plugin": "^2.11.0",
4747
"@types/he": "^1.2.3",

packages/amazonq/.changes/next-release/Feature-31d91f84-30cb-4acd-9e39-9dc153edf0a6.json

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

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ describe('runtimeLanguageContext', function () {
177177
'jsx',
178178
'kotlin',
179179
'php',
180+
'plaintext',
180181
'python',
181182
'ruby',
182183
'rust',
@@ -287,6 +288,7 @@ describe('runtimeLanguageContext', function () {
287288
['jsx', 'jsx'],
288289
['kotlin', 'kt'],
289290
['php', 'php'],
291+
['plaintext', 'txt'],
290292
['python', 'py'],
291293
['ruby', 'rb'],
292294
['rust', 'rs'],

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ export function extractContextForCodeWhisperer(editor: vscode.TextEditor): codew
151151
)
152152
let languageName = 'plaintext'
153153
if (!checkLeftContextKeywordsForJson(document.fileName, caretLeftFileContext, editor.document.languageId)) {
154-
languageName = runtimeLanguageContext.resolveLang(editor.document)
154+
languageName =
155+
runtimeLanguageContext.normalizeLanguage(editor.document.languageId) ?? editor.document.languageId
155156
}
156157
if (editor.document.uri.scheme === 'vscode-notebook-cell') {
157158
const notebook = getEnclosingNotebook(editor)

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

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export class RuntimeLanguageContext {
6767

6868
constructor() {
6969
this.supportedLanguageMap = createConstantMap<
70-
Exclude<CodeWhispererConstants.PlatformLanguageId | CodewhispererLanguage, 'plaintext'>,
70+
CodeWhispererConstants.PlatformLanguageId | CodewhispererLanguage,
7171
CodewhispererLanguage
7272
>({
7373
c: 'c',
@@ -85,6 +85,7 @@ export class RuntimeLanguageContext {
8585
jsx: 'jsx',
8686
kotlin: 'kotlin',
8787
packer: 'tf',
88+
plaintext: 'plaintext',
8889
php: 'php',
8990
python: 'python',
9091
ruby: 'ruby',
@@ -111,7 +112,6 @@ export class RuntimeLanguageContext {
111112
systemverilog: 'systemVerilog',
112113
verilog: 'systemVerilog',
113114
vue: 'vue',
114-
abap: 'abap',
115115
})
116116
this.supportedLanguageExtensionMap = createConstantMap<string, CodewhispererLanguage>({
117117
c: 'c',
@@ -152,8 +152,6 @@ export class RuntimeLanguageContext {
152152
ps1: 'powershell',
153153
psm1: 'powershell',
154154
r: 'r',
155-
abap: 'abap',
156-
acds: 'abap',
157155
})
158156
this.languageSingleLineCommentPrefixMap = createConstantMap<CodewhispererLanguage, string>({
159157
c: '// ',
@@ -187,14 +185,9 @@ export class RuntimeLanguageContext {
187185
vue: '', // vue lacks a single-line comment prefix
188186
yaml: '# ',
189187
yml: '# ',
190-
abap: '',
191188
})
192189
}
193190

194-
public resolveLang(doc: vscode.TextDocument): CodewhispererLanguage {
195-
return this.normalizeLanguage(doc.languageId) || this.byFileExt(doc) || 'plaintext'
196-
}
197-
198191
/**
199192
* To add a new platform language id:
200193
* 1. add new platform language ID constant in the file codewhisperer/constant.ts
@@ -324,7 +317,8 @@ export class RuntimeLanguageContext {
324317
} else {
325318
const normalizedLanguageId = this.normalizeLanguage(arg.languageId)
326319
const byLanguageId = !normalizedLanguageId || normalizedLanguageId === 'plaintext' ? false : true
327-
const byFileExtension = this.byFileExt(arg) !== undefined
320+
const extension = path.extname(arg.uri.fsPath)
321+
const byFileExtension = this.isFileFormatSupported(extension.substring(1))
328322

329323
return byLanguageId || byFileExtension
330324
}
@@ -347,17 +341,6 @@ export class RuntimeLanguageContext {
347341
public getLanguageFromFileExtension(fileExtension: string) {
348342
return this.supportedLanguageExtensionMap.get(fileExtension)
349343
}
350-
351-
private byFileExt(doc: vscode.TextDocument): CodewhispererLanguage | undefined {
352-
const extension = path.extname(doc.uri.fsPath)
353-
const byExt = this.supportedLanguageExtensionMap.get(extension.substring(1))
354-
355-
if (byExt === 'plaintext') {
356-
return undefined
357-
}
358-
359-
return byExt
360-
}
361344
}
362345

363346
export const runtimeLanguageContext = new RuntimeLanguageContext()

0 commit comments

Comments
 (0)