• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript vscode-uri.file函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中vscode-uri.file函数的典型用法代码示例。如果您正苦于以下问题:TypeScript file函数的具体用法?TypeScript file怎么用?TypeScript file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了file函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: test

	test('CSS url() Path Completion - Unquoted url', function () {
		let testUri = Uri.file(path.resolve(__dirname, '../../test/pathCompletionFixtures/about/about.css')).toString();
		let folders = [{ name: 'x', uri: Uri.file(path.resolve(__dirname, '../../test')).toString() }];

		assertCompletions('html { background-image: url(./|)', {
			items: [
				{ label: 'about.html', resultText: 'html { background-image: url(./about.html)' }
			]
		}, testUri, folders);

		assertCompletions('html { background-image: url(./a|)', {
			items: [
				{ label: 'about.html', resultText: 'html { background-image: url(./about.html)' }
			]
		}, testUri, folders);

		assertCompletions('html { background-image: url(../|src/)', {
			items: [
				{ label: 'about/', resultText: 'html { background-image: url(../about/)' }
			]
		}, testUri, folders);

		assertCompletions('html { background-image: url(../s|rc/)', {
			items: [
				{ label: 'about/', resultText: 'html { background-image: url(../about/)' }
			]
		}, testUri, folders);
	});
开发者ID:developers23,项目名称:vscode,代码行数:28,代码来源:completion.test.ts


示例2: test

	test('CSS Path completion', function () {
		let testUri = Uri.file(path.resolve(__dirname, '../../test/pathCompletionFixtures/about/about.css')).toString();
		let folders = [{ name: 'x', uri: Uri.file(path.resolve(__dirname, '../../test')).toString() }];

		assertCompletions('html { background-image: url("./|")', {
			items: [
				{ label: 'about.html', resultText: 'html { background-image: url("./about.html")' }
			]
		}, testUri, folders);

		assertCompletions(`html { background-image: url('../|')`, {
			items: [
				{ label: 'about/', resultText: `html { background-image: url('../about/')` },
				{ label: 'index.html', resultText: `html { background-image: url('../index.html')` },
				{ label: 'src/', resultText: `html { background-image: url('../src/')` }
			]
		}, testUri, folders);

		assertCompletions(`html { background-image: url('../src/a|')`, {
			items: [
				{ label: 'feature.js', resultText: `html { background-image: url('../src/feature.js')` },
				{ label: 'data/', resultText: `html { background-image: url('../src/data/')` },
				{ label: 'test.js', resultText: `html { background-image: url('../src/test.js')` }
			]
		}, testUri, folders);

		assertCompletions(`html { background-image: url('../src/data/f|.asar')`, {
			items: [
				{ label: 'foo.asar', resultText: `html { background-image: url('../src/data/foo.asar')` }
			]
		}, testUri, folders);

		assertCompletions(`html { background-image: url('|')`, {
			items: [
				{ label: 'about.css', resultText: `html { background-image: url('about.css')` },
				{ label: 'about.html', resultText: `html { background-image: url('about.html')` },
			]
		}, testUri, folders);

		assertCompletions(`html { background-image: url('/|')`, {
			items: [
				{ label: 'pathCompletionFixtures/', resultText: `html { background-image: url('/pathCompletionFixtures/')` }
			]
		}, testUri, folders);

		assertCompletions(`html { background-image: url('/pathCompletionFixtures/|')`, {
			items: [
				{ label: 'about/', resultText: `html { background-image: url('/pathCompletionFixtures/about/')` },
				{ label: 'index.html', resultText: `html { background-image: url('/pathCompletionFixtures/index.html')` },
				{ label: 'src/', resultText: `html { background-image: url('/pathCompletionFixtures/src/')` }
			]
		}, testUri, folders);

		assertCompletions(`html { background-image: url("/|")`, {
			items: [
				{ label: 'pathCompletionFixtures/', resultText: `html { background-image: url("/pathCompletionFixtures/")` }
			]
		}, testUri, folders);
	});
开发者ID:costincaraivan,项目名称:vscode,代码行数:59,代码来源:completion.test.ts


示例3: test

	test('Completion should ignore files/folders starting with dot', function () {
		let testUri = Uri.file(path.resolve(__dirname, '../../test/pathCompletionFixtures/about/about.css')).toString();
		let folders = [{ name: 'x', uri: Uri.file(path.resolve(__dirname, '../../test')).toString() }];

		assertCompletions('html { background-image: url("../|")', {
			count: 4
		}, testUri, folders);

	});
开发者ID:DonJayamanne,项目名称:vscode,代码行数:9,代码来源:completion.test.ts


