Skip to content

fix: snippet tabbing, duplicates, and accuracy#104

Open
alexanderdombroski wants to merge 5 commits into
Digitalbrainstem:masterfrom
alexanderdombroski:ad/snippets-upgrade
Open

fix: snippet tabbing, duplicates, and accuracy#104
alexanderdombroski wants to merge 5 commits into
Digitalbrainstem:masterfrom
alexanderdombroski:ad/snippets-upgrade

Conversation

@alexanderdombroski
Copy link
Copy Markdown

@alexanderdombroski alexanderdombroski commented Aug 2, 2025

Fixes #105 and #87

Changes

  • Merged duplicate snippets into the same, having multiple prefixes.
  • Fixed '<%-' and '<%=' snippets having confusing descriptions
  • Spaces -> tabs for code-block creating snippets (ie 'if')
  • Added closing '}' to else statement, as you would never not need it.
  • Added snippet choice insertion feature to choose 'let' or 'const' in for..of loop.

Because I completely redid the file, I merged a couple related PR's before I made my changes: PR 58 & 100

Justin Chow and others added 5 commits July 1, 2020 00:40
- Merged duplicate snippets into the same, having multiple prefixes.
- Fixed '<%-' and '<%=' snippets having confusing descriptions
- Spaces -> tabs for code-block creating snippets (ie 'if')
- Added closing '}' to else statement, as you would never not need it.
- Added snippet choice insertion feature to choose 'let' or 'const' in for..of loop.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR consolidates and improves EJS snippets by removing duplicates, correcting descriptions, improving formatting, and adding new functionality. The changes address issues #105 and #87 related to snippet quality and usability.

Key Changes:

  • Consolidated duplicate snippets by combining them with multiple prefixes (e.g., both "ejs" and "<%" trigger the same snippet)
  • Changed final tab stops from $2 to $0 for better cursor positioning after snippet expansion
  • Replaced spaces with tabs for indentation in code-block snippets and added missing closing braces

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
snippets/snippets.json Merged duplicate snippets, fixed descriptions for output tags, standardized indentation to tabs, added for...of loop with const/let choice, and added closing brace to else statement
README.md Updated snippet documentation table to reflect new prefixes, clearer descriptions, and the new for...of loop snippet

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Comment thread snippets/snippets.json
Comment on lines +55 to +56
"ejsinc",
"<%"
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prefix "<%" for the EJS Include snippet conflicts with multiple other snippets that also use "<%" as a prefix (EJS No Output, EJS For Loop, EJS For...Of Loop, EJS ForEach, EJS If Statement, EJS Else If Statement, and EJS Else Statement). This will cause ambiguity when users type <% and trigger the autocomplete. Consider using a more specific prefix like "ejsinclude" or removing this generic prefix from snippets where the specific prefix (like "ejsinc") is more appropriate.

Suggested change
"ejsinc",
"<%"
"ejsinc"

Copilot uses AI. Check for mistakes.
Comment thread snippets/snippets.json
"<% } else { %>",
" $1"
"<% } else if (${1:condition}) { %>",
"\t$0"
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The else if snippet is missing a closing <% } %> tag, unlike the other conditional snippets. This creates an inconsistency: the else statement (lines 128-130) has the closing brace, but else if does not. An else if block should also close its opening {, similar to how the if statement does.

Suggested change
"\t$0"
"\t$0",
"<% } %>"

Copilot uses AI. Check for mistakes.
Comment thread README.md
| ---------- | --------- | -------------------------------------------------------- |
| `ejs→` | `<%` | `<% %>` – No output tag |
| `ejsesc→` | `<%=` | `<%= %>` – Output **escaped** value |
| `ejsraw→` | `<%-` | `<%- %>` – Output **raw/unescaped** value (injects HTML) |
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The snippet prefix listed here is ejsraw→, but there's also ejsunesc→ as a prefix in the actual snippet definition (snippets.json lines 24-25). The README should document both prefixes or clarify which one is the primary one. Currently, ejsunesc→ is missing from the documentation.

Suggested change
| `ejsraw→` | `<%-` | `<%- %>` – Output **raw/unescaped** value (injects HTML) |
| `ejsraw→` | `<%-` | `<%- %>` – Output **raw/unescaped** value (injects HTML) |
| `ejsunesc→`| `<%-` | `<%- %>` – Output **raw/unescaped** value (injects HTML) |

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

snippet file includes duplicate snippets

3 participants