本文整理汇总了TypeScript中vs/base/common/uri.toString函数的典型用法代码示例。如果您正苦于以下问题:TypeScript toString函数的具体用法?TypeScript toString怎么用?TypeScript toString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了toString函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: getMultiSelectedResources
export function getMultiSelectedResources(resource: URI | object, listService: IListService, editorService: IEditorService): URI[] {
const list = listService.lastFocusedList;
if (list && list.isDOMFocused()) {
// Explorer
if (list instanceof Tree) {
const selection = list.getSelection().map((fs: ExplorerItem) => fs.resource);
const focus = list.getFocus();
const mainUriStr = URI.isUri(resource) ? resource.toString() : focus instanceof ExplorerItem ? focus.resource.toString() : undefined;
// If the resource is passed it has to be a part of the returned context.
// We only respect the selection if it contains the focused element.
if (selection.some(s => URI.isUri(s) && s.toString() === mainUriStr)) {
return selection;
}
}
// Open editors view
if (list instanceof List) {
const selection = list.getSelectedElements().filter(s => s instanceof OpenEditor).map((oe: OpenEditor) => oe.getResource());
const focusedElements = list.getFocusedElements();
const focus = focusedElements.length ? focusedElements[0] : undefined;
const mainUriStr = URI.isUri(resource) ? resource.toString() : (focus instanceof OpenEditor) ? focus.getResource().toString() : undefined;
// We only respect the selection if it contains the main element.
if (selection.some(s => s.toString() === mainUriStr)) {
return selection;
}
}
}
const result = getResourceForCommand(resource, listService, editorService);
return !!result ? [result] : [];
}
开发者ID:liunian,项目名称:vscode,代码行数:31,代码来源:files.ts
示例2: testWorkspace
export function testWorkspace(resource: URI): Workspace {
return new Workspace(
resource.toString(),
resource.fsPath,
toWorkspaceFolders([{ path: resource.fsPath }])
);
}
开发者ID:AlexxNica,项目名称:sqlopsstudio,代码行数:7,代码来源:testWorkspace.ts
示例3: isEqual
export function isEqual(first: uri, second: uri, ignoreCase?: boolean): boolean {
const identityEquals = (first === second);
if (identityEquals) {
return true;
}
if (!first || !second) {
return false;
}
if (ignoreCase) {
return equalsIgnoreCase(first.toString(), second.toString());
}
return first.toString() === second.toString();
}
开发者ID:jinlongchen2018,项目名称:vscode,代码行数:16,代码来源:resources.ts
示例4: getMultiSelectedResources
export function getMultiSelectedResources(resource: URI | {}, listService: IListService, editorService: IWorkbenchEditorService): URI[] {
const list = listService.lastFocusedList;
if (list && list.isDOMFocused()) {
// Explorer
if (list instanceof Tree) {
const focus: IFileStat = list.getFocus();
// If the resource is passed it has to be a part of the returned context.
if (focus && (!URI.isUri(resource) || focus.resource.toString() === resource.toString())) {
const selection = list.getSelection();
// We only respect the selection if it contains the focused element.
if (selection && selection.indexOf(focus) >= 0) {
return selection.map(fs => fs.resource);
}
}
}
// Open editors view
if (list instanceof List) {
const focus = list.getFocusedElements();
// If the resource is passed it has to be a part of the returned context.
if (focus.length && (!URI.isUri(resource) || (focus[0] instanceof OpenEditor && focus[0].getResource().toString() === resource.toString()))) {
const selection = list.getSelectedElements();
// We only respect the selection if it contains the focused element.
if (selection && selection.indexOf(focus[0]) >= 0) {
return selection.filter(s => s instanceof OpenEditor).map((oe: OpenEditor) => oe.getResource());
}
}
}
}
const result = getResourceForCommand(resource, listService, editorService);
return !!result ? [result] : [];
}
开发者ID:sameer-coder,项目名称:vscode,代码行数:33,代码来源:files.ts
示例5: testWorkspace
export function testWorkspace(resource: URI): Workspace {
return new Workspace(
resource.toString(),
resource.fsPath,
[resource]
);
}
开发者ID:Chan-PH,项目名称:vscode,代码行数:7,代码来源:testWorkspace.ts
示例6: compute
export function compute(languageService:ts.LanguageService, resource:URI, position:EditorCommon.IPosition):Modes.ILogicalSelectionEntry[] {
var sourceFile = languageService.getSourceFile(resource.toString()),
offset = converter.getOffset(sourceFile, position);
var token = ts.getTokenAtPosition(sourceFile, offset),
lastStart = -1,
lastEnd = -1,
result:Modes.ILogicalSelectionEntry[] = [];
while(token) {
var start = token.getStart(),
end = token.getEnd();
if(start !== lastStart || end !== lastEnd) {
result.unshift({
type: 'node',
range: converter.getRange(sourceFile, start, end)
});
}
lastStart = start;
lastEnd = end;
token = token.parent;
}
return result;
}
开发者ID:578723746,项目名称:vscode,代码行数:29,代码来源:logicalSelection.ts
示例7: find
export function find(project: projectService.IProject, resource: URI, position: EditorCommon.IPosition, includeDecl: boolean, insideFileOnly: boolean = false): Modes.IReference[] {
var filename = resource.toString(),
offset = project.host.getScriptLineMap(filename).getOffset(position),
entries: ts.ReferenceEntry[];
entries = insideFileOnly
? project.languageService.getOccurrencesAtPosition(filename, offset)
: project.languageService.getReferencesAtPosition(filename, offset);
if(!entries) {
return [];
}
return entries.filter(info => {
var targetFile = project.languageService.getSourceFile(info.fileName);
return (includeDecl || !isDeclaration(targetFile, info.textSpan.start));
}).map(info => {
var r:Modes.IReference = {
resource: URI.parse(info.fileName),
range: project.host.getScriptLineMap(info.fileName).getRangeFromSpan(info.textSpan)
};
return r;
});
}
开发者ID:578723746,项目名称:vscode,代码行数:25,代码来源:references.ts
示例8: compute
export function compute(languageService: ts.LanguageService, resource:URI, position:EditorCommon.IPosition):Modes.IComputeExtraInfoResult {
var filename = resource.toString(),
sourceFile = languageService.getSourceFile(filename),
offset = converter.getOffset(sourceFile, position),
info = languageService.getQuickInfoAtPosition(filename, offset),
result:Modes.IComputeExtraInfoResult;
if(info) {
var htmlContent = [
previewer.html(info.displayParts),
previewer.html(info.documentation, 'documentation')
];
result = {
value: '',
htmlContent: htmlContent,
className: 'typeInfo ts',
range: converter.getRange(sourceFile, info.textSpan)
};
}
return result;
}
开发者ID:gaoxiaojun,项目名称:vscode,代码行数:25,代码来源:extraInfo.ts
示例9: insert
public insert(uri:URI, element:IMirrorModel): void {
let key = uri.toString();
if (this._map.contains(key)) {
// There already exists a model with this id => this is a programmer error
throw new Error('ResourceService: Cannot add model ' + ResourceService._anonymousModelId(key) + ' because it already exists!');
}
this._map.set(key, element);
}
开发者ID:douglaseccker,项目名称:vscode,代码行数:9,代码来源:resourceServiceImpl.ts
示例10: saveViewState
protected saveViewState(resource: URI | string, editorViewState: HtmlPreviewEditorViewState): void {
const memento = this.getMemento(this.storageService, Scope.WORKSPACE);
let editorViewStateMemento: { [key: string]: { [position: number]: HtmlPreviewEditorViewState } } = memento[this.viewStateStorageKey];
if (!editorViewStateMemento) {
editorViewStateMemento = Object.create(null);
memento[this.viewStateStorageKey] = editorViewStateMemento;
}
let fileViewState = editorViewStateMemento[resource.toString()];
if (!fileViewState) {
fileViewState = Object.create(null);
editorViewStateMemento[resource.toString()] = fileViewState;
}
if (typeof this.position === 'number') {
fileViewState[this.position] = editorViewState;
}
}
开发者ID:JarnoNijboer,项目名称:vscode,代码行数:18,代码来源:webviewEditor.ts
注:本文中的vs/base/common/uri.toString函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论