本文整理匯總了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 }));