moved this functionality into config.json
This commit is contained in:
parent
38b8e02f3e
commit
5c27bf3171
8 changed files with 11 additions and 32 deletions
|
|
@ -846,6 +846,7 @@ declare global {
|
|||
codeBlockToolbarPosition?: "top" | "bottom";
|
||||
fontSize?: number;
|
||||
displayRawMarkdown?: boolean;
|
||||
codeWrap?: boolean;
|
||||
}
|
||||
|
||||
interface ContextMenuConfig {
|
||||
|
|
|
|||
1
core/index.d.ts
vendored
1
core/index.d.ts
vendored
|
|
@ -1098,6 +1098,7 @@ export interface ContinueUIConfig {
|
|||
displayRawMarkdown?: boolean;
|
||||
showChatScrollbar?: boolean;
|
||||
getChatTitles?: boolean;
|
||||
codeWrap?: boolean;
|
||||
}
|
||||
|
||||
interface ContextMenuConfig {
|
||||
|
|
|
|||
|
|
@ -2896,6 +2896,11 @@
|
|||
"x-intellij-html-description": "If set to <code>true</code>, a scrollbar will be displayed in the chat window to navigate through messages.",
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"codeWrap": {
|
||||
"type": "boolean",
|
||||
"description": "If set to true, code in pre blocks will wrap.",
|
||||
"default": false
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import {
|
|||
CommandLineIcon,
|
||||
PlayIcon,
|
||||
ArrowLeftEndOnRectangleIcon,
|
||||
Bars3CenterLeftIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { defaultBorderRadius, vscEditorBackground } from "..";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
|
|
@ -19,8 +18,6 @@ import {
|
|||
selectDefaultModel,
|
||||
selectUIConfig,
|
||||
} from "../../redux/slices/configSlice";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { toggle } from "../../redux/slices/codeWrapSlice";
|
||||
|
||||
const TopDiv = styled.div`
|
||||
outline: 0.5px solid rgba(153, 153, 152);
|
||||
|
|
@ -69,7 +66,6 @@ export default function StepContainerPreActionButtons({
|
|||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const uiConfig = useAppSelector(selectUIConfig);
|
||||
const streamIdRef = useRef<string | null>(null);
|
||||
const dispatch = useDispatch();
|
||||
const nextCodeBlockIndex = useAppSelector(
|
||||
(state) => state.session.codeBlockApplyStates.curIndex,
|
||||
);
|
||||
|
|
@ -97,10 +93,6 @@ export default function StepContainerPreActionButtons({
|
|||
});
|
||||
}
|
||||
|
||||
function toggleWrap() {
|
||||
dispatch(toggle());
|
||||
}
|
||||
|
||||
async function onClickRunTerminal(): Promise<void> {
|
||||
if (shouldRunTerminalCmd) {
|
||||
return ideMessenger.ide.runCommand(getTerminalCommand(codeBlockContent));
|
||||
|
|
@ -161,13 +153,6 @@ export default function StepContainerPreActionButtons({
|
|||
<ArrowLeftEndOnRectangleIcon className="h-4 w-4 text-gray-400" />
|
||||
</HeaderButtonWithToolTip>
|
||||
<CopyIconButton text={codeBlockContent} />
|
||||
<HeaderButtonWithToolTip
|
||||
text="Wrap code"
|
||||
style={{ backgroundColor: vscEditorBackground }}
|
||||
onClick={toggleWrap}
|
||||
>
|
||||
<Bars3CenterLeftIcon className="h-4 w-4 text-gray-400" />
|
||||
</HeaderButtonWithToolTip>
|
||||
</InnerHoverDiv>
|
||||
</HoverDiv>
|
||||
{children}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import SymbolLink from "./SymbolLink";
|
|||
import { SyntaxHighlightedPre } from "./SyntaxHighlightedPre";
|
||||
import { patchNestedMarkdown } from "./utils/patchNestedMarkdown";
|
||||
import { useAppSelector } from "../../redux/hooks";
|
||||
import { RootState } from '../../redux/store';
|
||||
import { selectUIConfig } from "../../redux/slices/configSlice";
|
||||
|
||||
const StyledMarkdown = styled.div<{
|
||||
fontSize?: number;
|
||||
|
|
@ -292,8 +292,8 @@ const StyledMarkdownPreview = memo(function StyledMarkdownPreview(
|
|||
setMarkdownSource(patchNestedMarkdown(props.source ?? ""));
|
||||
}, [props.source]);
|
||||
|
||||
const codeWrapState = useSelector((state: RootState) => state.codeWrap);
|
||||
console.log("here", codeWrapState);
|
||||
const uiConfig = useAppSelector(selectUIConfig);
|
||||
const codeWrapState = uiConfig?.codeWrap ? "pre-wrap" : "pre";
|
||||
return (
|
||||
<StyledMarkdown fontSize={getFontSize()} whiteSpace={codeWrapState}>{reactContent}</StyledMarkdown>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
import { createSlice } from '@reduxjs/toolkit';
|
||||
|
||||
const isWrappedSlice = createSlice({
|
||||
name: "codeWrap",
|
||||
initialState: "pre",
|
||||
reducers: {
|
||||
toggle: (state) => (state === "pre" ? "pre-wrap" : "pre"),
|
||||
},
|
||||
});
|
||||
|
||||
export const { toggle } = isWrappedSlice.actions;
|
||||
export default isWrappedSlice.reducer;
|
||||
|
|
@ -15,7 +15,6 @@ import configReducer from "./slices/configSlice";
|
|||
import indexingReducer from "./slices/indexingSlice";
|
||||
import sessionReducer from "./slices/sessionSlice";
|
||||
import uiReducer from "./slices/uiSlice";
|
||||
import codeWrapReducer from "./slices/codeWrapSlice"
|
||||
|
||||
export interface ChatMessage {
|
||||
role: "system" | "user" | "assistant";
|
||||
|
|
@ -29,7 +28,6 @@ const rootReducer = combineReducers({
|
|||
editModeState: editModeStateReducer,
|
||||
config: configReducer,
|
||||
indexing: indexingReducer,
|
||||
codeWrap: codeWrapReducer,
|
||||
});
|
||||
|
||||
const saveSubsetFilters = [
|
||||
|
|
|
|||
|
|
@ -125,6 +125,7 @@ export const uiOptionsSchema = z.object({
|
|||
fontSize: z.number().optional(),
|
||||
displayRawMarkdown: z.boolean().optional(),
|
||||
showChatScrollbar: z.boolean().optional(),
|
||||
codeWrap: z.boolean().optional(),
|
||||
});
|
||||
export type UiOptions = z.infer<typeof uiOptionsSchema>;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue