Skip to content

Add some commonly used QL snippets#782

Merged
aeisenberg merged 1 commit intogithub:mainfrom
edoardopirovano:snippets
Mar 17, 2021
Merged

Add some commonly used QL snippets#782
aeisenberg merged 1 commit intogithub:mainfrom
edoardopirovano:snippets

Conversation

@edoardopirovano
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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://un5kwkaggy09p37krhzxzd8.julianrbryant.com/docs/editor/userdefinedsnippets#_choice

},
"From/Where/Select": {
"prefix": "from",
"body": ["from $1", "where $2", "select $3"],
Copy link
Copy Markdown
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
Copy Markdown
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 aeisenberg merged commit 10e86f1 into github:main Mar 17, 2021
@aeisenberg
Copy link
Copy Markdown
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
Copy Markdown
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.

4 participants