-
Notifications
You must be signed in to change notification settings - Fork 218
Introduce command to set default Code Tour database #2027
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
Conversation
d38017a to
1fe410f
Compare
shati-patel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but then we paired on this, so I'm happy for another pair of eyes 😅 👀
|
[As discussed offline too] |
We have a codespace template which houses our CodeQL tour: https://github.com/github/codespaces-codeql This contains a repo with a default databases already loaded for the user so that they can start writing queries more quickly. At the moment we're asking the user to manually right click on the database folder ('codeql-tutorial-database') and set it as the current database. We can take this one step further by defining a command that gets triggered when we arrive at the step for setting up the database. The command ("codeQL.setDefaultTourDatabase") will build the URI pointing to our preloaded database and set it as the current one. We initially considered whether we can re-use the setCurrentDatabase command and pass the URI of the database from the codespace itself, but the URI would be hardcoded as: ``` file://0-62/workspaces/codespaces-codeql/codeql-tutorial-database ``` as we can only pass the codeTour extension a command and string parameters. This would have been brittle as the filepath for a codespace might change in the future. Instead we can define a custom tour command ("setDefaultTourDatabase") to look at the current workspace folder and build the path to the database in the CodeQL extension. Co-authored-by: Shati Patel <shati-patel@github.com>
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
6eaad25 to
99d794c
Compare
shati-patel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All comments addressed, thanks!
Makes this possible: github/codespaces-codeql#4
We have a codespace template which houses our CodeQL tour: https://github.com/github/codespaces-codeql
This contains a repo with a default databases already loaded for the user so that they can start writing queries more quickly.
At the moment we're asking the user to manually right click on the database folder (
codeql-tutorial-database) and set it as the current database.We can take this one step further by defining a command that gets triggered when we arrive at the step for setting up the database.
The command (
codeQL.setDefaultTourDatabase) will build the URI pointing to our preloaded database and set it as the current one.We initially considered whether we can re-use the
setCurrentDatabasecommand and pass the URI of the database from the codespace itself, but the URI would be hardcoded as:as we can only pass the codeTour extension a command and string parameters.
This would have been brittle as the filepath for a codespace might change in the future.
Instead we can define a custom tour command (
setDefaultTourDatabase) to look at the current workspace folder and build the path to the database in the CodeQL extension.We've made the command publicly visible so that we can execute it from our code tour.
Checklist
ready-for-doc-reviewlabel there.