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

Add some commonly used QL snippets #782

Merged
merged 1 commit into from
Mar 17, 2021
Merged

Conversation

edoardopirovano
Copy link
Contributor

This PR addresses #392 by introducing some simple snippets for query metadata, classes, from/where/select statements, predicates, dataflow/taint tracking classes, and all the aggregates and quantifiers.

Copy link
Contributor

@aeisenberg aeisenberg left a comment

Choose a reason for hiding this comment

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

This looks nicely comprehensive. Thanks!

I think in general, any snippet placeholder that must be added should have a default value. If nothing else, this just signifies where a user can edit.

"/**",
" * @name $1",
" * @description $2",
" * @kind $3",
Copy link
Contributor

Choose a reason for hiding this comment

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

Either add a choice here, or separate this into multiple snippets, one for each metadata kind.

https://code.visualstudio.com/docs/editor/userdefinedsnippets#_choice

},
"From/Where/Select": {
"prefix": "from",
"body": ["from $1", "where $2", "select $3"],
Copy link
Contributor

Choose a reason for hiding this comment

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

I find it easier to read if there are default values for each replacement step.

Suggested change
"body": ["from $1", "where $2", "select $3"],
"body": ["from ${1:params}", "where ${2:clause}", "select ${2:args}"],

Copy link
Contributor

@aeisenberg aeisenberg left a comment

Choose a reason for hiding this comment

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

Nice work!

@aeisenberg aeisenberg enabled auto-merge (rebase) March 17, 2021 15:07
auto-merge was automatically disabled March 17, 2021 15:14

Rebase failed

@aeisenberg aeisenberg enabled auto-merge (rebase) March 17, 2021 15:34
@aeisenberg
Copy link
Contributor

@github/docs-content-dsp Is this the kind of thing that should go in the documentation?

@edoardopirovano edoardopirovano deleted the snippets branch March 19, 2021 18:29
@shati-patel
Copy link
Contributor

@github/docs-content-dsp Is this the kind of thing that should go in the documentation?

Looks exciting 😄 I've opened an internal docs issue where we can assess if/where we need to document this.

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.

3 participants