Skip to content

Commit

Permalink
Fix search phrase
Browse files Browse the repository at this point in the history
  • Loading branch information
hieunc229 committed Jul 16, 2024
1 parent c69b9cf commit 1edf91f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function activate(_: vscode.ExtensionContext) {
rs = await search(match.searchPhrase);
if (rs) {
items = rs.results.map((item) => {
const output = `\n${match.commentSyntax} Source: ${item.sourceURL} ${match.commentSyntaxEnd}\n${item.code}`;
const output = `\n${match.commentSyntax} Source: ${item.sourceURL} ${match.searchPhrase}\n${item.code}`;
return {
text: output,
insertText: output,
Expand Down
3 changes: 1 addition & 2 deletions src/utils/matchSearchPhrase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ type SearchMatchResult = {
*/
export function matchSearchPhrase(input: string): SearchMatchResult | undefined {
const match = CSConfig.SEARCH_PATTERN.exec(input);

if (match && match.length > 2) {

const [_, commentSyntax, searchPhrase, commentSyntaxEnd] = match;
const [_, commentSyntax, searchSymbol, searchPhrase, commentSyntaxEnd] = match;

// @ts-ignore
let fileType = window.activeTextEditor.document.languageId;
Expand Down

0 comments on commit 1edf91f

Please sign in to comment.