Skip to content

Commit a30bbd3

Browse files
Merge branch 'main' into pe/generating-text-lump
2 parents e14163c + d6b9dcb commit a30bbd3

File tree

65 files changed

+818
-619
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+818
-619
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
## Screenshots
1111

12-
[ For visual changes, include screenshots. ]
12+
[ For visual changes, include screenshots. Screen recordings are particularly helpful, and appreciated! ]
1313

1414
## Testing instructions
1515

.github/workflows/jetbrains-release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
ref: ${{ github.event.release.tag_name }}
5555

5656
- name: Import Apple certificate
57-
uses: apple-actions/import-codesign-certs@v3
57+
uses: apple-actions/import-codesign-certs@v5
5858
with:
5959
keychain: ${{ github.run_id }}
6060
keychain-password: ${{ github.run_id }}

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,15 @@ Similarly, any changes to `core` or `extensions/vscode` will be automatically in
139139

140140
#### JetBrains
141141

142-
See the [`CONTRIBUTING.md`](./extensions/intellij/CONTRIBUTING.md) for the JetBrains extension.
142+
See [`intellij/CONTRIBUTING.md`](./extensions/intellij/CONTRIBUTING.md) for the JetBrains extension.
143143

144144
### Our Git Workflow
145145

146146
We keep a single permanent branch: `main`. When we are ready to create a "pre-release" version, we create a tag on the `main` branch titled `v0.9.x-vscode`, which automatically triggers the workflow in [preview.yaml](./.github/workflows/preview.yaml), which builds and releases a version of the VS Code extension. When a release has been sufficiently tested, we will create a new release titled `v0.8.x-vscode`, triggering a similar workflow in [main.yaml](./.github/workflows/main.yaml), which will build and release a main release of the VS Code extension. Any hotfixes can be made by creating a feature branch from the tag for the release in question. This workflow is well explained by <http://releaseflow.org>.
147147

148148
### Testing
149149

150-
We have a mix of unit, functional, and e2e test suites, with a primary focus on functional testing. These tests run on each pull request. If your PR causes one of these tests to fail, we will ask that you resolve the issue before we merge.
150+
We have a mix of unit, functional, and e2e test suites, with a primary focus on functional testing. These tests run on each pull request. If your PR causes one of these tests to fail, we will ask that you to resolve the issue before we merge.
151151

152152
When contributing, please update or create the appropriate tests to help verify the correctness of your implementaiton.
153153

@@ -217,7 +217,7 @@ Continue consists of 2 parts that are split so that it can be extended to work i
217217

218218
1. **Continue GUI** - The Continue GUI is a React application that gives the user control over Continue. It displays the current chat history, allows the user to ask questions, invoke slash commands, and use context providers. The GUI also handles most state and holds as much of the logic as possible so that it can be reused between IDEs.
219219

