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

TypeScript vscode-languageserver-types.Location类代码示例

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

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



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

示例1: test

  test('Id and classes', function () {
    const content = '<html id=\'root\'><body id="Foo" class="bar"><div class="a b"></div></body></html>';

    const expected = [
      {
        name: 'html#root',
        kind: SymbolKind.Field,
        containerName: '',
        location: Location.create(TEST_URI, Range.create(0, 0, 0, 80))
      },
      {
        name: 'body#Foo.bar',
        kind: SymbolKind.Field,
        containerName: 'html#root',
        location: Location.create(TEST_URI, Range.create(0, 16, 0, 73))
      },
      {
        name: 'div.a.b',
        kind: SymbolKind.Field,
        containerName: 'body#Foo.bar',
        location: Location.create(TEST_URI, Range.create(0, 43, 0, 66))
      }
    ];

    testSymbolsFor(content, expected);
  });
开发者ID:tiravata,项目名称:vetur,代码行数:26,代码来源:symbols.test.ts


示例2: it

 it('should get quickfix item from Location', async () => {
   let filepath = await createTmpFile('quickfix')
   let uri = URI.file(filepath).toString()
   let p = Position.create(0, 0)
   let loc = Location.create(uri, Range.create(p, p))
   let item = await workspace.getQuickfixItem(loc)
   expect(item.filename).toBe(filepath)
   expect(item.text).toBe('quickfix')
 })
开发者ID:illarionvk,项目名称:dotfiles,代码行数:9,代码来源:workspace.test.ts


示例3: plan

        plan(3, async () => {
            const fileText = trimLiteral`
            |  .gaga {
            |    -st-states: active;
            |    color: red;
            |}
            |
            |.gaga:active .gaga {
            |    background-color: fuchsia;
            |}
            |
            |.lokal {
            |    -st-extends:      gaga;
            |}
            |
            |.mixed {
            |    -st-mixin: lokal,
            |    gaga, lokal,
            |    gaga;
            |}`;

            const fileName = 'references.st.css';
            const fileSystem = new MemoryFileSystem('', { content: { [fileName]: fileText } });

            init(fileSystem, testCon.server);
            const context = { includeDeclaration: true };
            const textDocument = TextDocumentItem.create(
                toVscodePath('/' + fileName),
                'stylable',
                0,
                fileSystem.loadTextFileSync(fileName)
            );
            const refsInSelector = await testCon.client.references({
                context,
                textDocument,
                position: { line: 5, character: 16 }
            });
            const refsInMixin = await testCon.client.references({
                context,
                textDocument,
                position: { line: 10, character: 25 }
            });
            const refsInExtends = await testCon.client.references({
                context,
                textDocument,
                position: { line: 15, character: 6 }
            });
            const expectedRefs = [
                // Refs should be listed in the order they appear in the file
                Location.create(textDocument.uri, createRange(0, 3, 0, 7)),
                Location.create(textDocument.uri, createRange(5, 1, 5, 5)),
                Location.create(textDocument.uri, createRange(5, 14, 5, 18)),
                Location.create(textDocument.uri, createRange(10, 22, 10, 26)),
                Location.create(textDocument.uri, createRange(15, 4, 15, 8)),
                Location.create(textDocument.uri, createRange(16, 4, 16, 8))
            ];

            expect(refsInSelector).to.eql(expectedRefs);
            expect(refsInMixin).to.eql(expectedRefs);
            expect(refsInExtends).to.eql(expectedRefs);
        })
开发者ID:wix,项目名称:stylable-intelligence,代码行数:61,代码来源:service.spec.ts


示例4:

 return res.map(loc => Location.create(toVscodePath(loc.uri), loc.range));
开发者ID:wix,项目名称:stylable-intelligence,代码行数:1,代码来源:service.ts


示例5: test

		test('basic symbols', () => {
			let p = new Parser();
			assertSymbols(p, '.foo {}', [{ name: '.foo', kind: SymbolKind.Class, location: Location.create('test://test/test.css' ,newRange(0, 7)) }]);
			assertSymbols(p, '.foo:not(.selected) {}', [{ name: '.foo:not(.selected)', kind: SymbolKind.Class, location: Location.create('test://test/test.css' ,newRange(0, 22)) }]);
		});
开发者ID:Microsoft,项目名称:vscode-css-languageservice,代码行数:5,代码来源:navigation.test.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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