当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Uri.parse方法代码示例

本文整理汇总了TypeScript中vscode.Uri.parse方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Uri.parse方法的具体用法?TypeScript Uri.parse怎么用?TypeScript Uri.parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vscode.Uri的用法示例。


在下文中一共展示了Uri.parse方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

        client.onRequest(NoSassLintLibraryRequest.type, (params) => {
            const uri: Uri = Uri.parse(params.source.uri);

            const workspaceFolder = workspace.getWorkspaceFolder(uri);
            const packageManager = workspace.getConfiguration("sasslint", uri).get("packageManager", "npm");

            client.info(getInstallFailureMessage(uri, workspaceFolder, packageManager));

            return {};
        });
开发者ID:glen-84,项目名称:vscode-sass-lint,代码行数:10,代码来源:extension.ts

示例2: test

	test('editor, onDidChangeTextEditorViewColumn (move editor group)', () => {

		let actualEvents: TextEditorViewColumnChangeEvent[] = [];

		let registration1 = workspace.registerTextDocumentContentProvider('bikes', {
			provideTextDocumentContent() {
				return 'mountainbiking,roadcycling';
			}
		});

		return Promise.all([
			workspace.openTextDocument(Uri.parse('bikes://testing/one')).then(doc => window.showTextDocument(doc, ViewColumn.One)),
			workspace.openTextDocument(Uri.parse('bikes://testing/two')).then(doc => window.showTextDocument(doc, ViewColumn.Two))
		]).then(editors => {

			let [, two] = editors;
			two.show();

			return new Promise(resolve => {

				let registration2 = window.onDidChangeTextEditorViewColumn(event => {
					actualEvents.push(event);

					if (actualEvents.length === 2) {
						registration2.dispose();
						resolve();
					}
				});

				// move active editor group left
				return commands.executeCommand('workbench.action.moveActiveEditorGroupLeft');

			}).then(() => {
				assert.equal(actualEvents.length, 2);

				for (const event of actualEvents) {
					assert.equal(event.viewColumn, event.textEditor.viewColumn);
				}

				registration1.dispose();
			});
		});
	});
开发者ID:joelday,项目名称:vscode,代码行数:43,代码来源:window.test.ts

示例3: init

async function init(context: ExtensionContext, disposables: Disposable[]): Promise<void> {
	const { name, version, aiKey } = require(context.asAbsolutePath('./package.json')) as { name: string, version: string, aiKey: string };
	const telemetryReporter: TelemetryReporter = new TelemetryReporter(name, version, aiKey);
	disposables.push(telemetryReporter);

	const outputChannel = window.createOutputChannel('Git');
	disposables.push(outputChannel);

	const config = workspace.getConfiguration('git');
	const enabled = config.get<boolean>('enabled') === true;
	const workspaceRootPath = workspace.rootPath;

	const pathHint = workspace.getConfiguration('git').get<string>('path');
	const info = await findGit(pathHint);
	const askpass = new Askpass();
	const env = await askpass.getEnv();
	const git = new Git({ gitPath: info.path, version: info.version, env });

	if (!workspaceRootPath || !enabled) {
		const commandCenter = new CommandCenter(git, undefined, outputChannel, telemetryReporter);
		disposables.push(commandCenter);
		return;
	}

	const model = new Model(git, workspaceRootPath);

	outputChannel.appendLine(localize('using git', "Using git {0} from {1}", info.version, info.path));
	git.onOutput(str => outputChannel.append(str), null, disposables);

	const commandCenter = new CommandCenter(git, model, outputChannel, telemetryReporter);
	const statusBarCommands = new StatusBarCommands(model);
	const provider = new GitSCMProvider(model, commandCenter, statusBarCommands);
	const contentProvider = new GitContentProvider(model);
	const autoFetcher = new AutoFetcher(model);
	const mergeDecorator = new MergeDecorator(model);

	disposables.push(
		commandCenter,
		provider,
		contentProvider,
		autoFetcher,
		mergeDecorator,
		model
	);

	if (/^[01]/.test(info.version)) {
		const update = localize('updateGit', "Update Git");
		const choice = await window.showWarningMessage(localize('git20', "You seem to have git {0} installed. Code works best with git >= 2", info.version), update);

		if (choice === update) {
			commands.executeCommand('vscode.open', Uri.parse('https://git-scm.com/'));
		}
	}
}
开发者ID:m-khosravi,项目名称:vscode,代码行数:54,代码来源:main.ts

