24 | Our server had error while processing your query.
25 |26 | Please 27 | open an issue and include information about your query.
28 |4 | BigTSQuery is a powerful source code search engine for TypeScript, built on top of 5 | TSQuery. It allows you to search using 6 | AST Selectors, and performs the search over nearly 1 million source files found on GitHub. 7 |
8 |9 | Type your query below or use one of the following presets, and then click the search button: 10 |
11 |12 | {{preset.name}} 13 |
14 | 22 |26 | Searching in 1 million TypeScript files... this may take up to 30 seconds 27 |
28 |
--------------------------------------------------------------------------------
/src/app/search-result/search-result.component.scss:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/urish/bigtsquery/0c5ff6e6eb3d46e9ff835f41745059687cf1ead6/src/app/search-result/search-result.component.scss
--------------------------------------------------------------------------------
/src/app/search-result/search-result.component.ts:
--------------------------------------------------------------------------------
1 | import { AfterViewInit, Component, ElementRef, Input, ViewChild } from '@angular/core';
2 | import * as Prism from 'prismjs';
3 | import 'prismjs/components/prism-typescript';
4 | import 'prismjs/plugins/keep-markup/prism-keep-markup';
5 | import 'prismjs/plugins/line-numbers/prism-line-numbers';
6 | import { IASTQueryMatch } from '../ast-search.service';
7 |
8 | @Component({
9 | selector: 'app-search-result',
10 | templateUrl: './search-result.component.html',
11 | styleUrls: ['./search-result.component.scss'],
12 | })
13 | export class SearchResultComponent implements AfterViewInit {
14 | @Input() result: IASTQueryMatch;
15 |
16 | @ViewChild('codeEl', { read: ElementRef })
17 | codeEl: ElementRef;
18 |
19 | constructor() {}
20 |
21 | ngAfterViewInit() {
22 | Prism.highlightElement(this.codeEl.nativeElement);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/app/search-result/search-result.stories.ts:
--------------------------------------------------------------------------------
1 | import { storiesOf } from '@storybook/angular';
2 | import { SearchResultComponent } from './search-result.component';
3 | import { HighlightMatchPipe } from '../highlight-match.pipe';
4 |
5 | import '../../styles.css';
6 |
7 | storiesOf('SearchResult', module)
8 | .add('with a single line of code', () => ({
9 | component: SearchResultComponent,
10 | moduleMetadata: {
11 | declarations: [HighlightMatchPipe],
12 | },
13 | props: {
14 | result: {
15 | text: 'interface MyInterface {}',
16 | line: 0,
17 | matchLine: 0,
18 | matchChar: 10,
19 | matchLength: 11,
20 | },
21 | },
22 | }))
23 | .add('with a multiple lines of code', () => ({
24 | component: SearchResultComponent,
25 | moduleMetadata: {
26 | declarations: [HighlightMatchPipe],
27 | },
28 | props: {
29 | result: {
30 | line: 1,
31 | matchChar: 0,
32 | matchLine: 2,
33 | matchLength: 151,
34 | text:
35 | `let secureProtocols = ['https:', 'wss:'];\n` +
36 | `function isSecureProtocol(url: string): boolean {\n` +
37 | ` const { protocol } = parse(url.toLowerCase());\n` +
38 | ` return secureProtocols.indexOf(protocol) !== -1;\n` +
39 | `}\n` +
40 | `function g() {`,
41 | },
42 | },
43 | }));
44 |
--------------------------------------------------------------------------------
/src/app/search-results/search-results.component.html:
--------------------------------------------------------------------------------
1 | 3 | No results found. Please check your query and try again. 4 |
5 |