fix: autocomplete logging + input layout

This commit is contained in:
Test 2024-09-25 14:42:31 -07:00
parent 0afe65711b
commit c542e5d615
8 changed files with 28 additions and 31 deletions

View file

@ -204,7 +204,7 @@ export class CompletionProvider {
const outcome = this._outcomes.get(completionId)!;
outcome.accepted = true;
logDevData("autocomplete", outcome);
Telemetry.capture(
void Telemetry.capture(
"autocomplete",
{
accepted: outcome.accepted,
@ -378,7 +378,7 @@ export class CompletionProvider {
outcome.accepted = false;
logDevData("autocomplete", outcome);
const { prompt, completion, ...restOfOutcome } = outcome;
Telemetry.capture(
void Telemetry.capture(
"autocomplete",
{
...restOfOutcome,

View file

@ -571,7 +571,9 @@ export class Core {
);
return outcome ? [outcome.completion] : [];
});
on("autocomplete/accept", async (msg) => {});
on("autocomplete/accept", async (msg) => {
this.completionProvider.accept(msg.data.completionId);
});
on("autocomplete/cancel", async (msg) => {
this.completionProvider.cancel();
});

View file

@ -148,8 +148,10 @@ class AutocompleteService(private val project: Project) {
val editor = completion.editor
val offset = completion.offset
editor.document.insertString(offset, text)
editor.caretModel.moveToOffset(offset + text.length)
project.service<ContinuePluginService>().coreMessenger?.request("autocomplete/accept", completion.completionId, null, ({}))
invokeLater {
clearCompletions(editor)
@ -177,6 +179,7 @@ class AutocompleteService(private val project: Project) {
if (currentDelimiter.isNotEmpty()) {
result.add(currentDelimiter)
}
return result

View file

@ -35,6 +35,7 @@ const LayoutTopDiv = styled(CustomScrollbarDiv)`
height: 100%;
border-radius: ${defaultBorderRadius};
position: relative;
overflow-x: hidden;
&::after {
position: absolute;

View file

@ -123,24 +123,13 @@ function StepContainer(props: StepContainerProps) {
</ContentDiv>
{(props.isLast || isHovered || typeof feedback !== "undefined") &&
!active && (
<div
className="flex items-center gap-1 absolute -bottom-2 right-2 hidden xs:flex"
style={{
color: lightGray,
fontSize: getFontSize() - 3,
}}
>
<div className="flex items-center gap-1 absolute -bottom-2 right-2 hidden xs:flex text-xs text-gray-400">
{props.modelTitle && (
<div className="hidden sm:flex">
<div className="flex items-center">{props.modelTitle}</div>
<div
className="ml-2 mr-1"
style={{
width: "1px",
height: "20px",
backgroundColor: lightGray,
}}
></div>
<div className="flex items-center truncate max-w-[40vw]">
{props.modelTitle}
</div>
<div className="ml-2 mr-1 w-px h-5 bg-gray-300" />
</div>
)}

View file

@ -114,7 +114,7 @@ function InputToolbar(props: InputToolbarProps) {
defaultModel.capabilities,
) && (
<span
className="ml-1 -mb-0.5 cursor-pointer"
className="cursor-pointer"
onMouseLeave={() => setFileSelectHovered(false)}
onMouseEnter={() => setFileSelectHovered(true)}
>
@ -170,11 +170,11 @@ function InputToolbar(props: InputToolbarProps) {
})
}
>
<span className="hidden md:inline">
{" "}
{getMetaKeyLabel()}⏎ @codebase
<span className="hidden lg:inline">
{getMetaKeyLabel()}⏎ Use @codebase
</span>
<span className="md:hidden">@codebase</span>
<span className="hidden md:inline lg:hidden">@codebase</span>
</HoverItem>
)}
</div>
@ -187,8 +187,8 @@ function InputToolbar(props: InputToolbarProps) {
});
}}
>
<span className="hidden md:inline">⏎ Enter</span>
<span className="md:hidden">⏎</span>
<span className="hidden sm:inline">⏎ Enter</span>
<span className="sm:hidden">⏎</span>
</EnterButton>
</div>
</StyledDiv>

View file

@ -318,7 +318,7 @@ function ModelSelect() {
style={{ padding: 0 }}
onClick={calculatePosition}
>
<div className="text-gray-400 hover:text-gray-300 transition-colors duration-200 flex items-center gap-1 max-w-[33vw]">
<div className="text-gray-400 hover:text-gray-300 transition-colors duration-200 flex items-center gap-1 max-w-[40vw]">
<span className="truncate">
{modelSelectTitle(defaultModel) || "Select model"}{" "}
</span>

View file

@ -469,20 +469,22 @@ function GUI() {
<br />
</>
) : state.history.length > 0 ? (
<div className="mt-2">
<div className="mt-2 hidden xs:inline">
<NewSessionButton
onClick={() => {
saveSession();
}}
className="mr-auto"
>
New Session ({getMetaKeyLabel()} {isJetBrains() ? "J" : "L"})
<span className="hidden xs:inline">
New Session ({getMetaKeyLabel()} {isJetBrains() ? "J" : "L"})
</span>
</NewSessionButton>{" "}
</div>
) : (
<>
{getLastSessionId() ? (
<div className="mt-2">
<div className="mt-2 hidden xs:inline">
<NewSessionButton
onClick={async () => {
loadLastSession().catch((e) =>
@ -491,7 +493,7 @@ function GUI() {
}}
className="mr-auto flex items-center gap-2"
>
<ArrowLeftIcon width="11px" height="11px" />
<ArrowLeftIcon className="w-3 h-3" />
Last Session
</NewSessionButton>
</div>