Chore: Prettier for consistant formatting (#794)

* Chore: Pretier for consistant formatting

- TODO: This PR needs to be updated by Saoud after he runs `npm install` & `npm format:fix` and commits the results of the prettier changes.

* Revert prettier config

* Run npm install

* Fix prettier config and ignore package lock

* Run format

---------

Co-authored-by: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com>
This commit is contained in:
Mark Percival
2024-11-21 13:13:54 -08:00
committed by GitHub
parent 8d7e28c5e3
commit 93e70c62f1
65 changed files with 2101 additions and 2091 deletions

View File

@@ -74,7 +74,10 @@ export class ClineProvider implements vscode.WebviewViewProvider {
private workspaceTracker?: WorkspaceTracker
private latestAnnouncementId = "oct-28-2024" // update to some unique identifier when we add a new announcement
constructor(readonly context: vscode.ExtensionContext, private readonly outputChannel: vscode.OutputChannel) {
constructor(
readonly context: vscode.ExtensionContext,
private readonly outputChannel: vscode.OutputChannel,
) {
this.outputChannel.appendLine("ClineProvider instantiated")
ClineProvider.activeInstances.add(this)
this.workspaceTracker = new WorkspaceTracker(this)
@@ -110,7 +113,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
}
resolveWebviewView(
webviewView: vscode.WebviewView | vscode.WebviewPanel
webviewView: vscode.WebviewView | vscode.WebviewPanel,
//context: vscode.WebviewViewResolveContext<unknown>, used to recreate a deallocated webview, but we don't need this since we use retainContextWhenHidden
//token: vscode.CancellationToken
): void | Thenable<void> {
@@ -143,7 +146,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
}
},
null,
this.disposables
this.disposables,
)
} else if ("onDidChangeVisibility" in webviewView) {
// sidebar
@@ -154,7 +157,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
}
},
null,
this.disposables
this.disposables,
)
}
@@ -165,7 +168,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
await this.dispose()
},
null,
this.disposables
this.disposables,
)
// Listen for when color changes
@@ -177,7 +180,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
}
},
null,
this.disposables
this.disposables,
)
// if the extension is starting a new session, clear previous task state
@@ -202,7 +205,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
alwaysAllowReadOnly,
undefined,
undefined,
historyItem
historyItem,
)
}
@@ -306,7 +309,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
this.postStateToWebview()
this.workspaceTracker?.initializeFilePaths() // don't await
getTheme().then((theme) =>
this.postMessageToWebview({ type: "theme", text: JSON.stringify(theme) })
this.postMessageToWebview({ type: "theme", text: JSON.stringify(theme) }),
)
// post last cached models in case the call to endpoint fails
this.readOpenRouterModels().then((openRouterModels) => {
@@ -324,7 +327,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
if (apiConfiguration.openRouterModelId) {
await this.updateGlobalState(
"openRouterModelInfo",
openRouterModels[apiConfiguration.openRouterModelId]
openRouterModels[apiConfiguration.openRouterModelId],
)
await this.postStateToWebview()
}
@@ -487,7 +490,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
}
},
null,
this.disposables
this.disposables,
)
}
@@ -573,7 +576,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
async readOpenRouterModels(): Promise<Record<string, ModelInfo> | undefined> {
const openRouterModelsFilePath = path.join(
await this.ensureCacheDirectoryExists(),
GlobalFileNames.openRouterModels
GlobalFileNames.openRouterModels,
)
const fileExists = await fileExistsAtPath(openRouterModelsFilePath)
if (fileExists) {
@@ -586,7 +589,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
async refreshOpenRouterModels() {
const openRouterModelsFilePath = path.join(
await this.ensureCacheDirectoryExists(),
GlobalFileNames.openRouterModels
GlobalFileNames.openRouterModels,
)
let models: Record<string, ModelInfo> = {}