@theia/ai-code-completion 1.58.3 → 1.59.0-next.62
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-frontend-module.d.ts.map +1 -1
- package/lib/browser/ai-code-completion-frontend-module.js +0 -5
- package/lib/browser/ai-code-completion-frontend-module.js.map +1 -1
- package/lib/browser/ai-code-completion-preference.d.ts.map +1 -1
- package/lib/browser/ai-code-completion-preference.js +12 -11
- package/lib/browser/ai-code-completion-preference.js.map +1 -1
- package/lib/browser/code-completion-agent.d.ts.map +1 -1
- package/lib/browser/code-completion-agent.js +5 -5
- package/lib/browser/code-completion-agent.js.map +1 -1
- package/package.json +8 -8
- package/src/browser/ai-code-completion-frontend-module.ts +0 -5
- package/src/browser/ai-code-completion-preference.ts +15 -11
- package/src/browser/code-completion-agent.ts +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-code-completion-frontend-module.d.ts","sourceRoot":"","sources":["../../src/browser/ai-code-completion-frontend-module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ai-code-completion-frontend-module.d.ts","sourceRoot":"","sources":["../../src/browser/ai-code-completion-frontend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AAS/D,wBAUG"}
|
|
@@ -15,7 +15,6 @@
|
|
|
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
|
-
const core_1 = require("@theia/core");
|
|
19
18
|
const inversify_1 = require("@theia/core/shared/inversify");
|
|
20
19
|
const code_completion_agent_1 = require("./code-completion-agent");
|
|
21
20
|
const ai_code_frontend_application_contribution_1 = require("./ai-code-frontend-application-contribution");
|
|
@@ -25,10 +24,6 @@ const ai_code_completion_preference_1 = require("./ai-code-completion-preference
|
|
|
25
24
|
const ai_code_inline_completion_provider_1 = require("./ai-code-inline-completion-provider");
|
|
26
25
|
const code_completion_postprocessor_1 = require("./code-completion-postprocessor");
|
|
27
26
|
exports.default = new inversify_1.ContainerModule(bind => {
|
|
28
|
-
bind(core_1.ILogger).toDynamicValue(ctx => {
|
|
29
|
-
const parentLogger = ctx.container.get(core_1.ILogger);
|
|
30
|
-
return parentLogger.child('code-completion-agent');
|
|
31
|
-
}).inSingletonScope().whenTargetNamed('code-completion-agent');
|
|
32
27
|
bind(code_completion_agent_1.CodeCompletionAgentImpl).toSelf().inSingletonScope();
|
|
33
28
|
bind(code_completion_agent_1.CodeCompletionAgent).toService(code_completion_agent_1.CodeCompletionAgentImpl);
|
|
34
29
|
bind(ai_core_1.Agent).toService(code_completion_agent_1.CodeCompletionAgentImpl);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-code-completion-frontend-module.js","sourceRoot":"","sources":["../../src/browser/ai-code-completion-frontend-module.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,
|
|
1
|
+
{"version":3,"file":"ai-code-completion-frontend-module.js","sourceRoot":"","sources":["../../src/browser/ai-code-completion-frontend-module.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,4DAA+D;AAC/D,mEAAuF;AACvF,2GAAgG;AAChG,qDAA0H;AAC1H,4CAAuC;AACvC,mFAAoF;AACpF,6FAAuF;AACvF,mFAAkH;AAElH,kBAAe,IAAI,2BAAe,CAAC,IAAI,CAAC,EAAE;IACtC,IAAI,CAAC,+CAAuB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC1D,IAAI,CAAC,2CAAmB,CAAC,CAAC,SAAS,CAAC,+CAAuB,CAAC,CAAC;IAC7D,IAAI,CAAC,eAAK,CAAC,CAAC,SAAS,CAAC,+CAAuB,CAAC,CAAC;IAC/C,IAAI,CAAC,oEAA+B,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAClE,IAAI,CAAC,6EAAiC,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACpE,IAAI,CAAC,yCAA+B,CAAC,CAAC,EAAE,CAAC,6EAAiC,CAAC,CAAC;IAC5E,IAAI,CAAC,gCAAsB,CAAC,CAAC,SAAS,CAAC,6EAAiC,CAAC,CAAC;IAC1E,IAAI,CAAC,gCAAsB,CAAC,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,iEAAiC,EAAE,CAAC,CAAC;IAC5F,IAAI,CAAC,2DAA2B,CAAC,CAAC,EAAE,CAAC,kEAAkC,CAAC,CAAC,gBAAgB,EAAE,CAAC;AAChG,CAAC,CAAC,CAAC"}
|
|
@@ -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;
|
|
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;AAI/F,eAAO,MAAM,0CAA0C,uDAAuD,CAAC;AAC/G,eAAO,MAAM,6CAA6C,sDAAsD,CAAC;AACjH,eAAO,MAAM,2CAA2C,+CAA+C,CAAC;AACxG,eAAO,MAAM,yCAAyC,8CAA8C,CAAC;AAErG,eAAO,MAAM,iCAAiC,EAAE,gBAuC/C,CAAC"}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.AICodeCompletionPreferencesSchema = exports.PREF_AI_INLINE_COMPLETION_STRIP_BACKTICKS = exports.PREF_AI_INLINE_COMPLETION_MAX_CONTEXT_LINES = 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
|
+
const core_1 = require("@theia/core");
|
|
20
21
|
exports.PREF_AI_INLINE_COMPLETION_AUTOMATIC_ENABLE = 'ai-features.codeCompletion.automaticCodeCompletion';
|
|
21
22
|
exports.PREF_AI_INLINE_COMPLETION_EXCLUDED_EXTENSIONS = 'ai-features.codeCompletion.excludedFileExtensions';
|
|
22
23
|
exports.PREF_AI_INLINE_COMPLETION_MAX_CONTEXT_LINES = 'ai-features.codeCompletion.maxContextLines';
|
|
@@ -27,33 +28,33 @@ exports.AICodeCompletionPreferencesSchema = {
|
|
|
27
28
|
[exports.PREF_AI_INLINE_COMPLETION_AUTOMATIC_ENABLE]: {
|
|
28
29
|
title: ai_core_preferences_1.AI_CORE_PREFERENCES_TITLE,
|
|
29
30
|
type: 'boolean',
|
|
30
|
-
description: 'Automatically trigger AI completions inline within any (Monaco) editor while editing.\
|
|
31
|
+
description: core_1.nls.localize('theia/ai/completion/automaticEnable/description', 'Automatically trigger AI completions inline within any (Monaco) editor while editing.\
|
|
31
32
|
\n\
|
|
32
|
-
Alternatively, you can manually trigger the code via the command "Trigger Inline Suggestion" or the default shortcut "Ctrl+Alt+Space".',
|
|
33
|
-
default:
|
|
33
|
+
Alternatively, you can manually trigger the code via the command "Trigger Inline Suggestion" or the default shortcut "Ctrl+Alt+Space".'),
|
|
34
|
+
default: true
|
|
34
35
|
},
|
|
35
36
|
[exports.PREF_AI_INLINE_COMPLETION_EXCLUDED_EXTENSIONS]: {
|
|
36
|
-
title: 'Excluded File Extensions',
|
|
37
|
+
title: core_1.nls.localize('theia/ai/completion/excludedFileExts/title', 'Excluded File Extensions'),
|
|
37
38
|
type: 'array',
|
|
38
|
-
description: 'Specify file extensions (e.g., .md, .txt) where AI completions should be disabled.',
|
|
39
|
+
description: core_1.nls.localize('theia/ai/completion/excludedFileExts/description', 'Specify file extensions (e.g., .md, .txt) where AI completions should be disabled.'),
|
|
39
40
|
items: {
|
|
40
41
|
type: 'string'
|
|
41
42
|
},
|
|
42
43
|
default: []
|
|
43
44
|
},
|
|
44
45
|
[exports.PREF_AI_INLINE_COMPLETION_MAX_CONTEXT_LINES]: {
|
|
45
|
-
title: 'Maximum Context Lines',
|
|
46
|
+
title: core_1.nls.localize('theia/ai/completion/maxContextLines/title', 'Maximum Context Lines'),
|
|
46
47
|
type: 'number',
|
|
47
|
-
description: 'The maximum number of lines used as context, distributed among the lines before and after the cursor position (prefix and suffix).\
|
|
48
|
-
Set this to -1 to use the full file as context without any line limit and 0 to only use the current line.',
|
|
48
|
+
description: core_1.nls.localize('theia/ai/completion/maxContextLines/description', 'The maximum number of lines used as context, distributed among the lines before and after the cursor position (prefix and suffix).\
|
|
49
|
+
Set this to -1 to use the full file as context without any line limit and 0 to only use the current line.'),
|
|
49
50
|
default: -1,
|
|
50
51
|
minimum: -1
|
|
51
52
|
},
|
|
52
53
|
[exports.PREF_AI_INLINE_COMPLETION_STRIP_BACKTICKS]: {
|
|
53
|
-
title: 'Strip Backticks from Inline Completions',
|
|
54
|
+
title: core_1.nls.localize('theia/ai/completion/stripBackticks/title', 'Strip Backticks from Inline Completions'),
|
|
54
55
|
type: 'boolean',
|
|
55
|
-
description: 'Remove surrounding backticks from the code returned by some LLMs. If a backtick is detected, all content after the closing\
|
|
56
|
-
backtick is stripped as well. This setting helps ensure plain code is returned when language models use markdown-like formatting.',
|
|
56
|
+
description: core_1.nls.localize('theia/ai/completion/stripBackticks/description', 'Remove surrounding backticks from the code returned by some LLMs. If a backtick is detected, all content after the closing\
|
|
57
|
+
backtick is stripped as well. This setting helps ensure plain code is returned when language models use markdown-like formatting.'),
|
|
57
58
|
default: true
|
|
58
59
|
}
|
|
59
60
|
}
|
|
@@ -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;
|
|
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;AAC3F,sCAAkC;AAErB,QAAA,0CAA0C,GAAG,oDAAoD,CAAC;AAClG,QAAA,6CAA6C,GAAG,mDAAmD,CAAC;AACpG,QAAA,2CAA2C,GAAG,4CAA4C,CAAC;AAC3F,QAAA,yCAAyC,GAAG,2CAA2C,CAAC;AAExF,QAAA,iCAAiC,GAAqB;IAC/D,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACR,CAAC,k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AC;IAGvC,SAAS,CAAC,gBAAgB,EAAE,6BAA6B,CAAC;IAG1D,SAAS,CAAC,eAAe,EAAE,eAAe,CAAC;IAG3C,SAAS,CAAC,WAAW,EAAE,iBAAiB,CAAC;IAGzC,SAAS,CAAC,aAAa,EAAE,2BAA2B,CAAC;IAErD,EAAE,SAAqB;IACvB,IAAI,SAAqB;IACzB,WAAW,SACkI;IAC7I,eAAe,EAAE,cAAc,EAAE,CA6B/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"}
|
|
@@ -28,10 +28,11 @@ let CodeCompletionAgentImpl = class CodeCompletionAgentImpl {
|
|
|
28
28
|
constructor() {
|
|
29
29
|
this.id = 'Code Completion';
|
|
30
30
|
this.name = 'Code Completion';
|
|
31
|
-
this.description = 'This agent provides inline code completion in the code editor in the Theia IDE.';
|
|
31
|
+
this.description = core_1.nls.localize('theia/ai/completion/agent/description', 'This agent provides inline code completion in the code editor in the Theia IDE.');
|
|
32
32
|
this.promptTemplates = [
|
|
33
33
|
{
|
|
34
|
-
id: 'code-completion-prompt',
|
|
34
|
+
id: 'code-completion-prompt-previous',
|
|
35
|
+
variantOf: 'code-completion-prompt',
|
|
35
36
|
template: `{{!-- Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
|
|
36
37
|
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
37
38
|
You are a code completion agent. The current file you have to complete is named {{file}}.
|
|
@@ -43,8 +44,7 @@ Finish the following code snippet.
|
|
|
43
44
|
Only return the exact replacement for [[MARKER]] to complete the snippet.`
|
|
44
45
|
},
|
|
45
46
|
{
|
|
46
|
-
id: 'code-completion-prompt
|
|
47
|
-
variantOf: 'code-completion-prompt',
|
|
47
|
+
id: 'code-completion-prompt',
|
|
48
48
|
template: `{{!-- Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
|
|
49
49
|
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
50
50
|
## Code snippet
|
|
@@ -75,7 +75,7 @@ Replace [[MARKER]] with the exact code to complete the code snippet. Return only
|
|
|
75
75
|
];
|
|
76
76
|
}
|
|
77
77
|
async provideInlineCompletions(model, position, context, token) {
|
|
78
|
-
const progress = await this.progressService.showProgress({ text: 'Calculating AI code completion...', options: { location: 'window' } });
|
|
78
|
+
const progress = await this.progressService.showProgress({ text: core_1.nls.localize('theia/ai/code-completion/progressText', 'Calculating AI code completion...'), options: { location: 'window' } });
|
|
79
79
|
try {
|
|
80
80
|
const languageModel = await this.languageModelRegistry.selectLanguageModel({
|
|
81
81
|
agent: this.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-completion-agent.js","sourceRoot":"","sources":["../../src/browser/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,
|
|
1
|
+
{"version":3,"file":"code-completion-agent.js","sourceRoot":"","sources":["../../src/browser/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,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O;gBACH,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,2BAA2B,EAAE,CAAC;gBACpD,sBAAsB,EAAE,IAAI;aAC/B,CAAC;QACN,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,IAAI,CAAC,KAAK,CAAC,uBAAuB,EAAE,CAAC;gBACjC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YAChC,CAAC;QACL,CAAC;gBACO,CAAC;YACL,QAAQ,CAAC,MAAM,EAAE,CAAC;QACtB,CAAC;IACL,CAAC;CAyEJ,CAAA;AAtMY,0DAAuB;AAiItB;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;AAGhD;IADT,IAAA,kBAAM,EAAC,sBAAe,CAAC;sCACG,sBAAe;gEAAC;AAGjC;IADT,IAAA,kBAAM,EAAC,2BAAiB,CAAC;;4DACe;AAG/B;IADT,IAAA,kBAAM,EAAC,2DAA2B,CAAC;;8DACiB;kCAnJ5C,uBAAuB;IADnC,IAAA,sBAAU,GAAE;GACA,uBAAuB,CAsMnC"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/ai-code-completion",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.59.0-next.62+9e43c93ad",
|
|
4
4
|
"description": "Theia - AI Core",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/ai-core": "1.
|
|
7
|
-
"@theia/core": "1.
|
|
8
|
-
"@theia/filesystem": "1.
|
|
6
|
+
"@theia/ai-core": "1.59.0-next.62+9e43c93ad",
|
|
7
|
+
"@theia/core": "1.59.0-next.62+9e43c93ad",
|
|
8
|
+
"@theia/filesystem": "1.59.0-next.62+9e43c93ad",
|
|
9
9
|
"@theia/monaco-editor-core": "1.96.302",
|
|
10
|
-
"@theia/output": "1.
|
|
11
|
-
"@theia/workspace": "1.
|
|
10
|
+
"@theia/output": "1.59.0-next.62+9e43c93ad",
|
|
11
|
+
"@theia/workspace": "1.59.0-next.62+9e43c93ad",
|
|
12
12
|
"minimatch": "^5.1.0",
|
|
13
13
|
"tslib": "^2.6.2"
|
|
14
14
|
},
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"watch": "theiaext watch"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@theia/ext-scripts": "1.58.
|
|
49
|
+
"@theia/ext-scripts": "1.58.0"
|
|
50
50
|
},
|
|
51
51
|
"nyc": {
|
|
52
52
|
"extends": "../../configs/nyc.json"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "9e43c93ad61ea977db3974207bac5d7c1fd3ccd6"
|
|
55
55
|
}
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
-
import { ILogger } from '@theia/core';
|
|
18
17
|
import { ContainerModule } from '@theia/core/shared/inversify';
|
|
19
18
|
import { CodeCompletionAgent, CodeCompletionAgentImpl } from './code-completion-agent';
|
|
20
19
|
import { AIFrontendApplicationContribution } from './ai-code-frontend-application-contribution';
|
|
@@ -25,10 +24,6 @@ import { AICodeInlineCompletionsProvider } from './ai-code-inline-completion-pro
|
|
|
25
24
|
import { CodeCompletionPostProcessor, DefaultCodeCompletionPostProcessor } from './code-completion-postprocessor';
|
|
26
25
|
|
|
27
26
|
export default new ContainerModule(bind => {
|
|
28
|
-
bind(ILogger).toDynamicValue(ctx => {
|
|
29
|
-
const parentLogger = ctx.container.get<ILogger>(ILogger);
|
|
30
|
-
return parentLogger.child('code-completion-agent');
|
|
31
|
-
}).inSingletonScope().whenTargetNamed('code-completion-agent');
|
|
32
27
|
bind(CodeCompletionAgentImpl).toSelf().inSingletonScope();
|
|
33
28
|
bind(CodeCompletionAgent).toService(CodeCompletionAgentImpl);
|
|
34
29
|
bind(Agent).toService(CodeCompletionAgentImpl);
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
|
|
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
|
+
import { nls } from '@theia/core';
|
|
19
20
|
|
|
20
21
|
export const PREF_AI_INLINE_COMPLETION_AUTOMATIC_ENABLE = 'ai-features.codeCompletion.automaticCodeCompletion';
|
|
21
22
|
export const PREF_AI_INLINE_COMPLETION_EXCLUDED_EXTENSIONS = 'ai-features.codeCompletion.excludedFileExtensions';
|
|
@@ -28,33 +29,36 @@ export const AICodeCompletionPreferencesSchema: PreferenceSchema = {
|
|
|
28
29
|
[PREF_AI_INLINE_COMPLETION_AUTOMATIC_ENABLE]: {
|
|
29
30
|
title: AI_CORE_PREFERENCES_TITLE,
|
|
30
31
|
type: 'boolean',
|
|
31
|
-
description: '
|
|
32
|
+
description: nls.localize('theia/ai/completion/automaticEnable/description',
|
|
33
|
+
'Automatically trigger AI completions inline within any (Monaco) editor while editing.\
|
|
32
34
|
\n\
|
|
33
|
-
Alternatively, you can manually trigger the code via the command "Trigger Inline Suggestion" or the default shortcut "Ctrl+Alt+Space".',
|
|
34
|
-
default:
|
|
35
|
+
Alternatively, you can manually trigger the code via the command "Trigger Inline Suggestion" or the default shortcut "Ctrl+Alt+Space".'),
|
|
36
|
+
default: true
|
|
35
37
|
},
|
|
36
38
|
[PREF_AI_INLINE_COMPLETION_EXCLUDED_EXTENSIONS]: {
|
|
37
|
-
title: 'Excluded File Extensions',
|
|
39
|
+
title: nls.localize('theia/ai/completion/excludedFileExts/title', 'Excluded File Extensions'),
|
|
38
40
|
type: 'array',
|
|
39
|
-
description: 'Specify file extensions (e.g., .md, .txt) where AI completions should be disabled.',
|
|
41
|
+
description: nls.localize('theia/ai/completion/excludedFileExts/description', 'Specify file extensions (e.g., .md, .txt) where AI completions should be disabled.'),
|
|
40
42
|
items: {
|
|
41
43
|
type: 'string'
|
|
42
44
|
},
|
|
43
45
|
default: []
|
|
44
46
|
},
|
|
45
47
|
[PREF_AI_INLINE_COMPLETION_MAX_CONTEXT_LINES]: {
|
|
46
|
-
title: 'Maximum Context Lines',
|
|
48
|
+
title: nls.localize('theia/ai/completion/maxContextLines/title', 'Maximum Context Lines'),
|
|
47
49
|
type: 'number',
|
|
48
|
-
description: '
|
|
49
|
-
|
|
50
|
+
description: nls.localize('theia/ai/completion/maxContextLines/description',
|
|
51
|
+
'The maximum number of lines used as context, distributed among the lines before and after the cursor position (prefix and suffix).\
|
|
52
|
+
Set this to -1 to use the full file as context without any line limit and 0 to only use the current line.'),
|
|
50
53
|
default: -1,
|
|
51
54
|
minimum: -1
|
|
52
55
|
},
|
|
53
56
|
[PREF_AI_INLINE_COMPLETION_STRIP_BACKTICKS]: {
|
|
54
|
-
title: 'Strip Backticks from Inline Completions',
|
|
57
|
+
title: nls.localize('theia/ai/completion/stripBackticks/title', 'Strip Backticks from Inline Completions'),
|
|
55
58
|
type: 'boolean',
|
|
56
|
-
description: '
|
|
57
|
-
|
|
59
|
+
description: nls.localize('theia/ai/completion/stripBackticks/description',
|
|
60
|
+
'Remove surrounding backticks from the code returned by some LLMs. If a backtick is detected, all content after the closing\
|
|
61
|
+
backtick is stripped as well. This setting helps ensure plain code is returned when language models use markdown-like formatting.'),
|
|
58
62
|
default: true
|
|
59
63
|
}
|
|
60
64
|
}
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
Agent, AgentSpecificVariables, CommunicationRecordingService, getTextOfResponse,
|
|
19
19
|
LanguageModelRegistry, LanguageModelRequest, LanguageModelRequirement, PromptService, PromptTemplate
|
|
20
20
|
} from '@theia/ai-core/lib/common';
|
|
21
|
-
import { generateUuid, ILogger, ProgressService } from '@theia/core';
|
|
21
|
+
import { generateUuid, ILogger, nls, ProgressService } from '@theia/core';
|
|
22
22
|
import { inject, injectable, named } from '@theia/core/shared/inversify';
|
|
23
23
|
import * as monaco from '@theia/monaco-editor-core';
|
|
24
24
|
import { PREF_AI_INLINE_COMPLETION_MAX_CONTEXT_LINES } from './ai-code-completion-preference';
|
|
@@ -40,7 +40,7 @@ export class CodeCompletionAgentImpl implements CodeCompletionAgent {
|
|
|
40
40
|
token: monaco.CancellationToken
|
|
41
41
|
): Promise<monaco.languages.InlineCompletions | undefined> {
|
|
42
42
|
const progress = await this.progressService.showProgress(
|
|
43
|
-
{ text: 'Calculating AI code completion...', options: { location: 'window' } }
|
|
43
|
+
{ text: nls.localize('theia/ai/code-completion/progressText', 'Calculating AI code completion...'), options: { location: 'window' } }
|
|
44
44
|
);
|
|
45
45
|
try {
|
|
46
46
|
const languageModel =
|
|
@@ -184,10 +184,11 @@ export class CodeCompletionAgentImpl implements CodeCompletionAgent {
|
|
|
184
184
|
id = 'Code Completion';
|
|
185
185
|
name = 'Code Completion';
|
|
186
186
|
description =
|
|
187
|
-
'This agent provides inline code completion in the code editor in the Theia IDE.';
|
|
187
|
+
nls.localize('theia/ai/completion/agent/description', 'This agent provides inline code completion in the code editor in the Theia IDE.');
|
|
188
188
|
promptTemplates: PromptTemplate[] = [
|
|
189
189
|
{
|
|
190
|
-
id: 'code-completion-prompt',
|
|
190
|
+
id: 'code-completion-prompt-previous',
|
|
191
|
+
variantOf: 'code-completion-prompt',
|
|
191
192
|
template: `{{!-- Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
|
|
192
193
|
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
193
194
|
You are a code completion agent. The current file you have to complete is named {{file}}.
|
|
@@ -199,8 +200,7 @@ Finish the following code snippet.
|
|
|
199
200
|
Only return the exact replacement for [[MARKER]] to complete the snippet.`
|
|
200
201
|
},
|
|
201
202
|
{
|
|
202
|
-
id: 'code-completion-prompt
|
|
203
|
-
variantOf: 'code-completion-prompt',
|
|
203
|
+
id: 'code-completion-prompt',
|
|
204
204
|
template: `{{!-- Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
|
|
205
205
|
https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
|
|
206
206
|
## Code snippet
|