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


TypeScript uri.with函數代碼示例

本文整理匯總了TypeScript中vs/base/common/uri.with函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript with函數的具體用法?TypeScript with怎麽用?TypeScript with使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1:

				savePromise = textFileService.save(resource).then((result) => {
					if (result) {
						return resource.with({ scheme: Schemas.file });
					}

					return null;
				});
開發者ID:liunian,項目名稱:vscode,代碼行數:7,代碼來源:fileCommands.ts

示例2: dirname

export function dirname(resource: uri): uri {
	const dirname = paths.dirname(resource.path);
	if (resource.authority && dirname && !paths.isAbsolute(dirname)) {
		return null; // If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character
	}

	return resource.with({
		path: dirname
	});
}
開發者ID:jinlongchen2018,項目名稱:vscode,代碼行數:10,代碼來源:resources.ts

示例3: getPathLabel

export function getPathLabel(resource: URI | string, userHomeProvider: IUserHomeProvider, rootProvider?: IWorkspaceFolderProvider): string {
	if (!resource) {
		return null;
	}

	if (typeof resource === 'string') {
		resource = URI.file(resource);
	}

	// return early if we can resolve a relative path label from the root
	const baseResource = rootProvider ? rootProvider.getWorkspaceFolder(resource) : null;
	if (baseResource) {
		const hasMultipleRoots = rootProvider.getWorkspace().folders.length > 1;

		let pathLabel: string;
		if (isEqual(baseResource.uri, resource, !isLinux)) {
			pathLabel = ''; // no label if paths are identical
		} else {
			pathLabel = normalize(ltrim(resource.path.substr(baseResource.uri.path.length), sep), true);
		}

		if (hasMultipleRoots) {
			const rootName = (baseResource && baseResource.name) ? baseResource.name : pathsBasename(baseResource.uri.fsPath);
			pathLabel = pathLabel ? (rootName + ' • ' + pathLabel) : rootName; // always show root basename if there are multiple
		}

		return pathLabel;
	}

	// return if the resource is neither file:// nor untitled:// and no baseResource was provided
	if (resource.scheme !== Schemas.file && resource.scheme !== Schemas.untitled) {
		return resource.with({ query: null, fragment: null }).toString(true);
	}

	// convert c:\something => C:\something
	if (hasDriveLetter(resource.fsPath)) {
		return normalize(normalizeDriveLetter(resource.fsPath), true);
	}

	// normalize and tildify (macOS, Linux only)
	let res = normalize(resource.fsPath, true);
	if (!isWindows && userHomeProvider) {
		res = tildify(res, userHomeProvider.userHome);
	}

	return res;
}
開發者ID:burhandodhy,項目名稱:azuredatastudio,代碼行數:47,代碼來源:labels.ts

示例4: joinPath

export function joinPath(resource: uri, pathFragment: string): uri {
	const joinedPath = paths.join(resource.path || '/', pathFragment);
	return resource.with({
		path: joinedPath
	});
}
開發者ID:jinlongchen2018,項目名稱:vscode,代碼行數:6,代碼來源:resources.ts

示例5:

				.then(info => {
					return uri.with({ query: `${uri.query ? uri.query + '&' : ''}utm_source=VsCode&utm_medium=${encodeURIComponent(origin)}&utm_campaign=${encodeURIComponent(info.instanceId)}&utm_content=${encodeURIComponent(experiment)}` });
				});
開發者ID:AlexxNica,項目名稱:sqlopsstudio,代碼行數:3,代碼來源:telemetryNodeUtils.ts

示例6: dirname

export function dirname(resource: uri): uri {
	return resource.with({
		path: paths.dirname(resource.path)
	});
}
開發者ID:jamesforest,項目名稱:vscode,代碼行數:5,代碼來源:resources.ts


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