vscode#QuickPickOptions TypeScript Examples

The following examples show how to use vscode#QuickPickOptions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: changeSMApi.ts    From sourcepawn-vscode with MIT License 6 votes vote down vote up
export async function run(args: any) {
  const optionalSMHomes: OptionalSMAPI[] = Workspace.getConfiguration(
    "sourcepawn"
  ).get("availableAPIs");
  let newSMHomeChoices: QuickPickItem[] = optionalSMHomes.map(
    (optionalHome) => {
      return {
        label: optionalHome.name,
        detail: optionalHome.SMHomePath,
      };
    }
  );

  const QuickPickOptions: QuickPickOptions = {
    canPickMany: false,
  };
  window
    .showQuickPick(newSMHomeChoices, QuickPickOptions)
    .then(async (newSMHome) => {
      if (newSMHome.detail == undefined) {
        return;
      }
      await Workspace.getConfiguration("sourcepawn").update(
        "SourcemodHome",
        newSMHome.detail
      );
      let spCompPath = optionalSMHomes.find((e) => e.name === newSMHome.label)
        .compilerPath;
      await Workspace.getConfiguration("sourcepawn").update(
        "SpcompPath",
        spCompPath
      );
      commands.executeCommand("workbench.action.reloadWindow");
    });
  return 0;
}
Example #2
Source File: commit-detail.ts    From git-commit-plugin with MIT License 5 votes vote down vote up
CommitDetailQuickPickOptions: QuickPickOptions = {
    matchOnDescription: true,
    matchOnDetail: true,
    ignoreFocusOut: true,
}
Example #3
Source File: CodeLinkFeature.ts    From vscode-drawio with GNU General Public License v3.0 5 votes vote down vote up
@action.bound
	private async linkSymbolWithSelectedNode(
		storeTopLevelSymbol: boolean = false
	) {
		const lastActiveDrawioEditor =
			this.editorManager.lastActiveDrawioEditor;
		if (!lastActiveDrawioEditor) {
			window.showErrorMessage("No active drawio instance.");
			return;
		}
		const editor = window.activeTextEditor;
		if (editor == undefined) {
			window.showErrorMessage("No text editor active.");
			return;
		}
		const uri = editor.document.uri;
		const hasSelection = !editor.selection.start.isEqual(
			editor.selection.end
		);
		const result = (await commands.executeCommand(
			"vscode.executeDocumentSymbolProvider",
			uri
		)) as DocumentSymbol[];
		let items: QuickPickItem[] = [];
		function recurse(symb: DocumentSymbol[], path: string) {
			for (let x of symb) {
				// If there is a selection and we do not intersect it, omit the symbol
				let intersectSelection = true;
				if (hasSelection && editor) {
					intersectSelection = editor.selections.reduce(
						(prev: boolean, cur) => {
							return (
								prev &&
								cur.intersection(x.selectionRange) !== undefined
							);
						},
						intersectSelection
					);
				}
				// Add the symbol and descend into children
				let curpath = path == "" ? x.name : `${path}.${x.name}`;
				if (intersectSelection) {
					items.push(<QuickPickItem>{
						label: `$(${symbolNameMap[x.kind]}) ${x.name}`,
						description: x.detail,
						detail: curpath,
					});
				}
				recurse(x.children, curpath);
			}
		}
		recurse(result, "");
		window
			.showQuickPick(items, <QuickPickOptions>{
				matchOnDescription: true,
				matchOnDetail: true,
				placeHolder: `Choose symbol from ${path.basename(uri.fsPath)}`,
			})
			.then(async (v) => {
				if (v == undefined) return;
				const pos: CodePosition = new CodePosition(
					storeTopLevelSymbol ? undefined : uri,
					v.detail
				);
				lastActiveDrawioEditor.drawioClient.linkSelectedNodeWithData(
					pos.serialize(lastActiveDrawioEditor.uri)
				);
				// Validate upon exist, as some languages do not export workspace symbols
				if (
					storeTopLevelSymbol &&
					v.detail &&
					!(await resolveTopSymbol(v.detail))
				) {
					window.showWarningMessage(
						`Cannot resolve symbol ${v.detail}. This likely means workspace symbols are not supported by your language. Try "Link Symbol With Selected Node" instead.`
					);
				}
			});
	}
Example #4
Source File: new-trongate-module-dropdown-options.ts    From trongate-vscode with MIT License 5 votes vote down vote up
quickPickOptions: QuickPickOptions = {
  placeHolder: "Do you want a view template?",
  canPickMany: false,
}
Example #5
Source File: switch-frontend-snippet.comand.ts    From trongate-vscode with MIT License 5 votes vote down vote up
cssFrameworkQuickPickOptions: QuickPickOptions = {
    placeHolder: "Choose your CSS framework ",
    canPickMany: false
}