-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix/go-cyclic-dependencies
- Loading branch information
Showing
11 changed files
with
167 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { extensionId, treeViewId } from "../constants"; | ||
import { ClientOrPluginProperties } from "../kiotaInterop"; | ||
import { OpenApiTreeProvider } from "../openApiTreeProvider"; | ||
import { updateTreeViewIcons } from "../util"; | ||
import { openTreeViewWithProgress } from "../utilities/progress"; | ||
import { Command } from "./Command"; | ||
|
||
export class EditPathsCommand extends Command { | ||
|
||
private _openApiTreeProvider: OpenApiTreeProvider; | ||
|
||
public constructor(openApiTreeProvider: OpenApiTreeProvider) { | ||
super(); | ||
this._openApiTreeProvider = openApiTreeProvider; | ||
} | ||
|
||
public getName(): string { | ||
return `${extensionId}.editPaths`; | ||
} | ||
|
||
public async execute({ clientKey, clientObject }: { clientKey: string, clientObject: ClientOrPluginProperties }): Promise<void> { | ||
await this.loadEditPaths(clientKey, clientObject); | ||
this._openApiTreeProvider.resetInitialState(); | ||
await updateTreeViewIcons(treeViewId, false, true); | ||
} | ||
|
||
private async loadEditPaths(clientKey: string, clientObject: ClientOrPluginProperties) { | ||
await openTreeViewWithProgress(() => this._openApiTreeProvider.loadEditPaths(clientKey, clientObject)); | ||
} | ||
} |
3 changes: 2 additions & 1 deletion
3
.../microsoft-kiota/src/searchDescription.ts → ...open-api-description/searchDescription.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
...ds/open-api-tree-view/search-or-open-api-description/searchOrOpenApiDescriptionCommand.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import TelemetryReporter from "@vscode/extension-telemetry"; | ||
import * as vscode from "vscode"; | ||
|
||
import { extensionId, treeViewId } from "../../../constants"; | ||
import { getExtensionSettings } from "../../../extensionSettings"; | ||
import { setDeepLinkParams } from "../../../handlers/deepLinkParamsHandler"; | ||
import { OpenApiTreeProvider } from "../../../openApiTreeProvider"; | ||
import { searchSteps } from "../../../steps"; | ||
import { IntegrationParams, validateDeepLinkQueryParams } from "../../../utilities/deep-linking"; | ||
import { Command } from "../../Command"; | ||
import { searchDescription } from "./searchDescription"; | ||
import { openTreeViewWithProgress } from "../../../utilities/progress"; | ||
|
||
export class SearchOrOpenApiDescriptionCommand extends Command { | ||
|
||
private _openApiTreeProvider: OpenApiTreeProvider; | ||
private _context: vscode.ExtensionContext; | ||
|
||
constructor(openApiTreeProvider: OpenApiTreeProvider, context: vscode.ExtensionContext) { | ||
super(); | ||
this._openApiTreeProvider = openApiTreeProvider; | ||
this._context = context; | ||
} | ||
|
||
public getName(): string { | ||
return `${treeViewId}.searchOrOpenApiDescription`; | ||
} | ||
|
||
public async execute(searchParams: Partial<IntegrationParams>): Promise<void> { | ||
// set deeplink params if exists | ||
if (Object.keys(searchParams).length > 0) { | ||
let [params, errorsArray] = validateDeepLinkQueryParams(searchParams); | ||
setDeepLinkParams(params); | ||
const reporter = new TelemetryReporter(this._context.extension.packageJSON.telemetryInstrumentationKey); | ||
reporter.sendTelemetryEvent("DeepLinked searchOrOpenApiDescription", { | ||
"searchParameters": JSON.stringify(searchParams), | ||
"validationErrors": errorsArray.join(", ") | ||
}); | ||
} | ||
|
||
// proceed to enable loading of openapi description | ||
const yesAnswer = vscode.l10n.t("Yes, override it"); | ||
if (this._openApiTreeProvider.hasChanges()) { | ||
const response = await vscode.window.showWarningMessage( | ||
vscode.l10n.t( | ||
"Before adding a new API description, consider that your changes and current selection will be lost."), | ||
yesAnswer, | ||
vscode.l10n.t("Cancel") | ||
); | ||
if (response !== yesAnswer) { | ||
return; | ||
} | ||
} | ||
|
||
const config = await searchSteps(x => vscode.window.withProgress({ | ||
location: vscode.ProgressLocation.Notification, | ||
cancellable: false, | ||
title: vscode.l10n.t("Searching...") | ||
}, (progress, _) => { | ||
const settings = getExtensionSettings(extensionId); | ||
return searchDescription(this._context, x, settings.clearCache); | ||
})); | ||
|
||
if (config.descriptionPath) { | ||
await openTreeViewWithProgress(() => this._openApiTreeProvider.setDescriptionUrl(config.descriptionPath!)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
vscode/microsoft-kiota/src/handlers/deepLinkParamsHandler.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { IntegrationParams } from "../utilities/deep-linking"; | ||
|
||
let deepLinkParams: Partial<IntegrationParams> = {}; | ||
|
||
export const getDeepLinkParams = () => deepLinkParams; | ||
export const setDeepLinkParams = (params: Partial<IntegrationParams>) => { | ||
deepLinkParams = { ...deepLinkParams, ...params }; | ||
}; | ||
export const clearDeepLinkParams = () => { | ||
deepLinkParams = {}; | ||
}; |
Oops, something went wrong.