Merge branch 'main' into dallin/node-extra-ca-certs
This commit is contained in:
commit
74f0ee5ce5
134 changed files with 1115 additions and 6806 deletions
|
|
@ -1,16 +1,111 @@
|
|||
---
|
||||
globs: docs/**/*.{md,mdx}
|
||||
description: Standards for writing and maintaining Continue Docs
|
||||
globs: docs/\*_/_.{md,mdx}
|
||||
description: This style guide should be used as a reference for maintaining consistency across all Continue documentation
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Continue Docs Standards
|
||||
# Continue Documentation Style Guide
|
||||
|
||||
## Overview
|
||||
|
||||
## Writing Tone & Voice
|
||||
|
||||
### Conversational and Direct
|
||||
|
||||
- Follow Docusaurus documentation standards
|
||||
- Include YAML frontmatter with title, description, and keywords
|
||||
- Use consistent heading hierarchy starting with h2 (##)
|
||||
- Include relevant Admonition components for tips, warnings, and info
|
||||
- Use descriptive alt text for images
|
||||
- Include cross-references to related documentation
|
||||
- Reference other docs with relative paths
|
||||
- Use simple, conversational language that gets straight to the point
|
||||
- Avoid overly technical jargon when simpler terms work
|
||||
- Write as if speaking directly to the developer using the tool
|
||||
- Keep paragraphs concise and scannable
|
||||
- Use code blocks with appropriate language tags
|
||||
|
||||
**Example:**
|
||||
✅ "You send it a question, and it replies with an answer"
|
||||
❌ "The system processes user queries and generates corresponding responses"
|
||||
|
||||
### Helpful and Instructional
|
||||
|
||||
- Focus on helping users accomplish their goals
|
||||
- Use active voice and imperative mood for instructions
|
||||
- Assume users want to get things done quickly
|
||||
- Include relevant Admonition components for tips, warnings, and info
|
||||
|
||||
**Example:**
|
||||
✅ "Press cmd/ctrl + L to begin a new session"
|
||||
❌ "A new session can be initiated by pressing cmd/ctrl + L"
|
||||
|
||||
### Practical and Task-Oriented
|
||||
|
||||
- Emphasize what users can accomplish with each feature
|
||||
- Lead with benefits and use cases before diving into mechanics
|
||||
- Keep explanations grounded in real-world scenarios
|
||||
|
||||
## Content Structure
|
||||
|
||||
### Page Organization
|
||||
|
||||
1. **Visual Introduction**: Lead with GIFs or images showing the feature in action
|
||||
2. **Purpose Statement**: Brief explanation of what the feature does and when to use it
|
||||
3. **Step-by-Step Instructions**: Clear, actionable steps with keyboard shortcuts
|
||||
4. **Platform-Specific Notes**: Separate sections for VS Code and JetBrains when needed
|
||||
5. **Additional Tips**: Advanced usage or troubleshooting notes
|
||||
|
||||
### Section Headers
|
||||
|
||||
- Use consistent heading hierarchy starting with h2 (##)
|
||||
- Include YAML frontmatter with title, description, and keywords
|
||||
- Use action-oriented headers that describe what users will do
|
||||
- Format: "Verb + object" (e.g., "Type a request and press enter")
|
||||
- Keep headers concise but descriptive
|
||||
- Use title case
|
||||
|
||||
**Examples:**
|
||||
✅ "Highlight code and activate"
|
||||
✅ "Accept or reject changes"
|
||||
✅ "Switch between different models"
|
||||
|
||||
### Lists and Steps
|
||||
|
||||
- Use numbered lists for sequential steps
|
||||
- Use bullet points for feature lists or options
|
||||
- Keep list items parallel in structure
|
||||
- Start action items with verbs
|
||||
|
||||
## Technical Writing Standards
|
||||
|
||||
### Code and Keyboard Shortcuts
|
||||
|
||||
- Use `backticks` for inline code elements
|
||||
- Format keyboard shortcuts consistently: `cmd/ctrl + L`
|
||||
- Always provide shortcuts for Mac/Windows/Linux
|
||||
- Use code blocks for configuration examples with proper syntax highlighting
|
||||
|
||||
### Cross-References
|
||||
|
||||
- Link to related sections using descriptive anchor text
|
||||
- Use relative links to other documentation pages
|
||||
- Format: `[descriptive text](/path/to/page)`
|
||||
|
||||
### Platform Differences
|
||||
|
||||
- Always address both VS Code and JetBrains when applicable
|
||||
- Use clear subheadings to separate platform-specific instructions
|
||||
- Lead with the more common platform (typically VS Code) when both are covered
|
||||
|
||||
## Language Conventions
|
||||
|
||||
### Terminology
|
||||
|
||||
- **Consistent Terms**: Use the same terms throughout (e.g., "LLM" not "AI model" in some places)
|
||||
- **Product Names**: Capitalize product names correctly (VS Code, JetBrains, Continue)
|
||||
- **Feature Names**: Use consistent capitalization for Continue features (Chat, Edit, Agent, Autocomplete)
|
||||
|
||||
### Abbreviations
|
||||
|
||||
- Spell out acronyms on first use, then use abbreviation consistently
|
||||
- Common abbreviations: LLM, IDE, API, URL
|
||||
|
||||
### Pronouns
|
||||
|
||||
- Use "you" to address the user directly
|
||||
- Use "it" to refer to the tool/model
|
||||
- Avoid "we" unless referring to the Continue team
|
||||
|
|
|
|||
2
.github/workflows/pr_checks.yaml
vendored
2
.github/workflows/pr_checks.yaml
vendored
|
|
@ -439,7 +439,7 @@ jobs:
|
|||
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
|
||||
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
|
||||
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
|
||||
AZURE_FOUNDRY_API_KEY: ${{ secrets.AZURE_FOUNDRY_API_KEY }}
|
||||
AZURE_FOUNDRY_CODESTRAL_API_KEY: ${{ secrets.AZURE_FOUNDRY_CODESTRAL_API_KEY }}
|
||||
AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY: ${{ secrets.AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY }}
|
||||
AZURE_OPENAI_GPT41_API_KEY: ${{ secrets.AZURE_OPENAI_GPT41_API_KEY }}
|
||||
|
||||
|
|
|
|||
12
binary/package-lock.json
generated
12
binary/package-lock.json
generated
|
|
@ -20,6 +20,7 @@
|
|||
"posthog-node": "^3.6.3",
|
||||
"system-ca": "^1.0.2",
|
||||
"tar": "^7.4.3",
|
||||
"undici": "^7.10.0",
|
||||
"uuid": "^9.0.1",
|
||||
"vectordb": "^0.4.20",
|
||||
"win-ca": "^3.5.1"
|
||||
|
|
@ -105,6 +106,7 @@
|
|||
"sqlite3": "^5.1.7",
|
||||
"system-ca": "^1.0.3",
|
||||
"tar": "^7.4.3",
|
||||
"tree-sitter-structured-text": "^0.0.1",
|
||||
"tree-sitter-wasms": "^0.1.11",
|
||||
"uuid": "^9.0.1",
|
||||
"vectordb": "^0.4.20",
|
||||
|
|
@ -143,6 +145,7 @@
|
|||
"myers-diff": "^2.1.0",
|
||||
"onnxruntime-common": "1.14.0",
|
||||
"onnxruntime-web": "1.14.0",
|
||||
"tree-sitter-cli": "^0.22.5",
|
||||
"ts-jest": "^29.1.1",
|
||||
"typescript": "^5.6.3",
|
||||
"vitest": "^3.1.4"
|
||||
|
|
@ -6774,6 +6777,15 @@
|
|||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/undici": {
|
||||
"version": "7.10.0",
|
||||
"resolved": "https://registry.npmmirror.com/undici/-/undici-7.10.0.tgz",
|
||||
"integrity": "sha512-u5otvFBOBZvmdjWLVW+5DAc9Nkq8f24g0O9oY7qw2JVIF1VocIFoyz9JFkuVOS2j41AufeO0xnlweJ2RLT8nGw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=20.18.1"
|
||||
}
|
||||
},
|
||||
"node_modules/universal-user-agent": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz",
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@
|
|||
"posthog-node": "^3.6.3",
|
||||
"system-ca": "^1.0.2",
|
||||
"tar": "^7.4.3",
|
||||
"undici": "^7.10.0",
|
||||
"uuid": "^9.0.1",
|
||||
"vectordb": "^0.4.20",
|
||||
"win-ca": "^3.5.1"
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ const { rimrafSync } = require("rimraf");
|
|||
const tar = require("tar");
|
||||
const { RIPGREP_VERSION, TARGET_TO_RIPGREP_RELEASE } = require("./targets");
|
||||
const AdmZip = require("adm-zip");
|
||||
const { ProxyAgent } = require("undici");
|
||||
|
||||
const RIPGREP_BASE_URL = `https://github.com/BurntSushi/ripgrep/releases/download/${RIPGREP_VERSION}`;
|
||||
|
||||
|
|
@ -16,8 +17,13 @@ const RIPGREP_BASE_URL = `https://github.com/BurntSushi/ripgrep/releases/downloa
|
|||
*/
|
||||
async function downloadFile(url, destPath) {
|
||||
// Use the built-in fetch API instead of node-fetch
|
||||
// Use proxy if set in environment variables
|
||||
const proxy = process.env.https_proxy || process.env.HTTPS_PROXY;
|
||||
const agent = proxy ? new ProxyAgent(proxy) : undefined;
|
||||
|
||||
const response = await fetch(url, {
|
||||
redirect: "follow", // Automatically follow redirects
|
||||
dispatcher: agent,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { describe, test } from "vitest";
|
||||
import { PYTHON_TEST_CASES, TYPESCRIPT_TEST_CASES } from "./testCases";
|
||||
import { testRootPathContext } from "./testUtils";
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { jest } from "@jest/globals";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { expect, vi } from "vitest";
|
||||
|
||||
import Parser from "web-tree-sitter";
|
||||
import { Position } from "../../../..";
|
||||
|
|
@ -36,7 +36,7 @@ export async function testRootPathContext(
|
|||
const importDefinitionsService = new ImportDefinitionsService(ide);
|
||||
const service = new RootPathContextService(importDefinitionsService, ide);
|
||||
|
||||
const getSnippetsMock = jest
|
||||
const getSnippetsMock = vi
|
||||
// @ts-ignore
|
||||
.spyOn(service, "getSnippets")
|
||||
// @ts-ignore
|
||||
|
|
@ -46,7 +46,7 @@ export async function testRootPathContext(
|
|||
|
||||
// Copy the folder to the test directory
|
||||
const folderPath = path.join(
|
||||
__dirname,
|
||||
process.cwd(),
|
||||
"autocomplete",
|
||||
"context",
|
||||
"root-path-context",
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import { stopAtStartOf, stopAtStopTokens } from "./charStream";
|
||||
|
||||
async function* createMockStream(chunks: string[]): AsyncGenerator<string> {
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
import { jest } from "@jest/globals";
|
||||
import { beforeEach, describe, expect, it, Mock, vi } from "vitest";
|
||||
|
||||
import * as lineStream from "./lineStream";
|
||||
|
||||
// eslint-disable-next-line max-lines-per-function
|
||||
describe("lineStream", () => {
|
||||
let mockFullStop: jest.Mock;
|
||||
let mockFullStop: Mock;
|
||||
|
||||
async function getLineGenerator(lines: any) {
|
||||
return (async function* () {
|
||||
|
|
@ -25,7 +25,7 @@ describe("lineStream", () => {
|
|||
}
|
||||
|
||||
beforeEach(() => {
|
||||
mockFullStop = jest.fn();
|
||||
mockFullStop = vi.fn();
|
||||
});
|
||||
|
||||
describe("noTopLevelKeywordsMidline", () => {
|
||||
|
|
@ -1,4 +1,9 @@
|
|||
import { setUpTestDir, tearDownTestDir } from "../../../test/testDir";
|
||||
import { afterAll, beforeAll, beforeEach, describe, it } from "vitest";
|
||||
import {
|
||||
addToTestDir,
|
||||
setUpTestDir,
|
||||
tearDownTestDir,
|
||||
} from "../../../test/testDir";
|
||||
|
||||
import { TEST_CASES_WITH_DIFF, TEST_CASES_WITHOUT_DIFF } from "./testCases";
|
||||
import {
|
||||
|
|
@ -18,6 +23,7 @@ describe("Autocomplete filtering tests", () => {
|
|||
beforeAll(async () => {
|
||||
tearDownTestDir();
|
||||
setUpTestDir();
|
||||
addToTestDir([".continueignore"]);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
import { expect } from "vitest";
|
||||
import MockLLM from "../../../llm/llms/Mock";
|
||||
import { testConfigHandler, testIde } from "../../../test/fixtures";
|
||||
import { joinPathsToUri } from "../../../util/uri";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,12 @@
|
|||
import { jest } from "@jest/globals";
|
||||
import {
|
||||
afterEach,
|
||||
beforeEach,
|
||||
describe,
|
||||
expect,
|
||||
Mock,
|
||||
test,
|
||||
vi,
|
||||
} from "vitest";
|
||||
import { GeneratorReuseManager } from "./GeneratorReuseManager";
|
||||
|
||||
function createMockGenerator(
|
||||
|
|
@ -14,7 +22,7 @@ function createMockGenerator(
|
|||
}
|
||||
}
|
||||
};
|
||||
const newGenerator = jest
|
||||
const newGenerator = vi
|
||||
.fn<() => AsyncGenerator<string>>()
|
||||
.mockReturnValue(mockGenerator());
|
||||
|
||||
|
|
@ -23,15 +31,15 @@ function createMockGenerator(
|
|||
|
||||
describe("GeneratorReuseManager", () => {
|
||||
let reuseManager: GeneratorReuseManager;
|
||||
let onErrorMock: jest.Mock;
|
||||
let onErrorMock: Mock;
|
||||
|
||||
beforeEach(() => {
|
||||
onErrorMock = jest.fn();
|
||||
onErrorMock = vi.fn();
|
||||
reuseManager = new GeneratorReuseManager(onErrorMock);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
test("creates new generator when there is no current generator", async () => {
|
||||
|
|
@ -169,7 +177,7 @@ describe("GeneratorReuseManager", () => {
|
|||
const mockGenerator = async function* () {
|
||||
throw error;
|
||||
};
|
||||
const newGenerator = jest
|
||||
const newGenerator = vi
|
||||
.fn<() => AsyncGenerator<string>>()
|
||||
.mockReturnValue(mockGenerator());
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { jest } from "@jest/globals";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { ListenableGenerator } from "./ListenableGenerator";
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ describe("ListenableGenerator", () => {
|
|||
it("should yield values from the source generator via tee()", async () => {
|
||||
const values = [1, 2, 3];
|
||||
const source = asyncGenerator(values);
|
||||
const onError = jest.fn();
|
||||
const onError = vi.fn();
|
||||
|
||||
const lg = new ListenableGenerator<number>(
|
||||
source,
|
||||
|
|
@ -36,7 +36,7 @@ describe("ListenableGenerator", () => {
|
|||
it("should allow listeners to receive values", async () => {
|
||||
const values = [1, 2, 3];
|
||||
const source = asyncGenerator(values, 10); // Introduce delay to simulate async behavior
|
||||
const onError = jest.fn();
|
||||
const onError = vi.fn();
|
||||
|
||||
const lg = new ListenableGenerator<number>(
|
||||
source,
|
||||
|
|
@ -44,7 +44,7 @@ describe("ListenableGenerator", () => {
|
|||
new AbortController(),
|
||||
);
|
||||
|
||||
const listener = jest.fn();
|
||||
const listener = vi.fn();
|
||||
|
||||
// Add listener after some delay to simulate late subscription
|
||||
setTimeout(() => {
|
||||
|
|
@ -64,7 +64,7 @@ describe("ListenableGenerator", () => {
|
|||
it("should buffer values for listeners added after some values have been yielded", async () => {
|
||||
const values = [1, 2, 3];
|
||||
const source = asyncGenerator(values, 10);
|
||||
const onError = jest.fn();
|
||||
const onError = vi.fn();
|
||||
|
||||
const lg = new ListenableGenerator<number>(
|
||||
source,
|
||||
|
|
@ -72,7 +72,7 @@ describe("ListenableGenerator", () => {
|
|||
new AbortController(),
|
||||
);
|
||||
|
||||
const initialListener = jest.fn();
|
||||
const initialListener = vi.fn();
|
||||
|
||||
lg.listen(initialListener);
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ describe("ListenableGenerator", () => {
|
|||
await new Promise((resolve) => setTimeout(resolve, 15));
|
||||
|
||||
// Add a second listener
|
||||
const newListener = jest.fn();
|
||||
const newListener = vi.fn();
|
||||
lg.listen(newListener);
|
||||
|
||||
// Wait for generator to finish
|
||||
|
|
@ -98,7 +98,7 @@ describe("ListenableGenerator", () => {
|
|||
it("should handle cancellation", async () => {
|
||||
const values = [1, 2, 3, 4, 5];
|
||||
const source = asyncGenerator(values, 10);
|
||||
const onError = jest.fn();
|
||||
const onError = vi.fn();
|
||||
|
||||
const lg = new ListenableGenerator<number>(
|
||||
source,
|
||||
|
|
@ -131,7 +131,7 @@ describe("ListenableGenerator", () => {
|
|||
}
|
||||
|
||||
const source = errorGenerator();
|
||||
const onError = jest.fn();
|
||||
const onError = vi.fn();
|
||||
|
||||
const lg = new ListenableGenerator<number>(
|
||||
source,
|
||||
|
|
@ -152,7 +152,7 @@ describe("ListenableGenerator", () => {
|
|||
it("should notify listeners when the generator ends", async () => {
|
||||
const values = [1, 2, 3];
|
||||
const source = asyncGenerator(values);
|
||||
const onError = jest.fn();
|
||||
const onError = vi.fn();
|
||||
|
||||
const lg = new ListenableGenerator<number>(
|
||||
source,
|
||||
|
|
@ -160,7 +160,7 @@ describe("ListenableGenerator", () => {
|
|||
new AbortController(),
|
||||
);
|
||||
|
||||
const listener = jest.fn();
|
||||
const listener = vi.fn();
|
||||
lg.listen(listener);
|
||||
|
||||
// Wait for the generator to finish
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
import { jest } from "@jest/globals";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { stopAfterMaxProcessingTime } from "./utils";
|
||||
|
||||
describe("stopAfterMaxProcessingTime", () => {
|
||||
beforeEach(() => {
|
||||
jest.useFakeTimers();
|
||||
vi.useFakeTimers();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.useRealTimers();
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
async function* createMockStream(chunks: string[]): AsyncGenerator<string> {
|
||||
|
|
@ -28,7 +28,7 @@ describe("stopAfterMaxProcessingTime", () => {
|
|||
|
||||
it("should yield all chunks when maxTimeMs is not reached", async () => {
|
||||
const mockStream = createMockStream(["Hello", " world", "!"]);
|
||||
const fullStop = jest.fn();
|
||||
const fullStop = vi.fn();
|
||||
const result = stopAfterMaxProcessingTime(mockStream, 1000, fullStop);
|
||||
|
||||
const output = await streamToString(result);
|
||||
|
|
@ -37,11 +37,11 @@ describe("stopAfterMaxProcessingTime", () => {
|
|||
expect(fullStop).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it.only("should stop processing after max time is reached", async () => {
|
||||
it("should stop processing after max time is reached", async () => {
|
||||
// Mock implementation of Date.now
|
||||
let currentTime = 0;
|
||||
const originalDateNow = Date.now;
|
||||
Date.now = jest.fn(() => currentTime);
|
||||
Date.now = vi.fn(() => currentTime);
|
||||
|
||||
// Create a generator that we can control
|
||||
async function* controlledGenerator(): AsyncGenerator<string> {
|
||||
|
|
@ -54,7 +54,7 @@ describe("stopAfterMaxProcessingTime", () => {
|
|||
}
|
||||
}
|
||||
|
||||
const fullStop = jest.fn();
|
||||
const fullStop = vi.fn();
|
||||
const maxTimeMs = 500;
|
||||
|
||||
const transformedGenerator = stopAfterMaxProcessingTime(
|
||||
|
|
@ -84,10 +84,10 @@ describe("stopAfterMaxProcessingTime", () => {
|
|||
it("should check time only periodically based on checkInterval", async () => {
|
||||
const chunks = Array(100).fill("x");
|
||||
const mockStream = createMockStream(chunks);
|
||||
const fullStop = jest.fn();
|
||||
const fullStop = vi.fn();
|
||||
|
||||
// Spy on Date.now to count how many times it's called
|
||||
const dateSpy = jest.spyOn(Date, "now");
|
||||
const dateSpy = vi.spyOn(Date, "now");
|
||||
|
||||
// Stream should complete normally (not hitting the timeout)
|
||||
await streamToString(
|
||||
|
|
@ -105,7 +105,7 @@ describe("stopAfterMaxProcessingTime", () => {
|
|||
|
||||
it("should handle empty stream gracefully", async () => {
|
||||
const mockStream = createMockStream([]);
|
||||
const fullStop = jest.fn();
|
||||
const fullStop = vi.fn();
|
||||
const result = stopAfterMaxProcessingTime(mockStream, 1000, fullStop);
|
||||
|
||||
const output = await streamToString(result);
|
||||
|
|
@ -117,7 +117,7 @@ describe("stopAfterMaxProcessingTime", () => {
|
|||
it("should pass through all chunks if there's no timeout", async () => {
|
||||
const chunks = Array(100).fill("test chunk");
|
||||
const mockStream = createMockStream(chunks);
|
||||
const fullStop = jest.fn();
|
||||
const fullStop = vi.fn();
|
||||
|
||||
// Use undefined as timeout to simulate no timeout
|
||||
const result = stopAfterMaxProcessingTime(
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
import { beforeEach, expect, test, vi } from "vitest";
|
||||
import { GitDiffCache } from "./gitDiffCache";
|
||||
|
||||
beforeEach(() => {
|
||||
|
|
@ -7,7 +8,7 @@ beforeEach(() => {
|
|||
|
||||
test("GitDiffCache returns cached results within cache time", async () => {
|
||||
const mockDiff = ["file1.ts", "file2.ts"];
|
||||
const getDiffFn = jest.fn().mockResolvedValue(mockDiff);
|
||||
const getDiffFn = vi.fn().mockResolvedValue(mockDiff);
|
||||
const cache = GitDiffCache.getInstance(getDiffFn, 1); // 1 second cache
|
||||
|
||||
const result1 = await cache.get();
|
||||
|
|
@ -20,7 +21,7 @@ test("GitDiffCache returns cached results within cache time", async () => {
|
|||
|
||||
test("GitDiffCache refreshes cache after expiration", async () => {
|
||||
const mockDiff = ["file1.ts"];
|
||||
const getDiffFn = jest.fn().mockResolvedValue(mockDiff);
|
||||
const getDiffFn = vi.fn().mockResolvedValue(mockDiff);
|
||||
const cache = GitDiffCache.getInstance(getDiffFn, 0.1); // 100ms cache
|
||||
|
||||
const result1 = await cache.get();
|
||||
|
|
@ -31,7 +32,7 @@ test("GitDiffCache refreshes cache after expiration", async () => {
|
|||
});
|
||||
|
||||
test("GitDiffCache returns empty array on error", async () => {
|
||||
const getDiffFn = jest.fn().mockRejectedValue(new Error("Git error"));
|
||||
const getDiffFn = vi.fn().mockRejectedValue(new Error("Git error"));
|
||||
const cache = GitDiffCache.getInstance(getDiffFn);
|
||||
|
||||
const result = await cache.get();
|
||||
|
|
@ -41,7 +42,7 @@ test("GitDiffCache returns empty array on error", async () => {
|
|||
test("GitDiffCache reuses pending request", async () => {
|
||||
const mockDiff = ["file1.ts"];
|
||||
let resolvePromise: (value: string[]) => void;
|
||||
const getDiffFn = jest.fn().mockImplementation(() => {
|
||||
const getDiffFn = vi.fn().mockImplementation(() => {
|
||||
return new Promise((resolve) => {
|
||||
resolvePromise = resolve;
|
||||
});
|
||||
|
|
@ -63,7 +64,7 @@ test("GitDiffCache reuses pending request", async () => {
|
|||
|
||||
test("GitDiffCache invalidate clears cache", async () => {
|
||||
const mockDiff = ["file1.ts"];
|
||||
const getDiffFn = jest.fn().mockResolvedValue(mockDiff);
|
||||
const getDiffFn = vi.fn().mockResolvedValue(mockDiff);
|
||||
const cache = GitDiffCache.getInstance(getDiffFn);
|
||||
|
||||
await cache.get();
|
||||
|
|
@ -74,8 +75,8 @@ test("GitDiffCache invalidate clears cache", async () => {
|
|||
});
|
||||
|
||||
test("GitDiffCache maintains singleton instance", () => {
|
||||
const getDiffFn1 = jest.fn();
|
||||
const getDiffFn2 = jest.fn();
|
||||
const getDiffFn1 = vi.fn();
|
||||
const getDiffFn2 = vi.fn();
|
||||
|
||||
const instance1 = GitDiffCache.getInstance(getDiffFn1);
|
||||
const instance2 = GitDiffCache.getInstance(getDiffFn2);
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
import { describe, expect, test } from "vitest";
|
||||
import {
|
||||
AutocompleteCodeSnippet,
|
||||
AutocompleteDiffSnippet,
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
processTestCase,
|
||||
type CompletionTestCase,
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import { processTestCase } from "./completionTestUtils";
|
||||
import { processSingleLineCompletion } from "./processSingleLineCompletion";
|
||||
|
||||
|
|
@ -25,6 +25,7 @@ export function slashFromCustomCommand(
|
|||
config,
|
||||
selectedCode,
|
||||
fetch,
|
||||
abortController,
|
||||
}) {
|
||||
// Render prompt template
|
||||
let renderedPrompt: string;
|
||||
|
|
@ -63,7 +64,7 @@ export function slashFromCustomCommand(
|
|||
|
||||
for await (const chunk of llm.streamChat(
|
||||
messages,
|
||||
new AbortController().signal,
|
||||
abortController.signal,
|
||||
completionOptions,
|
||||
)) {
|
||||
yield renderChatMessage(chunk);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { renderChatMessage } from "../../util/messageContent.js";
|
|||
const CommitMessageCommand: SlashCommand = {
|
||||
name: "commit",
|
||||
description: "Generate a commit message for current changes",
|
||||
run: async function* ({ ide, llm, params }) {
|
||||
run: async function* ({ ide, llm, params, abortController }) {
|
||||
const includeUnstaged = params?.includeUnstaged ?? false;
|
||||
const diff = await ide.getDiff(includeUnstaged);
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ const CommitMessageCommand: SlashCommand = {
|
|||
const prompt = `${diff.join("\n")}\n\nGenerate a commit message for the above set of changes. First, give a single sentence, no more than 80 characters. Then, after 2 line breaks, give a list of no more than 5 short bullet points, each no more than 40 characters. Output nothing except for the commit message, and don't surround it in quotes.`;
|
||||
for await (const chunk of llm.streamChat(
|
||||
[{ role: "user", content: prompt }],
|
||||
new AbortController().signal,
|
||||
abortController.signal,
|
||||
)) {
|
||||
yield renderChatMessage(chunk);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ Body:\n\n`;
|
|||
const DraftIssueCommand: SlashCommand = {
|
||||
name: "issue",
|
||||
description: "Draft a GitHub issue",
|
||||
run: async function* ({ input, llm, history, params }) {
|
||||
run: async function* ({ input, llm, history, params, abortController }) {
|
||||
if (params?.repositoryUrl === undefined) {
|
||||
yield "This command requires a repository URL to be set in the config file.";
|
||||
return;
|
||||
|
|
@ -46,7 +46,7 @@ const DraftIssueCommand: SlashCommand = {
|
|||
|
||||
for await (const chunk of llm.streamChat(
|
||||
messages,
|
||||
new AbortController().signal,
|
||||
abortController.signal,
|
||||
)) {
|
||||
body += chunk.content;
|
||||
yield renderChatMessage(chunk);
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ export function constructMcpSlashCommand(
|
|||
|
||||
for await (const chunk of context.llm.streamChat(
|
||||
messages,
|
||||
new AbortController().signal,
|
||||
context.abortController.signal,
|
||||
context.completionOptions,
|
||||
)) {
|
||||
yield renderChatMessage(chunk);
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ const MAX_EXPLORE_DEPTH = 2;
|
|||
const OnboardSlashCommand: SlashCommand = {
|
||||
name: "onboard",
|
||||
description: "Familiarize yourself with the codebase",
|
||||
run: async function* ({ llm, ide }) {
|
||||
run: async function* ({ llm, ide, abortController }) {
|
||||
const [workspaceDir] = await ide.getWorkspaceDirs();
|
||||
|
||||
const context = await gatherProjectContext(workspaceDir, ide);
|
||||
|
|
@ -49,7 +49,7 @@ const OnboardSlashCommand: SlashCommand = {
|
|||
|
||||
for await (const chunk of llm.streamChat(
|
||||
[{ role: "user", content: prompt }],
|
||||
new AbortController().signal,
|
||||
abortController.signal,
|
||||
)) {
|
||||
yield renderChatMessage(chunk);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,14 +38,14 @@ function getLastUserHistory(history: ChatMessage[]): string {
|
|||
const ReviewMessageCommand: SlashCommand = {
|
||||
name: "review",
|
||||
description: "Review code and give feedback",
|
||||
run: async function* ({ llm, history }) {
|
||||
run: async function* ({ llm, history, abortController }) {
|
||||
const reviewText = getLastUserHistory(history).replace("\\review", "");
|
||||
|
||||
const content = `${prompt} \r\n ${reviewText}`;
|
||||
|
||||
for await (const chunk of llm.streamChat(
|
||||
[{ role: "user", content: content }],
|
||||
new AbortController().signal,
|
||||
abortController.signal,
|
||||
)) {
|
||||
yield renderChatMessage(chunk);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -211,6 +211,6 @@ export function migrateJsonSharedConfig(filepath: string, ide: IDE): void {
|
|||
new GlobalContext().updateSharedConfig(shareConfigUpdates);
|
||||
}
|
||||
} catch (e) {
|
||||
throw new Error(`Migration: Failed to parse config.json: ${e}`);
|
||||
console.error(`Migration: Failed to parse config.json: ${e}`);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,7 +123,6 @@ describe("LocalPlatformClient", () => {
|
|||
expect(
|
||||
(resolvedFQSNs[0] as SecretResult & { value: unknown })?.value,
|
||||
).toBe(secretValue);
|
||||
console.log("debug1 resolved fqsn", resolvedFQSNs);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
22
core/core.ts
22
core/core.ts
|
|
@ -47,7 +47,7 @@ import {
|
|||
type IDE,
|
||||
} from ".";
|
||||
|
||||
import { ConfigYaml } from "@continuedev/config-yaml";
|
||||
import { BLOCK_TYPES, ConfigYaml } from "@continuedev/config-yaml";
|
||||
import { getDiffFn, GitDiffCache } from "./autocomplete/snippets/gitDiffCache";
|
||||
import { isLocalDefinitionFile } from "./config/loadLocalAssistants";
|
||||
import {
|
||||
|
|
@ -58,6 +58,7 @@ import {
|
|||
import { createNewWorkspaceBlockFile } from "./config/workspace/workspaceBlocks";
|
||||
import { MCPManagerSingleton } from "./context/mcp/MCPManagerSingleton";
|
||||
import { setMdmLicenseKey } from "./control-plane/mdm/mdm";
|
||||
import { ApplyAbortManager } from "./edit/applyAbortManager";
|
||||
import { streamDiffLines } from "./edit/streamDiffLines";
|
||||
import { shouldIgnore } from "./indexing/shouldIgnore";
|
||||
import { walkDirCache } from "./indexing/walkDir";
|
||||
|
|
@ -67,7 +68,6 @@ import { llmStreamChat } from "./llm/streamChat";
|
|||
import type { FromCoreProtocol, ToCoreProtocol } from "./protocol";
|
||||
import { OnboardingModes } from "./protocol/core";
|
||||
import type { IMessenger, Message } from "./protocol/messenger";
|
||||
import { StreamAbortManager } from "./util/abortManager";
|
||||
import { getUriPathBasename } from "./util/uri";
|
||||
|
||||
const hasRulesFiles = (uris: string[]): boolean => {
|
||||
|
|
@ -512,6 +512,11 @@ export class Core {
|
|||
throw new Error("No model selected");
|
||||
}
|
||||
|
||||
const abortManager = ApplyAbortManager.getInstance();
|
||||
const abortController = abortManager.get(
|
||||
data.fileUri ?? "current-file-stream",
|
||||
); // not super important since currently cancelling apply will cancel all streams it's one file at a time
|
||||
|
||||
return streamDiffLines({
|
||||
highlighted: data.highlighted,
|
||||
prefix: data.prefix,
|
||||
|
|
@ -525,13 +530,13 @@ export class Core {
|
|||
language: data.language,
|
||||
onlyOneInsertion: false,
|
||||
overridePrompt: undefined,
|
||||
abortControllerId: data.fileUri ?? "current-file-stream", // not super important since currently cancelling apply will cancel all streams it's one file at a time
|
||||
abortController,
|
||||
});
|
||||
});
|
||||
|
||||
on("cancelApply", async (msg) => {
|
||||
const abortManager = StreamAbortManager.getInstance();
|
||||
abortManager.clear();
|
||||
const abortManager = ApplyAbortManager.getInstance();
|
||||
abortManager.clear(); // for now abort all streams
|
||||
});
|
||||
|
||||
on("onboarding/complete", this.handleCompleteOnboarding.bind(this));
|
||||
|
|
@ -887,7 +892,12 @@ export class Core {
|
|||
uri.endsWith(".prompt") ||
|
||||
uri.endsWith(SYSTEM_PROMPT_DOT_FILE) ||
|
||||
(uri.includes(".continue") && uri.endsWith(".yaml")) ||
|
||||
uri.endsWith(RULES_MARKDOWN_FILENAME)
|
||||
uri.endsWith(RULES_MARKDOWN_FILENAME) ||
|
||||
BLOCK_TYPES.some(
|
||||
(blockType) =>
|
||||
uri.includes(`.continue/${blockType}`) ||
|
||||
uri.includes(`.continue\\${blockType}`),
|
||||
)
|
||||
) {
|
||||
await this.configHandler.reloadConfig();
|
||||
} else if (
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
export class StreamAbortManager {
|
||||
private static instance: StreamAbortManager;
|
||||
export class ApplyAbortManager {
|
||||
private static instance: ApplyAbortManager;
|
||||
private controllers: Map<string, AbortController>;
|
||||
|
||||
private constructor() {
|
||||
this.controllers = new Map();
|
||||
}
|
||||
|
||||
public static getInstance(): StreamAbortManager {
|
||||
if (!StreamAbortManager.instance) {
|
||||
StreamAbortManager.instance = new StreamAbortManager();
|
||||
public static getInstance(): ApplyAbortManager {
|
||||
if (!ApplyAbortManager.instance) {
|
||||
ApplyAbortManager.instance = new ApplyAbortManager();
|
||||
}
|
||||
return StreamAbortManager.instance;
|
||||
return ApplyAbortManager.instance;
|
||||
}
|
||||
|
||||
public get(id: string): AbortController {
|
||||
|
|
@ -16,6 +16,7 @@ export async function applyCodeBlock(
|
|||
newLazyFile: string,
|
||||
filename: string,
|
||||
llm: ILLM,
|
||||
abortController: AbortController,
|
||||
): Promise<{
|
||||
isInstantApply: boolean;
|
||||
diffLinesGenerator: AsyncGenerator<DiffLine>;
|
||||
|
|
@ -51,6 +52,12 @@ export async function applyCodeBlock(
|
|||
|
||||
return {
|
||||
isInstantApply: false,
|
||||
diffLinesGenerator: streamLazyApply(oldFile, filename, newLazyFile, llm),
|
||||
diffLinesGenerator: streamLazyApply(
|
||||
oldFile,
|
||||
filename,
|
||||
newLazyFile,
|
||||
llm,
|
||||
abortController,
|
||||
),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ export async function* getReplacementWithLlm(
|
|||
linesBefore: string[],
|
||||
linesAfter: string[],
|
||||
llm: ILLM,
|
||||
abortController: AbortController,
|
||||
): AsyncGenerator<string> {
|
||||
const userPrompt = dedent`
|
||||
ORIGINAL CODE:
|
||||
|
|
@ -88,7 +89,7 @@ export async function* getReplacementWithLlm(
|
|||
{ role: "user", content: userPrompt },
|
||||
{ role: "assistant", content: assistantPrompt },
|
||||
],
|
||||
new AbortController().signal,
|
||||
abortController.signal,
|
||||
);
|
||||
|
||||
let lines = streamLines(completion);
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ export async function* streamLazyApply(
|
|||
filename: string,
|
||||
newCode: string,
|
||||
llm: ILLM,
|
||||
abortController: AbortController,
|
||||
): AsyncGenerator<DiffLine> {
|
||||
const promptFactory = lazyApplyPromptForModel(llm.model, llm.providerName);
|
||||
if (!promptFactory) {
|
||||
|
|
@ -23,10 +24,7 @@ export async function* streamLazyApply(
|
|||
}
|
||||
|
||||
const promptMessages = promptFactory(oldCode, filename, newCode);
|
||||
const lazyCompletion = llm.streamChat(
|
||||
promptMessages,
|
||||
new AbortController().signal,
|
||||
);
|
||||
const lazyCompletion = llm.streamChat(promptMessages, abortController.signal);
|
||||
|
||||
// Do find and replace over the lazy edit response
|
||||
async function* replacementFunction(
|
||||
|
|
@ -39,6 +37,7 @@ export async function* streamLazyApply(
|
|||
linesBefore,
|
||||
linesAfter,
|
||||
llm,
|
||||
abortController,
|
||||
)) {
|
||||
yield line;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import { streamDiff } from "../diff/streamDiff";
|
|||
import { streamLines } from "../diff/util";
|
||||
import { getSystemMessageWithRules } from "../llm/rules/getSystemMessageWithRules";
|
||||
import { gptEditPrompt } from "../llm/templates/edit";
|
||||
import { StreamAbortManager } from "../util/abortManager";
|
||||
import { findLast } from "../util/findLast";
|
||||
import { Telemetry } from "../util/posthog";
|
||||
import { recursiveStream } from "./recursiveStream";
|
||||
|
|
@ -64,7 +63,7 @@ export async function* streamDiffLines({
|
|||
highlighted,
|
||||
suffix,
|
||||
llm,
|
||||
abortControllerId,
|
||||
abortController,
|
||||
input,
|
||||
language,
|
||||
onlyOneInsertion,
|
||||
|
|
@ -75,15 +74,13 @@ export async function* streamDiffLines({
|
|||
highlighted: string;
|
||||
suffix: string;
|
||||
llm: ILLM;
|
||||
abortControllerId: string;
|
||||
abortController: AbortController;
|
||||
input: string;
|
||||
language: string | undefined;
|
||||
onlyOneInsertion: boolean;
|
||||
overridePrompt: ChatMessage[] | undefined;
|
||||
rulesToInclude: RuleWithSource[] | undefined;
|
||||
}): AsyncGenerator<DiffLine> {
|
||||
const abortManager = StreamAbortManager.getInstance();
|
||||
const abortController = abortManager.get(abortControllerId);
|
||||
void Telemetry.capture(
|
||||
"inlineEdit",
|
||||
{
|
||||
|
|
|
|||
3
core/index.d.ts
vendored
3
core/index.d.ts
vendored
|
|
@ -833,6 +833,7 @@ export interface ContinueSDK {
|
|||
config: ContinueConfig;
|
||||
fetch: FetchFunction;
|
||||
completionOptions?: LLMFullCompletionOptions;
|
||||
abortController: AbortController;
|
||||
}
|
||||
|
||||
export interface SlashCommand {
|
||||
|
|
@ -1280,7 +1281,7 @@ export interface HighlightedCodePayload {
|
|||
}
|
||||
|
||||
export interface AcceptOrRejectDiffPayload {
|
||||
filepath: string;
|
||||
filepath?: string;
|
||||
streamId?: string;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,5 @@ export default {
|
|||
globalSetup: "<rootDir>/test/jest.global-setup.ts",
|
||||
setupFilesAfterEnv: ["<rootDir>/test/jest.setup-after-env.js"],
|
||||
maxWorkers: 1, // equivalent to CLI --runInBand
|
||||
modulePathIgnorePatterns: [
|
||||
"<rootDir>/config/yaml/LocalPlatformClient.test.ts",
|
||||
],
|
||||
testMatch: ["**/*.test.ts"],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import { findLast } from "../util/findLast";
|
|||
import { normalizeToMessageParts } from "../util/messageContent";
|
||||
import { isUserOrToolMsg } from "./messages";
|
||||
import { getSystemMessageWithRules } from "./rules/getSystemMessageWithRules";
|
||||
import { RulePolicies } from "./rules/types";
|
||||
|
||||
export const DEFAULT_CHAT_SYSTEM_MESSAGE_URL =
|
||||
"https://github.com/continuedev/continue/blob/main/core/llm/constructMessages.ts";
|
||||
|
|
@ -108,6 +109,7 @@ export function constructMessages(
|
|||
history: ChatHistoryItem[],
|
||||
baseChatOrAgentSystemMessage: string | undefined,
|
||||
rules: RuleWithSource[],
|
||||
rulePolicies?: RulePolicies,
|
||||
): ChatMessage[] {
|
||||
const filteredHistory = history.filter(
|
||||
(item) => item.message.role !== "system",
|
||||
|
|
@ -164,6 +166,7 @@ export function constructMessages(
|
|||
rules,
|
||||
userMessage: lastUserMsg,
|
||||
contextItems: lastUserContextItems,
|
||||
rulePolicies,
|
||||
});
|
||||
|
||||
if (systemMessage.trim()) {
|
||||
|
|
|
|||
|
|
@ -161,12 +161,7 @@ function testLLM(
|
|||
group: "Hello",
|
||||
},
|
||||
],
|
||||
toolChoice: {
|
||||
type: "function",
|
||||
function: {
|
||||
name: "say_hello",
|
||||
},
|
||||
},
|
||||
toolChoice: { type: "function", function: { name: "say_hello" } },
|
||||
},
|
||||
)) {
|
||||
const typedChunk = chunk as AssistantChatMessage;
|
||||
|
|
@ -211,10 +206,7 @@ describe("LLM", () => {
|
|||
model: "claude-3-5-sonnet-latest",
|
||||
apiKey: process.env.ANTHROPIC_API_KEY,
|
||||
}),
|
||||
{
|
||||
skip: false,
|
||||
testToolCall: true,
|
||||
},
|
||||
{ skip: false, testToolCall: true },
|
||||
);
|
||||
testLLM(new OpenAI({ apiKey: process.env.OPENAI_API_KEY, model: "gpt-4o" }), {
|
||||
skip: false,
|
||||
|
|
@ -240,12 +232,7 @@ describe("LLM", () => {
|
|||
apiKey: process.env.MISTRAL_API_KEY,
|
||||
model: "codestral-latest",
|
||||
}),
|
||||
{
|
||||
testFim: true,
|
||||
skip: false,
|
||||
testToolCall: true,
|
||||
timeout: 60000,
|
||||
},
|
||||
{ testFim: true, skip: false, testToolCall: true, timeout: 60000 },
|
||||
);
|
||||
testLLM(
|
||||
new Azure({
|
||||
|
|
@ -260,11 +247,10 @@ describe("LLM", () => {
|
|||
);
|
||||
testLLM(
|
||||
new Azure({
|
||||
apiKey: process.env.AZURE_FOUNDRY_API_KEY,
|
||||
model: "codestral-latest",
|
||||
apiBase:
|
||||
"https://codestral-2501-continue-testing.eastus.models.ai.azure.com",
|
||||
apiType: "azure-foundry",
|
||||
apiKey: process.env.AZURE_FOUNDRY_CODESTRAL_API_KEY,
|
||||
model: "Codestral-2501",
|
||||
apiBase: "https://continue-foundry-resource.services.ai.azure.com",
|
||||
env: { apiType: "azure-foundry", apiVersion: "2024-05-01-preview" },
|
||||
}),
|
||||
{ testFim: false, skip: false, timeout: 20000 },
|
||||
);
|
||||
|
|
|
|||
186
core/llm/rules/alwaysApply.vitest.ts
Normal file
186
core/llm/rules/alwaysApply.vitest.ts
Normal file
|
|
@ -0,0 +1,186 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
ContextItemId,
|
||||
ContextItemWithId,
|
||||
RuleWithSource,
|
||||
UserChatMessage,
|
||||
} from "../..";
|
||||
import { getApplicableRules } from "./getSystemMessageWithRules";
|
||||
|
||||
describe("alwaysApply Behavior", () => {
|
||||
// Common test fixtures
|
||||
const testFile = "src/app.ts";
|
||||
const matchingFile = "src/components/Button.tsx";
|
||||
const nonMatchingFile = "src/utils/helper.js"; // Not matching *.tsx glob
|
||||
|
||||
// File context items
|
||||
const matchingFileContext: ContextItemWithId = {
|
||||
id: { providerTitle: "file", itemId: "match1" } as ContextItemId,
|
||||
uri: { type: "file", value: matchingFile },
|
||||
content: "export const Button = () => {...}",
|
||||
name: "Button.tsx",
|
||||
description: "Component file",
|
||||
};
|
||||
|
||||
const nonMatchingFileContext: ContextItemWithId = {
|
||||
id: { providerTitle: "file", itemId: "nonmatch1" } as ContextItemId,
|
||||
uri: { type: "file", value: nonMatchingFile },
|
||||
content: "export const helper = () => {...}",
|
||||
name: "helper.js",
|
||||
description: "Helper file",
|
||||
};
|
||||
|
||||
// Message with no file references
|
||||
const messageWithoutFile: UserChatMessage = {
|
||||
role: "user",
|
||||
content: "Can you help me understand how this works?",
|
||||
};
|
||||
|
||||
it("alwaysApply: true - Always include the rule, regardless of file context", () => {
|
||||
// Rule with alwaysApply: true
|
||||
const alwaysApplyRule: RuleWithSource = {
|
||||
name: "Always Apply Rule",
|
||||
rule: "This rule should always be applied",
|
||||
alwaysApply: true,
|
||||
globs: "**/*.tsx", // Should be ignored since alwaysApply is true
|
||||
source: "rules-block",
|
||||
ruleFile: ".continue/rules.md",
|
||||
};
|
||||
|
||||
// Test with no file context
|
||||
let applicableRules = getApplicableRules(
|
||||
messageWithoutFile,
|
||||
[alwaysApplyRule],
|
||||
[],
|
||||
);
|
||||
expect(applicableRules).toHaveLength(1);
|
||||
expect(applicableRules[0].name).toBe("Always Apply Rule");
|
||||
|
||||
// Test with matching file
|
||||
applicableRules = getApplicableRules(
|
||||
undefined,
|
||||
[alwaysApplyRule],
|
||||
[matchingFileContext],
|
||||
);
|
||||
expect(applicableRules).toHaveLength(1);
|
||||
expect(applicableRules[0].name).toBe("Always Apply Rule");
|
||||
|
||||
// Test with non-matching file
|
||||
applicableRules = getApplicableRules(
|
||||
undefined,
|
||||
[alwaysApplyRule],
|
||||
[nonMatchingFileContext],
|
||||
);
|
||||
expect(applicableRules).toHaveLength(1);
|
||||
expect(applicableRules[0].name).toBe("Always Apply Rule");
|
||||
});
|
||||
|
||||
it("alwaysApply: false - Only include if globs exist AND match file context", () => {
|
||||
// Rule with alwaysApply: false and globs
|
||||
const conditionalRule: RuleWithSource = {
|
||||
name: "Conditional Rule",
|
||||
rule: "Apply only to matching files",
|
||||
alwaysApply: false,
|
||||
globs: "**/*.tsx",
|
||||
source: "rules-block",
|
||||
ruleFile: ".continue/rules.md",
|
||||
};
|
||||
|
||||
// Rule with alwaysApply: false and no globs
|
||||
const neverApplyRule: RuleWithSource = {
|
||||
name: "Never Apply Rule",
|
||||
rule: "This rule should never apply",
|
||||
alwaysApply: false,
|
||||
// No globs
|
||||
source: "rules-block",
|
||||
ruleFile: ".continue/rules.md",
|
||||
};
|
||||
|
||||
// Test with no file context
|
||||
let applicableRules = getApplicableRules(
|
||||
messageWithoutFile,
|
||||
[conditionalRule, neverApplyRule],
|
||||
[],
|
||||
);
|
||||
expect(applicableRules).toHaveLength(0); // No rules should apply
|
||||
|
||||
// Test with matching file
|
||||
applicableRules = getApplicableRules(
|
||||
undefined,
|
||||
[conditionalRule, neverApplyRule],
|
||||
[matchingFileContext],
|
||||
);
|
||||
expect(applicableRules).toHaveLength(1);
|
||||
expect(applicableRules[0].name).toBe("Conditional Rule");
|
||||
expect(applicableRules.map((r) => r.name)).not.toContain(
|
||||
"Never Apply Rule",
|
||||
);
|
||||
|
||||
// Test with non-matching file
|
||||
applicableRules = getApplicableRules(
|
||||
undefined,
|
||||
[conditionalRule, neverApplyRule],
|
||||
[nonMatchingFileContext],
|
||||
);
|
||||
expect(applicableRules).toHaveLength(0); // No rules should apply
|
||||
});
|
||||
|
||||
it("alwaysApply: undefined - Default behavior: include if no globs exist OR globs exist and match", () => {
|
||||
// Rule with undefined alwaysApply and no globs (should behave like a global rule)
|
||||
const defaultNoGlobsRule: RuleWithSource = {
|
||||
name: "Default No Globs Rule",
|
||||
rule: "Default rule with no globs",
|
||||
source: "rules-block",
|
||||
ruleFile: ".continue/rules.md",
|
||||
// No alwaysApply, no globs
|
||||
};
|
||||
|
||||
// Rule with undefined alwaysApply and globs
|
||||
const defaultWithGlobsRule: RuleWithSource = {
|
||||
name: "Default With Globs Rule",
|
||||
rule: "Default rule with globs",
|
||||
globs: "**/*.tsx",
|
||||
source: "rules-block",
|
||||
ruleFile: ".continue/rules.md",
|
||||
// No alwaysApply, with globs
|
||||
};
|
||||
|
||||
// Test with no file context
|
||||
let applicableRules = getApplicableRules(
|
||||
messageWithoutFile,
|
||||
[defaultNoGlobsRule, defaultWithGlobsRule],
|
||||
[],
|
||||
);
|
||||
expect(applicableRules).toHaveLength(1);
|
||||
expect(applicableRules[0].name).toBe("Default No Globs Rule");
|
||||
expect(applicableRules.map((r) => r.name)).not.toContain(
|
||||
"Default With Globs Rule",
|
||||
);
|
||||
|
||||
// Test with matching file
|
||||
applicableRules = getApplicableRules(
|
||||
undefined,
|
||||
[defaultNoGlobsRule, defaultWithGlobsRule],
|
||||
[matchingFileContext],
|
||||
);
|
||||
expect(applicableRules).toHaveLength(2);
|
||||
expect(applicableRules.map((r) => r.name)).toContain(
|
||||
"Default No Globs Rule",
|
||||
);
|
||||
expect(applicableRules.map((r) => r.name)).toContain(
|
||||
"Default With Globs Rule",
|
||||
);
|
||||
|
||||
// Test with non-matching file
|
||||
applicableRules = getApplicableRules(
|
||||
undefined,
|
||||
[defaultNoGlobsRule, defaultWithGlobsRule],
|
||||
[nonMatchingFileContext],
|
||||
);
|
||||
expect(applicableRules).toHaveLength(1);
|
||||
expect(applicableRules[0].name).toBe("Default No Globs Rule");
|
||||
expect(applicableRules.map((r) => r.name)).not.toContain(
|
||||
"Default With Globs Rule",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
@ -6,6 +6,7 @@ import {
|
|||
UserChatMessage,
|
||||
} from "../..";
|
||||
import { getApplicableRules } from "./getSystemMessageWithRules";
|
||||
import { RulePolicies } from "./types";
|
||||
|
||||
describe("Rule application with alwaysApply", () => {
|
||||
// Create an always-apply rule
|
||||
|
|
@ -136,4 +137,38 @@ describe("Rule application with alwaysApply", () => {
|
|||
expect(applicableRules).toHaveLength(1);
|
||||
expect(applicableRules.map((r) => r.name)).toContain("Always Apply Rule");
|
||||
});
|
||||
|
||||
it("should respect 'off' rulePolicies over alwaysApply when there are no file paths", () => {
|
||||
// Rule with alwaysApply: true
|
||||
const globalRule: RuleWithSource = {
|
||||
name: "Global Rule",
|
||||
rule: "This rule has alwaysApply: true but is blocked by rulePolicies",
|
||||
alwaysApply: true,
|
||||
source: "rules-block",
|
||||
ruleFile: "src/some/path.md",
|
||||
};
|
||||
|
||||
// Message with no code blocks or file references
|
||||
const simpleMessage: UserChatMessage = {
|
||||
role: "user",
|
||||
content: "Can you help me with something?",
|
||||
};
|
||||
|
||||
// Create a rule policy that blocks the rule
|
||||
const rulePolicies: RulePolicies = {
|
||||
"Global Rule": "off",
|
||||
};
|
||||
|
||||
// The rule should NOT be applied due to the "off" policy,
|
||||
// even though it has alwaysApply: true and there are no file paths
|
||||
const applicableRules = getApplicableRules(
|
||||
simpleMessage,
|
||||
[globalRule],
|
||||
[],
|
||||
rulePolicies,
|
||||
);
|
||||
|
||||
expect(applicableRules).toHaveLength(0);
|
||||
expect(applicableRules.map((r) => r.name)).not.toContain("Global Rule");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import {
|
|||
import { renderChatMessage } from "../../util/messageContent";
|
||||
import { getCleanUriPath } from "../../util/uri";
|
||||
import { extractPathsFromCodeBlocks } from "../utils/extractPathsFromCodeBlocks";
|
||||
import { RulePolicies } from "./types";
|
||||
|
||||
/**
|
||||
* Checks if a path matches any of the provided globs
|
||||
|
|
@ -120,13 +121,21 @@ const isGlobalRule = (rule: RuleWithSource): boolean => {
|
|||
export const shouldApplyRule = (
|
||||
rule: RuleWithSource,
|
||||
filePaths: string[],
|
||||
rulePolicies: RulePolicies = {},
|
||||
): boolean => {
|
||||
const policy = rulePolicies[rule.name || ""];
|
||||
|
||||
// Never apply if policy is "off"
|
||||
if (policy === "off") {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If it's a global rule, always apply it regardless of file paths
|
||||
if (isGlobalRule(rule)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If there are no file paths to check:
|
||||
// If there are no file paths to check and we've made it here:
|
||||
// - We've already handled global rules above
|
||||
// - Don't apply other rules since we have no files to match against
|
||||
if (filePaths.length === 0) {
|
||||
|
|
@ -196,11 +205,9 @@ export const getApplicableRules = (
|
|||
userMessage: UserChatMessage | ToolResultChatMessage | undefined,
|
||||
rules: RuleWithSource[],
|
||||
contextItems: ContextItemWithId[],
|
||||
rulePolicies: RulePolicies = {},
|
||||
): RuleWithSource[] => {
|
||||
// First, extract any global rules that should always apply
|
||||
const globalRules = rules.filter((rule) => isGlobalRule(rule));
|
||||
|
||||
// Get file paths from message and context for regular rule matching
|
||||
// Get file paths from message and context for rule matching
|
||||
const filePathsFromMessage = userMessage
|
||||
? extractPathsFromCodeBlocks(renderChatMessage(userMessage))
|
||||
: [];
|
||||
|
|
@ -213,41 +220,34 @@ export const getApplicableRules = (
|
|||
// Combine file paths from both sources
|
||||
const allFilePaths = [...filePathsFromMessage, ...filePathsFromContextItems];
|
||||
|
||||
// If we have no file paths, just return the global rules
|
||||
if (allFilePaths.length === 0) {
|
||||
return globalRules;
|
||||
}
|
||||
// Apply shouldApplyRule to all rules - this will handle global rules, rule policies,
|
||||
// and path matching in a consistent way
|
||||
const applicableRules = rules.filter((rule) =>
|
||||
shouldApplyRule(rule, allFilePaths, rulePolicies),
|
||||
);
|
||||
|
||||
// Get rules that match file paths
|
||||
const matchingRules = rules
|
||||
.filter((rule) => !isGlobalRule(rule)) // Skip global rules as we've already handled them
|
||||
.filter((rule) => shouldApplyRule(rule, allFilePaths));
|
||||
|
||||
// Combine global rules with matching rules, ensuring no duplicates
|
||||
return [...globalRules, ...matchingRules];
|
||||
return applicableRules;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a system message string with applicable rules appended
|
||||
*
|
||||
* @param baseSystemMessage - The base system message to start with
|
||||
* @param userMessage - The user message to check for file paths
|
||||
* @param rules - The list of rules to filter
|
||||
* @param contextItems - Context items to check for file paths
|
||||
* @returns System message with applicable rules appended
|
||||
*/
|
||||
export const getSystemMessageWithRules = ({
|
||||
baseSystemMessage,
|
||||
userMessage,
|
||||
rules,
|
||||
contextItems,
|
||||
rulePolicies = {},
|
||||
}: {
|
||||
baseSystemMessage?: string;
|
||||
userMessage: UserChatMessage | ToolResultChatMessage | undefined;
|
||||
rules: RuleWithSource[];
|
||||
contextItems: ContextItemWithId[];
|
||||
rulePolicies?: RulePolicies;
|
||||
}) => {
|
||||
const applicableRules = getApplicableRules(userMessage, rules, contextItems);
|
||||
const applicableRules = getApplicableRules(
|
||||
userMessage,
|
||||
rules,
|
||||
contextItems,
|
||||
rulePolicies,
|
||||
);
|
||||
let systemMessage = baseSystemMessage ?? "";
|
||||
|
||||
for (const rule of applicableRules) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import { RuleWithSource } from "../..";
|
||||
import { shouldApplyRule } from "./getSystemMessageWithRules";
|
||||
import { RulePolicies } from "./types";
|
||||
|
||||
describe("Rule colocation glob matching", () => {
|
||||
// This test file demonstrates the expected behavior after our fix
|
||||
|
|
@ -132,3 +133,114 @@ describe("Rule colocation glob matching", () => {
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Rule policies", () => {
|
||||
const componentRule: RuleWithSource = {
|
||||
name: "Components Rule",
|
||||
rule: "Use functional components with hooks",
|
||||
source: "rules-block",
|
||||
ruleFile: "src/components/rules.md",
|
||||
};
|
||||
|
||||
const testFiles = ["src/components/Button.tsx"];
|
||||
const nonMatchingFiles = ["src/utils/helpers.ts"];
|
||||
|
||||
it("should never apply rules with 'off' policy regardless of file paths", () => {
|
||||
const rulePolicies: RulePolicies = {
|
||||
"Components Rule": "off",
|
||||
};
|
||||
|
||||
// Should not apply even to matching files
|
||||
expect(shouldApplyRule(componentRule, testFiles, rulePolicies)).toBe(false);
|
||||
|
||||
// Rule with alwaysApply: true should still be overridden by 'off' policy
|
||||
const alwaysApplyRule: RuleWithSource = {
|
||||
name: "Always Apply Rule",
|
||||
rule: "This rule would normally always apply",
|
||||
alwaysApply: true,
|
||||
source: "rules-block",
|
||||
ruleFile: "src/components/rules.md",
|
||||
};
|
||||
|
||||
const offPolicies: RulePolicies = {
|
||||
"Always Apply Rule": "off",
|
||||
};
|
||||
|
||||
expect(shouldApplyRule(alwaysApplyRule, testFiles, offPolicies)).toBe(
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
it("should apply 'on' policy rules based on normal matching logic", () => {
|
||||
const rulePolicies: RulePolicies = {
|
||||
"Components Rule": "on",
|
||||
};
|
||||
|
||||
// Should apply to matching files
|
||||
expect(shouldApplyRule(componentRule, testFiles, rulePolicies)).toBe(true);
|
||||
|
||||
// Should not apply to non-matching files
|
||||
expect(shouldApplyRule(componentRule, nonMatchingFiles, rulePolicies)).toBe(
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
it("should use default behavior when no policy is specified", () => {
|
||||
// Empty policies object should use default behavior
|
||||
const rulePolicies: RulePolicies = {};
|
||||
|
||||
// Should apply to matching files
|
||||
expect(shouldApplyRule(componentRule, testFiles, rulePolicies)).toBe(true);
|
||||
|
||||
// Should not apply to non-matching files
|
||||
expect(shouldApplyRule(componentRule, nonMatchingFiles, rulePolicies)).toBe(
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
it("should handle policy interaction with global rules", () => {
|
||||
// Root level rule which would normally apply globally
|
||||
const rootRule: RuleWithSource = {
|
||||
name: "Root Rule",
|
||||
rule: "Follow project standards",
|
||||
source: "rules-block",
|
||||
ruleFile: ".continue/rules.md",
|
||||
};
|
||||
|
||||
// Off policy should override even global rules
|
||||
const offPolicies: RulePolicies = {
|
||||
"Root Rule": "off",
|
||||
};
|
||||
|
||||
expect(shouldApplyRule(rootRule, testFiles, offPolicies)).toBe(false);
|
||||
|
||||
// On policy should maintain global rule behavior
|
||||
const onPolicies: RulePolicies = {
|
||||
"Root Rule": "on",
|
||||
};
|
||||
|
||||
expect(shouldApplyRule(rootRule, testFiles, onPolicies)).toBe(true);
|
||||
});
|
||||
|
||||
it("should prioritize 'off' policy over alwaysApply and directory restrictions", () => {
|
||||
// Create rule with multiple matching criteria
|
||||
const complexRule: RuleWithSource = {
|
||||
name: "Complex Rule",
|
||||
rule: "This rule has complex matching logic",
|
||||
alwaysApply: true,
|
||||
globs: "**/*.ts",
|
||||
source: "rules-block",
|
||||
ruleFile: "src/utils/rules.md",
|
||||
};
|
||||
|
||||
// Off policy should win over everything
|
||||
const offPolicies: RulePolicies = {
|
||||
"Complex Rule": "off",
|
||||
};
|
||||
|
||||
// Even with matching files and alwaysApply: true, off policy wins
|
||||
expect(
|
||||
shouldApplyRule(complexRule, ["src/utils/test.ts"], offPolicies),
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
2
core/llm/rules/types.ts
Normal file
2
core/llm/rules/types.ts
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export type RulePolicy = "on" | "off";
|
||||
export type RulePolicies = { [ruleName: string]: RulePolicy };
|
||||
|
|
@ -85,6 +85,7 @@ export async function* llmStreamChat(
|
|||
config.requestOptions,
|
||||
),
|
||||
completionOptions,
|
||||
abortController,
|
||||
});
|
||||
let next = await gen.next();
|
||||
while (!next.done) {
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ export function slashCommandFromPromptFileV1(
|
|||
|
||||
for await (const chunk of context.llm.streamChat(
|
||||
messages,
|
||||
new AbortController().signal,
|
||||
context.abortController.signal,
|
||||
context.completionOptions,
|
||||
)) {
|
||||
yield renderChatMessage(chunk);
|
||||
|
|
|
|||
11
core/test/vitest.global-setup.ts
Normal file
11
core/test/vitest.global-setup.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
// Sets up the GLOBAL directory for testing - equivalent to ~/.continue
|
||||
// IMPORTANT: the CONTINUE_GLOBAL_DIR environment variable is used in utils/paths for getting all local paths
|
||||
export default async function () {
|
||||
process.env.CONTINUE_GLOBAL_DIR = path.join(__dirname, ".continue-test");
|
||||
if (fs.existsSync(process.env.CONTINUE_GLOBAL_DIR)) {
|
||||
fs.rmdirSync(process.env.CONTINUE_GLOBAL_DIR, { recursive: true });
|
||||
}
|
||||
}
|
||||
16
core/test/vitest.setup.ts
Normal file
16
core/test/vitest.setup.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import { TextDecoder, TextEncoder } from "util";
|
||||
|
||||
import fetch, { Request, Response } from "node-fetch";
|
||||
import { beforeAll } from "vitest";
|
||||
|
||||
beforeAll(() => {
|
||||
// @ts-ignore
|
||||
globalThis.fetch = fetch;
|
||||
// @ts-ignore
|
||||
globalThis.Request = Request;
|
||||
// @ts-ignore
|
||||
globalThis.Response = Response;
|
||||
globalThis.TextEncoder = TextEncoder;
|
||||
// @ts-ignore
|
||||
globalThis.TextDecoder = TextDecoder;
|
||||
});
|
||||
|
|
@ -1,10 +1,6 @@
|
|||
import { execSync } from "child_process";
|
||||
import { homedir } from "os";
|
||||
|
||||
/**
|
||||
* Gets the PATH env var from the user's login shell on non-Windows platforms.
|
||||
* Windows is not implemented primarily because it is not needed at the moment.
|
||||
* @returns The enhanced PATH from the user's shell, or the current PATH if it cannot be determined
|
||||
*/
|
||||
export function getEnvPathFromUserShell(): string | undefined {
|
||||
if (process.platform === "win32") {
|
||||
console.warn(`${getEnvPathFromUserShell.name} not implemented for Windows`);
|
||||
|
|
@ -16,7 +12,8 @@ export function getEnvPathFromUserShell(): string | undefined {
|
|||
}
|
||||
|
||||
try {
|
||||
const command = `${process.env.SHELL} -l -c 'echo $PATH'`;
|
||||
// Source common profile files
|
||||
const command = `${process.env.SHELL} -l -c 'for f in ~/.zprofile ~/.zshrc ~/.bash_profile ~/.bashrc; do [ -f "$f" ] && source "$f" 2>/dev/null; done; echo $PATH'`;
|
||||
|
||||
const stdout = execSync(command, {
|
||||
encoding: "utf8",
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ export async function getQueryForFile(
|
|||
}
|
||||
|
||||
const sourcePath = path.join(
|
||||
__dirname,
|
||||
process.env.NODE_ENV === "test" ? process.cwd() : __dirname,
|
||||
"..",
|
||||
...(process.env.NODE_ENV === "test"
|
||||
? ["extensions", "vscode", "tree-sitter"]
|
||||
|
|
@ -201,7 +201,7 @@ async function loadLanguageForFileExt(
|
|||
fileExtension: string,
|
||||
): Promise<Language> {
|
||||
const wasmPath = path.join(
|
||||
__dirname,
|
||||
process.env.NODE_ENV === "test" ? process.cwd() : __dirname,
|
||||
...(process.env.NODE_ENV === "test"
|
||||
? ["node_modules", "tree-sitter-wasms", "out"]
|
||||
: ["tree-sitter-wasms"]),
|
||||
|
|
|
|||
|
|
@ -2,6 +2,13 @@ import { defineConfig } from "vitest/config";
|
|||
|
||||
export default defineConfig({
|
||||
test: {
|
||||
testTransformMode: {
|
||||
web: ["/.[jt]s?$/"],
|
||||
ssr: ["/.[jt]s?$/"],
|
||||
},
|
||||
globalSetup: "./test/vitest.global-setup.ts",
|
||||
setupFiles: "./test/vitest.setup.ts",
|
||||
fileParallelism: false,
|
||||
include: ["**/*.vitest.ts"],
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import TabItem from "@theme/TabItem";
|
||||
import Tabs from "@theme/Tabs";
|
||||
|
||||
# vLLM
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ We recommend configuring **Claude 4 Sonnet** as your chat model.
|
|||
{
|
||||
"title": "Claude 4 Sonnet",
|
||||
"provider": "anthropic",
|
||||
"model": "claude-sonnet-4-20250514",
|
||||
"model": "claude-sonnet-4-latest",
|
||||
"apiKey": "<YOUR_ANTHROPIC_API_KEY>"
|
||||
}
|
||||
]
|
||||
|
|
@ -68,9 +68,6 @@ Prompt caching is generally available for:
|
|||
- Claude 3.7 Sonnet
|
||||
- Claude 3.5 Sonnet
|
||||
- Claude 3.5 Haiku
|
||||
- Claude 3 Opus
|
||||
- Claude 3 Sonnet
|
||||
- Claude 3 Haiku
|
||||
|
||||
To enable caching of the system message and the turn-by-turn conversation, update your model configuration as follows:
|
||||
|
||||
|
|
@ -84,9 +81,8 @@ To enable caching of the system message and the turn-by-turn conversation, updat
|
|||
apiKey: <YOUR_ANTHROPIC_API_KEY>
|
||||
roles:
|
||||
- chat
|
||||
cacheBehavior:
|
||||
cacheSystemMessage: true
|
||||
cacheConversation: true
|
||||
defaultCompletionOptions:
|
||||
promptCaching: true
|
||||
```
|
||||
</TabItem>
|
||||
<TabItem value="json" label="JSON">
|
||||
|
|
@ -100,7 +96,10 @@ To enable caching of the system message and the turn-by-turn conversation, updat
|
|||
},
|
||||
"title": "Anthropic",
|
||||
"provider": "anthropic",
|
||||
"model": "claude-sonnet-4-20250514",
|
||||
"model": "claude-sonnet-4-latest",
|
||||
"defaultCompletionOptions": {
|
||||
"promptCaching": true
|
||||
},
|
||||
"apiKey": "<YOUR_ANTHROPIC_API_KEY>"
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -203,6 +203,14 @@ const config = {
|
|||
},
|
||||
}),
|
||||
plugins: [
|
||||
[
|
||||
"posthog-docusaurus",
|
||||
{
|
||||
apiKey: process.env.POSTHOG_API_KEY || "DEV",
|
||||
appUrl: "https://us.i.posthog.com",
|
||||
enableInDevelopment: false,
|
||||
},
|
||||
],
|
||||
[
|
||||
"@docusaurus/plugin-client-redirects",
|
||||
{
|
||||
|
|
|
|||
10
docs/package-lock.json
generated
10
docs/package-lock.json
generated
|
|
@ -14,6 +14,7 @@
|
|||
"@docusaurus/preset-classic": "^3.7.0",
|
||||
"@mdx-js/react": "^3.0.0",
|
||||
"clsx": "^2.1.0",
|
||||
"posthog-docusaurus": "^2.0.4",
|
||||
"prism-react-renderer": "^2.3.1",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0"
|
||||
|
|
@ -14990,6 +14991,15 @@
|
|||
"postcss": "^8.4.31"
|
||||
}
|
||||
},
|
||||
"node_modules/posthog-docusaurus": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/posthog-docusaurus/-/posthog-docusaurus-2.0.4.tgz",
|
||||
"integrity": "sha512-xnEVCBovSuvQvYXGny03CDTc0yZCl7O3Mz21sJpXmE1Gvs21gM33WzWaA9Cm6WvWGYZtQy8t8/g8OjCkmTWlXA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10.15.1"
|
||||
}
|
||||
},
|
||||
"node_modules/pretty-error": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-4.0.0.tgz",
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
"@docusaurus/preset-classic": "^3.7.0",
|
||||
"@mdx-js/react": "^3.0.0",
|
||||
"clsx": "^2.1.0",
|
||||
"posthog-docusaurus": "^2.0.4",
|
||||
"prism-react-renderer": "^2.3.1",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ pluginGroup=com.github.continuedev.continueintellijextension
|
|||
pluginName=continue-intellij-extension
|
||||
pluginRepositoryUrl=https://github.com/continuedev/continue
|
||||
# SemVer format -> https://semver.org
|
||||
pluginVersion=1.0.23
|
||||
pluginVersion=1.0.24
|
||||
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
|
||||
pluginSinceBuild=223
|
||||
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
|
||||
|
|
|
|||
|
|
@ -169,7 +169,11 @@ class ApplyToFileHandler(
|
|||
ide: IDE,
|
||||
params: ApplyToFileParams
|
||||
) {
|
||||
val editorUtils = EditorUtils.getOrOpenEditor(project, params.filepath)
|
||||
val editorUtils = if (EditorUtils.editorFileExist(params.filepath))
|
||||
EditorUtils.getOrOpenEditor(project, params.filepath)
|
||||
else
|
||||
EditorUtils.getEditorByCreateFile(project, params.filepath)
|
||||
|
||||
val diffStreamService = project.getService(DiffStreamService::class.java)
|
||||
|
||||
val handler = ApplyToFileHandler(
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.github.continuedev.continueintellijextension.editor
|
|||
|
||||
import com.github.continuedev.continueintellijextension.utils.toUriOrNull
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.application.runWriteAction
|
||||
import com.intellij.openapi.command.WriteCommandAction
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.editor.SelectionModel
|
||||
|
|
@ -14,6 +15,8 @@ import com.intellij.openapi.util.TextRange
|
|||
import com.intellij.openapi.vfs.VirtualFileManager
|
||||
import com.intellij.ui.JBColor
|
||||
import com.intellij.openapi.editor.ScrollType
|
||||
import com.intellij.openapi.vfs.LocalFileSystem
|
||||
import java.io.File
|
||||
|
||||
/**
|
||||
* Utility class for working with Editor instances.
|
||||
|
|
@ -166,5 +169,38 @@ class EditorUtils(val editor: Editor) {
|
|||
val editor = FileEditorManager.getInstance(project).selectedTextEditor ?: return null
|
||||
return EditorUtils(editor)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets editor for the filepath is existed
|
||||
*/
|
||||
fun editorFileExist(filepath: String?): Boolean {
|
||||
return !filepath.isNullOrEmpty() && VirtualFileManager.getInstance().findFileByUrl(filepath) != null
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets editor for the no exist filepath and returns an EditorUtils instance
|
||||
*/
|
||||
fun getEditorByCreateFile(project: Project, filepath: String?): EditorUtils? {
|
||||
if (!filepath.isNullOrEmpty()) {
|
||||
// file not exists and create
|
||||
val ioFile = File(filepath.replace("file:///", ""))
|
||||
if (!ioFile.exists()) {
|
||||
ioFile.parentFile?.mkdirs()
|
||||
ioFile.createNewFile()
|
||||
}
|
||||
// IntelliJ refresh VirtualFile
|
||||
val virtualFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(ioFile)
|
||||
if (virtualFile != null) {
|
||||
ApplicationManager.getApplication().invokeAndWait {
|
||||
runWriteAction {
|
||||
FileEditorManager.getInstance(project).openFile(virtualFile, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val editor = FileEditorManager.getInstance(project).selectedTextEditor ?: return null
|
||||
return EditorUtils(editor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ data class StreamDiffLinesPayload(
|
|||
)
|
||||
|
||||
data class AcceptOrRejectDiffPayload(
|
||||
val filepath: String,
|
||||
val filepath: String? = null,
|
||||
val streamId: String? = null
|
||||
)
|
||||
|
||||
|
|
|
|||
4
extensions/vscode/package-lock.json
generated
4
extensions/vscode/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"version": "1.1.47",
|
||||
"version": "1.1.48",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "continue",
|
||||
"version": "1.1.47",
|
||||
"version": "1.1.48",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@continuedev/config-types": "^1.0.14",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"name": "continue",
|
||||
"icon": "media/icon.png",
|
||||
"author": "Continue Dev, Inc",
|
||||
"version": "1.1.48",
|
||||
"version": "1.1.49",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/continuedev/continue"
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { applyCodeBlock } from "core/edit/lazy/applyCodeBlock";
|
|||
import { getUriPathBasename } from "core/util/uri";
|
||||
import * as vscode from "vscode";
|
||||
|
||||
import { ApplyAbortManager } from "core/edit/applyAbortManager";
|
||||
import { VerticalDiffManager } from "../diff/vertical/manager";
|
||||
import { VsCodeIde } from "../VsCodeIde";
|
||||
import { VsCodeWebviewProtocol } from "../webviewProtocol";
|
||||
|
|
@ -116,11 +117,16 @@ export class ApplyManager {
|
|||
return;
|
||||
}
|
||||
|
||||
const fileUri = editor.document.uri.toString();
|
||||
const abortManager = ApplyAbortManager.getInstance();
|
||||
const abortController = abortManager.get(fileUri);
|
||||
|
||||
const { isInstantApply, diffLinesGenerator } = await applyCodeBlock(
|
||||
editor.document.getText(),
|
||||
text,
|
||||
getUriPathBasename(editor.document.uri.toString()),
|
||||
getUriPathBasename(fileUri),
|
||||
llm,
|
||||
abortController,
|
||||
);
|
||||
|
||||
if (isInstantApply) {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import {
|
|||
} from "./autocomplete/statusBar";
|
||||
import { ContinueConsoleWebviewViewProvider } from "./ContinueConsoleWebviewViewProvider";
|
||||
import { ContinueGUIWebviewViewProvider } from "./ContinueGUIWebviewViewProvider";
|
||||
import { processDiff } from "./diff/processDiff";
|
||||
import { VerticalDiffManager } from "./diff/vertical/manager";
|
||||
import EditDecorationManager from "./quickEdit/EditDecorationManager";
|
||||
import { QuickEdit, QuickEditShowParams } from "./quickEdit/QuickEditQuickPick";
|
||||
|
|
@ -86,56 +87,6 @@ function hideGUI() {
|
|||
}
|
||||
}
|
||||
|
||||
async function processDiff(
|
||||
action: "accept" | "reject",
|
||||
sidebar: ContinueGUIWebviewViewProvider,
|
||||
ide: VsCodeIde,
|
||||
core: Core,
|
||||
verticalDiffManager: VerticalDiffManager,
|
||||
newFileUri?: string,
|
||||
streamId?: string,
|
||||
toolCallId?: string,
|
||||
) {
|
||||
captureCommandTelemetry(`${action}Diff`);
|
||||
|
||||
const currentFile = await ide.getCurrentFile();
|
||||
|
||||
let newOrCurrentUri = newFileUri;
|
||||
if (!newOrCurrentUri) {
|
||||
newOrCurrentUri = currentFile?.path;
|
||||
}
|
||||
if (!newOrCurrentUri) {
|
||||
console.warn(
|
||||
`No file provided or current file open while attempting to resolve diff`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
await ide.openFile(newOrCurrentUri);
|
||||
|
||||
// Clear vertical diffs depending on action
|
||||
verticalDiffManager.clearForfileUri(newOrCurrentUri, action === "accept");
|
||||
if (action === "reject") {
|
||||
core.invoke("cancelApply", undefined);
|
||||
}
|
||||
|
||||
if (streamId) {
|
||||
const fileContent = await ide.readFile(newOrCurrentUri);
|
||||
|
||||
await sidebar.webviewProtocol.request("updateApplyState", {
|
||||
fileContent,
|
||||
filepath: newOrCurrentUri,
|
||||
streamId,
|
||||
status: "closed",
|
||||
numDiffs: 0,
|
||||
toolCallId,
|
||||
});
|
||||
}
|
||||
|
||||
// Save the file
|
||||
await ide.saveFile(newOrCurrentUri);
|
||||
}
|
||||
|
||||
function waitForSidebarReady(
|
||||
sidebar: ContinueGUIWebviewViewProvider,
|
||||
timeout: number,
|
||||
|
|
@ -226,8 +177,9 @@ const getCommandsMap: (
|
|||
}
|
||||
|
||||
return {
|
||||
"continue.acceptDiff": async (newFileUri?: string, streamId?: string) =>
|
||||
processDiff(
|
||||
"continue.acceptDiff": async (newFileUri?: string, streamId?: string) => {
|
||||
captureCommandTelemetry("acceptDiff");
|
||||
void processDiff(
|
||||
"accept",
|
||||
sidebar,
|
||||
ide,
|
||||
|
|
@ -235,10 +187,12 @@ const getCommandsMap: (
|
|||
verticalDiffManager,
|
||||
newFileUri,
|
||||
streamId,
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
"continue.rejectDiff": async (newFileUri?: string, streamId?: string) =>
|
||||
processDiff(
|
||||
"continue.rejectDiff": async (newFileUri?: string, streamId?: string) => {
|
||||
captureCommandTelemetry("rejectDiff");
|
||||
void processDiff(
|
||||
"reject",
|
||||
sidebar,
|
||||
ide,
|
||||
|
|
@ -246,7 +200,8 @@ const getCommandsMap: (
|
|||
verticalDiffManager,
|
||||
newFileUri,
|
||||
streamId,
|
||||
),
|
||||
);
|
||||
},
|
||||
"continue.acceptVerticalDiffBlock": (fileUri?: string, index?: number) => {
|
||||
captureCommandTelemetry("acceptVerticalDiffBlock");
|
||||
verticalDiffManager.acceptRejectVerticalDiffBlock(true, fileUri, index);
|
||||
|
|
|
|||
52
extensions/vscode/src/diff/processDiff.ts
Normal file
52
extensions/vscode/src/diff/processDiff.ts
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
import { Core } from "core/core";
|
||||
import { ContinueGUIWebviewViewProvider } from "../ContinueGUIWebviewViewProvider";
|
||||
import { VsCodeIde } from "../VsCodeIde";
|
||||
import { VerticalDiffManager } from "./vertical/manager";
|
||||
|
||||
export async function processDiff(
|
||||
action: "accept" | "reject",
|
||||
sidebar: ContinueGUIWebviewViewProvider,
|
||||
ide: VsCodeIde,
|
||||
core: Core,
|
||||
verticalDiffManager: VerticalDiffManager,
|
||||
newFileUri?: string,
|
||||
streamId?: string,
|
||||
toolCallId?: string,
|
||||
) {
|
||||
let newOrCurrentUri = newFileUri;
|
||||
if (!newOrCurrentUri) {
|
||||
const currentFile = await ide.getCurrentFile();
|
||||
newOrCurrentUri = currentFile?.path;
|
||||
}
|
||||
if (!newOrCurrentUri) {
|
||||
console.warn(
|
||||
`No file provided or current file open while attempting to resolve diff`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
await ide.openFile(newOrCurrentUri);
|
||||
|
||||
// Clear vertical diffs depending on action
|
||||
verticalDiffManager.clearForfileUri(newOrCurrentUri, action === "accept");
|
||||
if (action === "reject") {
|
||||
// this is so that IDE reject diff command can also cancel apply
|
||||
core.invoke("cancelApply", undefined);
|
||||
}
|
||||
|
||||
if (streamId) {
|
||||
const fileContent = await ide.readFile(newOrCurrentUri);
|
||||
|
||||
await sidebar.webviewProtocol.request("updateApplyState", {
|
||||
fileContent,
|
||||
filepath: newOrCurrentUri,
|
||||
streamId,
|
||||
status: "closed",
|
||||
numDiffs: 0,
|
||||
toolCallId,
|
||||
});
|
||||
}
|
||||
|
||||
// Save the file
|
||||
await ide.saveFile(newOrCurrentUri);
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@ import EditDecorationManager from "../../quickEdit/EditDecorationManager";
|
|||
import { handleLLMError } from "../../util/errorHandling";
|
||||
import { VsCodeWebviewProtocol } from "../../webviewProtocol";
|
||||
|
||||
import { ApplyAbortManager } from "core/edit/applyAbortManager";
|
||||
import { VerticalDiffHandler, VerticalDiffHandlerOptions } from "./handler";
|
||||
|
||||
export interface VerticalDiffCodeLens {
|
||||
|
|
@ -437,6 +438,9 @@ export class VerticalDiffManager {
|
|||
|
||||
this.editDecorationManager.clear();
|
||||
|
||||
const abortManager = ApplyAbortManager.getInstance();
|
||||
const abortController = abortManager.get(fileUri);
|
||||
|
||||
try {
|
||||
const streamedLines: string[] = [];
|
||||
|
||||
|
|
@ -451,7 +455,7 @@ export class VerticalDiffManager {
|
|||
language: getMarkdownLanguageTagForFile(fileUri),
|
||||
onlyOneInsertion: !!onlyOneInsertion,
|
||||
overridePrompt,
|
||||
abortControllerId: fileUri,
|
||||
abortController,
|
||||
});
|
||||
|
||||
for await (const line of stream) {
|
||||
|
|
@ -467,6 +471,10 @@ export class VerticalDiffManager {
|
|||
// enable a listener for user edits to file while diff is open
|
||||
this.enableDocumentChangeListener();
|
||||
|
||||
if (abortController.signal.aborted) {
|
||||
vscode.commands.executeCommand("continue.rejectDiff");
|
||||
}
|
||||
|
||||
return `${prefix}${streamedLines.join("\n")}${suffix}`;
|
||||
} catch (e) {
|
||||
this.disableDocumentChangeListener();
|
||||
|
|
|
|||
|
|
@ -183,7 +183,6 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable {
|
|||
|
||||
async refreshSessions() {
|
||||
try {
|
||||
debugger;
|
||||
await this._refreshSessions();
|
||||
} catch (e) {
|
||||
console.error(`Error refreshing sessions: ${e}`);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"root": true,
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"plugins": ["@typescript-eslint", "eslint-plugin-react"],
|
||||
"plugins": ["@typescript-eslint", "eslint-plugin-react", "no-barrel-files"],
|
||||
"parserOptions": {
|
||||
"project": ["tsconfig.json", "tsconfig.node.json"]
|
||||
},
|
||||
|
|
@ -13,7 +13,8 @@
|
|||
],
|
||||
"rules": {
|
||||
"@typescript-eslint/naming-convention": "off",
|
||||
"@typescript-eslint/no-floating-promises": "warn"
|
||||
"@typescript-eslint/no-floating-promises": "warn",
|
||||
"no-barrel-files/no-barrel-files": "error"
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
|
|
|
|||
13
gui/package-lock.json
generated
13
gui/package-lock.json
generated
|
|
@ -90,6 +90,7 @@
|
|||
"@vitest/ui": "^2.1.3",
|
||||
"autoprefixer": "^10.4.13",
|
||||
"eslint": "^8",
|
||||
"eslint-plugin-no-barrel-files": "^1.2.1",
|
||||
"eslint-plugin-react": "^7.37.2",
|
||||
"jsdom": "^25.0.1",
|
||||
"postcss": "^8.4.21",
|
||||
|
|
@ -214,7 +215,7 @@
|
|||
},
|
||||
"../packages/config-yaml": {
|
||||
"name": "@continuedev/config-yaml",
|
||||
"version": "1.0.92",
|
||||
"version": "1.0.94",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@continuedev/config-types": "^1.0.14",
|
||||
|
|
@ -5281,6 +5282,16 @@
|
|||
"url": "https://opencollective.com/eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-no-barrel-files": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-no-barrel-files/-/eslint-plugin-no-barrel-files-1.2.1.tgz",
|
||||
"integrity": "sha512-WoZ48JXa99yptWwWWAKmuKNgvgA6tpSol6Cf0GzXs2Lg/JdBqe+CF58Bf8saEpYJRA+6+cTzP90nI7U7zoy5IQ==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/utils": "^8.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-react": {
|
||||
"version": "7.37.2",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.37.2.tgz",
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@
|
|||
"@vitest/ui": "^2.1.3",
|
||||
"autoprefixer": "^10.4.13",
|
||||
"eslint": "^8",
|
||||
"eslint-plugin-no-barrel-files": "^1.2.1",
|
||||
"eslint-plugin-react": "^7.37.2",
|
||||
"jsdom": "^25.0.1",
|
||||
"postcss": "^8.4.21",
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
export * from "./ConversationStarterCards";
|
||||
export { ConversationStarterCards } from "./ConversationStarterCards";
|
||||
|
|
|
|||
|
|
@ -7,12 +7,7 @@ import { selectSelectedChatModel } from "../../redux/slices/configSlice";
|
|||
import { setMode } from "../../redux/slices/sessionSlice";
|
||||
import { getFontSize, getMetaKeyLabel } from "../../util";
|
||||
import { useMainEditor } from "../mainInput/TipTapEditor";
|
||||
import {
|
||||
Listbox,
|
||||
ListboxButton,
|
||||
ListboxOption,
|
||||
ListboxOptions,
|
||||
} from "../ui/Listbox";
|
||||
import { Listbox, ListboxButton, ListboxOption, ListboxOptions } from "../ui";
|
||||
import { ModeIcon } from "./ModeIcon";
|
||||
|
||||
export function ModeSelect() {
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
export * from "./ModeSelect";
|
||||
export { ModeSelect } from "./ModeSelect";
|
||||
|
|
|
|||
|
|
@ -3,14 +3,12 @@ import { useAppSelector } from "../../redux/hooks";
|
|||
import { getLocalStorage, setLocalStorage } from "../../util/localStorage";
|
||||
import Alert from "../gui/Alert";
|
||||
import { ReusableCard } from "../ReusableCard";
|
||||
import {
|
||||
OnboardingCardLanding,
|
||||
OnboardingCardTabs,
|
||||
OnboardingLocalTab,
|
||||
OnboardingModelsAddOnTab,
|
||||
OnboardingProvidersTab,
|
||||
} from "./components";
|
||||
import { useOnboardingCard } from "./hooks";
|
||||
import { OnboardingCardLanding } from "./components/OnboardingCardLanding";
|
||||
import { OnboardingCardTabs } from "./components/OnboardingCardTabs";
|
||||
import { OnboardingLocalTab } from "./components/OnboardingLocalTab";
|
||||
import { OnboardingModelsAddOnTab } from "./components/OnboardingModelsAddOnTab";
|
||||
import { OnboardingProvidersTab } from "./components/OnboardingProvidersTab";
|
||||
import { useOnboardingCard } from "./hooks/useOnboardingCard";
|
||||
|
||||
export interface OnboardingCardState {
|
||||
show?: boolean;
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@ import { useContext } from "react";
|
|||
import { Button, SecondaryButton } from "../..";
|
||||
import { useAuth } from "../../../context/Auth";
|
||||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
import { selectCurrentOrg } from "../../../redux";
|
||||
import { useAppDispatch, useAppSelector } from "../../../redux/hooks";
|
||||
import { selectFirstHubProfile } from "../../../redux/thunks";
|
||||
import { selectCurrentOrg } from "../../../redux/slices/profilesSlice";
|
||||
import { selectFirstHubProfile } from "../../../redux/thunks/selectFirstHubProfile";
|
||||
import { hasPassedFTL } from "../../../util/freeTrial";
|
||||
import { ToolTip } from "../../gui/Tooltip";
|
||||
import ContinueLogo from "../../svg/ContinueLogo";
|
||||
import { useOnboardingCard } from "../hooks";
|
||||
import { useOnboardingCard } from "../hooks/useOnboardingCard";
|
||||
|
||||
export function OnboardingCardLanding({
|
||||
onSelectConfigure,
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ import { useAuth } from "../../../context/Auth";
|
|||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
import { useAppDispatch } from "../../../redux/hooks";
|
||||
import { setDialogMessage, setShowDialog } from "../../../redux/slices/uiSlice";
|
||||
import { updateSelectedModelByRole } from "../../../redux/thunks";
|
||||
import { useSubmitOnboarding } from "../hooks";
|
||||
import { updateSelectedModelByRole } from "../../../redux/thunks/updateSelectedModelByRole";
|
||||
import { useSubmitOnboarding } from "../hooks/useSubmitOnboarding";
|
||||
import OllamaModelDownload from "./OllamaModelDownload";
|
||||
import { OllamaStatus } from "./OllamaStatus";
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { useContext, useEffect, useState } from "react";
|
|||
import { Button } from "../..";
|
||||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
import { getLocalStorage } from "../../../util/localStorage";
|
||||
import { useOnboardingCard } from "../hooks";
|
||||
import { useOnboardingCard } from "../hooks/useOnboardingCard";
|
||||
|
||||
/**
|
||||
* Models Add-On tab component displaying pricing and tier information
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { OnboardingModes } from "core/protocol/core";
|
||||
import { FormProvider, useForm } from "react-hook-form";
|
||||
import { AddModelForm } from "../../../forms";
|
||||
import { AddModelForm } from "../../../forms/AddModelForm";
|
||||
import { providers } from "../../../pages/AddNewModel/configs/providers";
|
||||
import { useAppDispatch } from "../../../redux/hooks";
|
||||
import { setDialogMessage, setShowDialog } from "../../../redux/slices/uiSlice";
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
export * from "./OllamaCompletedStep";
|
||||
export * from "./OllamaModelDownload";
|
||||
export * from "./OllamaStatus";
|
||||
export * from "./OnboardingCardLanding";
|
||||
export * from "./OnboardingCardTabs";
|
||||
export * from "./OnboardingLocalTab";
|
||||
export * from "./OnboardingModelsAddOnTab";
|
||||
export * from "./OnboardingProvidersTab";
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
export * from "./useSubmitOnboarding";
|
||||
export * from "./useOnboardingCard";
|
||||
|
|
@ -1,3 +1,8 @@
|
|||
export * from "./OnboardingCard";
|
||||
export * from "./utils";
|
||||
export * from "./hooks/useOnboardingCard";
|
||||
export { useOnboardingCard } from "./hooks/useOnboardingCard";
|
||||
export { useSubmitOnboarding } from "./hooks/useSubmitOnboarding";
|
||||
export { OnboardingCard, type OnboardingCardState } from "./OnboardingCard";
|
||||
export {
|
||||
defaultOnboardingCardState,
|
||||
isNewUserOnboarding,
|
||||
type OnboardingStatus,
|
||||
} from "./utils";
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import {
|
|||
vscEditorBackground,
|
||||
} from "../..";
|
||||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
import { useIdeMessengerRequest } from "../../../hooks";
|
||||
import { useIdeMessengerRequest } from "../../../hooks/useIdeMessengerRequest";
|
||||
import { useWebviewListener } from "../../../hooks/useWebviewListener";
|
||||
import { useAppSelector } from "../../../redux/hooks";
|
||||
import { selectCurrentToolCallApplyState } from "../../../redux/selectors/selectCurrentToolCall";
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { ExclamationCircleIcon } from "@heroicons/react/24/outline";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { AddModelForm } from "../../forms";
|
||||
import { AddModelForm } from "../../forms/AddModelForm";
|
||||
import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice";
|
||||
import { FREE_TRIAL_LIMIT_REQUESTS } from "../../util/freeTrial";
|
||||
import { ToolTip } from "../gui/Tooltip";
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { ArrowLeftIcon } from "@heroicons/react/24/outline";
|
|||
import { useContext } from "react";
|
||||
import { IdeMessengerContext } from "../../../../context/IdeMessenger";
|
||||
import { useAppDispatch, useAppSelector } from "../../../../redux/hooks";
|
||||
import { exitEdit } from "../../../../redux/thunks";
|
||||
import { exitEdit } from "../../../../redux/thunks/edit";
|
||||
import { getEditFilenameAndRangeText } from "../../util";
|
||||
|
||||
export function EditToolbar() {
|
||||
|
|
|
|||
|
|
@ -2,11 +2,13 @@ import { AnimatedEllipsis } from "../../..";
|
|||
|
||||
export function GeneratingIndicator({
|
||||
text = "Generating",
|
||||
testId,
|
||||
}: {
|
||||
text?: string;
|
||||
testId?: string;
|
||||
}) {
|
||||
return (
|
||||
<div className="text-description-muted text-xs">
|
||||
<div className="text-description-muted text-xs" data-testid={testId}>
|
||||
<span>{text}</span>
|
||||
<AnimatedEllipsis />
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,24 +1,29 @@
|
|||
import { useContext } from "react";
|
||||
import { IdeMessengerContext } from "../../../../context/IdeMessenger";
|
||||
import { useAppDispatch } from "../../../../redux/hooks";
|
||||
import { cancelStream } from "../../../../redux/thunks/cancelStream";
|
||||
import { getAltKeyLabel, getMetaKeyLabel } from "../../../../util";
|
||||
import { Container, StopButton } from "./components";
|
||||
import { GeneratingIndicator } from "./GeneratingIndicator";
|
||||
|
||||
export const IsApplyingToolbar = () => {
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
|
||||
const dispatch = useAppDispatch();
|
||||
const jetbrains = window.location.protocol === "jb-api:";
|
||||
|
||||
return (
|
||||
<Container>
|
||||
<GeneratingIndicator text="Applying" />
|
||||
<GeneratingIndicator text="Applying" testId={"notch-applying-text"} />
|
||||
<StopButton
|
||||
data-testid="notch-applying-cancel-button"
|
||||
className="text-description"
|
||||
onClick={() => {
|
||||
// Note that this will NOT stop generation but once apply is cancelled will show the Generating/cancel option
|
||||
// Apply is prioritized because it can be more catastrophic
|
||||
// Intentional to be more WYSIWYG for now
|
||||
ideMessenger.post("cancelApply", undefined);
|
||||
// Keyboard shortcut is handled in chat
|
||||
void dispatch(cancelStream());
|
||||
ideMessenger.post("rejectDiff", {});
|
||||
}}
|
||||
>
|
||||
{/* JetBrains overrides cmd+backspace, so we have to use another shortcut */}
|
||||
|
|
|
|||
|
|
@ -2,10 +2,8 @@ import { useEffect } from "react";
|
|||
import { useSelector } from "react-redux";
|
||||
import { useAppDispatch, useAppSelector } from "../../../../redux/hooks";
|
||||
import { selectCurrentToolCall } from "../../../../redux/selectors/selectCurrentToolCall";
|
||||
import {
|
||||
callCurrentTool,
|
||||
cancelCurrentToolCall,
|
||||
} from "../../../../redux/thunks";
|
||||
import { callCurrentTool } from "../../../../redux/thunks/callCurrentTool";
|
||||
import { cancelCurrentToolCall } from "../../../../redux/thunks/cancelCurrentToolCall";
|
||||
import { isJetBrains } from "../../../../util";
|
||||
import { BlockSettingsTopToolbar } from "./BlockSettingsTopToolbar";
|
||||
import { EditOutcomeToolbar } from "./EditOutcomeToolbar";
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
import styled from "styled-components";
|
||||
import { useAppDispatch } from "../../../../redux/hooks";
|
||||
import {
|
||||
callCurrentTool,
|
||||
cancelCurrentToolCall,
|
||||
} from "../../../../redux/thunks";
|
||||
import { callCurrentTool } from "../../../../redux/thunks/callCurrentTool";
|
||||
import { cancelCurrentToolCall } from "../../../../redux/thunks/cancelCurrentToolCall";
|
||||
import {
|
||||
getAltKeyLabel,
|
||||
getFontSize,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { useAppDispatch } from "../../../../redux/hooks";
|
||||
import { cancelStream } from "../../../../redux/thunks";
|
||||
import { cancelStream } from "../../../../redux/thunks/cancelStream";
|
||||
import { getAltKeyLabel, getMetaKeyLabel, isJetBrains } from "../../../../util";
|
||||
import { Container, StopButton } from "./components";
|
||||
import { GeneratingIndicator } from "./GeneratingIndicator";
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
export * from "./LumpToolbar";
|
||||
|
|
@ -5,7 +5,7 @@ import {
|
|||
vscInputBackground,
|
||||
} from "../..";
|
||||
import { useLump } from "./LumpContext";
|
||||
import { LumpToolbar } from "./LumpToolbar";
|
||||
import { LumpToolbar } from "./LumpToolbar/LumpToolbar";
|
||||
import { SelectedSection } from "./sections/SelectedSection";
|
||||
|
||||
const LumpDiv = styled.div`
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { ModelDescription } from "core";
|
|||
import { useAuth } from "../../../../context/Auth";
|
||||
import ModelRoleSelector from "../../../../pages/config/ModelRoleSelector";
|
||||
import { useAppDispatch, useAppSelector } from "../../../../redux/hooks";
|
||||
import { updateSelectedModelByRole } from "../../../../redux/thunks";
|
||||
import { updateSelectedModelByRole } from "../../../../redux/thunks/updateSelectedModelByRole";
|
||||
import { isJetBrains } from "../../../../util";
|
||||
|
||||
export function ModelsSection() {
|
||||
|
|
|
|||
|
|
@ -16,10 +16,13 @@ import { useAuth } from "../../../../context/Auth";
|
|||
import { IdeMessengerContext } from "../../../../context/IdeMessenger";
|
||||
import { useAppDispatch, useAppSelector } from "../../../../redux/hooks";
|
||||
import {
|
||||
DEFAULT_RULE_SETTING,
|
||||
setDialogMessage,
|
||||
setShowDialog,
|
||||
toggleRuleSetting,
|
||||
} from "../../../../redux/slices/uiSlice";
|
||||
import HeaderButtonWithToolTip from "../../../gui/HeaderButtonWithToolTip";
|
||||
import Switch from "../../../gui/Switch";
|
||||
import { useFontSize } from "../../../ui/font";
|
||||
import { ExploreBlocksButton } from "./ExploreBlocksButton";
|
||||
|
||||
|
|
@ -31,6 +34,13 @@ const RuleCard: React.FC<RuleCardProps> = ({ rule }) => {
|
|||
const dispatch = useAppDispatch();
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const mode = useAppSelector((store) => store.session.mode);
|
||||
const policy = useAppSelector((state) =>
|
||||
rule.name
|
||||
? state.ui.ruleSettings[rule.name] || DEFAULT_RULE_SETTING
|
||||
: undefined,
|
||||
);
|
||||
|
||||
const isDisabled = policy === "off";
|
||||
|
||||
const handleOpen = async () => {
|
||||
if (rule.slug) {
|
||||
|
|
@ -53,6 +63,12 @@ const RuleCard: React.FC<RuleCardProps> = ({ rule }) => {
|
|||
}
|
||||
};
|
||||
|
||||
const handleTogglePolicy = () => {
|
||||
if (rule.name) {
|
||||
dispatch(toggleRuleSetting(rule.name));
|
||||
}
|
||||
};
|
||||
|
||||
const title = useMemo(() => {
|
||||
if (rule.name) {
|
||||
return rule.name;
|
||||
|
|
@ -90,31 +106,45 @@ const RuleCard: React.FC<RuleCardProps> = ({ rule }) => {
|
|||
const smallFont = useFontSize(-2);
|
||||
const tinyFont = useFontSize(-3);
|
||||
return (
|
||||
<div className="border-border flex flex-col rounded-sm px-2 py-1.5 transition-colors">
|
||||
<div
|
||||
className={`border-border flex flex-col rounded-sm px-2 py-1.5 transition-colors ${isDisabled ? "opacity-50" : ""}`}
|
||||
>
|
||||
<div className="flex flex-col">
|
||||
<div className="flex flex-row justify-between gap-1">
|
||||
<span
|
||||
className="text-vsc-foreground line-clamp-2"
|
||||
className={`line-clamp-2 ${isDisabled ? "text-gray-400" : "text-vsc-foreground"}`}
|
||||
style={{
|
||||
fontSize: smallFont,
|
||||
}}
|
||||
>
|
||||
{title}
|
||||
</span>
|
||||
<div className="flex flex-row items-start gap-1">
|
||||
<HeaderButtonWithToolTip onClick={onClickExpand} text="Expand">
|
||||
<ArrowsPointingOutIcon className="h-3 w-3 text-gray-400" />
|
||||
</HeaderButtonWithToolTip>{" "}
|
||||
{rule.source === "default-chat" ||
|
||||
rule.source === "default-agent" ? (
|
||||
<HeaderButtonWithToolTip onClick={handleOpen} text="View">
|
||||
<EyeIcon className="h-3 w-3 text-gray-400" />
|
||||
</HeaderButtonWithToolTip>
|
||||
) : (
|
||||
<HeaderButtonWithToolTip onClick={handleOpen} text="Edit">
|
||||
<PencilIcon className="h-3 w-3 text-gray-400" />
|
||||
</HeaderButtonWithToolTip>
|
||||
<div className="flex flex-row items-center gap-2">
|
||||
{rule.name && policy && (
|
||||
<div className="flex cursor-pointer flex-row items-center justify-end gap-1 px-2 py-0.5">
|
||||
<Switch
|
||||
isToggled={policy === "on"}
|
||||
onToggle={() => handleTogglePolicy()}
|
||||
size={10}
|
||||
text=""
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<div className="flex flex-row items-start gap-1">
|
||||
<HeaderButtonWithToolTip onClick={onClickExpand} text="Expand">
|
||||
<ArrowsPointingOutIcon className="h-3 w-3 text-gray-400" />
|
||||
</HeaderButtonWithToolTip>{" "}
|
||||
{rule.source === "default-chat" ||
|
||||
rule.source === "default-agent" ? (
|
||||
<HeaderButtonWithToolTip onClick={handleOpen} text="View">
|
||||
<EyeIcon className="h-3 w-3 text-gray-400" />
|
||||
</HeaderButtonWithToolTip>
|
||||
) : (
|
||||
<HeaderButtonWithToolTip onClick={handleOpen} text="Edit">
|
||||
<PencilIcon className="h-3 w-3 text-gray-400" />
|
||||
</HeaderButtonWithToolTip>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -122,7 +152,7 @@ const RuleCard: React.FC<RuleCardProps> = ({ rule }) => {
|
|||
style={{
|
||||
fontSize: tinyFont,
|
||||
}}
|
||||
className="mt-1 line-clamp-3 text-gray-400"
|
||||
className={`mt-1 line-clamp-3 ${isDisabled ? "text-gray-500" : "text-gray-400"}`}
|
||||
>
|
||||
{rule.rule}
|
||||
</span>
|
||||
|
|
@ -134,7 +164,9 @@ const RuleCard: React.FC<RuleCardProps> = ({ rule }) => {
|
|||
className="mt-1.5 flex flex-col gap-1"
|
||||
>
|
||||
<span className="italic">Applies to files</span>
|
||||
<code className="line-clamp-1 px-1 py-0.5 text-gray-400">
|
||||
<code
|
||||
className={`line-clamp-1 px-1 py-0.5 ${isDisabled ? "text-gray-500" : "text-gray-400"}`}
|
||||
>
|
||||
{rule.globs}
|
||||
</code>
|
||||
</div>
|
||||
|
|
@ -146,7 +178,6 @@ const RuleCard: React.FC<RuleCardProps> = ({ rule }) => {
|
|||
|
||||
export function RulesSection() {
|
||||
const { selectedProfile } = useAuth();
|
||||
|
||||
const config = useAppSelector((store) => store.config.config);
|
||||
const mode = useAppSelector((store) => store.session.mode);
|
||||
const sortedRules: RuleWithSource[] = useMemo(() => {
|
||||
|
|
|
|||
|
|
@ -9,11 +9,12 @@ import { useAppDispatch, useAppSelector } from "../../../redux/hooks";
|
|||
import { selectSelectedChatModel } from "../../../redux/slices/configSlice";
|
||||
import InputToolbar, { ToolbarOptions } from "../InputToolbar";
|
||||
import { ComboBoxItem } from "../types";
|
||||
import { DragOverlay, InputBoxDiv } from "./components";
|
||||
import { DragOverlay } from "./components/DragOverlay";
|
||||
import { InputBoxDiv } from "./components/StyledComponents";
|
||||
import { useMainEditor } from "./MainEditorProvider";
|
||||
import "./TipTapEditor.css";
|
||||
import { handleImageFile } from "./utils";
|
||||
import { createEditorConfig, getPlaceholderText } from "./utils/editorConfig";
|
||||
import { handleImageFile } from "./utils/imageUtils";
|
||||
import { useEditorEventHandlers } from "./utils/keyHandlers";
|
||||
|
||||
export interface TipTapEditorProps {
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
export * from "./DragOverlay";
|
||||
export * from "./ExpandableToolbarPreview";
|
||||
export * from "./StyledComponents";
|
||||
|
|
@ -1 +0,0 @@
|
|||
export * from "./CodeBlock";
|
||||
|
|
@ -1 +0,0 @@
|
|||
export * from "./PromptBlock";
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
export * from "./CodeBlock";
|
||||
export * from "./Mention";
|
||||
export * from "./Prompt";
|
||||
export * from "./SlashCommand";
|
||||
export { CodeBlock } from "./CodeBlock/CodeBlock";
|
||||
export { Mention } from "./Mention";
|
||||
export { PromptBlock } from "./Prompt/PromptBlock";
|
||||
export { SlashCommand } from "./SlashCommand";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
export * from "./extensions";
|
||||
export * from "./MainEditorProvider";
|
||||
export * from "./TipTapEditor";
|
||||
export * from "./utils";
|
||||
export { MainEditorProvider, useMainEditor } from "./MainEditorProvider";
|
||||
export { TipTapEditor } from "./TipTapEditor";
|
||||
export { resolveEditorContent } from "./utils/resolveEditorContent";
|
||||
|
|
|
|||
|
|
@ -11,10 +11,6 @@ import { InputModifiers } from "core";
|
|||
import { modelSupportsImages } from "core/llm/autodetect";
|
||||
import { usePostHog } from "posthog-js/react";
|
||||
import { useRef } from "react";
|
||||
import {
|
||||
getContextProviderDropdownOptions,
|
||||
getSlashCommandDropdownOptions,
|
||||
} from ".";
|
||||
import { IIdeMessenger } from "../../../../context/IdeMessenger";
|
||||
import { useSubmenuContextProviders } from "../../../../context/SubmenuContextProviders";
|
||||
import { useInputHistory } from "../../../../hooks/useInputHistory";
|
||||
|
|
@ -25,8 +21,12 @@ import { selectSelectedChatModel } from "../../../../redux/slices/configSlice";
|
|||
import { AppDispatch } from "../../../../redux/store";
|
||||
import { exitEdit } from "../../../../redux/thunks/edit";
|
||||
import { getFontSize, isJetBrains } from "../../../../util";
|
||||
import * as ContinueExtensions from "../extensions";
|
||||
import { CodeBlock, Mention, PromptBlock, SlashCommand } from "../extensions";
|
||||
import { TipTapEditorProps } from "../TipTapEditor";
|
||||
import {
|
||||
getContextProviderDropdownOptions,
|
||||
getSlashCommandDropdownOptions,
|
||||
} from "./getSuggestion";
|
||||
import { handleImageFile } from "./imageUtils";
|
||||
|
||||
export function getPlaceholderText(
|
||||
|
|
@ -52,9 +52,7 @@ export function getPlaceholderText(
|
|||
export function hasValidEditorContent(json: JSONContent): boolean {
|
||||
// Check for prompt or code blocks
|
||||
const hasPromptOrCodeBlock = json.content?.some(
|
||||
(c) =>
|
||||
c.type === ContinueExtensions.PromptBlock.name ||
|
||||
c.type === ContinueExtensions.CodeBlock.name,
|
||||
(c) => c.type === PromptBlock.name || c.type === CodeBlock.name,
|
||||
);
|
||||
|
||||
// Check for text content
|
||||
|
|
@ -306,7 +304,7 @@ export function createEditorConfig(options: {
|
|||
},
|
||||
}),
|
||||
Text,
|
||||
ContinueExtensions.Mention.configure({
|
||||
Mention.configure({
|
||||
suggestion: getContextProviderDropdownOptions(
|
||||
availableContextProvidersRef,
|
||||
getSubmenuContextItemsRef,
|
||||
|
|
@ -317,7 +315,7 @@ export function createEditorConfig(options: {
|
|||
ideMessenger,
|
||||
),
|
||||
}),
|
||||
ContinueExtensions.SlashCommand.configure({
|
||||
SlashCommand.configure({
|
||||
suggestion: getSlashCommandDropdownOptions(
|
||||
availableSlashCommandsRef,
|
||||
onClose,
|
||||
|
|
@ -327,8 +325,8 @@ export function createEditorConfig(options: {
|
|||
props.inputId,
|
||||
),
|
||||
}),
|
||||
ContinueExtensions.PromptBlock,
|
||||
ContinueExtensions.CodeBlock,
|
||||
PromptBlock,
|
||||
CodeBlock,
|
||||
],
|
||||
editorProps: {
|
||||
attributes: {
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
export * from "./editorConfig";
|
||||
export * from "./getSuggestion";
|
||||
export * from "./imageUtils";
|
||||
export * from "./keyHandlers";
|
||||
export * from "./resolveEditorContent";
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { Editor } from "@tiptap/core";
|
||||
import { ContextProviderDescription } from "core";
|
||||
import * as ContinueExtensions from "../extensions";
|
||||
import { Mention } from "../extensions";
|
||||
|
||||
/**
|
||||
* inserts the current file context as a removable mention in the editor area
|
||||
|
|
@ -16,7 +16,7 @@ export function insertCurrentFileContextMention(
|
|||
);
|
||||
|
||||
if (foundCurrentFileProvider) {
|
||||
const node = editor.schema.nodes[ContinueExtensions.Mention.name].create({
|
||||
const node = editor.schema.nodes[Mention.name].create({
|
||||
name: foundCurrentFileProvider.displayTitle,
|
||||
description: foundCurrentFileProvider.description,
|
||||
id: foundCurrentFileProvider.title,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { Editor } from "@tiptap/react";
|
||||
import { KeyboardEvent } from "react";
|
||||
import { getPlatform, isWebEnvironment } from "../../../util";
|
||||
import { CodeBlock } from "../TipTapEditor";
|
||||
import { CodeBlock } from "../TipTapEditor/extensions";
|
||||
|
||||
const isWebEnv = isWebEnvironment();
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue