From 7b7af6233e21ea65021cac2a88537470ffc12de9 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Thu, 29 Jun 2023 20:58:02 -0700 Subject: add .continue to .gitignore, update icons in docs --- docs/docusaurus.config.js | 2 +- docs/static/img/favicon.ico | Bin 4286 -> 53323 bytes docs/static/img/logo.png | Bin 0 -> 1974607 bytes extension/package-lock.json | 4 +-- extension/package.json | 4 +-- extension/src/suggestions.ts | 65 ++++++++++++++++++++++++++++++------------- 6 files changed, 50 insertions(+), 25 deletions(-) create mode 100644 docs/static/img/logo.png diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index 46632e21..2274d42a 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -62,7 +62,7 @@ const config = { title: "Continue", logo: { alt: "Continue Logo", - src: "img/logo.svg", + src: "img/logo.png", }, items: [ { diff --git a/docs/static/img/favicon.ico b/docs/static/img/favicon.ico index 0c361979..6e7624b7 100644 Binary files a/docs/static/img/favicon.ico and b/docs/static/img/favicon.ico differ diff --git a/docs/static/img/logo.png b/docs/static/img/logo.png new file mode 100644 index 00000000..d7a54b2f Binary files /dev/null and b/docs/static/img/logo.png differ diff --git a/extension/package-lock.json b/extension/package-lock.json index c33567c4..102d8917 100644 --- a/extension/package-lock.json +++ b/extension/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.0.88", + "version": "0.0.89", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "continue", - "version": "0.0.88", + "version": "0.0.89", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", diff --git a/extension/package.json b/extension/package.json index 91e285f8..8c9905dd 100644 --- a/extension/package.json +++ b/extension/package.json @@ -13,8 +13,8 @@ "license": "Apache-2.0", "displayName": "Continue", "pricing": "Free", - "description": "Accelerating software development with language models", - "version": "0.0.88", + "description": "The open-source coding autopilot", + "version": "0.0.89", "publisher": "Continue", "engines": { "vscode": "^1.74.0" diff --git a/extension/src/suggestions.ts b/extension/src/suggestions.ts index 52fff196..8bed202c 100644 --- a/extension/src/suggestions.ts +++ b/extension/src/suggestions.ts @@ -2,9 +2,8 @@ import * as vscode from "vscode"; import { sendTelemetryEvent, TelemetryEvent } from "./telemetry"; import { openEditorAndRevealRange } from "./util/vscode"; import { translate, readFileAtRange } from "./util/vscode"; -import * as fs from 'fs'; -import * as path from 'path'; - +import * as fs from "fs"; +import * as path from "path"; export interface SuggestionRanges { oldRange: vscode.Range; @@ -208,39 +207,65 @@ function selectSuggestion( : suggestion.newRange; } - let workspaceDir = vscode.workspace.workspaceFolders ? vscode.workspace.workspaceFolders[0]?.uri.fsPath : undefined; + let workspaceDir = vscode.workspace.workspaceFolders + ? vscode.workspace.workspaceFolders[0]?.uri.fsPath + : undefined; - let collectOn = vscode.workspace.getConfiguration("continue").get("dataSwitch") + let collectOn = vscode.workspace + .getConfiguration("continue") + .get("dataSwitch"); if (workspaceDir && collectOn) { - let continueDir = path.join(workspaceDir, ".continue"); - + // Check if .continue directory doesn't exists - if(!fs.existsSync(continueDir)) { + if (!fs.existsSync(continueDir)) { fs.mkdirSync(continueDir); } - + let suggestionsPath = path.join(continueDir, "suggestions.json"); - + // Initialize suggestions list let suggestions = []; - + // Check if suggestions.json exists - if(fs.existsSync(suggestionsPath)) { - let rawData = fs.readFileSync(suggestionsPath, 'utf-8'); + if (fs.existsSync(suggestionsPath)) { + let rawData = fs.readFileSync(suggestionsPath, "utf-8"); suggestions = JSON.parse(rawData); } if (accept === "new" || (accept === "selected" && suggestion.newSelected)) { - suggestions.push({ accepted: true, timestamp: Date.now(), suggestion: suggestion.newContent }); + suggestions.push({ + accepted: true, + timestamp: Date.now(), + suggestion: suggestion.newContent, + }); } else { - suggestions.push({ accepted: false, timestamp: Date.now(), suggestion: suggestion.newContent }); + suggestions.push({ + accepted: false, + timestamp: Date.now(), + suggestion: suggestion.newContent, + }); } - - // Write the updated suggestions back to the file - fs.writeFileSync(suggestionsPath, JSON.stringify(suggestions, null, 4), 'utf-8'); + // Write the updated suggestions back to the file + fs.writeFileSync( + suggestionsPath, + JSON.stringify(suggestions, null, 4), + "utf-8" + ); + + // If it's not already there, add .continue to .gitignore + const gitignorePath = path.join(workspaceDir, ".gitignore"); + if (fs.existsSync(gitignorePath)) { + const gitignoreData = fs.readFileSync(gitignorePath, "utf-8"); + const gitIgnoreLines = gitignoreData.split("\n"); + if (!gitIgnoreLines.includes(".continue")) { + fs.appendFileSync(gitignorePath, "\n.continue\n"); + } + } else { + fs.writeFileSync(gitignorePath, ".continue\n"); + } } rangeToDelete = new vscode.Range( @@ -380,7 +405,7 @@ export async function showSuggestion( oldRange: range, newRange: suggestionRange, newSelected: true, - newContent: content + newContent: content, }); editorToSuggestions.set(filename, suggestions); currentSuggestion.set(filename, suggestions.length - 1); @@ -390,7 +415,7 @@ export async function showSuggestion( oldRange: range, newRange: suggestionRange, newSelected: true, - newContent: content + newContent: content, }, ]); currentSuggestion.set(filename, 0); -- cgit v1.2.3-70-g09d2