示例4: it

 it('should support RenameFile edit', async () => {
   let file = path.join(__dirname, 'foo')
   await workspace.createFile(file, { ignoreIfExists: true, overwrite: true })
   let newFile = path.join(__dirname, 'bar')
   let uri = URI.file(file).toString()
   let workspaceEdit: WorkspaceEdit = {
     documentChanges: [RenameFile.create(uri, URI.file(newFile).toString())]
   }
   let res = await workspace.applyEdit(workspaceEdit)
   expect(res).toBe(true)
   await workspace.deleteFile(newFile, { ignoreIfNotExists: true })
 })
开发者ID:illarionvk,项目名称:dotfiles,代码行数:12,代码来源:workspace.test.ts


示例5: modifyConfiguration

 private async modifyConfiguration(target: ConfigurationTarget, key: string, value?: any): Promise<void> {
   let { nvim, workspace } = this
   let file = workspace.getConfigFile(target)
   if (!file) return
   let formattingOptions = await workspace.getFormatOptions()
   let content = await workspace.readFile(Uri.file(file).toString())
   value = value == null ? undefined : value
   let edits = modify(content, [key], value, { formattingOptions })
   content = applyEdits(content, edits)
   fs.writeFileSync(file, content, 'utf8')
   let doc = workspace.getDocument(Uri.file(file).toString())
   if (doc) nvim.command('checktime', true)
   return
 }
开发者ID:demelev,项目名称:coc.nvim,代码行数:14,代码来源:shape.ts


示例6: getSourceDoc

 definitions.forEach(d => {
   const definitionTargetDoc = getSourceDoc(d.fileName, program);
   definitionResults.push({
     uri: Uri.file(d.fileName).toString(),
     range: convertRange(definitionTargetDoc, d.textSpan)
   });
 });
开发者ID:tiravata,项目名称:vetur,代码行数:7,代码来源:javascript.ts


示例7: getUri

export function getUri(fullpath: string, id: number, buftype: string): string {
  if (!fullpath) return `untitled:${id}`
  if (path.isAbsolute(fullpath)) return Uri.file(fullpath).toString()
  if (isuri.isValid(fullpath)) return Uri.parse(fullpath).toString()
  if (buftype != '') return `${buftype}:${id}`
  return `unknown:${id}`
}
开发者ID:illarionvk,项目名称:dotfiles,代码行数:7,代码来源:index.ts


示例8: test

  test(testName, async() => {
    const {synchronizer, baseDir, clientConnection, converter} =
        createFileSynchronizer();
    const indexPath = path.join(baseDir, 'index.html');
    const indexUri = URI.file(indexPath).toString();

    // We read the file from disk before it is opened.
    fs.writeFileSync(indexPath, 'Filesystem content');
    assert.deepEqual(
        await synchronizer.urlLoader.load(
            converter.getAnalyzerUrl({uri: 'index.html'})!),
        'Filesystem content');

    // Open the document
    const openParams: DidOpenTextDocumentParams = {
      textDocument: {
        languageId: 'html',
        text: 'Initial text document content',
        uri: indexUri,
        version: 0
      }
    };
    clientConnection.sendNotification(
        DidOpenTextDocumentNotification.type, openParams);
    let change = await synchronizer.fileChanges.next;
    assert.deepEqual(change, [{type: FileChangeType.Changed, uri: indexUri}]);
    assert.deepEqual(
        await synchronizer.urlLoader.load(
            converter.getAnalyzerUrl({uri: 'index.html'})!),
        'Initial text document content');

    // Change the file in memory
    const changeParams: DidChangeTextDocumentParams = {
      textDocument: {uri: indexUri, version: 1},
      contentChanges: [{
        range: {start: {line: 0, character: 0}, end: {line: 0, character: 100}},
        text: 'Changed text document content'
      }]
    };
    clientConnection.sendNotification(
        DidChangeTextDocumentNotification.type, changeParams);
    change = await synchronizer.fileChanges.next;
    assert.deepEqual(change, [{type: FileChangeType.Changed, uri: indexUri}]);
    assert.deepEqual(
        await synchronizer.urlLoader.load(
            converter.getAnalyzerUrl({uri: 'index.html'})!),
        'Changed text document content');

    // Close without saving
    const closeParams:
        DidCloseTextDocumentParams = {textDocument: {uri: indexUri}};
    clientConnection.sendNotification(
        DidCloseTextDocumentNotification.type, closeParams);
    change = await synchronizer.fileChanges.next;
    assert.deepEqual(change, [{type: FileChangeType.Changed, uri: indexUri}]);
    assert.deepEqual(
        await synchronizer.urlLoader.load(
            converter.getAnalyzerUrl({uri: 'index.html'})!),
        'Filesystem content');
  });
开发者ID:MehdiRaash,项目名称:tools,代码行数:60,代码来源:file-synchronizer_test.ts



注:本文中的vscode-uri.file函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript vscode-uri.parse函数代码示例发布时间:2022-05-25
下一篇:
TypeScript vscode-test-content.setWithSelection函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap