本文整理汇总了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);
});
示例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];
}
}
示例3:
protocol2Code: (value: string) =>
vscode.Uri.file(realpathSync(vscode.Uri.parse(value).fsPath))
示例4:
return items.map(item => new vscode.SymbolInformation(
item.symbolName, item.symbolKind, '',
new vscode.Location(vscode.Uri.file(item.fileName), item.position)
));
示例5:
const openDocument = () => {
const uri = Uri.file(editorFile1);
return workspace.openTextDocument(uri)
.then((textDocument) => window.showTextDocument(textDocument));
};
示例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' });
};
示例7:
export const getDocUri = (p: string) => {
return vscode.Uri.file(getDocPath(p));
};
示例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);
});
示例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');
示例10:
return children.map(([name, type]) => ({ uri: vscode.Uri.file(path.join(workspaceFolder.uri.fsPath, name)), type }));