Skip to content

Commit

Permalink
Filter snippets based on word starts with snippet label
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulyadav-57 committed Apr 22, 2024
1 parent e1bf05c commit de359bf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/workspace/Editor/EditorOnMount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@ export const editorOnMount = async (
startColumn: word.startColumn,
endColumn: word.endColumn,
};
// Filter snippets based on the word starts with the snippet label
const filteredSnippets = tactSnippets.filter((snippet) =>
snippet.label.startsWith(word.word)
);
return {
suggestions: tactSnippets.map((snippet) => {
suggestions: filteredSnippets.map((snippet) => {
return {
label: snippet.label,
kind: monaco.languages.CompletionItemKind.Snippet,
Expand Down

0 comments on commit de359bf

Please sign in to comment.