当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Location.create方法代码示例

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


在下文中一共展示了Location.create方法的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.create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。