Merge branch 'main' of github.com:continuedev/continue into main
This commit is contained in:
commit
fd6e0c5920
6 changed files with 58 additions and 8 deletions
|
|
@ -13,6 +13,7 @@ import HeaderButtonWithText from "./HeaderButtonWithText";
|
|||
import { DocumentPlus } from "@styled-icons/heroicons-outline";
|
||||
import { HighlightedRangeContext } from "../../../schema/FullState";
|
||||
import { postVscMessage } from "../vscode";
|
||||
import { getMetaKeyLabel } from "../util";
|
||||
|
||||
// #region styled components
|
||||
const mainInputFontSize = 13;
|
||||
|
|
@ -286,7 +287,7 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
|
|||
<div className="flex px-2" ref={divRef} hidden={!downshiftProps.isOpen}>
|
||||
<MainTextInput
|
||||
disabled={props.disabled}
|
||||
placeholder="Ask a question, give instructions, or type '/' to see slash commands. ⌘⏎ to edit."
|
||||
placeholder={`Ask a question, give instructions, or type '/' to see slash commands. ${getMetaKeyLabel()}⏎ to edit.`}
|
||||
{...getInputProps({
|
||||
onChange: (e) => {
|
||||
const target = e.target as HTMLTextAreaElement;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import { StopCircle } from "@styled-icons/heroicons-solid";
|
|||
import { HistoryNode } from "../../../schema/HistoryNode";
|
||||
import HeaderButtonWithText from "./HeaderButtonWithText";
|
||||
import MarkdownPreview from "@uiw/react-markdown-preview";
|
||||
import { getMetaKeyLabel, isMetaEquivalentKeyPressed } from "../util";
|
||||
|
||||
interface StepContainerProps {
|
||||
historyNode: HistoryNode;
|
||||
|
|
@ -217,7 +218,11 @@ function StepContainer(props: StepContainerProps) {
|
|||
e.stopPropagation();
|
||||
props.onDelete();
|
||||
}}
|
||||
text={props.historyNode.active ? "Stop (⌘⌫)" : "Delete"}
|
||||
text={
|
||||
props.historyNode.active
|
||||
? `Stop (${getMetaKeyLabel()}⌫)`
|
||||
: "Delete"
|
||||
}
|
||||
>
|
||||
{props.historyNode.active ? (
|
||||
<StopCircle size="1.6em" onClick={props.onDelete} />
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
type Platform = "mac" | "linux" | "windows" | "unknown";
|
||||
|
||||
function getPlatform(): Platform {
|
||||
export function getPlatform(): Platform {
|
||||
const platform = window.navigator.platform.toUpperCase();
|
||||
if (platform.indexOf("MAC") >= 0) {
|
||||
return "mac";
|
||||
|
|
@ -13,7 +13,7 @@ function getPlatform(): Platform {
|
|||
}
|
||||
}
|
||||
|
||||
function isMetaEquivalentKeyPressed(event: {
|
||||
export function isMetaEquivalentKeyPressed(event: {
|
||||
metaKey: boolean;
|
||||
ctrlKey: boolean;
|
||||
}): boolean {
|
||||
|
|
@ -28,3 +28,16 @@ function isMetaEquivalentKeyPressed(event: {
|
|||
return event.metaKey;
|
||||
}
|
||||
}
|
||||
|
||||
export function getMetaKeyLabel(): string {
|
||||
const platform = getPlatform();
|
||||
switch (platform) {
|
||||
case "mac":
|
||||
return "⌘";
|
||||
case "linux":
|
||||
case "windows":
|
||||
return "^";
|
||||
default:
|
||||
return "⌘";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import * as path from "path";
|
|||
import * as fs from "fs";
|
||||
import * as vscode from "vscode";
|
||||
import { extensionContext, ideProtocolClient } from "./activation/activate";
|
||||
import { getMetaKeyLabel } from "./util/util";
|
||||
|
||||
interface DiffInfo {
|
||||
originalFilepath: string;
|
||||
|
|
@ -86,7 +87,7 @@ class DiffManager {
|
|||
) {
|
||||
vscode.window
|
||||
.showInformationMessage(
|
||||
"Accept (⌘⇧↩) or reject (⌘⇧⌫) at the top of the file.",
|
||||
`Accept (${getMetaKeyLabel()}⇧↩) or reject (${getMetaKeyLabel()}⇧⌫) at the top of the file.`,
|
||||
"Got it",
|
||||
"Don't show again"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { editorToSuggestions, editorSuggestionsLocked } from "../suggestions";
|
|||
import * as path from "path";
|
||||
import * as os from "os";
|
||||
import { DIFF_DIRECTORY, diffManager } from "../diffs";
|
||||
import { getMetaKeyLabel } from "../util/util";
|
||||
class SuggestionsCodeLensProvider implements vscode.CodeLensProvider {
|
||||
public provideCodeLenses(
|
||||
document: vscode.TextDocument,
|
||||
|
|
@ -35,7 +36,7 @@ class SuggestionsCodeLensProvider implements vscode.CodeLensProvider {
|
|||
if (codeLenses.length === 2) {
|
||||
codeLenses.push(
|
||||
new vscode.CodeLens(range, {
|
||||
title: "(⌘⇧↩/⌘⇧⌫ to accept/reject all)",
|
||||
title: `(${getMetaKeyLabel()}⇧↩/${getMetaKeyLabel()}⇧⌫ to accept/reject all)`,
|
||||
command: "",
|
||||
})
|
||||
);
|
||||
|
|
@ -60,12 +61,12 @@ class DiffViewerCodeLensProvider implements vscode.CodeLensProvider {
|
|||
}
|
||||
codeLenses.push(
|
||||
new vscode.CodeLens(range, {
|
||||
title: "Accept All ✅ (⌘⇧↩)",
|
||||
title: `Accept All ✅ (${getMetaKeyLabel()}⇧↩)`,
|
||||
command: "continue.acceptDiff",
|
||||
arguments: [document.uri.fsPath],
|
||||
}),
|
||||
new vscode.CodeLens(range, {
|
||||
title: "Reject All ❌ (⌘⇧⌫)",
|
||||
title: `Reject All ❌ (${getMetaKeyLabel()}⇧⌫)`,
|
||||
command: "continue.rejectDiff",
|
||||
arguments: [document.uri.fsPath],
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { RangeInFile, SerializedDebugContext } from "../client";
|
||||
import * as fs from "fs";
|
||||
const os = require("os");
|
||||
|
||||
function charIsEscapedAtIndex(index: number, str: string): boolean {
|
||||
if (index === 0) return false;
|
||||
|
|
@ -113,3 +114,31 @@ export function debounced(delay: number, fn: Function) {
|
|||
}, delay);
|
||||
};
|
||||
}
|
||||
|
||||
type Platform = "mac" | "linux" | "windows" | "unknown";
|
||||
|
||||
function getPlatform(): Platform {
|
||||
const platform = os.platform();
|
||||
if (platform === "darwin") {
|
||||
return "mac";
|
||||
} else if (platform === "linux") {
|
||||
return "linux";
|
||||
} else if (platform === "win32") {
|
||||
return "windows";
|
||||
} else {
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
export function getMetaKeyLabel() {
|
||||
const platform = getPlatform();
|
||||
switch (platform) {
|
||||
case "mac":
|
||||
return "⌘";
|
||||
case "linux":
|
||||
case "windows":
|
||||
return "^";
|
||||
default:
|
||||
return "⌘";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue