change installation status approach

This commit is contained in:
Trevor Hudson
2025-05-06 17:06:51 -07:00
parent df9b0a163d
commit 89b46c10b2
3 changed files with 9 additions and 16 deletions
+8 -12
View File
@@ -82,7 +82,7 @@ export function activate(context: vscode.ExtensionContext) {
}),
)
const openClineInNewTab = async () => {
const openClineInNewTab = async (): Promise<WebviewProvider> => {
Logger.log("Opening Cline in new tab")
// (this example uses webviewProvider activation event which is necessary to deserialize cached webview, but since we use retainContextWhenHidden, we don't need to use that event)
// https://github.com/microsoft/vscode-extension-samples/blob/main/webview-sample/src/extension.ts
@@ -113,10 +113,9 @@ export function activate(context: vscode.ExtensionContext) {
// Lock the editor group so clicking on files doesn't open them over the panel
await setTimeoutPromise(100)
await vscode.commands.executeCommand("workbench.action.lockEditorGroup")
return tabWebview
}
checkInstallationStatus(context)
context.subscriptions.push(vscode.commands.registerCommand("cline.popoutButtonClicked", openClineInNewTab))
context.subscriptions.push(vscode.commands.registerCommand("cline.openInNewTab", openClineInNewTab))
@@ -423,6 +422,7 @@ export function activate(context: vscode.ExtensionContext) {
})
}),
)
checkInstallationStatus(context)
return createClineAPI(outputChannel, sidebarWebview.controller)
@@ -432,16 +432,12 @@ export function activate(context: vscode.ExtensionContext) {
const previous = context.globalState.get<string>(VERSION_KEY)
if (!previous) {
// ── first-ever install ──
WebviewProvider.getTabInstances().forEach(async (tab) => {
const state = await tab.controller.getStateToPostToWebview()
state.showWelcome = true
await tab.controller.postMessageToWebview({ type: "state", state })
})
openClineInNewTab()
const tab = await openClineInNewTab()
await tab.controller.postMessageToWebview({ type: "showWelcome" })
// persist for the next activation
await context.globalState.update(VERSION_KEY, current)
}
// persist for the next activation
await context.globalState.update(VERSION_KEY, current)
}
}
+1 -1
View File
@@ -47,6 +47,7 @@ export interface ExtensionMessage {
| "fileSearchResults"
| "grpc_response" // New type for gRPC responses
| "setActiveQuote"
| "showWelcome"
text?: string
action?:
| "chatButtonClicked"
@@ -143,7 +144,6 @@ export interface ExtensionState {
localClineRulesToggles: ClineRulesToggles
localCursorRulesToggles: ClineRulesToggles
localWindsurfRulesToggles: ClineRulesToggles
showWelcome: boolean
}
export interface ClineMessage {
@@ -76,7 +76,6 @@ export const ExtensionStateContextProvider: React.FC<{
shellIntegrationTimeout: 4000, // default timeout for shell integration
})
const [didHydrateState, setDidHydrateState] = useState(false)
const [showWelcome, setShowWelcome] = useState(false)
const [theme, setTheme] = useState<Record<string, string>>()
const [filePaths, setFilePaths] = useState<string[]>([])
const [openRouterModels, setOpenRouterModels] = useState<Record<string, ModelInfo>>({
@@ -107,7 +106,6 @@ export const ExtensionStateContextProvider: React.FC<{
: prevState.autoApprovalSettings,
}
})
setShowWelcome(true)
setDidHydrateState(true)
break
}
@@ -183,7 +181,6 @@ export const ExtensionStateContextProvider: React.FC<{
const contextValue: ExtensionStateContextType = {
...state,
didHydrateState,
showWelcome,
theme,
openRouterModels,
openAiModels,