Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable space indent and conversion to tabs #5

Merged
merged 7 commits into from
Jan 19, 2022
Merged

Configurable space indent and conversion to tabs #5

merged 7 commits into from
Jan 19, 2022

Conversation

jwdeane
Copy link
Owner

@jwdeane jwdeane commented Jan 19, 2022

The output of a snippet body should print the \t character if tabs were used for indentation in the source snippet, however if the source input snippet uses space based indentation conversion is required.

Input

const req = async fetch($1)
// this is a single line comment
const res = await req.json()
const string = "badger" // inline comment test
for (const item of res) {
  if (item.name.includes(string)) {
    console.log(item.name)
  }
}
$0

Output

"snippet-name-goes-here": {
  "scope": "javascript, typescript",
  "prefix": "badger",
  "body": [
    "const req = async fetch($1)",
    "// this is a single line comment",
    "const res = await req.json()",
    "const string = \"badger\" // inline comment test",
    "for (const item of res) {",
    "\tif (item.name.includes(string)) {",
    "\t\tconsole.log(item.name)",
    "\t}",
    "}",
    "$0"
  ],
  "description": "snippet description goes here"
}

Now using a shortcode instead of a filter.

Fixed #4

@jwdeane jwdeane merged commit 818c4d6 into main Jan 19, 2022
@jwdeane jwdeane deleted the issue4 branch January 19, 2022 21:30
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.

Handle indentation
1 participant