-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
feat: support javascript snippet files #219
Commits on Oct 21, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 44e2689 - Browse repository at this point
Copy the full SHA 44e2689View commit details -
feat(snippets): support javascript snippet files
parsing snippets now first involves attempting to import it as a javascript module, with the default export expected to be the snippets. this enables improved snippet config writing, and could supercede the need for the "variables" setting of the plugin. if importing fails, falls back to existing behavior of parsing as json5 string. security risk: dynamically imported user-provided files may execute malicious code; users should be validate snippet files others share.
Configuration menu - View commit details
-
Copy full SHA for 6a2546f - Browse repository at this point
Copy the full SHA 6a2546fView commit details -
feat(snippets): support regexp literal triggers in js; support regexp…
… flags in js snippets files, support passing in regexp literals as the trigger. also, generally support regexp flags for regexp snippets (i.e. regexp literals, or snippets with the `r` option). only the following flags are allowed: `i`, `m`, `s`, `u`, `v`. when a snippet with a regexp literal trigger also has flags defined, the flags get merged together.
Configuration menu - View commit details
-
Copy full SHA for 76991c4 - Browse repository at this point
Copy the full SHA 76991c4View commit details -
docs: add documentation on snippet file format,
flags
fielddescribe snippet file formats (js, json5); add documentation on added `flags` field; note validity of regex triggers in js snippet files.
Configuration menu - View commit details
-
Copy full SHA for b17a507 - Browse repository at this point
Copy the full SHA b17a507View commit details
Commits on Oct 22, 2023
-
fix(snippets): mark
ParsedSnippet
flags
as always definedpreviously, flags were marked as optional field. however, flags are always defined as a string, even if an empty one.
Configuration menu - View commit details
-
Copy full SHA for 22b76c7 - Browse repository at this point
Copy the full SHA 22b76c7View commit details -
refactor(snippets): improve snippet validation
add stricter validation checks, and improve validation check type signature
Configuration menu - View commit details
-
Copy full SHA for b489c16 - Browse repository at this point
Copy the full SHA b489c16View commit details -
refactor(snippets): always treat snippets file as js
removes the dependency on json5. if the snippets file isn't a js module with a default export, it now gets treated as a js array via an `export default ` prepended to it, as opposed to a json5 array. json5 is valid js so it should hopefully not break anything
Configuration menu - View commit details
-
Copy full SHA for 0b7703a - Browse repository at this point
Copy the full SHA 0b7703aView commit details -
docs: update snippets file format description; add security warning
update docs to not mention json5 since it's no longer used. add a warning on readme underneath snippet sharing, to warn about the dangers of running arbitrary javascript code.
Configuration menu - View commit details
-
Copy full SHA for fa604a8 - Browse repository at this point
Copy the full SHA fa604a8View commit details -
fix(snippets): properly handle regex literal flags
typo in code was using unmodified raw options string, so regex literal triggers did not result in `Option.regex` being marked.
Configuration menu - View commit details
-
Copy full SHA for 49e4418 - Browse repository at this point
Copy the full SHA 49e4418View commit details
Commits on Oct 30, 2023
-
feat: use
var(--text-accent)
for regex in snippet editorpreviously was a hardcoded color that was not very readable on dark bg
Configuration menu - View commit details
-
Copy full SHA for a3d24d5 - Browse repository at this point
Copy the full SHA a3d24d5View commit details -
Configuration menu - View commit details
-
Copy full SHA for d1172ad - Browse repository at this point
Copy the full SHA d1172adView commit details -
refactor: clean up
ParsedSnippet
constructorremove redundant uses of raw snippet, make state of values more explicit.
Configuration menu - View commit details
-
Copy full SHA for 54cb71e - Browse repository at this point
Copy the full SHA 54cb71eView commit details -
chore: make
RawSnippet
class an interface`RawSnippet` is never actually instantiated, and serves more so as an interface representing the expected shape of a parsed snippet. as such an interface is more appropriate than a `class` for it.
Configuration menu - View commit details
-
Copy full SHA for ab27c13 - Browse repository at this point
Copy the full SHA ab27c13View commit details -
Configuration menu - View commit details
-
Copy full SHA for f35dfd8 - Browse repository at this point
Copy the full SHA f35dfd8View commit details -
in `ParsedSnippet` constructor, variable was named `override` because it overrode certain fields of `raw` in construction of final parsed snippet. however, `parsed` no longer uses both `raw` and `override`, and so as such `override` more so represents the _resolved_ fields.
Configuration menu - View commit details
-
Copy full SHA for b65d6bf - Browse repository at this point
Copy the full SHA b65d6bfView commit details -
Configuration menu - View commit details
-
Copy full SHA for 57c011d - Browse repository at this point
Copy the full SHA 57c011dView commit details