220-
2. **Continue Extension** - The Continue Extension is a plugin for the IDE which implements the [IDE Interface](./core/index.d.ts#L229). This allows the GUI to request information from or actions to be taken within the IDE. This same interface is used regardless of IDE. The first Continue extensions we have built are for VS Code and JetBrains, but we plan to build clients for other IDEs in the future. The IDE Client must 1. implement IDE Interface, as is done [here](./extensions/vscode/src/ideProtocol.ts) for VS Code and 2. display the Continue GUI in a sidebar, like [here](./extensions/vscode/src/ContinueGUIWebviewViewProvider.ts).
220+
2. **Continue Extension** - The Continue Extension is a plugin for the IDE which implements the [IDE Interface](./core/index.d.ts#L229). This allows the GUI to request information from or actions to be taken within the IDE. This same interface is used regardless of IDE. The first Continue extensions we have built are for VS Code and JetBrains, but we plan to build clients for other IDEs in the future. The IDE Client must 1. implement IDE Interface, as is done [here](./extensions/vscode/src/VsCodeIde.ts) for VS Code and 2. display the Continue GUI in a sidebar, like [here](./extensions/vscode/src/ContinueGUIWebviewViewProvider.ts).
221221

222222
### Continue VS Code Extension
223223

binary/package-lock.json

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

core/autocomplete/context/ImportDefinitionsService.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
getParserForFile,
66
getQueryForFile,
77
} from "../../util/treeSitter";
8+
import { findUriInDirs } from "../../util/uri";
89

910
interface FileInfo {
1011
imports: { [key: string]: RangeInFileWithContents[] };
@@ -44,7 +45,15 @@ export class ImportDefinitionsService {
4445

4546
let fileContents: string | undefined = undefined;
4647
try {
47-
fileContents = await this.ide.readFile(filepath);
48+
const { foundInDir } = findUriInDirs(
49+
filepath,
50+
await this.ide.getWorkspaceDirs(),
51+
);
52+
if (!foundInDir) {
53+
return null;
54+
} else {
55+
fileContents = await this.ide.readFile(filepath);
56+
}
4857
} catch (err) {
4958
// File removed
5059
return null;

core/commands/index.ts

Lines changed: 17 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,41 @@
11
import { CustomCommand, SlashCommand, SlashCommandDescription } from "../";
22
import { renderTemplatedString } from "../promptFiles/v1/renderTemplatedString";
3+
import { replaceSlashCommandWithPromptInChatHistory } from "../promptFiles/v1/updateChatHistory";
34
import { renderChatMessage } from "../util/messageContent";
45

56
import SlashCommands from "./slash";
67

78
export function slashFromCustomCommand(
89
customCommand: CustomCommand,
910
): SlashCommand {
11+
const commandName = customCommand.name.startsWith("/")
12+
? customCommand.name.substring(1)
13+
: customCommand.name;
1014
return {
11-
name: customCommand.name,
15+
name: commandName,
1216
description: customCommand.description ?? "",
1317
prompt: customCommand.prompt,
1418
run: async function* ({ input, llm, history, ide, completionOptions }) {
15-
// Remove slash command prefix from input
16-
let userInput = input;
17-
if (userInput.startsWith(`/${customCommand.name}`)) {
18-
userInput = userInput
19-
.slice(customCommand.name.length + 1, userInput.length)
20-
.trimStart();
21-
}
22-
2319
// Render prompt template
24-
let promptUserInput: string;
20+
let renderedPrompt: string;
2521
if (customCommand.prompt.includes("{{{ input }}}")) {
26-
promptUserInput = await renderTemplatedString(
22+
renderedPrompt = await renderTemplatedString(
2723
customCommand.prompt,
2824
ide.readFile.bind(ide),
29-
{ input: userInput },
25+
{ input },
3026
);
3127
} else {
32-
promptUserInput = customCommand.prompt + "\n\n" + userInput;
28+
renderedPrompt = customCommand.prompt + "\n\n" + input;
3329
}
3430

35-
const messages = [...history];
36-
// Find the last chat message with this slash command and replace it with the user input
37-
for (let i = messages.length - 1; i >= 0; i--) {
38-
const message = messages[i];
39-
const { role, content } = message;
40-
if (role !== "user") {
41-
continue;
42-
}
43-
44-
if (
45-
Array.isArray(content) &&
46-
content.some(
47-
(part) =>
48-
"text" in part && part.text?.startsWith(`/${customCommand.name}`),
49-
)
50-
) {
51-
messages[i] = {
52-
...message,
53-
content: content.map((part) => {
54-
if (
55-
"text" in part &&
56-
part.text.startsWith(`/${customCommand.name}`)
57-
) {
58-
return { type: "text", text: promptUserInput };
59-
}
60-
return part;
61-
}),
62-
};
63-
break;
64-
} else if (
65-
typeof content === "string" &&
66-
content.startsWith(`/${customCommand.name}`)
67-
) {
68-
messages[i] = { ...message, content: promptUserInput };
69-
break;
70-
}
71-
}
31+
// Replaces slash command messages with the rendered prompt
32+
// which INCLUDES the input
33+
const messages = replaceSlashCommandWithPromptInChatHistory(
34+
history,
35+
commandName,
36+
renderedPrompt,
37+
undefined,
38+
);
7239

7340
for await (const chunk of llm.streamChat(
7441
messages,

core/config/yaml/convertFromJson.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import { AssistantUnrolled, ModelConfig } from "@continuedev/config-yaml";
22

33
import { SerializedContinueConfig } from "../..";
44

5+
/*
6+
TODO this is not functional
7+
*/
58
export function convertConfigJsonToConfigYaml(
69
configJson: SerializedContinueConfig,
710
): AssistantUnrolled {

core/config/yaml/models.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ async function modelConfigToBaseLLM(
3939

4040
let options: LLMOptions = {
4141
...rest,
42-
// contextLength: model.defaultCompletionOptions?.contextLength ?? undefined,
42+
contextLength: model.defaultCompletionOptions?.contextLength,
4343
completionOptions: {
4444
...(model.defaultCompletionOptions ?? {}),
4545
model: model.model,

0 commit comments

Comments
 (0)