Skip to content

Commit fa5451c

Browse files
feat: add doc links to selector/strictness
1 parent 7006d54 commit fa5451c

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

src/webview/SearchSidebar/SearchWidgetContainer/PatternConfig.tsx

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import { SearchInput } from './SearchInput'
2-
import { VSCodeDropdown, VSCodeOption } from '@vscode/webview-ui-toolkit/react'
2+
import {
3+
VSCodeDropdown,
4+
VSCodeOption,
5+
VSCodeLink,
6+
} from '@vscode/webview-ui-toolkit/react'
37
import { usePatternConfig, useSearchField } from '../../hooks/useQuery'
48
import { useCallback } from 'react'
59

@@ -14,6 +18,14 @@ const titleStyle = {
1418
}
1519
const NOOP = () => {}
1620

21+
function Link({ href }: { href: string }) {
22+
return (
23+
<VSCodeLink style={{ fontSize: '0.9em', marginLeft: '0.25em' }} href={href}>
24+
25+
</VSCodeLink>
26+
)
27+
}
28+
1729
export default function PatternConfig() {
1830
const [strictness, setStrictness] = useSearchField('strictness')
1931
const [selector, setSelector] = usePatternConfig('selector')
@@ -27,7 +39,10 @@ export default function PatternConfig() {
2739
)
2840
return (
2941
<div>
30-
<h4 style={titleStyle}>Strictness</h4>
42+
<h4 style={titleStyle}>
43+
Strictness
44+
<Link href="https://ast-grep.github.io/advanced/match-algorithm.html" />
45+
</h4>
3146
<VSCodeDropdown
3247
value={strictness}
3348
onChange={onStrictnessChange}
@@ -39,7 +54,10 @@ export default function PatternConfig() {
3954
<VSCodeOption value="relaxed">Relaxed (ignore comments)</VSCodeOption>
4055
<VSCodeOption value="signature">Signature (ignore text)</VSCodeOption>
4156
</VSCodeDropdown>
42-
<h4 style={titleStyle}>Selector</h4>
57+
<h4 style={titleStyle}>
58+
Selector
59+
<Link href="https://ast-grep.github.io/advanced/faq.html#my-pattern-does-not-work-why" />
60+
</h4>
4361
<SearchInput
4462
isSingleLine={true}
4563
placeholder="sub-node kind to match"

0 commit comments

Comments
 (0)