@theia/ai-code-completion 1.55.0-next.70 → 1.55.0-next.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/ai-code-completion-preference.d.ts +0 -1
- package/lib/browser/ai-code-completion-preference.d.ts.map +1 -1
- package/lib/browser/ai-code-completion-preference.js +2 -3
- package/lib/browser/ai-code-completion-preference.js.map +1 -1
- package/lib/common/code-completion-agent.d.ts +1 -1
- package/lib/common/code-completion-agent.d.ts.map +1 -1
- package/lib/common/code-completion-agent.js +9 -7
- package/lib/common/code-completion-agent.js.map +1 -1
- package/package.json +7 -7
- package/src/browser/ai-code-completion-preference.ts +1 -2
- package/src/common/code-completion-agent.ts +10 -8
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { PreferenceSchema } from '@theia/core/lib/browser/preferences/preference-contribution';
|
|
2
|
-
export declare const PREF_AI_INLINE_COMPLETION_ENABLE = "ai-features.codeCompletion.enableCodeCompletion";
|
|
3
2
|
export declare const PREF_AI_INLINE_COMPLETION_AUTOMATIC_ENABLE = "ai-features.codeCompletion.automaticCodeCompletion";
|
|
4
3
|
export declare const PREF_AI_INLINE_COMPLETION_EXCLUDED_EXTENSIONS = "ai-features.codeCompletion.excludedFileExtensions";
|
|
5
4
|
export declare const AICodeCompletionPreferencesSchema: PreferenceSchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-code-completion-preference.d.ts","sourceRoot":"","sources":["../../src/browser/ai-code-completion-preference.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6DAA6D,CAAC;AAG/F,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"ai-code-completion-preference.d.ts","sourceRoot":"","sources":["../../src/browser/ai-code-completion-preference.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6DAA6D,CAAC;AAG/F,eAAO,MAAM,0CAA0C,uDAAuD,CAAC;AAC/G,eAAO,MAAM,6CAA6C,sDAAsD,CAAC;AAEjH,eAAO,MAAM,iCAAiC,EAAE,gBAqB/C,CAAC"}
|
|
@@ -15,9 +15,8 @@
|
|
|
15
15
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
16
|
// *****************************************************************************
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.AICodeCompletionPreferencesSchema = exports.PREF_AI_INLINE_COMPLETION_EXCLUDED_EXTENSIONS = exports.PREF_AI_INLINE_COMPLETION_AUTOMATIC_ENABLE =
|
|
18
|
+
exports.AICodeCompletionPreferencesSchema = exports.PREF_AI_INLINE_COMPLETION_EXCLUDED_EXTENSIONS = exports.PREF_AI_INLINE_COMPLETION_AUTOMATIC_ENABLE = void 0;
|
|
19
19
|
const ai_core_preferences_1 = require("@theia/ai-core/lib/browser/ai-core-preferences");
|
|
20
|
-
exports.PREF_AI_INLINE_COMPLETION_ENABLE = 'ai-features.codeCompletion.enableCodeCompletion';
|
|
21
20
|
exports.PREF_AI_INLINE_COMPLETION_AUTOMATIC_ENABLE = 'ai-features.codeCompletion.automaticCodeCompletion';
|
|
22
21
|
exports.PREF_AI_INLINE_COMPLETION_EXCLUDED_EXTENSIONS = 'ai-features.codeCompletion.excludedFileExtensions';
|
|
23
22
|
exports.AICodeCompletionPreferencesSchema = {
|
|
@@ -28,7 +27,7 @@ exports.AICodeCompletionPreferencesSchema = {
|
|
|
28
27
|
type: 'boolean',
|
|
29
28
|
description: 'Automatically trigger AI completions inline within any (Monaco) editor while editing.\
|
|
30
29
|
\n\
|
|
31
|
-
|
|
30
|
+
Alternatively, you can manually trigger the code via the command "Trigger Inline Suggestion" or the default shortcut "SHIFT+Space".',
|
|
32
31
|
default: true
|
|
33
32
|
},
|
|
34
33
|
[exports.PREF_AI_INLINE_COMPLETION_EXCLUDED_EXTENSIONS]: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-code-completion-preference.js","sourceRoot":"","sources":["../../src/browser/ai-code-completion-preference.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAGhF,wFAA2F;AAE9E,QAAA,
|
|
1
|
+
{"version":3,"file":"ai-code-completion-preference.js","sourceRoot":"","sources":["../../src/browser/ai-code-completion-preference.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAGhF,wFAA2F;AAE9E,QAAA,0CAA0C,GAAG,oDAAoD,CAAC;AAClG,QAAA,6CAA6C,GAAG,mDAAmD,CAAC;AAEpG,QAAA,iCAAiC,GAAqB;IAC/D,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACR,CAAC,kDAA0C,CAAC,EAAE;YAC1C,KAAK,EAAE,+CAAyB;YAChC,IAAI,EAAE,SAAS;YACf,WAAW,EAAE;;gJAEuH;YACpI,OAAO,EAAE,IAAI;SAChB;QACD,CAAC,qDAA6C,CAAC,EAAE;YAC7C,KAAK,EAAE,0BAA0B;YACjC,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,oFAAoF;YACjG,KAAK,EAAE;gBACH,IAAI,EAAE,QAAQ;aACjB;YACD,OAAO,EAAE,EAAE;SACd;KACJ;CACJ,CAAC"}
|
|
@@ -19,6 +19,6 @@ export declare class CodeCompletionAgentImpl implements CodeCompletionAgent {
|
|
|
19
19
|
readonly variables: string[];
|
|
20
20
|
readonly functions: string[];
|
|
21
21
|
readonly agentSpecificVariables: AgentSpecificVariables[];
|
|
22
|
-
readonly tags?:
|
|
22
|
+
readonly tags?: string[] | undefined;
|
|
23
23
|
}
|
|
24
24
|
//# sourceMappingURL=code-completion-agent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-completion-agent.d.ts","sourceRoot":"","sources":["../../src/common/code-completion-agent.ts"],"names":[],"mappings":"AAgBA,OAAO,EACH,KAAK,EAAE,sBAAsB,EAAE,6BAA6B,EAC5D,qBAAqB,EAAwB,wBAAwB,EAAE,aAAa,EAAE,cAAc,EACvG,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAgB,OAAO,EAAE,MAAM,aAAa,CAAC;AAEpD,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AAEpD,eAAO,MAAM,mBAAmB,eAAgC,CAAC;AACjE,MAAM,WAAW,mBAAoB,SAAQ,KAAK;IAC9C,wBAAwB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAC/E,OAAO,EAAE,MAAM,CAAC,SAAS,CAAC,uBAAuB,EAAE,KAAK,EAAE,MAAM,CAAC,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAAA;CACnJ;AAED,qBACa,uBAAwB,YAAW,mBAAmB;IACzD,wBAAwB,CAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,EAC/B,QAAQ,EAAE,MAAM,CAAC,QAAQ,EACzB,OAAO,EAAE,MAAM,CAAC,SAAS,CAAC,uBAAuB,EACjD,KAAK,EAAE,MAAM,CAAC,iBAAiB,GAChC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,iBAAiB,GAAG,SAAS,CAAC;IAiF1D,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC;IAG1B,SAAS,C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G1B,SAAS,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;IAGvD,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC;IAGvC,SAAS,CAAC,gBAAgB,EAAE,6BAA6B,CAAC;IAE1D,EAAE,SAAqB;IACvB,IAAI,SAAqB;IACzB,WAAW,SAC2E;IACtF,eAAe,EAAE,cAAc,EAAE,CAa/B;IACF,yBAAyB,EAAE,wBAAwB,EAAE,CAKnD;IACF,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,CAAM;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,CAAM;IAClC,QAAQ,CAAC,sBAAsB,EAAE,sBAAsB,EAAE,CAKvD;IACF,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CACxC"}
|
|
@@ -29,11 +29,13 @@ let CodeCompletionAgentImpl = class CodeCompletionAgentImpl {
|
|
|
29
29
|
this.promptTemplates = [
|
|
30
30
|
{
|
|
31
31
|
id: 'code-completion-prompt',
|
|
32
|
-
template: `
|
|
32
|
+
template: `{{!-- Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
|
|
33
|
+
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
34
|
+
You are a code completion agent. The current file you have to complete is named {{file}}.
|
|
33
35
|
The language of the file is {{language}}. Return your result as plain text without markdown formatting.
|
|
34
36
|
Finish the following code snippet.
|
|
35
37
|
|
|
36
|
-
{{
|
|
38
|
+
{{prefix}}[[MARKER]]{{suffix}}
|
|
37
39
|
|
|
38
40
|
Only return the exact replacement for [[MARKER]] to complete the snippet.`,
|
|
39
41
|
},
|
|
@@ -49,8 +51,8 @@ Only return the exact replacement for [[MARKER]] to complete the snippet.`,
|
|
|
49
51
|
this.agentSpecificVariables = [
|
|
50
52
|
{ name: 'file', usedInPrompt: true, description: 'The uri of the file being edited.' },
|
|
51
53
|
{ name: 'language', usedInPrompt: true, description: 'The languageId of the file being edited.' },
|
|
52
|
-
{ name: '
|
|
53
|
-
{ name: '
|
|
54
|
+
{ name: 'prefix', usedInPrompt: true, description: 'The code before the current position of the cursor.' },
|
|
55
|
+
{ name: 'suffix', usedInPrompt: true, description: 'The code after the current position of the cursor.' }
|
|
54
56
|
];
|
|
55
57
|
}
|
|
56
58
|
async provideInlineCompletions(model, position, context, token) {
|
|
@@ -63,14 +65,14 @@ Only return the exact replacement for [[MARKER]] to complete the snippet.`,
|
|
|
63
65
|
return undefined;
|
|
64
66
|
}
|
|
65
67
|
// Get text until the given position
|
|
66
|
-
const
|
|
68
|
+
const prefix = model.getValueInRange({
|
|
67
69
|
startLineNumber: 1,
|
|
68
70
|
startColumn: 1,
|
|
69
71
|
endLineNumber: position.lineNumber,
|
|
70
72
|
endColumn: position.column,
|
|
71
73
|
});
|
|
72
74
|
// Get text after the given position
|
|
73
|
-
const
|
|
75
|
+
const suffix = model.getValueInRange({
|
|
74
76
|
startLineNumber: position.lineNumber,
|
|
75
77
|
startColumn: position.column,
|
|
76
78
|
endLineNumber: model.getLineCount(),
|
|
@@ -82,7 +84,7 @@ Only return the exact replacement for [[MARKER]] to complete the snippet.`,
|
|
|
82
84
|
return undefined;
|
|
83
85
|
}
|
|
84
86
|
const prompt = await this.promptService
|
|
85
|
-
.getPrompt('code-completion-prompt', {
|
|
87
|
+
.getPrompt('code-completion-prompt', { prefix, suffix, file, language })
|
|
86
88
|
.then(p => p === null || p === void 0 ? void 0 : p.text);
|
|
87
89
|
if (!prompt) {
|
|
88
90
|
this.logger.error('No prompt found for code-completion-agent');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-completion-agent.js","sourceRoot":"","sources":["../../src/common/code-completion-agent.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,sDAGmC;AACnC,sCAAoD;AACpD,4DAAyE;AAG5D,QAAA,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAO1D,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAA7B;QAkGH,OAAE,GAAG,iBAAiB,CAAC;QACvB,SAAI,GAAG,iBAAiB,CAAC;QACzB,gBAAW,GACP,iFAAiF,CAAC;QACtF,oBAAe,GAAqB;YAChC;gBACI,EAAE,EAAE,wBAAwB;gBAC5B,QAAQ,EAAE
|
|
1
|
+
{"version":3,"file":"code-completion-agent.js","sourceRoot":"","sources":["../../src/common/code-completion-agent.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,sDAGmC;AACnC,sCAAoD;AACpD,4DAAyE;AAG5D,QAAA,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAO1D,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAA7B;QAkGH,OAAE,GAAG,iBAAiB,CAAC;QACvB,SAAI,GAAG,iBAAiB,CAAC;QACzB,gBAAW,GACP,iFAAiF,CAAC;QACtF,oBAAe,GAAqB;YAChC;gBACI,EAAE,EAAE,wBAAwB;gBAC5B,QAAQ,EAAE;;;;;;;;0EAQoD;aACjE;SACJ,CAAC;QACF,8BAAyB,GAA+B;YACpD;gBACI,OAAO,EAAE,iBAAiB;gBAC1B,UAAU,EAAE,eAAe;aAC9B;SACJ,CAAC;QACO,cAAS,GAAa,EAAE,CAAC;QACzB,cAAS,GAAa,EAAE,CAAC;QACzB,2BAAsB,GAA6B;YAC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QACrB,CAAC;QACD,MAAM,cAAc,GAAG,MAAM,IAAA,0BAAiB,EAAC,QAAQ,CAAC,CAAC;QACzD,IAAI,KAAK,CAAC,uBAAuB,EAAE,CAAC;YAChC,OAAO,SAAS,CAAC;QACrB,CAAC;QACD,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC;YACjC,OAAO,EAAE,IAAI,CAAC,EAAE;YAChB,SAAS;YACT,SAAS;YACT,QAAQ,EAAE,cAAc;SAC3B,CAAC,CAAC;QAEH,OAAO;YACH,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC;YACvC,sBAAsB,EAAE,IAAI;SAC/B,CAAC;IACN,CAAC;CAgDJ,CAAA;AAnIY,0DAAuB;AAuFtB;IAFT,IAAA,kBAAM,EAAC,cAAO,CAAC;IACf,IAAA,iBAAK,EAAC,uBAAuB,CAAC;;uDACL;AAGhB;IADT,IAAA,kBAAM,EAAC,8BAAqB,CAAC;;sEACyB;AAG7C;IADT,IAAA,kBAAM,EAAC,sBAAa,CAAC;;8DACiB;AAG7B;IADT,IAAA,kBAAM,EAAC,sCAA6B,CAAC;;iEACoB;kCAhGjD,uBAAuB;IADnC,IAAA,sBAAU,GAAE;GACA,uBAAuB,CAmInC"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/ai-code-completion",
|
|
3
|
-
"version": "1.55.0-next.
|
|
3
|
+
"version": "1.55.0-next.97+52cad8a35",
|
|
4
4
|
"description": "Theia - AI Core",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/ai-core": "1.55.0-next.
|
|
7
|
-
"@theia/core": "1.55.0-next.
|
|
8
|
-
"@theia/filesystem": "1.55.0-next.
|
|
6
|
+
"@theia/ai-core": "1.55.0-next.97+52cad8a35",
|
|
7
|
+
"@theia/core": "1.55.0-next.97+52cad8a35",
|
|
8
|
+
"@theia/filesystem": "1.55.0-next.97+52cad8a35",
|
|
9
9
|
"@theia/monaco-editor-core": "1.83.101",
|
|
10
|
-
"@theia/output": "1.55.0-next.
|
|
11
|
-
"@theia/workspace": "1.55.0-next.
|
|
10
|
+
"@theia/output": "1.55.0-next.97+52cad8a35",
|
|
11
|
+
"@theia/workspace": "1.55.0-next.97+52cad8a35",
|
|
12
12
|
"minimatch": "^5.1.0",
|
|
13
13
|
"tslib": "^2.6.2"
|
|
14
14
|
},
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"nyc": {
|
|
52
52
|
"extends": "../../configs/nyc.json"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "52cad8a35c3c86231f1b3efc74608bd159840a69"
|
|
55
55
|
}
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
import { PreferenceSchema } from '@theia/core/lib/browser/preferences/preference-contribution';
|
|
18
18
|
import { AI_CORE_PREFERENCES_TITLE } from '@theia/ai-core/lib/browser/ai-core-preferences';
|
|
19
19
|
|
|
20
|
-
export const PREF_AI_INLINE_COMPLETION_ENABLE = 'ai-features.codeCompletion.enableCodeCompletion';
|
|
21
20
|
export const PREF_AI_INLINE_COMPLETION_AUTOMATIC_ENABLE = 'ai-features.codeCompletion.automaticCodeCompletion';
|
|
22
21
|
export const PREF_AI_INLINE_COMPLETION_EXCLUDED_EXTENSIONS = 'ai-features.codeCompletion.excludedFileExtensions';
|
|
23
22
|
|
|
@@ -29,7 +28,7 @@ export const AICodeCompletionPreferencesSchema: PreferenceSchema = {
|
|
|
29
28
|
type: 'boolean',
|
|
30
29
|
description: 'Automatically trigger AI completions inline within any (Monaco) editor while editing.\
|
|
31
30
|
\n\
|
|
32
|
-
|
|
31
|
+
Alternatively, you can manually trigger the code via the command "Trigger Inline Suggestion" or the default shortcut "SHIFT+Space".',
|
|
33
32
|
default: true
|
|
34
33
|
},
|
|
35
34
|
[PREF_AI_INLINE_COMPLETION_EXCLUDED_EXTENSIONS]: {
|
|
@@ -49,7 +49,7 @@ export class CodeCompletionAgentImpl implements CodeCompletionAgent {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
// Get text until the given position
|
|
52
|
-
const
|
|
52
|
+
const prefix = model.getValueInRange({
|
|
53
53
|
startLineNumber: 1,
|
|
54
54
|
startColumn: 1,
|
|
55
55
|
endLineNumber: position.lineNumber,
|
|
@@ -57,7 +57,7 @@ export class CodeCompletionAgentImpl implements CodeCompletionAgent {
|
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
// Get text after the given position
|
|
60
|
-
const
|
|
60
|
+
const suffix = model.getValueInRange({
|
|
61
61
|
startLineNumber: position.lineNumber,
|
|
62
62
|
startColumn: position.column,
|
|
63
63
|
endLineNumber: model.getLineCount(),
|
|
@@ -71,7 +71,7 @@ export class CodeCompletionAgentImpl implements CodeCompletionAgent {
|
|
|
71
71
|
return undefined;
|
|
72
72
|
}
|
|
73
73
|
const prompt = await this.promptService
|
|
74
|
-
.getPrompt('code-completion-prompt', {
|
|
74
|
+
.getPrompt('code-completion-prompt', { prefix, suffix, file, language })
|
|
75
75
|
.then(p => p?.text);
|
|
76
76
|
if (!prompt) {
|
|
77
77
|
this.logger.error('No prompt found for code-completion-agent');
|
|
@@ -134,11 +134,13 @@ export class CodeCompletionAgentImpl implements CodeCompletionAgent {
|
|
|
134
134
|
promptTemplates: PromptTemplate[] = [
|
|
135
135
|
{
|
|
136
136
|
id: 'code-completion-prompt',
|
|
137
|
-
template: `
|
|
137
|
+
template: `{{!-- Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
|
|
138
|
+
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
139
|
+
You are a code completion agent. The current file you have to complete is named {{file}}.
|
|
138
140
|
The language of the file is {{language}}. Return your result as plain text without markdown formatting.
|
|
139
141
|
Finish the following code snippet.
|
|
140
142
|
|
|
141
|
-
{{
|
|
143
|
+
{{prefix}}[[MARKER]]{{suffix}}
|
|
142
144
|
|
|
143
145
|
Only return the exact replacement for [[MARKER]] to complete the snippet.`,
|
|
144
146
|
},
|
|
@@ -154,8 +156,8 @@ Only return the exact replacement for [[MARKER]] to complete the snippet.`,
|
|
|
154
156
|
readonly agentSpecificVariables: AgentSpecificVariables[] = [
|
|
155
157
|
{ name: 'file', usedInPrompt: true, description: 'The uri of the file being edited.' },
|
|
156
158
|
{ name: 'language', usedInPrompt: true, description: 'The languageId of the file being edited.' },
|
|
157
|
-
{ name: '
|
|
158
|
-
{ name: '
|
|
159
|
+
{ name: 'prefix', usedInPrompt: true, description: 'The code before the current position of the cursor.' },
|
|
160
|
+
{ name: 'suffix', usedInPrompt: true, description: 'The code after the current position of the cursor.' }
|
|
159
161
|
];
|
|
160
|
-
readonly tags?:
|
|
162
|
+
readonly tags?: string[] | undefined;
|
|
161
163
|
}
|