Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preview #1419

Merged
merged 593 commits into from
Jun 4, 2024
Merged

Preview #1419

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
593 commits
Select commit Hold shift + click to select a range
f91ac82
🐛 fixes after refactor
sestinj May 5, 2024
eee2461
🚧 experimenting with perplexity style streaming
sestinj May 6, 2024
ae180c6
:bug: fix #1237
5eqn May 6, 2024
68b7962
💚 fix type error
sestinj May 6, 2024
e05cac9
⚡️ improve LSP usage in autocomplete
sestinj May 6, 2024
f314198
Merge branch 'fix-edit-prompt' of https://github.com/5eqn/continue in…
sestinj May 6, 2024
0c642b1
🐛 fix content parsing regression in /edit
sestinj May 6, 2024
e15259d
Merge branch '5eqn-fix-edit-prompt' into preview
sestinj May 6, 2024
7f05366
add PySide6 docs to preindexed docs (#1236)
pixelsortr May 6, 2024
6803dc5
CON-232 bring custom docs to top, alphabetize doc results, make scrol…
justinmilner1 May 6, 2024
7dd2d6f
CON-1067 condense some things
May 6, 2024
2d06910
🚚 [Auxiliary -> Continue] Sidebar
sestinj May 6, 2024
c3971a4
Merge branch 'preview' of https://github.com/continuedev/continue int…
sestinj May 6, 2024
4160ca6
🔊 log completion options in ~/.continue/sessions
sestinj May 6, 2024
344b23d
CON-1067 wrong ret val fix
May 6, 2024
4ae128f
CON-1067: fixes from testing
May 6, 2024
2b302d9
⚡️ filter out completions that are only punctuation/space
sestinj May 7, 2024
8668308
⚡️ inject intellisense docs, no multi-line on comments
sestinj May 7, 2024
671b98c
⚡️ crawl type definitions for autocomplete
sestinj May 7, 2024
c2cb6f4
⚡️ truncate function text
sestinj May 7, 2024
52b99dc
⚡️ cache LSP calls
sestinj May 7, 2024
07b3aba
⚡️ find recently edited ranges with perfect prefix match
sestinj May 7, 2024
9e1027a
🐛 fix gif paths
sestinj May 7, 2024
c88d222
⚡️ bring back double new line stop words
sestinj May 7, 2024
6e1dcb8
📌 add yarn lock files
sestinj May 7, 2024
0cd017b
🐛 allow language keywords to be generated
sestinj May 7, 2024
81e0e0c
💄 toggle on help button
sestinj May 7, 2024
370e610
🎨 defaultContext option
sestinj May 7, 2024
3749a8c
🐛 fix lancedb bug by upgrading
sestinj May 7, 2024
b6a5391
🐛 fix groq stop tokens
sestinj May 7, 2024
8117abc
🐛 preventDefault to avoid double paste
sestinj May 8, 2024
d117d7f
🚸 don't repeatedly override cmd+J
sestinj May 8, 2024
44e90ef
🧑‍💻 fix npm run test in core
sestinj May 8, 2024
0dbb4cc
📝 change description
sestinj May 8, 2024
f71af40
🐛 silence Ollama invalid server state warning
sestinj May 8, 2024
989fcd5
Merge branch 'main' into preview
sestinj May 8, 2024
241fdbc
⚡️ more accurate getTerminalContents
sestinj May 8, 2024
29bb218
⚡️ make getTerminalContents more accurate
sestinj May 8, 2024
e75a465
Merge
sestinj May 8, 2024
b99fcbc
🧑‍💻 use yarn instead of npm
sestinj May 9, 2024
8a2e18a
👷 fix yarn add --no-save in prepackge
sestinj May 9, 2024
f641a2b
🐛 correctly read entire notebook file contents
sestinj May 9, 2024
1f49397
➕ import handlebars
sestinj May 9, 2024
0101e6f
🔥 remove unnecessary migrations
sestinj May 9, 2024
8daf2c1
⚡️ improve /comment prompt
sestinj May 10, 2024
6a10a8e
Add debug terminal context menu (#1261)
djgould May 10, 2024
7908d75
Add --no-dependencies to vsce package (#1255)
djgould May 10, 2024
aaeaccd
Merge branch 'preview' of https://github.com/continuedev/continue int…
sestinj May 10, 2024
cfcd740
ui: change line decoration color to use vscode theme (#1253)
d-mahard May 10, 2024
c532bd2
Merge branch 'preview' of https://github.com/continuedev/continue int…
sestinj May 10, 2024
46fa021
Merge branch 'CON-1067-failed-indexing-state' of https://github.com/j…
sestinj May 10, 2024
2ba1263
🎨 refactor indexing state into a single object
sestinj May 10, 2024
1de0d8a
CON-223 Correct diff streaming abort (#1263)
justinmilner1 May 10, 2024
74c21be
📦 switch to pnpm (#1265)
sestinj May 11, 2024
19682cd
🐛 add powershell to extension mapping, and default to ext
sestinj May 11, 2024
8e18355
Add stream support for Bedrock Anthropic
May 11, 2024
ab7bcb0
🎨 make llamatokenizer commonjs compatible
sestinj May 11, 2024
6776a12
➕ add esbuild optional deps
sestinj May 11, 2024
d775919
🚚 rename vendor/node_modules -> modules
sestinj May 11, 2024
31226a3
🔖 update core version
sestinj May 11, 2024
2cac5c8
🐛 fixes for transformers.js compatibility
sestinj May 11, 2024
e3dc72b
🔖 update core version
sestinj May 11, 2024
ab49433
🎨 set modelPath in constructor
sestinj May 12, 2024
81b95eb
🎨 fix transformers.js import
sestinj May 12, 2024
89a6957
🎨 eslint enforce import extensions
sestinj May 12, 2024
778ceca
🎨 require -> import
sestinj May 12, 2024
a707eae
🚸 notify user if not diff in /commit
sestinj May 13, 2024
6e9a56b
💄 Improve colors of the IntelliJ tool window icon (#1273)
tnglemongrass May 13, 2024
83e2bba
Merge branch 'preview' of https://github.com/KoStard/continue into Ko…
sestinj May 13, 2024
034754c
✨ send Bearer token to Ollama if apiKey set
sestinj May 13, 2024
61d472f
🐛 fix slash command bug
sestinj May 13, 2024
ed9bf43
🧑‍💻 add onnxruntime (--save-dev) for types
sestinj May 13, 2024
b2d983e
🐛 don't apply to file when running code block in terminal
sestinj May 13, 2024
0dd4ae9
🐛 avoid double paste
sestinj May 13, 2024
8b50a2b
✨ gpt-4o
sestinj May 13, 2024
96dc066
🎨 pass uniqueId to constructor
sestinj May 13, 2024
781f713
🚸 focus without scrolling into vie
sestinj May 14, 2024
ae05da6
🎨 refactoring for continue-proxy LLM (#1277)
sestinj May 14, 2024
a672f80
🐛 continue server client fixes
sestinj May 14, 2024
fb2dca8
🎨 refactor OpenAI _getHeaders
sestinj May 14, 2024
7d5dc49
🎨 pass ideSettings to llmFromDescription
sestinj May 14, 2024
17a08b4
⚡️ improve add docstring command
sestinj May 14, 2024
e877f8a
💚 ci updates
sestinj May 14, 2024
3355d18
Merge branch 'preview' into nate/refactor-core
sestinj May 15, 2024
78cb6a2
🐛 merge fixes
sestinj May 15, 2024
41a9fbc
💄 increase font size in JB
sestinj May 15, 2024
c3fd16b
🐛 fix repeated paste bug
sestinj May 15, 2024
877c13d
🐛 fix build script
sestinj May 15, 2024
abd1ef6
Merge branch 'preview' of https://github.com/continuedev/continue int…
sestinj May 15, 2024
0eed7a0
🩹 various small improvements
sestinj May 15, 2024
5e9d28e
Merge branch 'preview' of https://github.com/continuedev/continue int…
sestinj May 15, 2024
491d9bf
📌 pin esbuild 0.17.19
sestinj May 15, 2024
5a4cc2b
🧑‍💻 pnpm i gui in prepackage
sestinj May 15, 2024
b5052a3
🐛 show all diff changes in vscode
sestinj May 15, 2024
3f83c6a
🩹 getMetaKeyName
sestinj May 15, 2024
6f962b3
🐛 fix reading of unopened ipynb files
sestinj May 15, 2024
bc5a6f6
⚡️ gpt-4o system prompt
sestinj May 15, 2024
7857c4c
💄 make font size configurable in config.json ui.fontSize
sestinj May 15, 2024
3b45028
🩹 properly dispose of diff handler
sestinj May 16, 2024
be741ac
🐛 fix indexing status display
sestinj May 16, 2024
b670949
⚡️ context pruning
sestinj May 17, 2024
9a9b7ba
🎨 update free trial models
sestinj May 17, 2024
9f160ad
fix: remove some backup files generated by pkg if present (#1287)
fernandosanchezjr May 17, 2024
4e33901
Merge branch 'main' into preview
sestinj May 17, 2024
7fde022
adjust toCopy (#1305)
justinmilner1 May 17, 2024
bc93e4a
Nate/prompt-file (#1308)
sestinj May 17, 2024
c52b6e7
🔥 remove hello from continuerc.json
sestinj May 18, 2024
d73783e
🔥 remove example files
sestinj May 18, 2024
cf12e2a
🎨 update test prompt
sestinj May 18, 2024
2723923
🎨 update prompt
sestinj May 18, 2024
e33895d
🎨 update test prompt
sestinj May 18, 2024
430c6fe
👷 create out/node_modules in prepackage.js
sestinj May 18, 2024
b8221eb
Log prompt-tokens to devdb and show in 'My Usage' view (#1309)
tijszwinkels May 18, 2024
1b49dfb
🔥 remove console logs
sestinj May 18, 2024
1a6710d
add lm studio tab-autocomplete walkthrough (#1298)
mrdjohnson May 18, 2024
72e585a
Merge branch 'preview' of https://github.com/continuedev/continue int…
sestinj May 18, 2024
5b4cc55
📝 update autocomplete LM Studio docs
sestinj May 18, 2024
f86e339
💚 fix prepackage.js
sestinj May 18, 2024
911c39b
⬆️ upgrade lancedb version
sestinj May 18, 2024
7fc6644
🚸 make it easier to continue past trial
sestinj May 18, 2024
630e5e9
🚸 improve model setup process
sestinj May 18, 2024
a533668
📌 update package-lock.jsons
sestinj May 18, 2024
696a955
Merge branch 'preview' into nate/refactor-core
sestinj May 19, 2024
7da39cf
🔀 merge changes
sestinj May 19, 2024
4fdae27
🩹 small fixes
sestinj May 19, 2024
27470eb
🐛 fix jetbrains build
sestinj May 19, 2024
b0397f4
🩹 more jetbrains fixes
sestinj May 19, 2024
ae75627
🎨 jetbrains improvements
sestinj May 19, 2024
d8c3b98
🐛 fix lancedb prob in jetbrains build
sestinj May 19, 2024
df68e86
👷 update jetbrains build process
sestinj May 19, 2024
95cd223
✨ intellij problems context provider
sestinj May 20, 2024
e9d0599
👷 add script utils file
sestinj May 20, 2024
609e4e6
💚 fix jetbrains build regression
sestinj May 20, 2024
b7bb1a5
🎨 dynamic import transformers.js
sestinj May 20, 2024
50f7978
🩹 small jetbrains updates
sestinj May 20, 2024
ae8ccc1
✨ folder context provider in jetbrains
sestinj May 20, 2024
ec8f40a
🎨 many more jetbrains improvements
sestinj May 20, 2024
06da0ca
🐛 fix prompt file loading bug
sestinj May 20, 2024
7cecbcc
docs: add setup guide for OpenRouter (#1284)
sambarnes May 20, 2024
ebc02fe
Update preIndexedDocs.ts (#1292)
JoseVega May 20, 2024
25d9e37
add toString (#1324)
justinmilner1 May 20, 2024
6f8528a
don't overwrite all models in onboarding
sestinj May 20, 2024
59ca138
Merge branch 'preview' of https://github.com/continuedev/continue int…
sestinj May 20, 2024
de0dc3d
Merge branch 'preview' of https://github.com/KoStard/continue into pr…
sestinj May 20, 2024
75c5e0b
Merge branch 'KoStard-preview' into preview
sestinj May 20, 2024
e150f7d
🔧 override headers with custom headers
sestinj May 20, 2024
4523fe6
✨ allow overwriting slash command description
sestinj May 20, 2024
424f7d5
feature flag (#1327)
sestinj May 21, 2024
2509dd5
👷 remove win32-arm64 target
sestinj May 21, 2024
90fe570
Update build.js (#1330)
JoseVega May 21, 2024
f6fedfc
📌 pin onnxruntime version to match transformers.js
sestinj May 21, 2024
f3744d8
Merge branch 'preview' into nate/refactor-core
sestinj May 21, 2024
226144b
🎨 transformers cleanup, extensionVersion header
sestinj May 21, 2024
f3b7c1a
Merge branch 'main' into preview
sestinj May 21, 2024
baa0c26
🔥 remove lingering pnpm
sestinj May 21, 2024
f1fcb91
🎨 update default models
sestinj May 21, 2024
87bcecc
🎨 update defaults
sestinj May 21, 2024
aed0d86
👷 fix version in build post-check
sestinj May 21, 2024
4c03dab
Merge branch 'main' into preview
sestinj May 21, 2024
63e70e5
🎨 test.js in dev
sestinj May 21, 2024
b57b48a
🧑‍💻 cleaning
sestinj May 22, 2024
fee942e
Add Gemini 1.5 Flash as a model (#1337)
HackyRoot May 22, 2024
fbf7aba
🎨 log dev data for tokens generated
sestinj May 23, 2024
167b1a3
Merge branch 'preview' of https://github.com/continuedev/continue int…
sestinj May 23, 2024
2e1c2f5
Expose custom context provider registration through a vscode extensio…
samelhusseini May 23, 2024
2664800
Merge branch 'main' into preview
sestinj May 23, 2024
045d98f
Merge branch 'preview' into nate/refactor-core
sestinj May 23, 2024
89549d6
🔀 merge fixes
sestinj May 23, 2024
a364ceb
⚡️ small improvements
sestinj May 23, 2024
4e5b116
🎨 tell users transformers.js not supported
sestinj May 23, 2024
e840140
🎨 trial updates
sestinj May 23, 2024
efeb582
📝 update jetbrains readmej
sestinj May 23, 2024
e26da7a
⚡️ Use gptEditPrompt for Mistral
sestinj May 24, 2024
5c4e512
✨ Codestral FIM
sestinj May 24, 2024
4231215
🔖 update gradle version
sestinj May 24, 2024
b482bbc
Merge branch 'main' into preview
sestinj May 24, 2024
1ca28ed
Fix typo "Experimantal" (#1353)
pzaback May 25, 2024
53b6128
🎨 Refactor core (#1281)
sestinj May 25, 2024
e007efb
⚡️ improved autocomplete stopping
sestinj May 25, 2024
2a0f6fe
🎨 count cmd+I
sestinj May 25, 2024
6397536
Merge branch 'main' into preview
sestinj May 25, 2024
6e47079
🔥 remove duplicate import
sestinj May 25, 2024
7d50f5f
🔥 remove unnecessary headers
sestinj May 25, 2024
10f6920
Merge branch 'main' into preview
sestinj May 25, 2024
9de68ac
⚡️ limit input history length
sestinj May 25, 2024
31f04b4
⚡️ limit submenu items until you can use disk-based search, to avoid …
sestinj May 25, 2024
f0b2060
🔥 remove duplicate function def
sestinj May 25, 2024
683d53b
Free Trial Auth (#1367)
sestinj May 26, 2024
044827b
⚡️ autocomplete stopping improvements
sestinj May 26, 2024
42aad40
🔥 remove unused auth code
sestinj May 26, 2024
129239b
Merge branch 'preview' into nate/mistral-prefilling
sestinj May 26, 2024
664adc3
⚡️ consider previous completion in bracket matching
sestinj May 27, 2024
645d267
Build fixes: Remove duplicated code, re-add overwritten commit (#1358)
justinmilner1 May 27, 2024
98d474d
📝 update keywords
sestinj May 27, 2024
db14578
✨ /commit slash command
sestinj May 27, 2024
04d4245
🎨 make transformers.js esm compatible
sestinj May 27, 2024
12fb5d4
⚡️ fix jetbrains indexing perfomance issue
sestinj May 28, 2024
4f9b4e4
💄 autocomplete model onboarding
sestinj May 28, 2024
feac75c
✨ mistral free trial autocomplete
sestinj May 28, 2024
0b28572
✨ mistral description
sestinj May 28, 2024
507010b
Merge branch 'preview' into nate/mistral-prefilling
sestinj May 28, 2024
4c19a6e
🩹 comment out fireworks.png
sestinj May 28, 2024
e289267
Merge branch 'preview' into nate/mistral-prefilling
sestinj May 28, 2024
44e75aa
🎨 trial fim model
sestinj May 28, 2024
6536fad
🎨 get gh token for autocomplete model trial
sestinj May 28, 2024
5462c4d
Merge branch 'preview' into nate/mistral-prefilling
sestinj May 28, 2024
04481c4
✨ gh auth token jb
sestinj May 28, 2024
7b62d76
Merge branch 'preview' into nate/mistral-prefilling
sestinj May 28, 2024
69572b3
🔧 update config files
sestinj May 28, 2024
94c8206
🎨 jetbrains onboarding
sestinj May 28, 2024
145ad30
Merge branch 'preview' into nate/mistral-prefilling
sestinj May 28, 2024
759ba12
🧑‍💻 create gui/dist if it doesn't exist
sestinj May 28, 2024
b70552a
Fix sidebar indexing status timing-related bugs (#1368)
justinmilner1 May 28, 2024
9907807
🚸 help user avoid login prompt if unwanted
sestinj May 28, 2024
695eab1
Merge branch 'preview' of https://github.com/continuedev/continue int…
sestinj May 28, 2024
e349e76
🚸 update onboarding flow
sestinj May 28, 2024
7a9c0c0
📝 codestral as recommended in docs
sestinj May 28, 2024
ad8743a
feat: Add cloudflare as provider
May 28, 2024
f9e819d
📝 set up codestral walkthrough
sestinj May 29, 2024
dfc6347
Merge branch 'preview' into nate/mistral-prefilling
sestinj May 29, 2024
27fec0f
Merge branch 'preview'
sestinj May 29, 2024
429f30b
codestral api base
sestinj May 29, 2024
f446bb2
Merge branch 'preview'
sestinj May 29, 2024
3f525f1
update codestral api link
sestinj May 29, 2024
19b5424
codestral api link
sestinj May 29, 2024
427e5c1
Merge branch 'main' into preview
sestinj May 29, 2024
2dce084
bearer token
sestinj May 29, 2024
ba04ee4
Merge branch 'preview' of https://github.com/continuedev/continue int…
sestinj May 29, 2024
78ec8ef
🐛 fix config loading
sestinj May 29, 2024
9702e6d
cleaner error message
sestinj May 29, 2024
58691db
fix codestral templating
sestinj May 29, 2024
93e3508
Merge branch 'cf' of https://github.com/deloreyj/continue into delore…
sestinj May 29, 2024
b869894
Merge branch 'deloreyj-cf' into preview
sestinj May 29, 2024
72937af
🔥 remove unused kotlin test
sestinj May 30, 2024
98440db
🧑‍💻 ./gradlew build
sestinj May 30, 2024
e65b002
codestral fim template
sestinj May 30, 2024
264dc18
Merge branch 'main' into preview
sestinj May 30, 2024
283ca8b
Merge branch 'main' into preview
sestinj May 31, 2024
48e8c6d
add additional llama.cpp params
sestinj Jun 1, 2024
0f20f9d
feat:Add promptPath configuration to use promptFolder from JSON file …
sestinj Jun 1, 2024
6b200ba
Full project file path in context (#1407)
tijszwinkels Jun 1, 2024
24a21f1
✨ jetbrains .continuerc.json support
sestinj Jun 2, 2024
ec2a0e5
tweak
sestinj Jun 2, 2024
d2a0df9
✨ allow non git tracked .prompts folder
sestinj Jun 2, 2024
62dc195
✨ currentFile in prompt files
sestinj Jun 2, 2024
0130b83
explain the purpose of sign in
sestinj Jun 2, 2024
d9f9fd0
help users remove free trial models
sestinj Jun 2, 2024
c96780a
better filtering of model artifacts
sestinj Jun 3, 2024
9955039
Merge branch 'main' into preview
sestinj Jun 4, 2024
3eb355e
improve sign in flow
sestinj Jun 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"--extensionDevelopmentPath=${workspaceFolder}/extensions/vscode"
],
"outFiles": [
"${workspaceFolder}/extensions/vscode/out/**/*.js",
"${workspaceFolder}/extensions/vscode/out/extension.js",
"/Users/natesesti/.continue/config.ts"
],
"preLaunchTask": "vscode-extension:build"
Expand Down
2 changes: 1 addition & 1 deletion core/autocomplete/completionProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ export async function getTabCompletion(
if (llm.model.includes("codestral")) {
// Codestral sometimes starts with an extra space
if (completion[0] === " " && completion[1] !== " ") {
if (suffix.startsWith("\n")) {
if (prefix.endsWith(" ") && suffix.startsWith("\n")) {
completion = completion.slice(1);
}
}
Expand Down
10 changes: 7 additions & 3 deletions core/autocomplete/lineStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,16 @@ export async function* skipLines(stream: LineStream): LineStream {
}
}

const LINES_TO_REMOVE_BEFORE_START = [
"<COMPLETION>",
"[CODE]",
"<START EDITING HERE>",
];

function shouldRemoveLineBeforeStart(line: string): boolean {
return (
line.trimStart().startsWith("```") ||
line.trim() === "[CODE]" ||
line.trim() === "" ||
line.trim() === "<START EDITING HERE>"
LINES_TO_REMOVE_BEFORE_START.some((l) => line.trim() === l)
);
}

Expand Down
2 changes: 1 addition & 1 deletion core/config/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const FREE_TRIAL_MODELS: ModelDescription[] = [
];

export const defaultConfig: SerializedContinueConfig = {
models: FREE_TRIAL_MODELS,
models: [],
customCommands: [
{
name: "test",
Expand Down
19 changes: 11 additions & 8 deletions core/config/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,18 @@ async function serializedToIntermediateConfig(
}

const workspaceDirs = await ide.getWorkspaceDirs();
const promptFiles = (
await Promise.all(
workspaceDirs.map((dir) =>
getPromptFiles(ide, path.join(dir, ".prompts")),
),
const promptFolder = initial.experimental?.promptPath;

let promptFiles: { path: string; content: string }[] = [];
if (promptFolder) {
promptFiles = (
await Promise.all(
workspaceDirs.map((dir) => getPromptFiles(ide, promptFolder)),
)
)
)
.flat()
.filter(({ path }) => path.endsWith(".prompt"));
.flat()
.filter(({ path }) => path.endsWith(".prompt"));
}

// Also read from ~/.continue/.prompts
promptFiles.push(...readAllGlobalPromptFiles());
Expand Down
11 changes: 9 additions & 2 deletions core/config/promptFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export async function getPromptFiles(
dir: string,
): Promise<{ path: string; content: string }[]> {
try {
const paths = await ide.listWorkspaceContents(dir);
const paths = await ide.listWorkspaceContents(dir, false);
const results = paths.map(async (path) => {
const content = await ide.readFile(path);
return { path, content };
Expand Down Expand Up @@ -55,10 +55,17 @@ export function slashCommandFromPromptFile(

// Render prompt template
const diff = await ide.getDiff();
const currentFilePath = await ide.getCurrentFile();
const promptUserInput = await renderTemplatedString(
prompt,
ide.readFile.bind(ide),
{ input: userInput, diff },
{
input: userInput,
diff,
currentFile: currentFilePath
? await ide.readFile(currentFilePath)
: undefined,
},
);

const messages = [...history];
Expand Down
2 changes: 1 addition & 1 deletion core/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ declare global {
stackDepth: number,
): Promise<string[]>;
getAvailableThreads(): Promise<Thread[]>;
listWorkspaceContents(directory?: string): Promise<string[]>;
listWorkspaceContents(directory?: string, useGitIgnore?: boolean): Promise<string[]>;
listFolders(): Promise<string[]>;
getWorkspaceDirs(): Promise<string[]>;
getWorkspaceConfigs(): Promise<ContinueRcJson[]>;
Expand Down
13 changes: 7 additions & 6 deletions core/context/providers/CodeHighlightsContextProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import {
import { getBasename } from "../../util/index.js";
import { BaseContextProvider } from "../index.js";

// import { getHighlightsThatFit, ILLMContextSizer } from "llm-code-highlighter/dist/index.continue";

const HIGHLIGHTS_TOKEN_BUDGET = 2000;

class CodeHighlightsContextProvider extends BaseContextProvider {
Expand All @@ -22,6 +20,9 @@ class CodeHighlightsContextProvider extends BaseContextProvider {
query: string,
extras: ContextProviderExtras,
): Promise<ContextItem[]> {
// const { getHighlightsThatFit } = await import(
// "llm-code-highlighter/src/index.continue.js"
// );
const ide = extras.ide;
const openFiles = await ide.getOpenFiles();
const allFiles: { name: string; absPath: string; content: string }[] =
Expand All @@ -34,11 +35,11 @@ class CodeHighlightsContextProvider extends BaseContextProvider {
};
}),
);
// const contextSizer = {
// const contextSizer = {
// fits(content: string): boolean {
// return countTokens(content, "") < HIGHLIGHTS_TOKEN_BUDGET;
// }
// } as ILLMContextSizer
// },
// };
// const repoMap = await getHighlightsThatFit(
// contextSizer,
// [],
Expand All @@ -49,7 +50,7 @@ class CodeHighlightsContextProvider extends BaseContextProvider {
// relPath: file.name,
// code: file.content,
// };
// })
// }),
// );
// return [
// {
Expand Down
10 changes: 1 addition & 9 deletions core/context/providers/FileTreeContextProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,14 @@ import {
ContextProviderExtras,
} from "../../index.js";
import { BaseContextProvider } from "../index.js";
import { splitPath } from "../../util/index.js";

interface Directory {
name: string;
files: string[];
directories: Directory[];
}

function splitPath(path: string, withRoot?: string): string[] {
let parts = path.includes("/") ? path.split("/") : path.split("\\");
if (withRoot !== undefined) {
const rootParts = splitPath(withRoot);
parts = parts.slice(rootParts.length - 1);
}
return parts;
}

function formatFileTree(tree: Directory, indentation = ""): string {
let result = "";
for (const file of tree.files) {
Expand Down
5 changes: 3 additions & 2 deletions core/context/providers/OpenFilesContextProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
ContextProviderDescription,
ContextProviderExtras,
} from "../../index.js";
import { getBasename } from "../../util/index.js";
import { getRelativePath } from "../../util/index.js";
import { BaseContextProvider } from "../index.js";

class OpenFilesContextProvider extends BaseContextProvider {
Expand All @@ -22,11 +22,12 @@ class OpenFilesContextProvider extends BaseContextProvider {
const openFiles = this.options?.onlyPinned
? await ide.getPinnedFiles()
: await ide.getOpenFiles();
const workspaceDirs = await extras.ide.getWorkspaceDirs();
return await Promise.all(
openFiles.map(async (filepath: string) => {
return {
description: filepath,
content: `\`\`\`${getBasename(filepath)}\n${await ide.readFile(
content: `\`\`\`${await getRelativePath(filepath, workspaceDirs)}\n${await ide.readFile(
filepath,
)}\n\`\`\``,
name: (filepath.split("/").pop() ?? "").split("\\").pop() ?? "",
Expand Down
1 change: 1 addition & 0 deletions core/context/providers/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ContextProviderName } from "../../index.js";
import { BaseContextProvider } from "../index.js";
import CodeContextProvider from "./CodeContextProvider.js";
// import CodeHighlightsContextProvider from "./CodeHighlightsContextProvider.js";
import CodebaseContextProvider from "./CodebaseContextProvider.js";
import CurrentFileContextProvider from "./CurrentFileContextProvider.js";
import DatabaseContextProvider from "./DatabaseContextProvider.js";
Expand Down
4 changes: 2 additions & 2 deletions core/context/retrieval/retrieval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from "../../index.js";
import { LanceDbIndex } from "../../indexing/LanceDbIndex.js";

import { deduplicateArray, getBasename } from "../../util/index.js";
import { deduplicateArray, getRelativePath } from "../../util/index.js";
import { RETRIEVAL_PARAMS } from "../../util/parameters.js";
import { retrieveFts } from "./fullTextSearch.js";

Expand Down Expand Up @@ -149,7 +149,7 @@ export async function retrieveContextItemsFromEmbeddings(

return [
...results.map((r) => {
const name = `${getBasename(r.filepath)} (${r.startLine}-${r.endLine})`;
const name = `${getRelativePath(r.filepath, workspaceDirs)} (${r.startLine}-${r.endLine})`;
const description = `${r.filepath} (${r.startLine}-${r.endLine})`;
return {
name,
Expand Down
6 changes: 5 additions & 1 deletion core/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,10 @@ export interface IDE {
stackDepth: number,
): Promise<string[]>;
getAvailableThreads(): Promise<Thread[]>;
listWorkspaceContents(directory?: string): Promise<string[]>;
listWorkspaceContents(
directory?: string,
useGitIgnore?: boolean,
): Promise<string[]>;
listFolders(): Promise<string[]>;
getWorkspaceDirs(): Promise<string[]>;
getWorkspaceConfigs(): Promise<ContinueRcJson[]>;
Expand Down Expand Up @@ -751,6 +754,7 @@ interface ExperimentalConfig {
contextMenuPrompts?: ContextMenuConfig;
modelRoles?: ModelRoles;
defaultContext?: "activeFile"[];
promptPath?: string;
}

export interface SerializedContinueConfig {
Expand Down
15 changes: 12 additions & 3 deletions core/llm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@
{ ...this.requestOptions },
);

// Error mapping to be more helpful
if (!resp.ok) {
let text = await resp.text();
if (resp.status === 404 && !resp.url.includes("/v1")) {
Expand All @@ -276,6 +277,12 @@
text =
"This may mean that you forgot to add '/v1' to the end of your 'apiBase' in config.json.";
}
} else if (
resp.status === 404 &&
resp.url.includes("api.openai.com")

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
api.openai.com
' can be anywhere in the URL, and arbitrary hosts may come before or after it.
) {
text =
"You may need to add pre-paid credits before using the OpenAI API.";
}
throw new Error(
`HTTP ${resp.status} ${resp.statusText} from ${resp.url}\n\n${text}`,
Expand All @@ -284,6 +291,10 @@

return resp;
} catch (e: any) {
console.warn(
`${e.message}\n\nCode: ${e.code}\nError number: ${e.errno}\nSyscall: ${e.erroredSysCall}\nType: ${e.type}\n\n${e.stack}`,
);

if (
e.code === "ECONNREFUSED" &&
e.message.includes("http://127.0.0.1:11434")
Expand All @@ -292,9 +303,7 @@
"Failed to connect to local Ollama instance. To start Ollama, first download it at https://ollama.ai.",
);
}
throw new Error(
`${e.message}\n\nCode: ${e.code}\nError number: ${e.errno}\nSyscall: ${e.erroredSysCall}\nType: ${e.type}\n\n${e.stack}`,
);
throw new Error(e.message);
}
};
return withExponentialBackoff<Response>(
Expand Down
3 changes: 3 additions & 0 deletions core/llm/llms/LlamaCpp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ class LlamaCpp extends BaseLLM {
min_p: options.minP,
mirostat: options.mirostat,
stop: options.stop,
top_k: options.topK,
top_p: options.topP,
temperature: options.temperature,
};

return finalOptions;
Expand Down
4 changes: 2 additions & 2 deletions core/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion core/protocol/ide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import { IdeSettings } from "./ideWebview";
export type ToIdeFromWebviewOrCoreProtocol = {
// Methods from IDE type
getIdeInfo: [undefined, IdeInfo];
listWorkspaceContents: [undefined, string[]];
listWorkspaceContents: [
{ directory?: string; useGitIgnore?: boolean },
string[],
];
getWorkspaceDirs: [undefined, string[]];
listFolders: [undefined, string[]];
writeFile: [{ path: string; contents: string }, void];
Expand Down
5 changes: 4 additions & 1 deletion core/util/filesystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ class FileSystemIde implements IDE {
return Promise.resolve();
}

listWorkspaceContents(): Promise<string[]> {
listWorkspaceContents(
directory?: string,
useGitIgnore?: boolean,
): Promise<string[]> {
return new Promise((resolve, reject) => {
fs.readdir("/tmp/continue", (err, files) => {
if (err) {
Expand Down
24 changes: 24 additions & 0 deletions core/util/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import {
ContextProviderExtras,
} from "../index.js";

export function removeQuotesAndEscapes(output: string): string {
output = output.trim();

Expand Down Expand Up @@ -97,6 +101,26 @@ export function getLastNPathParts(filepath: string, n: number): string {
return filepath.split(/[\\/]/).slice(-n).join("/");
}

export function getRelativePath(filepath: string, workspaceDirs: string[]): string {
for (const workspaceDir of workspaceDirs) {
const filepathParts = splitPath(filepath);
const workspaceDirParts = splitPath(workspaceDir);
if (filepathParts.slice(0, workspaceDirParts.length).join('/') === workspaceDirParts.join('/')) {
return filepathParts.slice(workspaceDirParts.length).join('/');
}
}
return splitPath(filepath).pop() ?? ''; // If the file is not in any of the workspaces, return the plain filename
}

export function splitPath(path: string, withRoot?: string): string[] {
let parts = path.includes("/") ? path.split("/") : path.split("\\");
if (withRoot !== undefined) {
const rootParts = splitPath(withRoot);
parts = parts.slice(rootParts.length - 1);
}
return parts;
}

export function getMarkdownLanguageTagForFile(filepath: string): string {
const ext = filepath.split(".").pop();
switch (ext) {
Expand Down
10 changes: 8 additions & 2 deletions core/util/messageIde.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,14 @@ export class MessageIde implements IDE {
return await this.request("getTerminalContents", undefined);
}

async listWorkspaceContents(directory?: string): Promise<string[]> {
return await this.request("listWorkspaceContents", undefined);
async listWorkspaceContents(
directory?: string,
useGitIgnore?: boolean,
): Promise<string[]> {
return await this.request("listWorkspaceContents", {
directory,
useGitIgnore,
});
}

async getWorkspaceDirs(): Promise<string[]> {
Expand Down
Loading