當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。