當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Uri.file方法代碼示例

本文整理匯總了TypeScript中vscode.Uri.file方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Uri.file方法的具體用法?TypeScript Uri.file怎麽用?TypeScript Uri.file使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在vscode.Uri的用法示例。


在下文中一共展示了Uri.file方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: parseInt

    errors.forEach(error => {
        let errorSplit = error.split(':');
        let fileName = errorSplit[0];
        let index = 1;
        // a full path in windows includes a : for the drive
        if (process.platform === 'win32') {
            fileName = errorSplit[0] + ':' + errorSplit[1];
            index = 2;
        }

        let line = parseInt(errorSplit[index]);
        let column = parseInt(errorSplit[index + 1]);
        let severity = getDiagnosticSeverity(errorSplit[index + 2], errorWarningCounts);
        
        let targetUri = vscode.Uri.file(fileName);
        let range = new vscode.Range(line - 1, column, line - 1, column);
        let diagnostic = new vscode.Diagnostic(range, error, severity);
        let diagnostics = diagnosticMap.get(targetUri);
        if (!diagnostics) {
            diagnostics = [];
        }
        diagnostics.push(diagnostic);
        diagnosticMap.set(targetUri, diagnostics);
    });
開發者ID:CedarLogic,項目名稱:vscode-solidity,代碼行數:24,代碼來源:compiler.ts

示例2: getSCMResource

	private getSCMResource(uri?: Uri): Resource | undefined {
		uri = uri ? uri : window.activeTextEditor && window.activeTextEditor.document.uri;

		if (!uri) {
			return undefined;
		}

		if (uri.scheme === 'git') {
			const { path } = fromGitUri(uri);
			uri = Uri.file(path);
		}

		if (uri.scheme === 'file') {
			const uriString = uri.toString();
			const repository = this.model.getRepository(uri);

			if (!repository) {
				return undefined;
			}

			return repository.workingTreeGroup.resourceStates.filter(r => r.resourceUri.toString() === uriString)[0]
				|| repository.indexGroup.resourceStates.filter(r => r.resourceUri.toString() === uriString)[0];
		}
	}
開發者ID:leonardovilarinho,項目名稱:vscode,代碼行數:24,代碼來源:commands.ts

示例3:

 protocol2Code: (value: string) =>
     vscode.Uri.file(realpathSync(vscode.Uri.parse(value).fsPath))
開發者ID:nickbabcock,項目名稱:EECS381StyleCheck,代碼行數:2,代碼來源:extension.ts

示例4:

 return items.map(item => new vscode.SymbolInformation(
     item.symbolName, item.symbolKind, '',
     new vscode.Location(vscode.Uri.file(item.fileName), item.position)
 ));
開發者ID:,項目名稱:,代碼行數:4,代碼來源:

示例5:

 const openDocument = () => {
     const uri = Uri.file(editorFile1);
     return workspace.openTextDocument(uri)
         .then((textDocument) => window.showTextDocument(textDocument));
 };
開發者ID:sleistner,項目名稱:vscode-fileutils,代碼行數:5,代碼來源:RenameFileCommand.test.ts

示例6:

const resolveExtensionResources = (extension: vscode.Extension<any>, resourcePath: string): vscode.Uri => {
	return vscode.Uri.file(path.join(extension.extensionPath, resourcePath))
		.with({ scheme: 'vscode-extension-resource' });
};
開發者ID:sameer-coder,項目名稱:vscode,代碼行數:4,代碼來源:markdownExtensions.ts

示例7:

export const getDocUri = (p: string) => {
	return vscode.Uri.file(getDocPath(p));
};
開發者ID:voodoos,項目名稱:vscode-extension-samples,代碼行數:3,代碼來源:helper.ts

示例8:

 references.forEach(ref => {
     var uri = vscode.Uri.file(ref.fileName);
     var range = new vscode.Range(ref.lineIndex, ref.columnIndex, ref.lineIndex, ref.columnIndex + _oldName.length);
     workSpaceEdit.replace(uri, range, _newName);
 });
開發者ID:maiamatheus,項目名稱:pythonVSCode,代碼行數:5,代碼來源:renameProvider.ts

示例9: getSymbolsForFile

/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

import * as assert from 'assert';
import 'mocha';
import * as vscode from 'vscode';
import SymbolProvider from '../features/documentSymbolProvider';
import { InMemoryDocument } from './inMemoryDocument';
import { createNewMarkdownEngine } from './engine';


const testFileName = vscode.Uri.file('test.md');


function getSymbolsForFile(fileContents: string) {
	const doc = new InMemoryDocument(testFileName, fileContents);
	const provider = new SymbolProvider(createNewMarkdownEngine());
	return provider.provideDocumentSymbols(doc);
}


suite('markdown.DocumentSymbolProvider', () => {
	test('Should not return anything for empty document', async () => {
		const symbols = await getSymbolsForFile('');
		assert.strictEqual(symbols.length, 0);
	});

	test('Should not return anything for document with no headers', async () => {
		const symbols = await getSymbolsForFile('a\na');
開發者ID:PKRoma,項目名稱:vscode,代碼行數:31,代碼來源:documentSymbolProvider.test.ts

示例10:

			return children.map(([name, type]) => ({ uri: vscode.Uri.file(path.join(workspaceFolder.uri.fsPath, name)), type }));
開發者ID:voodoos,項目名稱:vscode-extension-samples,代碼行數:1,代碼來源:fileExplorer.ts


注:本文中的vscode.Uri.file方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。