当前位置: 首页>>代码示例>>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;未经允许,请勿转载。