示例4:

 let csvCommand = commands.registerCommand('csv.preview', () => {
     let file = window.activeTextEditor.document.fileName;
     if (file.startsWith("/")) {
         file = file.substring(1);
     }
     previewUri = Uri.parse(`csv-preview://preview/${file}`);
     return commands.executeCommand('vscode.previewHtml', previewUri, ViewColumn.One).then((success) => {
     }, (reason) => {
         window.showErrorMessage(reason);
     });
 });
开发者ID:kmp1,项目名称:gc-excelviewer,代码行数:11,代码来源:extension.ts

示例5: test

	test('openTextDocument, untitled is dirty', function(done) {
		if (process.platform === 'win32') {
			return done(); // TODO@Joh this test fails on windows
		}

		workspace.openTextDocument(Uri.parse('untitled://' + join(workspace.rootPath, './newfile.txt'))).then(doc => {
			assert.equal(doc.uri.scheme, 'untitled');
			assert.ok(doc.isDirty);
			done();
		});
	});
开发者ID:sangohan,项目名称:KodeStudio,代码行数:11,代码来源:workspace.test.ts

示例6:

 vscode.window.showQuickPick(items, options).then(function (selection) {
     if (typeof selection === "undefined") {
         return;
     }
     global.methodForDescription = selection;
     syntaxHelper.update(previewUri);
     vscode.commands.executeCommand("vscode.previewHtml", vscode.Uri.parse(previewUriString), vscode.ViewColumn.Two).then((success) => {
     }, (reason) => {
         vscode.window.showErrorMessage(reason);
     });
 });
开发者ID:artbear,项目名称:vsc-language-1c-bsl,代码行数:11,代码来源:extension.ts

示例7: test

	test('api-command: vscode.diff', function () {

		let registration = workspace.registerTextDocumentContentProvider('sc', {
			provideTextDocumentContent(uri) {
				return `content of URI <b>${uri.toString()}</b>#${Math.random()}`;
			}
		});


		let a = commands.executeCommand('vscode.diff', Uri.parse('sc:a'), Uri.parse('sc:b'), 'DIFF').then(value => {
			assert.ok(value === void 0);
			registration.dispose();
		});

		let b = commands.executeCommand('vscode.diff', Uri.parse('sc:a'), Uri.parse('sc:b')).then(value => {
			assert.ok(value === void 0);
			registration.dispose();
		});

		let c = commands.executeCommand('vscode.diff', Uri.parse('sc:a'), Uri.parse('sc:b'), 'Title', { selection: new Range(new Position(1, 1), new Position(1, 2)) }).then(value => {
			assert.ok(value === void 0);
			registration.dispose();
		});

		let d = commands.executeCommand('vscode.diff').then(() => assert.ok(false), () => assert.ok(true));
		let e = commands.executeCommand('vscode.diff', 1, 2, 3).then(() => assert.ok(false), () => assert.ok(true));

		return Promise.all([a, b, c, d, e]);
	});
开发者ID:AllureFer,项目名称:vscode,代码行数:29,代码来源:commands.test.ts

示例8: openScript

async function openScript(pathOrUri: string) {

	let uri: vscode.Uri;
	if (pathOrUri.startsWith('debug:')) {
		uri = vscode.Uri.parse(pathOrUri);
	} else {
		uri = vscode.Uri.file(pathOrUri);
	}

	const doc = await vscode.workspace.openTextDocument(uri);

	vscode.window.showTextDocument(doc);
}
开发者ID:hbenl,项目名称:vscode-firefox-debug,代码行数:13,代码来源:main.ts

示例9: async

			async (params: WorkspaceRubyEnvironmentParams): Promise<WorkspaceRubyEnvironmentResult> => {
				const environments: WorkspaceRubyEnvironmentResult = {};

				for (const uri of params.folders) {
					const workspaceFolder: WorkspaceFolder = workspace.getWorkspaceFolder(Uri.parse(uri));

					if (workspaceFolder && workspaceFolder.uri.fsPath) {
						environments[uri] = await loadEnv(workspaceFolder.uri.fsPath);
					}
				}

				return environments;
			}
开发者ID:rubyide,项目名称:vscode-ruby,代码行数:13,代码来源:WorkspaceRubyEnvironment.ts

示例10: showOpenFileDialog

export async function showOpenFileDialog(): Promise<string> {
  const defaultFolder = workspace.workspaceFolders ? workspace.workspaceFolders[0].uri.fsPath : '';
  const folder = await (await window.showSaveDialog({
    defaultUri: Uri.parse(defaultFolder),
    saveLabel: 'Select mnemonic storage',
  }));

  if (!folder) {
    throw new CancellationEvent();
  }

  return folder.fsPath;
}
开发者ID:chrisseg,项目名称:vscode-azure-blockchain-ethereum,代码行数:13,代码来源:userInteraction.ts


注:本文中的vscode.Uri.parse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。