-
Notifications
You must be signed in to change notification settings - Fork 42
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
[FIX] Non-files showing up in auto file context feature #159
[FIX] Non-files showing up in auto file context feature #159
Conversation
…tput-as-file-in-auto-file-context-feature
Introduces a new `isFirstInSession` prop to the `ContinueInputBox` and `TipTapEditor` components. This prop determines whether the top bar should be displayed for the first input in a session. The top bar is now only shown for the first input in a session, providing a cleaner interface. Additionally, the `ContinueInputBox` now renders a visual indicator to indicate when the user is entering the first prompt in a new session.
…tput-as-file-in-auto-file-context-feature
- Add file path validation in uiStateSlice's setActiveFilePath reducer - Add validation check in VsCodeExtension's updateNewWindowActiveFilePath - Remove redundant activeFilePath management from stateSlice - Fix import path for isValidFilePath utility This fixes an issue where text from the Output console could appear in the ActiveFileIndicator when clicking New Session by ensuring file paths are validated at all entry points and managed in a single location.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…tput-as-file-in-auto-file-context-feature
…file handling. Key changes include: - Updated VsCodeExtension.ts to streamline active file path management. - Enhanced VsCodeIde in ideProtocol.ts with methods for setting and retrieving the active file path. - Modified ActiveFileIndicator.tsx and TopBarIndicators.tsx to conditionally display active file information based on session state. - Simplified state management logic in uiStateSlice.ts.
@Fryingpannn PR has been updated. All comments have been resolved. |
} | ||
}); | ||
|
||
this.ide.onDidChangeActiveTextEditor((filepath) => { | ||
this.core.invoke("didChangeActiveTextEditor", { filepath }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is invoke removed?
this.sidebar.webviewProtocol.request("setActiveFilePath", filepath, [PEAR_CONTINUE_VIEW_ID]); | ||
}); | ||
context.subscriptions.push( | ||
vscode.window.onDidChangeActiveTextEditor((event) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did we have to change to use the vscode's onDidChangeActiveTextEditor? Is it just to have the !event return
?
@@ -175,6 +176,10 @@ function GUI() { | |||
const [isAtBottom, setIsAtBottom] = useState<boolean>(false); | |||
const state = useSelector((state: RootState) => state.state); | |||
|
|||
const getIsFirstInSession = useMemo(() => { | |||
return (idx: number) => idx === state.history.findIndex(item => item.message.role === "user"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why can't just check history.length?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const isFirstMessage = state.history.length === 0;
…tput-as-file-in-auto-file-context-feature
@@ -5,7 +5,11 @@ import { useCallback, useContext, useEffect } from "react"; | |||
import { X } from "lucide-react"; | |||
import { setActiveFilePath } from "@/redux/slices/uiStateSlice"; | |||
|
|||
export default function ActiveFileIndicator() { | |||
interface ActiveFileIndicatorProps { | |||
isFirstInSession?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think instead of using prop. We can just check the history within active file indicator. See this PR: https://github.com/trypear/pearai-submodule/pull/181/files#diff-ea630c971a646645666575d7bbfe531ea6c00a5cb7108f3dc66ded51fccfd963R20
This PR I made above i will not be merging. Was playing around with some stuff but not good. However I did do the history stuff in there to determine first chat input, which may be worth using instead of prop drilling. Also we should grey out the thing, with unchangeable text if conversation is prompted.
PR on hold. Currently polling the community as to whether the current file feature should be removed or not. |
Active FIle feature being removed and chat interface is being redesigned. Closing this PR. |
Description ✏️
Fixes issue with clicking inside other tabs in the code editor, causing non filenames to show up in the Current File feature in the chat input.
This has only had a little bit of testing.
Checklist ✅