Skip to content

Commit 3cd5f97

Browse files
author
Damian Sznajder
committed
fix: initial hooks for prettier, generated with standard
1 parent c212942 commit 3cd5f97

File tree

9 files changed

+2090
-209
lines changed

9 files changed

+2090
-209
lines changed

Diff for: docs/Snippets.md

+178-178
Large diffs are not rendered by default.

Diff for: package.json

+2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@
4040
},
4141
"activationEvents": [
4242
"onLanguage:typescript",
43+
"onLanguage:typescriptReact",
4344
"onLanguage:javascript",
45+
"onLanguage:javascriptReact",
4446
"onCommand:reactSnippets.search"
4547
],
4648
"contributes": {

Diff for: src/helpers/parseSnippetToBody.ts

+2-17
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,6 @@ import { formatSnippet } from './formatters';
33
import { Snippet } from './generateSnippets';
44
import replaceOrRemoveReactImport from './replaceOrRemoveReactImport';
55

6-
// This is array of prefixes which are currently skipped because of syntax format issues
7-
const skippedSnippets = [
8-
'pge',
9-
'pse',
10-
'gdsfp',
11-
'gsbu',
12-
'scu',
13-
'cwun',
14-
'cdm',
15-
'cdup',
16-
'rconst',
17-
];
18-
196
const withReactImport = [
207
'rfce',
218
'rfc',
@@ -46,11 +33,9 @@ const parseSnippetToBody = (snippet: Snippet) => {
4633
? replaceOrRemoveReactImport(snippet.body)
4734
: body;
4835

49-
const formattedSnippet = skippedSnippets.includes(snippet.prefix)
50-
? snippetBody
51-
: formatSnippet(snippetBody).split('\n');
36+
const formattedSnippet = formatSnippet(snippetBody).split('\n');
5237

53-
return snippet.body.length === 1 ? formattedSnippet[0] : formattedSnippet;
38+
return formattedSnippet;
5439
};
5540

5641
export default parseSnippetToBody;

Diff for: src/helpers/revertSnippetPlaceholders.ts

Whitespace-only changes.

Diff for: src/index.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,14 @@ const showRestartMessage = async ({
3030
}
3131
};
3232

33-
export async function activate(context: ExtensionContext) {
33+
export function activate(context: ExtensionContext) {
3434
workspace.onDidChangeConfiguration(showRestartMessage);
3535
const snippetSearchCommand = commands.registerCommand(
3636
'reactSnippets.search',
3737
snippetSearch,
3838
);
3939

4040
context.subscriptions.push(snippetSearchCommand);
41-
42-
await generateSnippets();
4341
}
4442

4543
export function deactivate() {}

0 commit comments

Comments
 (0)