-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
feat(chat-panel): add vscode bundle script #2206
Conversation
useEffect(() => { | ||
if (iframeRef.current && !clientRef.current) { | ||
if (iframeRef.current && !clientRef.current) | ||
clientRef.current = createClient(iframeRef.current, api) | ||
} |
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.
Please revert the change. always use {}
with if
except one line ifs.
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.
update the eslint
export default antfu({
rules: {
curly: ['off', 'all'],
},
})
cc @icycodes |
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.
Otherwise LGTM
@@ -21,7 +20,8 @@ function useServer(api: ServerApi) { | |||
|
|||
useEffect(() => { | |||
const isInIframe = window.self !== window.top | |||
if (isInIframe && !serverRef.current) serverRef.current = createServer(api) | |||
if (isInIframe && !serverRef.current) | |||
serverRef.current = createServer(api) |
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.
ditto, use {}
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.
ditto, revert changes to this file since they're all formatting related
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 suggest revert change to this file as they're formatting changes.
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.
rename this to iframe.tsx
, since it's likely reuse by jetbrains as well
@@ -42,17 +42,21 @@ | |||
"start": "tsx src/index.ts", | |||
"test": "vitest", | |||
"test:once": "vitest run", | |||
"typecheck": "tsc --noEmit" | |||
"typecheck": "tsc --noEmit", | |||
"build:vscode": "yarn && esbuild src/vscode.tsx --bundle --minify --outfile=../vscode/chat-panel/index.js --loader:.js=jsx", |
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.
edit build.config.ts
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.
left a FIXME comment, because I have no idea how to edit the config file, I don't wanna spend time to check this document at the moment
Context
In the VSCode chat panel, we generate a Webview using the following code snippet. It consists of HTML that loads a js script.
Goal
In
clients/tabby-chat-panel
, it can generate a bundled JS file used for the VSCode webview.clients/tabby-chat-panel
, commandyarn build:vscode
will generate a bundled JS file into clients/vscode/chat-panel/clients/vscode
, commandyarn build
will callclients/tabby-chat-panel
to generate the JS file