fix: cmd+shft+l closes sidebar if focused (#1638)
* docs: add docs and schema for "OS" provider (#1536) * ignore .env * ✨ use and cache imports for autocomplete (#1456) * ✨ use and cache imports for autocomplete * fix tsc * add voyage rerank-1 * import Handlebars * feat: open pane on install (#1564) * feat: open pane on activation * comment out testing code * chore: add telemetry for pageviews (#1576) * feat: update onboarding w/ embeddings model (#1570) * chore(gui): remove unused pages * feat: add embeddings step * feat: update styles * feat: copy button updates * fix: correct pull command for embed model * fix: remove commented code * fix: remove commented code * feat: simplify copy btn props * chore: rename onboarding selection event * feat: add provider config * fix: undo msg name * remove dead code * fix: invalid mode check * fix: remove testing logic * fix: fullscreen gui retains context when hidden, fixed fullscreen focusing (#1582) * small UI tweaks * media query * feat: add best experience onboarding * small fixes * feat: add free trial card to onboarding (#1600) * feat: add free trial card to onboarding * add import * chore: add telemetry for full screen toggle (#1618) * rerank-lite-1 * remove doccs * basic tests for VS Code extension * improved testing of VS Code extension * manually implement stop tokens for hf inference api * chore: onboarding metrics (#1626) * fix: pageview tracking * feat: add onboarding telemetry * create single `onboardingStatus` type * improved var naming * remove console logs * fix windows performance issue * rename vscodeExtension.ts * migration of onboarding variables * "stash" instead of "delete" in indexing progress * fix preview.yaml * also fix main.yaml * Update troubleshooting.md (#1637) * feat: close panel if main input is focused * add skip param * Update TipTapEditor.tsx * merge dev * Update commands.ts --------- Co-authored-by: Nate Sesti <sestinj@gmail.com> Co-authored-by: Nate Sesti <33237525+sestinj@users.noreply.github.com> Co-authored-by: Jonah Wagner <jonahwagner231@gmail.com>
This commit is contained in:
parent
5d8f73bcd2
commit
92b5c4ccf6
8 changed files with 73 additions and 45 deletions
|
|
@ -65,7 +65,7 @@ export class LanceDbIndex implements CodebaseIndex {
|
|||
"lancedb_sqlite_artifact_id_column",
|
||||
async () => {
|
||||
await db.exec(
|
||||
`ALTER TABLE lance_db_cache ADD COLUMN artifact_id TEXT NOT NULL DEFAULT 'UNDEFINED'`,
|
||||
"ALTER TABLE lance_db_cache ADD COLUMN artifact_id TEXT NOT NULL DEFAULT 'UNDEFINED'",
|
||||
);
|
||||
resolve(undefined);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -54,5 +54,6 @@ export const CORE_TO_WEBVIEW_PASS_THROUGH: (keyof ToWebviewFromCoreProtocol)[] =
|
|||
"indexProgress",
|
||||
"addContextItem",
|
||||
"refreshSubmenuItems",
|
||||
"isContinueInputFocused",
|
||||
"didChangeAvailableProfiles",
|
||||
];
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ export type ToWebviewFromIdeOrCoreProtocol = {
|
|||
getDefaultModelTitle: [undefined, string];
|
||||
indexProgress: [IndexingProgressUpdate, void];
|
||||
refreshSubmenuItems: [undefined, void];
|
||||
isContinueInputFocused: [undefined, boolean];
|
||||
addContextItem: [
|
||||
{
|
||||
historyIndex: number;
|
||||
|
|
|
|||
|
|
@ -25,6 +25,11 @@ export class ContinueGUIWebviewViewProvider
|
|||
}
|
||||
|
||||
private _webview?: vscode.Webview;
|
||||
private _webviewView?: vscode.WebviewView;
|
||||
|
||||
get isVisible() {
|
||||
return this._webviewView?.visible;
|
||||
}
|
||||
|
||||
get webview() {
|
||||
return this._webview;
|
||||
|
|
@ -19,7 +19,7 @@ import {
|
|||
quickPickStatusText,
|
||||
setupStatusBar,
|
||||
} from "./autocomplete/statusBar";
|
||||
import { ContinueGUIWebviewViewProvider } from "./debugPanel";
|
||||
import { ContinueGUIWebviewViewProvider } from "./ContinueGUIWebviewViewProvider";
|
||||
import { DiffManager } from "./diff/horizontal";
|
||||
import { VerticalPerLineDiffManager } from "./diff/verticalPerLine/manager";
|
||||
import { QuickEdit } from "./quickEdit/QuickEdit";
|
||||
|
|
@ -82,7 +82,6 @@ function addCodeToContextFromRange(
|
|||
}
|
||||
|
||||
async function addHighlightedCodeToContext(
|
||||
edit: boolean,
|
||||
webviewProtocol: VsCodeWebviewProtocol | undefined,
|
||||
) {
|
||||
const editor = vscode.window.activeTextEditor;
|
||||
|
|
@ -322,19 +321,42 @@ const commandsMap: (
|
|||
fullScreenPanel?.reveal();
|
||||
}
|
||||
sidebar.webviewProtocol?.request("focusContinueInput", undefined);
|
||||
await addHighlightedCodeToContext(false, sidebar.webviewProtocol);
|
||||
await addHighlightedCodeToContext(sidebar.webviewProtocol);
|
||||
},
|
||||
"continue.focusContinueInputWithoutClear": async () => {
|
||||
if (!getFullScreenTab()) {
|
||||
vscode.commands.executeCommand("continue.continueGUIView.focus");
|
||||
}
|
||||
sidebar.webviewProtocol?.request(
|
||||
"focusContinueInputWithoutClear",
|
||||
const fullScreenTab = getFullScreenTab();
|
||||
|
||||
const isContinueInputFocused = await sidebar.webviewProtocol.request(
|
||||
"isContinueInputFocused",
|
||||
undefined,
|
||||
);
|
||||
await addHighlightedCodeToContext(true, sidebar.webviewProtocol);
|
||||
|
||||
if (isContinueInputFocused) {
|
||||
// Handle closing the GUI only if we are focused on the input
|
||||
if (fullScreenTab) {
|
||||
fullScreenPanel?.dispose();
|
||||
} else {
|
||||
vscode.commands.executeCommand("workbench.action.closeAuxiliaryBar");
|
||||
}
|
||||
} else {
|
||||
// Handle opening the GUI otherwise
|
||||
if (!fullScreenTab) {
|
||||
// focus sidebar
|
||||
vscode.commands.executeCommand("continue.continueGUIView.focus");
|
||||
} else {
|
||||
// focus fullscreen
|
||||
fullScreenPanel?.reveal();
|
||||
}
|
||||
|
||||
sidebar.webviewProtocol?.request(
|
||||
"focusContinueInputWithoutClear",
|
||||
undefined,
|
||||
);
|
||||
|
||||
await addHighlightedCodeToContext(sidebar.webviewProtocol);
|
||||
}
|
||||
},
|
||||
"continue.quickEdit": (injectedPrompt?: string) => {
|
||||
"continue.quickEdit": async (injectedPrompt?: string) => {
|
||||
captureCommandTelemetry("quickEdit");
|
||||
quickEdit.run(injectedPrompt);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import {
|
|||
} from "../autocomplete/statusBar";
|
||||
import { registerAllCommands } from "../commands";
|
||||
import { registerDebugTracker } from "../debug/debug";
|
||||
import { ContinueGUIWebviewViewProvider } from "../debugPanel";
|
||||
import { ContinueGUIWebviewViewProvider } from "../ContinueGUIWebviewViewProvider";
|
||||
import { DiffManager } from "../diff/horizontal";
|
||||
import { VerticalPerLineDiffManager } from "../diff/verticalPerLine/manager";
|
||||
import { VsCodeIde } from "../ideProtocol";
|
||||
|
|
|
|||
|
|
@ -151,8 +151,6 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
);
|
||||
const useActiveFile = useSelector(selectUseActiveFile);
|
||||
|
||||
const [inputFocused, setInputFocused] = useState(false);
|
||||
|
||||
const { saveSession } = useHistory(dispatch);
|
||||
|
||||
const inSubmenuRef = useRef<string | undefined>(undefined);
|
||||
|
|
@ -655,16 +653,14 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
],
|
||||
);
|
||||
|
||||
// On linux+jetbrains only was stealing focus
|
||||
// useEffect(() => {
|
||||
// if (props.isMainInput && editor && document.hasFocus()) {
|
||||
// editor.commands.focus();
|
||||
// // setTimeout(() => {
|
||||
// // // https://github.com/continuedev/continue/pull/881
|
||||
// // editor.commands.blur();
|
||||
// // }, 0);
|
||||
// }
|
||||
// }, [editor, props.isMainInput, historyLength, ignoreHighlightedCode]);
|
||||
useWebviewListener(
|
||||
"isContinueInputFocused",
|
||||
async () => {
|
||||
return props.isMainInput && editorFocusedRef.current;
|
||||
},
|
||||
[editorFocusedRef, props.isMainInput],
|
||||
!props.isMainInput,
|
||||
);
|
||||
|
||||
const [showDragOverMsg, setShowDragOverMsg] = useState(false);
|
||||
|
||||
|
|
@ -748,22 +744,13 @@ function TipTapEditor(props: TipTapEditorProps) {
|
|||
<EditorContent
|
||||
spellCheck={false}
|
||||
editor={editor}
|
||||
onFocus={() => {
|
||||
setInputFocused(true);
|
||||
}}
|
||||
onBlur={() => {
|
||||
// hack to stop from cancelling press of "Enter"
|
||||
setTimeout(() => {
|
||||
setInputFocused(false);
|
||||
}, 100);
|
||||
}}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
}}
|
||||
/>
|
||||
<InputToolbar
|
||||
showNoContext={optionKeyHeld}
|
||||
hidden={!(inputFocused || props.isMainInput)}
|
||||
hidden={!(editorFocusedRef.current || props.isMainInput)}
|
||||
onAddContextItem={() => {
|
||||
if (editor.getText().endsWith("@")) {
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -7,19 +7,31 @@ export function useWebviewListener<T extends keyof ToWebviewProtocol>(
|
|||
messageType: T,
|
||||
handler: (data: ToWebviewProtocol[T][0]) => Promise<ToWebviewProtocol[T][1]>,
|
||||
dependencies?: any[],
|
||||
skip?: boolean,
|
||||
) {
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
|
||||
useEffect(() => {
|
||||
const listener = async (event: { data: Message }) => {
|
||||
if (event.data.messageType === messageType) {
|
||||
const result = await handler(event.data.data);
|
||||
ideMessenger.respond(messageType, result, event.data.messageId);
|
||||
useEffect(
|
||||
() => {
|
||||
let listener;
|
||||
|
||||
if (!skip) {
|
||||
listener = async (event: { data: Message }) => {
|
||||
if (event.data.messageType === messageType) {
|
||||
const result = await handler(event.data.data);
|
||||
ideMessenger.respond(messageType, result, event.data.messageId);
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener("message", listener);
|
||||
}
|
||||
};
|
||||
window.addEventListener("message", listener);
|
||||
return () => {
|
||||
window.removeEventListener("message", listener);
|
||||
};
|
||||
}, dependencies ?? []);
|
||||
|
||||
return () => {
|
||||
if (listener) {
|
||||
window.removeEventListener("message", listener);
|
||||
}
|
||||
};
|
||||
},
|
||||
dependencies ? [...dependencies, skip] : [skip],
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue