monacopilot 0.12.5 → 0.12.7
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/README.md +9 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,10 +18,9 @@
|
|
|
18
18
|
- [Register Completion with the Monaco Editor](#register-completion-with-the-monaco-editor)
|
|
19
19
|
- [Register Completion Options](#register-completion-options)
|
|
20
20
|
- [Trigger Mode](#trigger-mode)
|
|
21
|
-
|
|
22
|
-
- [
|
|
23
|
-
|
|
24
|
-
- [Trigger Completions with an Editor Action](#trigger-completions-with-an-editor-action)
|
|
21
|
+
- [Manually Trigger Completions](#manually-trigger-completions)
|
|
22
|
+
- [Trigger Completions with a Keyboard Shortcut](#trigger-completions-with-a-keyboard-shortcut)
|
|
23
|
+
- [Trigger Completions with an Editor Action](#trigger-completions-with-an-editor-action)
|
|
25
24
|
- [Multi-File Context](#multi-file-context)
|
|
26
25
|
- [Filename](#filename)
|
|
27
26
|
- [Completions for Specific Technologies](#completions-for-specific-technologies)
|
|
@@ -34,7 +33,7 @@
|
|
|
34
33
|
- [Custom Model](#custom-model)
|
|
35
34
|
- [Completion Request Options](#completion-request-options)
|
|
36
35
|
- [Custom Headers for AI Model Requests](#custom-headers-for-ai-model-requests)
|
|
37
|
-
- [
|
|
36
|
+
- [Cross-Language API Handler Implementation](#cross-language-api-handler-implementation)
|
|
38
37
|
- [Contributing](#contributing)
|
|
39
38
|
|
|
40
39
|
### Examples
|
|
@@ -109,7 +108,7 @@ Or in case of an error:
|
|
|
109
108
|
}
|
|
110
109
|
```
|
|
111
110
|
|
|
112
|
-
If you prefer to use a different programming language for your API handler in cases where your backend is not in JavaScript, please refer to the section [
|
|
111
|
+
If you prefer to use a different programming language for your API handler in cases where your backend is not in JavaScript, please refer to the section [Cross-Language API Handler Implementation](#cross-language-api-handler-implementation) for guidance on implementing the handler in your chosen language.
|
|
113
112
|
|
|
114
113
|
Now, Monacopilot is set up to send completion requests to the `/complete` endpoint and receive completions in response.
|
|
115
114
|
|
|
@@ -168,7 +167,7 @@ registerCompletion(monaco, editor, {
|
|
|
168
167
|
|
|
169
168
|
> **Note:** If you prefer real-time completions, you can set the `trigger` option to `'onTyping'`. This may increase the number of requests made to the provider and the cost. This should not be too costly since most small models are very inexpensive.
|
|
170
169
|
|
|
171
|
-
|
|
170
|
+
### Manually Trigger Completions
|
|
172
171
|
|
|
173
172
|
If you prefer not to trigger completions automatically (e.g., on typing or on idle), you can trigger completions manually. This is useful in scenarios where you want to control when completions are provided, such as through a button click or a keyboard shortcut.
|
|
174
173
|
|
|
@@ -182,7 +181,7 @@ completion.trigger();
|
|
|
182
181
|
|
|
183
182
|
To set up manual triggering, configure the `trigger` option to `'onDemand'`. This disables automatic completions, allowing you to call the `completion.trigger()` method explicitly when needed.
|
|
184
183
|
|
|
185
|
-
|
|
184
|
+
#### Trigger Completions with a Keyboard Shortcut
|
|
186
185
|
|
|
187
186
|
You can set up completions to trigger when the `Ctrl+Shift+Space` keyboard shortcut is pressed.
|
|
188
187
|
|
|
@@ -199,7 +198,7 @@ monaco.editor.addCommand(
|
|
|
199
198
|
);
|
|
200
199
|
```
|
|
201
200
|
|
|
202
|
-
|
|
201
|
+
#### Trigger Completions with an Editor Action
|
|
203
202
|
|
|
204
203
|
You can add a custom editor action to trigger completions manually.
|
|
205
204
|
|
|
@@ -573,7 +572,7 @@ copilot.complete({
|
|
|
573
572
|
|
|
574
573
|
By using a custom prompt, you can guide the model to generate completions that better fit your coding style, project requirements, or specific technologies you're working with.
|
|
575
574
|
|
|
576
|
-
##
|
|
575
|
+
## Cross-Language API Handler Implementation
|
|
577
576
|
|
|
578
577
|
While the example in this documentation uses JavaScript/Node.js (which is recommended), you can set up the API handler in any language or framework. For JavaScript, Monacopilot provides a built-in function that handles all the necessary steps, such as generating the prompt, sending it to the model, and processing the response. However, if you're using a different language, you'll need to implement these steps manually. Here's a general approach to implement the handler in your preferred language:
|
|
579
578
|
|