Compare commits

...

2314 Commits

Author SHA1 Message Date
Charis Kyriakou
5375fcb26a v1.9.3 (#3022)
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
2023-10-26 11:11:17 +01:00
Koen Vlaswinkel
ff36088ecc Merge pull request #3012 from github/koesie10/use-selected-queries-item
Create new queries in selected folder of queries panel
2023-10-26 11:55:42 +02:00
Charis Kyriakou
234498a33e Enable multiple models feature (#3019) 2023-10-26 09:13:25 +00:00
Koen Vlaswinkel
40a77dfd4a Merge pull request #3018 from github/koesie10/fix-empty-location
Fix empty message with empty SARIF path
2023-10-26 11:04:45 +02:00
Koen Vlaswinkel
06b6595980 Update CHANGELOG 2023-10-26 10:42:11 +02:00
Shati Patel
9a97b7b0be Deselect current db when the language context changes (#3007) 2023-10-25 14:54:01 +01:00
Koen Vlaswinkel
6622d5e114 Fix empty message with empty SARIF path 2023-10-25 14:55:15 +02:00
Koen Vlaswinkel
f0f5538b51 Remove check for isFolderAlreadyInWorkspace 2023-10-25 14:37:11 +02:00
Nora
3f8302796f Merge pull request #3010 from github/nora/modeling-flow-testplan
Add method modeling flow to test plan
2023-10-25 14:28:59 +02:00
Koen Vlaswinkel
a3fad49577 Fix creation of nested query packs
Before, if you had selected a folder or file within for example
`codeql-custom-queries-java` and selected `java` as the language, it
would create a nested folder within `codeql-custom-queries-java` with
the name `codeql-custom-queries-java`. This is unexpected for the user,
who would expect a new query to be created within
`codeql-custom-queries-java`. This fixes that by checking for this
specific condition. It does not fix it for all scenarios, such as where
the selected file/folder is nested multiple levels deep within the
`codeql-custom-queries-java` folder.
2023-10-25 14:28:50 +02:00
Koen Vlaswinkel
68ab2fda2d Create new queries in selected folder of queries panel
This will change the behavior of the "Create new query" command to
create the new query in the same folder as the first selected item in
the queries panel. If no items are selected, the behavior is the same
as before.

I've used events to communicate the selection from the queries panel to
the local queries module. This is some more code and some extra
complexity, but it ensures that we don't have a dependency from the
local queries module to the queries panel module. This makes testing
easier.
2023-10-25 14:28:48 +02:00
Koen Vlaswinkel
fb33879a95 Merge pull request #3015 from github/koesie10/reveal-file-in-queries-panel
Reveal opened files in queries panel
2023-10-25 13:58:08 +02:00
Nora
0e5306742d Move test cases to optional and polish 2023-10-25 08:57:34 +00:00
Koen Vlaswinkel
3a07fa9e39 Show initially open file in queries panel 2023-10-25 10:13:48 +02:00
Koen Vlaswinkel
b6f7755908 Create subscribeToTreeSelectionEvents method 2023-10-25 10:06:14 +02:00
Koen Vlaswinkel
368f9c38ef Only change selection when tree view is visible 2023-10-25 10:04:31 +02:00
Koen Vlaswinkel
1e58e5a723 Reveal opened file in queries panel 2023-10-25 10:04:31 +02:00
Robert
2ebccd532f Merge pull request #3014 from github/robertbrignull/hidden_methods
Use the same logic for hiding methods in model editor and usages panel
2023-10-25 09:04:06 +01:00
Robert
231dcc0c55 Improve tests to cover showing supported modeled methods 2023-10-24 16:49:21 +01:00
Robert
675e2ec9f2 Use the same condition for hiding methods in model editor and usages panel 2023-10-24 16:34:39 +01:00
Shati Patel
f0f13f3569 Create query: open new query in editor before downloading DB (#3009) 2023-10-24 13:30:01 +00:00
Robert
8d336930c8 Merge pull request #3008 from github/robertbrignull/modeled_row_styling
Fix styling of "already modeled" rows when showing multiple methods
2023-10-24 14:13:18 +01:00
Koen Vlaswinkel
043cdab297 Merge pull request #3013 from github/koesie10/use-selected-language
Use selected language when creating query
2023-10-24 15:02:05 +02:00
Charis Kyriakou
b1172d7d64 Activate method modeling panel when model editor is opened (#3011) 2023-10-24 12:55:19 +01:00
Koen Vlaswinkel
8b5329fe08 Use selected language when creating query
This will change the "Create new query" command to use the selected
language when creating a new query. If no language is selected, it will
still prompt the user to pick a language.
2023-10-24 13:41:37 +02:00
Nora
7bade3e382 Include model panels in mandatory tests 2023-10-24 10:03:54 +00:00
Robert
eb42beee23 Move method classifications to start 2023-10-24 10:12:05 +01:00
Robert
2405628bcc Fix span size 2023-10-24 10:11:50 +01:00
Robert
0a75a0e835 Merge pull request #2983 from github/robertbrignull/remove_selected_model
Handle when the number of modeled methods decreases
2023-10-23 14:34:17 +01:00
Robert
07a4ffb306 Add tests that pagination is updated when a model is removed 2023-10-23 13:50:29 +01:00
Robert
1424afc7a4 Add tests that pagination is updated when add a new model 2023-10-23 13:46:10 +01:00
Koen Vlaswinkel
c62c054b95 Merge pull request #3001 from github/koesie10/validation-errors-focus
Add higlight on modeled method row when clicking in validation error
2023-10-23 13:17:59 +02:00
Koen Vlaswinkel
41aeb47a4e Merge pull request #3004 from github/koesie10/redactable-error-stack
Show stack for redactable error in log
2023-10-23 12:04:08 +02:00
Koen Vlaswinkel
4ca14f89df Revert "Use os.EOL for separating stack in error"
This reverts commit b33b5bb7c4.

The errors module is also imported in the webview, so we can't actually
use it.
2023-10-23 11:43:15 +02:00
Koen Vlaswinkel
8011481de2 Merge pull request #2996 from github/koesie10/query-save-dir
Fix results directory and evaluator log for cancelled queries
2023-10-23 10:45:41 +02:00
Koen Vlaswinkel
d682c520d5 Add tests for fullMessageWithStack 2023-10-23 10:44:25 +02:00
Koen Vlaswinkel
b33b5bb7c4 Use os.EOL for separating stack in error 2023-10-23 10:37:10 +02:00
Charis Kyriakou
1ab198fe49 Move modeling events to new ModelingEvents class (#3005) 2023-10-23 08:57:48 +01:00
Koen Vlaswinkel
48df8de2c2 Merge pull request #3003 from github/koesie10/fix-error-no-workspace-folders
Show error message for no workspace folders with model editor
2023-10-20 17:31:37 +02:00
Koen Vlaswinkel
78f832a73f Show stack for redactable error in log
When calling for example `showAndLogExceptionWithTelemetry`, the stack
trace would be sent to Application Insights, but there was no way to
see the stack trace from within VS Code. This will add the stack trace
to the log by returning it from `fullMessageWithStack` and using it in
the appropriate places.
2023-10-20 16:49:36 +02:00
Koen Vlaswinkel
8c594239cd Merge pull request #3002 from github/koesie10/jsx-key-rule
Enable `react/jsx-key` for fragment shorthands
2023-10-20 16:44:37 +02:00
Koen Vlaswinkel
89ccd70752 Show error message for no workspace folders with model editor
It is possible to open the model editor without opening a folder, but
this gave an unhelpful error message. This commit adds a more helpful
error message.
2023-10-20 16:43:58 +02:00
Koen Vlaswinkel
c928b1eb86 Enable react/jsx-key for fragment shorthands 2023-10-20 16:03:30 +02:00
Koen Vlaswinkel
faffe4590b Add focus on modeled method row on error click 2023-10-20 11:20:14 +02:00
Koen Vlaswinkel
91f6772ab9 Add interaction to MethodRow stories 2023-10-20 10:38:44 +02:00
Dave Bartolomeo
d20cf92eea Merge pull request #3000 from github/github-action/bump-cli
Bump CLI Version to v2.15.1 for integration tests
2023-10-19 13:57:08 -04:00
dependabot[bot]
1f34330052 Bump lint-staged from 14.0.0 to 15.0.2 in /extensions/ql-vscode (#2999)
Bumps [lint-staged](https://github.com/okonet/lint-staged) from 14.0.0 to 15.0.2.
- [Release notes](https://github.com/okonet/lint-staged/releases)
- [Changelog](https://github.com/lint-staged/lint-staged/blob/master/CHANGELOG.md)
- [Commits](https://github.com/okonet/lint-staged/compare/v14.0.0...v15.0.2)

---
updated-dependencies:
- dependency-name: lint-staged
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-19 10:39:57 -07:00
Robert
acb687cee7 Merge pull request #2997 from github/robertbrignull/model-table-validation
Show validation results in the model editor
2023-10-19 16:55:54 +01:00
github-actions[bot]
221b4392d3 Bump CLI version from v2.15.0 to v2.15.1 for integration tests 2023-10-19 15:44:43 +00:00
Robert
31d654d33d Add tests of showing validation errors 2023-10-19 16:26:08 +01:00
Robert
553435d5b7 Add stories for validation errors in MethodRow 2023-10-19 16:14:41 +01:00
Robert
0af77d086a Display validation errors in model editor 2023-10-19 12:52:45 +01:00
Robert
c69a310110 Add <> around inputs 2023-10-19 12:52:18 +01:00
Robert
1606829ceb Make setSelectedIndex optional 2023-10-19 12:47:50 +01:00
Robert
86b50560a4 Merge pull request #2995 from github/robertbrignull/model-table-multirow
Use one grid cell per model input, and have the method name span multiple rows
2023-10-19 12:40:03 +01:00
Robert
50f77e7918 Use Fragment to add key to map output 2023-10-19 10:53:06 +01:00
Robert
947f495d0b Merge pull request #2990 from github/robertbrignull/model-table-alignment
Use custom grid element instead of VSCodeDataGrid
2023-10-19 09:57:26 +01:00
Koen Vlaswinkel
18646ab637 Update CHANGELOG 2023-10-19 10:04:08 +02:00
Koen Vlaswinkel
046bc13fc3 Try generating evaluation log summary after failed query
When a local query fails (for example, if it is cancelled), it may still
have an evaluation log. We weren't generating evaluation log summaries
in these cases, so the options to view the summary text and to use the
evaluation log viewer would not be available. This fixes it by also
trying to generate the summary in the case of a failed query.
2023-10-19 10:04:08 +02:00
Koen Vlaswinkel
226274cb4e Fix showing of raw evaluator log for cancelled items
This will ensure that when "Show Evaluator Log (Raw JSON)" is used on a
cancelled query history item, we will still show it if it exists. This
changes the error messages on other cases to be more specific.
2023-10-19 10:04:08 +02:00
Koen Vlaswinkel
9928c338e9 Store query output dir on history items
This will add the `QueryOutputDir` to the `InitialQueryInfo` and
populate it when creating a local query history item. This will allow us
to open the results directory or show the evaluator log without a
completed query.
2023-10-19 10:04:08 +02:00
Andrew Eisenberg
df55e039a1 Merge pull request #2984 from github/aeisenberg/fix-log-path 2023-10-18 15:36:10 -07:00
Andrew Eisenberg
2e2051af6d Merge branch 'main' into aeisenberg/fix-log-path 2023-10-18 15:04:12 -07:00
Andrew Eisenberg
4ad3d962ec Add change note
Also, avoid a code scanning warning.
2023-10-18 15:03:16 -07:00
Robert
ec0e74bd9a Merge pull request #2992 from github/robertbrignull/columnCount
Add $ to columnCount prop used by styled component
2023-10-18 18:29:02 +01:00
dependabot[bot]
8a1da313ae Bump @babel/traverse from 7.22.8 to 7.23.2 in /extensions/ql-vscode (#2994)
Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.22.8 to 7.23.2.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse)

---
updated-dependencies:
- dependency-name: "@babel/traverse"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-18 16:50:14 +01:00
Robert
c88ecf76aa Add documentation to all DataGrid components 2023-10-18 16:42:50 +01:00
Robert
93de35e7a3 Rename HiddenMethodsText => HiddenMethodsCell 2023-10-18 16:30:30 +01:00
Robert
8c339d07e8 Pass rowType to styled component instead of using another class name 2023-10-18 16:29:48 +01:00
Robert
cead0ea52e Import ReactNode 2023-10-18 16:26:37 +01:00
Robert
db67d93f83 Extract DataGridRow props in params 2023-10-18 16:24:34 +01:00
Robert
a79867732c Make gridTemplateColumns just a string 2023-10-18 16:21:04 +01:00
Robert
09a8d29ea5 Use one grid cell per input 2023-10-18 15:17:07 +01:00
Shati Patel
a2f85877a8 Add option to sort DB panel by language (#2993) 2023-10-18 14:58:39 +01:00
Robert
c528a389e5 Use forwardRef for DataGridRow 2023-10-18 14:41:26 +01:00
Robert
48f719fa9d Pass through data-testid explicitly 2023-10-18 14:35:49 +01:00
Robert
cac9efa41b Introduce wrapper component for DataGridRow 2023-10-18 14:20:19 +01:00
Robert
56d0f28814 Add styling for header rows 2023-10-18 14:20:16 +01:00
Robert
298656444f Make gridRow and gridColumn optional 2023-10-18 14:10:16 +01:00
Koen Vlaswinkel
30b51d98c8 Merge pull request #2988 from github/koesie10/error-default-branch
Add custom error handler for missing default branch
2023-10-18 14:12:03 +02:00
Robert
6c2718927e Adjust styling to not use --design-unit 2023-10-18 13:02:34 +01:00
Robert
579042cf84 Extract props in parameters instead of as statement 2023-10-18 12:22:06 +01:00
Robert
2c70c0b792 Remove unnecessary aria label 2023-10-18 12:15:17 +01:00
Robert
ec64b59b96 Pass className through DataGridCell 2023-10-18 12:07:10 +01:00
Robert
f886cd0dc8 Add $ to props used by styled component 2023-10-18 11:52:01 +01:00
Robert
20469b0da4 Merge branch 'main' into robertbrignull/remove_selected_model 2023-10-18 11:43:12 +01:00
Robert
26fcef8f5d Introduce selectNewMethod ref 2023-10-18 11:43:05 +01:00
Charis Kyriakou
96fb0046c5 Style update to in-progress drop-down (#2986) 2023-10-18 08:45:49 +01:00
Koen Vlaswinkel
903b272952 Merge pull request #2989 from github/koesie10/usage-panel-tree-items-reference
Keep reference to original items in usage data provider
2023-10-18 09:23:30 +02:00
Robert
54db867d15 Use custom grid element instead of VSCodeDataGrid 2023-10-17 17:38:06 +01:00
Koen Vlaswinkel
a852f16eb1 Keep reference to original items in usage data provider
This changes the usage data provider tree items to keep a reference to
the method and usage instead of only including their properties in the
tree item. This makes it easier to find the original method and usage
when revealing an item in the tree. It also removes the `getParent` call
in `getTreeItem`.

The main reason for this fix is to ensure
`codeQLModelEditor.jumpToMethod` gets the correct `usage` argument.
It received the tree item before, but now we can actually pass the
usage that was clicked on.
2023-10-17 16:03:57 +02:00
Koen Vlaswinkel
a7f8019bf4 Merge pull request #2987 from github/koesie10/source-map-fix
Fix decoding source map with VS Code internal files
2023-10-17 15:40:38 +02:00
Koen Vlaswinkel
2d5caa77bc Remove unnecessary casting 2023-10-17 15:19:04 +02:00
Koen Vlaswinkel
82c2952059 Add custom error handler for missing default branch
When the GitHub API returns an error for a missing default branch, we
will now show a custom error message. This custom error message includes
a link to the page to create the branch. The error is detected using the
`errors` field on the response that is now being returned.
2023-10-17 14:57:19 +02:00
Koen Vlaswinkel
67f6f8f160 Fix decoding source map with VS Code internal files
This makes it possible to decode source maps containing references to
code that is not part of the extension. If it finds any such references,
it will simply not decode the source map and use the original stack
trace instead.
2023-10-17 13:34:11 +02:00
Charis Kyriakou
abde8f3fae Make automodel batch size configurable (#2985) 2023-10-17 12:07:30 +01:00
Robert
8d5574e468 Merge pull request #2982 from github/robertbrignull/add-remove-models
Implement onClick for the add/remove model buttons in the model editor
2023-10-17 10:29:16 +01:00
Andrew Eisenberg
cc0e850c72 Ensure the logFileLocation is set
`logFileLocation` was not set after a query finishes running. I don't
know when this bug was introduced. I think it goes as far back as
the refactor to remove the old query server.
2023-10-16 16:44:49 -07:00
Robert
46e7dda6a6 Don't bother using slice when creating handlers 2023-10-16 16:29:36 +01:00
Robert
d937934737 Use the onChange handler in tests 2023-10-16 16:27:23 +01:00
Robert
96c0feb3e6 Handle when the number of modeled methods decreases 2023-10-16 16:00:49 +01:00
Robert
0ff523a64b Add tests for for the add/remove model buttons 2023-10-16 15:36:46 +01:00
Robert
1d0a1f56b1 Implment onClick handlers for add/remove model buttons 2023-10-16 15:07:44 +01:00
Koen Vlaswinkel
fca68edbb3 Merge pull request #2969 from github/koesie10/fix-unmodeled-unsaved
Fix unmodeled methods always being marked as unsaved
2023-10-16 15:07:18 +02:00
Charis Kyriakou
b9279dc64f Simplify modeling in progress state (#2980) 2023-10-16 12:54:13 +00:00
Koen Vlaswinkel
00b6ccdfe0 Simplify condition in useEffect 2023-10-16 13:53:53 +02:00
Koen Vlaswinkel
688b9863da Merge pull request #2981 from github/koesie10/fix-failing-test
Fix failing test
2023-10-16 13:47:01 +02:00
Koen Vlaswinkel
c80641866c Fix failing test 2023-10-16 13:25:35 +02:00
Koen Vlaswinkel
6a7ce9f4d2 Merge pull request #2976 from github/koesie10/methods-usage-panel-parent
Introduce separate tree item types in the methods usage panel
2023-10-16 13:25:05 +02:00
Koen Vlaswinkel
d0e0237b9e Merge pull request #2965 from github/koesie10/modeled-method-validation-neutral
Fix neutral model validation to consider kind
2023-10-16 13:23:26 +02:00
Anders Starcke Henriksen
e57f04e6b1 Merge pull request #2975 from github/starcke/remove-old-language-filter
Remove old language context filter.
2023-10-16 13:06:40 +02:00
Charis Kyriakou
b87dfa4471 Show in-progress state in method modeling panel (#2979) 2023-10-16 11:47:31 +01:00
Robert
b1a4586791 Merge pull request #2977 from github/robertbrignull/fix_jump_to_usage
Revert changes to codeQLModelEditor.jumpToMethod to allow jumping to usages other than the first usage
2023-10-16 11:21:18 +01:00
Robert
aa8896e553 Merge pull request #2964 from github/robertbrignull/enable-add-multiple-models
Enable/disable the add/remove model buttons at the right times
2023-10-16 11:04:06 +01:00
Robert
9134e0e917 Add comment explaining caveats of setSelectedMethod 2023-10-16 11:03:19 +01:00
Robert
1259a3e61d Use 'import type' in commands.ts 2023-10-16 10:59:12 +01:00
Robert
7aa0fe32c2 Revert changes to codeQLModelEditor.jumpToMethod 2023-10-16 10:42:18 +01:00
Anders Starcke Henriksen
cc2eec78bd Merge branch 'main' into starcke/remove-old-language-filter 2023-10-16 11:27:56 +02:00
Koen Vlaswinkel
d715ceea10 Introduce separate tree item types in the methods usage panel
This creates new tree item types for methods and usages such that these
can contain references to their parent and children. This allows us to
easily find the parent of a usage and to find the children of a method.
This removes an expensive `find` call in `getParent`.
2023-10-16 11:18:27 +02:00
Anders Starcke Henriksen
8b3786c621 Remove old language context filter. 2023-10-16 10:30:26 +02:00
Koen Vlaswinkel
39a9f4ce1e Merge pull request #2974 from github/koesie10/changelog-install-workspace-packs
Add CHANGELOG entry for #2960
2023-10-16 10:09:48 +02:00
Koen Vlaswinkel
b2de9e94cd Add CHANGELOG entry for #2960 2023-10-16 09:53:22 +02:00
Charis Kyriakou
23dc8f16c3 Move in-progress methods state to modeling store (#2971) 2023-10-16 08:51:46 +01:00
Koen Vlaswinkel
d78a4d19eb Merge pull request #2960 from github/koesie10/install-workspace-packs
Do not show non-workspace packs when installing pack dependencies
2023-10-16 09:51:29 +02:00
Anders Starcke Henriksen
3cbaa5aa24 Merge pull request #2935 from github/starcke/language-selection-panel
Add language filter panel.
2023-10-16 09:42:35 +02:00
Anders Starcke Henriksen
e8e6c6bbc7 Update comment. 2023-10-13 16:28:14 +02:00
Anders Starcke Henriksen
d5388576b5 Apply suggestions from code review
Co-authored-by: Koen Vlaswinkel <koesie10@users.noreply.github.com>
2023-10-13 16:00:17 +02:00
Charis Kyriakou
a5139b7fbf Convert InProgressMethods to an interface (#2970) 2023-10-13 14:56:33 +01:00
Nora Dimitrijević
f5f5b398fe Merge pull request #2928 from github/d10c/trim-cache-command
Add "CodeQL: Trim Cache" command that calls `evaluation/trimCache`
2023-10-13 15:12:55 +02:00
Koen Vlaswinkel
7baad1a5c6 Fix unmodeled methods always being marked as unsaved
When opening a library group in the model editor, unmodeled methods
would always be marked as unsaved, even if there were no changes. This
was because the `ModelKindDropdown` component did not properly take into
account that the `kind` for an unmodeled method should be an empty
string. It would always try setting it to `undefined`, which would cause
the method to be marked as unsaved. This fixes it by checking if there
are valid kinds before setting the kind to the first one.
2023-10-13 13:21:53 +02:00
Koen Vlaswinkel
5e8de88ee0 Merge pull request #2968 from github/koesie10/readonly-modeling-store
Improve immutability of modeling store state
2023-10-13 13:13:27 +02:00
Koen Vlaswinkel
6801a64148 Improve immutability of modeling store state
This improves the immutability of the modeling store state by using
TypeScript's readonly types to ensure that state can only be modified
from within the modeling store or when it's copied. This mostly consists
of adding `readonly` to properties and arrays, but this also adds a
`DeepReadonly` type to use in `postMessage` arguments to ensure that
readonly objects can be passed in. `postMessage` will never modify the
objects, so this is safe.
2023-10-13 11:20:54 +02:00
Nora
ee630b4a87 Merge pull request #2963 from github/nora/cancel-code-search
Improve code search cancelling
2023-10-13 10:23:02 +02:00
Anders Starcke Henriksen
a03e2c85f1 Address comments. 2023-10-13 10:03:34 +02:00
Koen Vlaswinkel
288f44e57d Merge remote-tracking branch 'origin/main' into koesie10/modeled-method-validation-neutral 2023-10-13 10:01:34 +02:00
Anders Starcke Henriksen
52d32a5051 Merge branch 'main' into starcke/language-selection-panel 2023-10-13 09:52:17 +02:00
Koen Vlaswinkel
fa9cc7c5f9 Merge pull request #2967 from github/koesie10/fix-multiple-models-method-panel-spec
Fix incorrect test for `MultipleModeledMethodsPanel`
2023-10-13 09:51:32 +02:00
Anders Starcke Henriksen
cc3feabe66 Apply suggestions from code review
Co-authored-by: Koen Vlaswinkel <koesie10@users.noreply.github.com>
2023-10-13 09:48:28 +02:00
Koen Vlaswinkel
1dbd5aa86e Fix test with non-conflicting neutral 2023-10-13 09:47:00 +02:00
Koen Vlaswinkel
19c30f1ee2 Fix incorrect test for MultipleModeledMethodsPanel
This was caused by a semantic merge conflict resulting in the wrong
`onChange` argument being used in the test.
2023-10-13 09:33:55 +02:00
Koen Vlaswinkel
3c505719f2 Merge pull request #2957 from github/koesie10/modeled-methods-panel-multiple-save
Use `SetMultipleModeledMethodsMessage` in modeled methods panel
2023-10-13 09:26:44 +02:00
Nora Dimitrijević
b097804ad7 Make the command conditional on a supported CLI version 2023-10-12 16:15:49 +00:00
Nora Dimitrijević
8b918bdb19 Add CHANGELOG.md entry 2023-10-12 16:15:49 +00:00
Nora Dimitrijević
d0f4188f3f Add "VSCode: Trim Cache" command that calls evaluation/trimCache
The purpose of this change is to add a command that clears the cache except for predicates marked `cached`.
In contrast, the existing "VSCode: Clear Cache" command clears everything (`--mode=brutal`).

This calls into the query server's `evaluation/trimCache` method;
however, its existing behaviour is to do a database cleanup with `--mode=gentle`.
This is not well documented, and `--mode=normal` would give the desired behaviour.

Accordingly, this approach is dependent on separately changing the backend behaviour to `--mode=normal`.

Other possible amendments to this commit would be to not touch the legacy client
(replacing required methods by failing promises, since the legacy server is fully deprecated already),
or to have less duplication (by introducing more arguments — however,
I'm applying the rule of thumb that >3 copy-pastes are required for the introduction of a deduplicating abstraction).
2023-10-12 16:15:49 +00:00
Robert
bf828bccb6 Correctly test when buttons are disabled 2023-10-12 17:10:25 +01:00
Robert
48732a817a Update test names 2023-10-12 16:59:04 +01:00
Koen Vlaswinkel
4ac21232cf Fix neutral model validation to consider kind
This fixes a bug where the validation of modeled methods would not
consider the kind of the modeled method, and would therefore give an
error when there was e.g. a neutral sink and a non-neutral summary.
2023-10-12 16:41:28 +02:00
Robert
fc9588a1ec Add tests for buttons 2023-10-12 15:31:35 +01:00
Robert
08522f9ae2 Enable/disable the add/remove model buttons in model editor 2023-10-12 15:31:34 +01:00
Robert
e50affeb56 Introduce shared methods for canAdd / canRemoveModeledMethod 2023-10-12 15:31:32 +01:00
Nora
43bc92e386 throw when cancelling 2023-10-12 13:52:56 +00:00
Kasper Svendsen
8ecc31fae7 Merge pull request #2955 from github/kaspersv/hash-result-set-in-bqrs-filename
Hash result set name in sorted result set path
2023-10-12 14:17:47 +02:00
Koen Vlaswinkel
d15c57ee29 Merge pull request #2961 from github/koesie10/storybook-a11y
Add @storybook/addon-a11y package
2023-10-12 14:08:40 +02:00
Nora
f4f799894e Merge pull request #2815 from github/nora/remove-unused-activation-events
Remove unnecessary `activationEvents` from extension's package.json
2023-10-12 14:03:43 +02:00
Kasper Svendsen
ee5b738e00 Hash result set name in sorted result set path 2023-10-12 13:58:55 +02:00
Koen Vlaswinkel
25ba9e436b Merge branch 'main' into koesie10/install-workspace-packs 2023-10-12 13:48:19 +02:00
Koen Vlaswinkel
b72e0352c4 Merge branch 'main' into koesie10/storybook-a11y 2023-10-12 13:48:17 +02:00
Robert
95f43b7d8c Merge pull request #2953 from github/robertbrignull/add-multiple-models
Add add/remove buttons for models
2023-10-12 12:47:46 +01:00
Nora
95dfb6e820 Remove onLanguage event 2023-10-12 11:44:41 +00:00
Koen Vlaswinkel
00a5717d78 Merge pull request #2962 from github/koesie10/use-memo
Add missing useMemo import
2023-10-12 13:33:41 +02:00
Koen Vlaswinkel
ea8e5c6cc2 Add missing useMemo import 2023-10-12 13:13:53 +02:00
Koen Vlaswinkel
26b4b98cbc Merge pull request #2959 from github/koesie10/modeled-methods-panel-add-button
Only disable add button when there are no models yet
2023-10-12 13:08:28 +02:00
Koen Vlaswinkel
7e3cb7541c Merge pull request #2936 from github/koesie10/method-modeling-panel-validation
Add model validation in method modeling panel
2023-10-12 13:08:17 +02:00
Robert
77dd376f92 Add content to table header for screen readers 2023-10-12 11:18:41 +01:00
Nora
f53ecde0a9 Remove events 2023-10-12 10:00:14 +00:00
Koen Vlaswinkel
56697a9c2f Add storybook/addon-a11y package 2023-10-12 11:52:47 +02:00
Koen Vlaswinkel
a2a7002263 Do not show non-workspace packs when installing pack dependencies
When using the "CodeQL: Install pack dependencies" command, we would
show packs that are located in the package cache or distribution. Since
there are no dependencies to install for these packs, these options are
not useful.

This will filter out any packs that are not in the workspace folders
when showing the quick pick. This should exclude most packs if you are
in a workspace without the `codeql` submodule and should be a lot more
intuitive in those cases. If you are in a workspace with the `codeql`
submodule, it will still show all the packs.
2023-10-12 11:39:29 +02:00
Robert
369258dc95 Add add/remove buttons for models 2023-10-12 10:32:40 +01:00
Anders Starcke Henriksen
ac4ccf4c65 Merge pull request #2958 from github/version/bump-to-v1.9.3
Bump version to v1.9.3
2023-10-12 11:26:03 +02:00
Koen Vlaswinkel
2453c64f51 Only disable add button when there are no models yet
This will change the add button in the method modeling panel to only be
disabled if there is exactly 1 unmodeled method and there are no
unmodeled methods. This should be more intuitive for users since they
are able to see in 1 screen that there is an unmodeled method.
2023-10-12 11:06:52 +02:00
github-actions[bot]
23927ec0f1 Bump version to v1.9.3 2023-10-12 08:59:04 +00:00
Koen Vlaswinkel
095f5aecc3 Use SetMultipleModeledMethodsMessage in modeled methods panel 2023-10-12 10:36:43 +02:00
Robert
1993db5122 Merge pull request #2952 from github/robertbrignull/save_multiple_modeled_methods
Implement editing / saving multiple modeled methods from the model editor
2023-10-12 09:19:16 +01:00
Anders Starcke Henriksen
53df2bcd87 Merge pull request #2956 from github/v1.9.2
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
Release v1.9.2
2023-10-12 10:18:15 +02:00
Koen Vlaswinkel
bcceae4f51 Add test for adding neutral classification 2023-10-12 10:06:27 +02:00
Koen Vlaswinkel
b6eb383696 Merge remote-tracking branch 'origin/main' into koesie10/method-modeling-panel-validation 2023-10-12 10:02:19 +02:00
Koen Vlaswinkel
0835b140e7 Merge pull request #2948 from github/koesie10/sort-usages-panel
Sort methods in usages panel according to model editor sort order
2023-10-12 09:55:00 +02:00
Anders Starcke Henriksen
0e62d2635c v1.9.2 2023-10-12 09:50:13 +02:00
Koen Vlaswinkel
52e3a71f9c Define order of JSON.stringify operation 2023-10-12 09:49:24 +02:00
Koen Vlaswinkel
cce5a989cf Clarify Alert ARIA documentation 2023-10-12 09:41:47 +02:00
Koen Vlaswinkel
78284cbc7a Merge remote-tracking branch 'origin/main' into koesie10/sort-usages-panel 2023-10-12 09:39:11 +02:00
Koen Vlaswinkel
0d7002273a Merge pull request #2949 from github/koesie10/single-model-editor-per-db
Only allow a single model editor per database
2023-10-12 09:37:56 +02:00
Charis Kyriakou
7041dd7698 Rename 'open database' button and only show if source available (#2945) 2023-10-12 08:09:05 +01:00
Robert
539ce245fc Add more tests covering MethodRow 2023-10-11 16:29:59 +01:00
Koen Vlaswinkel
a3d41a2afe Merge pull request #2924 from github/koesie10/modeling-panel-multiple-models-add-remove
Add ability to add/remove modelings to method modeling panel
2023-10-11 16:20:39 +02:00
Robert
b881a38703 Fix expected value in tests 2023-10-11 15:03:11 +01:00
Koen Vlaswinkel
0cbdadb271 Add newline for readability
Co-authored-by: Robert <robertbrignull@github.com>
2023-10-11 15:59:56 +02:00
Robert
6db59a84a2 Use 'type: "none"' instead of undefined 2023-10-11 14:12:58 +01:00
Robert
eaf81efd64 Extract nested ternary to method 2023-10-11 14:12:10 +01:00
Henry Mercer
5105187dbd Merge pull request #2951 from github/github-action/bump-cli
Bump CLI Version to v2.15.0 for integration tests
2023-10-11 14:03:49 +01:00
Robert
9da3dc9a25 Allow editing multiple models in model editor 2023-10-11 13:41:45 +01:00
Robert
c7451fc4c2 Remove need for forEachModeledMethod method 2023-10-11 13:41:42 +01:00
Koen Vlaswinkel
918362f39e Merge pull request #2950 from github/koesie10/variant-analysis-save-before-start
Use `saveBeforeStart` setting when running a variant analysis
2023-10-11 14:34:08 +02:00
github-actions[bot]
0b5d2d86cf Bump CLI version from v2.14.6 to v2.15.0 for integration tests 2023-10-11 12:30:29 +00:00
Koen Vlaswinkel
3a035708c5 Merge pull request #2947 from github/koesie10/update-set-selected-method-message
Convert `SetSelectedMethodMessage` to include multiple modeled methods
2023-10-11 13:59:48 +02:00
Koen Vlaswinkel
84211c63bb Merge remote-tracking branch 'origin/main' into koesie10/update-set-selected-method-message 2023-10-11 13:40:27 +02:00
Koen Vlaswinkel
11218522e7 Update CHANGELOG 2023-10-11 13:35:11 +02:00
Koen Vlaswinkel
0bdd441767 Use saveBeforeStart setting when running a variant analysis
This will respect the user's `saveBeforeStart` setting when running a
variant analysis. This re-uses the existing `saveBeforeStart` function
that is used when running local queries. The default behavior if the
setting is not set is to save all open named files.
2023-10-11 13:33:24 +02:00
Koen Vlaswinkel
667bf19f46 Add methodSignature to SetMultipleModeledMethodsMessage 2023-10-11 13:07:18 +02:00
Robert
c459d0ff65 Merge pull request #2942 from github/robertbrignull/SetModeledMethodsMessage
Convert SetModeledMethodsMessage to include multiple modeled methods
2023-10-11 11:45:57 +01:00
Koen Vlaswinkel
039b28235d Only allow 1 view in the view tracker
This will change the model editor view tracker to only store 1 view per
database item instead of an array of views per database item.
2023-10-11 11:54:47 +02:00
Koen Vlaswinkel
76db520ce7 Only allow a single model editor per database
This will add checks in the appropriate places to ensure that only a
single model editor is opened per database.
2023-10-11 11:51:05 +02:00
Anders Starcke Henriksen
d2b17e1676 Add tests. 2023-10-11 11:45:01 +02:00
Koen Vlaswinkel
0e1afcee64 Sort methods in usages panel according to model editor sort order
This sorts the methods in the methods usages panel the same as in the
model editor. Since this is dependent on the mode, we need to keep track
of the mode in the modeling store, so this also adds a mode field to the
db state.
2023-10-11 11:42:10 +02:00
Robert
62c9e51c25 Avoid unnnecessarily renaming field read from props 2023-10-11 10:41:48 +01:00
Charis Kyriakou
2b47d3d192 Ensure modeled methods are not undefined in usages panel (#2946) 2023-10-11 08:29:39 +00:00
Koen Vlaswinkel
4a62d05af6 Convert SetSelectedMethodMessage to include multiple modeled methods 2023-10-11 10:14:58 +02:00
Koen Vlaswinkel
e77cf28192 Merge pull request #2944 from github/dependabot/npm_and_yarn/extensions/ql-vscode/postcss-8.4.31
Bump postcss from 8.4.24 to 8.4.31 in /extensions/ql-vscode
2023-10-11 09:51:41 +02:00
Koen Vlaswinkel
59e23f35e2 Merge pull request #2943 from github/koesie10/state-confusion
Fix confusion between modeling store and view states
2023-10-11 09:45:58 +02:00
dependabot[bot]
33d55b1f0a Bump postcss from 8.4.24 to 8.4.31 in /extensions/ql-vscode
Bumps [postcss](https://github.com/postcss/postcss) from 8.4.24 to 8.4.31.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/8.4.24...8.4.31)

---
updated-dependencies:
- dependency-name: postcss
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-10 15:03:37 +00:00
Koen Vlaswinkel
e7ddb4406a Merge pull request #2937 from github/koesie10/remove-gulp-sourcemaps
Remove `gulp-sourcemaps` dependency
2023-10-10 17:02:00 +02:00
Koen Vlaswinkel
9a12a12065 Unexport DbModelingState 2023-10-10 16:57:19 +02:00
Koen Vlaswinkel
073440914d Set instance variables on webview load 2023-10-10 16:55:55 +02:00
Robert
c6a9f23e7e Delete convertToLegacyModeledMethods 2023-10-10 15:50:02 +01:00
Robert
d531bc642d Convert SetModeledMethodsMessage to include multiple modeled methods 2023-10-10 15:50:02 +01:00
Robert
a6625334f0 Merge pull request #2940 from github/robertbrignull/CommonFromViewMessages
Add CommonFromViewMessages to FromModelEditorMessage
2023-10-10 15:49:04 +01:00
Koen Vlaswinkel
77bb9780ec Fix confusion between modeling store an view states
This fixes three bugs related to the modeling store and view states:
- In the model editor view, when `setModeledMethods` was called, it
would do it on the active database, instead of the database that the
view was showing. This should not result in any visible bugs since the
active database is always the one that is being shown (in theory), but
I can imagine that it could cause issues if showing multiple model
editors next to each other.
- In the method modeling panel, the "reveal in editor" button would
always show the already active model editor. Therefore, if you had
multiple open and were still viewing the method of the first one, it
would always show the second one.
- In the method modeling panel, the same bug would cause the incorrect
modeled methods to be updated.
2023-10-10 16:44:40 +02:00
Koen Vlaswinkel
bb88c148aa Merge pull request #2941 from github/koesie10/modeling-store-modeled-methods-bug
Fix bug when selecting method without modeled methods
2023-10-10 16:18:42 +02:00
Robert
6df7ea3ddc Remove unused import 2023-10-10 15:15:29 +01:00
Robert
2beaf9a88c ViewLoadedMsg is already included 2023-10-10 15:11:30 +01:00
Robert
a7dbae02e0 Use ap logger 2023-10-10 15:11:19 +01:00
Robert
28ac019929 Fix typo 2023-10-10 15:11:09 +01:00
Koen Vlaswinkel
2e2ab11e4f Merge pull request #2939 from github/koesie10/unhandled-error-stack
Add stack trace to unhandled error log message
2023-10-10 16:10:01 +02:00
Robert
edf3cad6e4 Add CommonFromViewMessages to FromModelEditorMessage 2023-10-10 15:03:23 +01:00
Robert
246c347b04 Merge pull request #2938 from github/robertbrignull/legacy-conversion
Make use of modeled-methods-legacy.ts in the webview code
2023-10-10 15:00:52 +01:00
Koen Vlaswinkel
e332b26f29 Fix bug when selecting method without modeled methods
When selecting a method that has no modeled methods, the modeling state
would not contain an entry for the method signature. This would cause
the `modeledMethods` to be `undefined`, which is not allowed according
to its type.
2023-10-10 15:51:59 +02:00
Koen Vlaswinkel
22f6ac7974 Add stack trace to unhandled error log message
This change sets the `fullMessage` of the
`showAndLogExceptionWithTelemetry` to include the stack trace. This
makes it possible to find the source of the error rather than only
knowing that a specific error occurred. If the error does not have a
stack trace (which should be rare) the message will be the same as
before.
2023-10-10 15:45:49 +02:00
Robert
e45f4bd0d9 Merge branch 'main' into robertbrignull/legacy-conversion 2023-10-10 14:37:20 +01:00
Charis Kyriakou
f4d74c7d3f Deal with already modeled methods in the modeling panel (#2933) 2023-10-10 14:35:21 +01:00
Robert
7ba58b6298 Use legacy modeled method conversions instead of custom conversions 2023-10-10 14:23:06 +01:00
Robert
2b59c041b8 Make convertFromLegacyModeledMethod handle undefined 2023-10-10 14:23:06 +01:00
Robert
a434fbffbc Move modeled-methods-legacy.ts to /shared directory 2023-10-10 14:23:06 +01:00
Koen Vlaswinkel
649f69234e Remove gulp-sourcemaps 2023-10-10 14:37:20 +02:00
Anders Starcke Henriksen
c668b39b30 Add language filter panel. 2023-10-10 14:34:04 +02:00
Koen Vlaswinkel
5f4e9d4879 Add alert to show validation errors 2023-10-10 14:29:10 +02:00
Koen Vlaswinkel
6b965afe4f Add validation function for modeled methods 2023-10-10 14:20:44 +02:00
Charis Kyriakou
4ee86c15ad Add some spacing in modeling method empty states (#2934) 2023-10-10 10:52:15 +00:00
Robert
fcfd4f37a6 Merge pull request #2926 from github/robertbrignull/JumpToUsageMessage
Only include method signature in JumpToUsageMessage
2023-10-10 11:12:36 +01:00
Robert
6561bb0543 Merge branch 'main' into robertbrignull/JumpToUsageMessage 2023-10-10 10:50:21 +01:00
Koen Vlaswinkel
319a54c32f Merge pull request #2906 from github/koesie10/convert-remaining-multiple-models
Convert remaining extension host code to handle multiple models
2023-10-10 11:43:09 +02:00
Koen Vlaswinkel
385b0e8d1a Merge remote-tracking branch 'origin/main' into koesie10/convert-remaining-multiple-models 2023-10-10 11:22:08 +02:00
Robert
4dcfa8b679 Merge pull request #2927 from github/robertbrignull/generateMethodsFromLlm
Only include method signatures in generateMethodsFromLlm message
2023-10-10 10:19:20 +01:00
Robert
47509a922a Rename jumpToUsage => jumpToMethod throughout 2023-10-10 10:14:27 +01:00
Charis Kyriakou
7eab7e4e48 Set modeling mode when initialising method modeling panel (#2932) 2023-10-10 10:12:01 +01:00
Charis Kyriakou
f794a19d96 Track db related to modeled method and react when it closes (#2930) 2023-10-10 09:51:50 +01:00
Charis Kyriakou
e98611fd21 Ensure modified methods updated after changing a method from the modeling panel (#2929) 2023-10-10 08:57:36 +01:00
Koen Vlaswinkel
461cf15a47 Merge remote-tracking branch 'origin/main' into koesie10/convert-remaining-multiple-models 2023-10-10 09:30:29 +02:00
Koen Vlaswinkel
54e1b29940 Add explicit return type to convertToLegacyModeledMethod 2023-10-10 09:26:27 +02:00
Dave Bartolomeo
623890adc9 Merge pull request #2922 from github/dbartol/passthru
Add `additionalArgs` option to `launch.json`
2023-10-09 15:04:13 -04:00
Dave Bartolomeo
e7f75ab928 Merge branch 'dbartol/passthru' of https://github.com/github/vscode-codeql into dbartol/passthru 2023-10-09 14:44:49 -04:00
Dave Bartolomeo
df02fecf3c Fix test expectations 2023-10-09 14:44:33 -04:00
Dave Bartolomeo
a861346b10 Merge branch 'main' into dbartol/passthru 2023-10-09 14:06:14 -04:00
Philip Ginsbach
86b2157552 Merge pull request #2792 from github/ginsbach/TextMateInstantiationSyntax
fix syntax highlighting after imports with instantiation arguments
2023-10-09 17:17:55 +01:00
Philip Ginsbach
47fa163cb9 Update compiled grammar 2023-10-09 16:58:00 +01:00
Dave Bartolomeo
c78f01758a Alternate fix for import highlighting with instantiations 2023-10-09 16:58:00 +01:00
Philip Ginsbach
353e22d6e8 link to the PR from the changelog entry 2023-10-09 16:58:00 +01:00
Philip Ginsbach
599d31e5ac add changelog entry for TextMate instantiation argument syntax 2023-10-09 16:57:25 +01:00
Philip Ginsbach
64df792eda TextMate grammar: imports can have instantiation arguments 2023-10-09 16:56:21 +01:00
Robert
feebf7c3fd Only include method signatures in generateMethodsFromLlm 2023-10-09 16:17:46 +01:00
Robert
27c4bd8349 Merge pull request #2910 from github/robertbrignull/multiple-models-method-row
Add ability for MethodRow to render multiple modelings of the same method
2023-10-09 16:17:17 +01:00
Dave Bartolomeo
d4cbfbb70e Rename to additionalRunQueryArgs 2023-10-09 11:04:22 -04:00
Robert
153424ae5a Only include method signature in JumpToUsageMessage 2023-10-09 16:03:41 +01:00
Robert
edd2aa5e8f Merge branch 'main' into robertbrignull/multiple-models-method-row 2023-10-09 15:38:00 +01:00
Robert
0265353370 Use index as react key 2023-10-09 14:44:43 +01:00
Koen Vlaswinkel
623df4c2ee Merge pull request #2919 from github/koesie10/show-multiple-models-listener
Listen to modeling setting changes in the model editor and method modeling panel
2023-10-09 15:38:30 +02:00
Robert
8b0825ab3c Use better name for variable 2023-10-09 14:32:56 +01:00
Robert
c620939895 Merge pull request #2913 from github/robertbrignull/SaveModeledMethods
Remove method and modeledMethods from SaveModeledMethods message
2023-10-09 14:16:30 +01:00
Koen Vlaswinkel
e4a290fe37 Merge pull request #2925 from github/koesie10/method-modeling-codeowner
Set SecExp as codeowner for modeling panel
2023-10-09 15:13:56 +02:00
Koen Vlaswinkel
3230cc9166 Set SecExp as codeowner for modeling panel 2023-10-09 14:56:38 +02:00
Koen Vlaswinkel
4dae9b87d4 Add ability to add/remove modelings 2023-10-09 14:54:32 +02:00
Koen Vlaswinkel
5c368cec8b Merge pull request #2921 from github/koesie10/modeling-panel-multiple-models
Add ability for method modeling panel to render multiple modelings of the same method
2023-10-09 14:27:30 +02:00
Koen Vlaswinkel
b76369330d Convert remaining extension host code to handle multiple models
This converts all remaining extension host code to handle multiple
models per method. The only place where we're using the legacy format
is in the webview and in the boundary between the webview and the
extension host.
2023-10-09 13:56:41 +02:00
Koen Vlaswinkel
323c5368ba Switch from CodiconButton to VSCodeButton 2023-10-09 13:52:55 +02:00
Robert
c3e18910fc Fix typo in comment 2023-10-09 12:26:09 +01:00
Robert
603c799717 Merge pull request #2923 from github/robertbrignull/telemetry-changelog
Update CHANGELOG.md for telemetry changes
2023-10-09 12:24:39 +01:00
Robert
aa045835fd Merge branch 'main' into robertbrignull/SaveModeledMethods 2023-10-09 11:35:47 +01:00
Robert
850c04a289 Clarify method docs 2023-10-09 11:30:35 +01:00
Robert
4d19955740 Update CHANGELOG.md for telemetry changes 2023-10-09 11:08:31 +01:00
Robert
b623f92c4a Merge pull request #2824 from github/robertbrignull/telemetry
Respect "telemetry.telemetryLevel" as well as "telemetry.enableTelemetry"
2023-10-09 10:59:26 +01:00
Koen Vlaswinkel
08342f1960 Merge pull request #2905 from github/koesie10/convert-modeled-method-fs
Convert `modeled-method-fs.ts` to handle multiple models per method
2023-10-09 11:54:31 +02:00
Robert
af334a98e3 Merge pull request #2912 from github/robertbrignull/simplify_messages/RevealMethodMessage
Convert RevealMethodMessage to only include method signature
2023-10-09 10:46:19 +01:00
Dave Bartolomeo
9e26c29ddb Fix tests for older CLIs 2023-10-06 18:35:20 -04:00
Dave Bartolomeo
705a7975c5 Add additionalArgs option to launch.json 2023-10-06 18:03:10 -04:00
Koen Vlaswinkel
6be98f3f8d Fix test 2023-10-06 16:57:31 +02:00
Koen Vlaswinkel
3b6263fb07 Remove size from CodiconButton 2023-10-06 16:48:49 +02:00
Koen Vlaswinkel
29aa4a3f29 Add tests for multiple modeled methods panel 2023-10-06 16:42:41 +02:00
Koen Vlaswinkel
3a494dff36 Add support for unmodeled methods 2023-10-06 16:26:53 +02:00
Koen Vlaswinkel
a01a76cb73 Add initial multiple modelings panel 2023-10-06 16:25:25 +02:00
Koen Vlaswinkel
a29112e045 Add multiple models to MethodModeling story 2023-10-06 15:54:02 +02:00
Koen Vlaswinkel
ee1bf8896e Change MethodModeling to accept multiple models 2023-10-06 15:50:31 +02:00
Koen Vlaswinkel
2410d2bfdd Merge pull request #2918 from github/koesie10/modeling-panel-view-state
Add view state to method modeling panel
2023-10-06 15:49:37 +02:00
Charis Kyriakou
0e5551b650 Make method modeling panel available to canary users (#2920) 2023-10-06 13:25:33 +00:00
Koen Vlaswinkel
951bd13881 Use ModelConfig for all model settings
This switches all places where we're retrieving some model configuration
to use the `ModelConfig` or `ModelConfigListener` types. This makes it
much easier to mock these settings in tests.

This also adds a listener to the `ModelEditorView` to send the new view
state when any of the settings is changed. This should make it easier
to test settings changes in the model editor without having to re-open
the model editor.
2023-10-06 14:29:07 +02:00
Koen Vlaswinkel
08944a292c Update method modeling panel after changes to config
This updates the method modeling panel's view state when the
`codeQL.model.showMultipleModels` setting changes. This will ensure that
the setting updates without needing to restart VS Code since this view
is much harder to restart than the model editor.
2023-10-06 14:15:23 +02:00
Koen Vlaswinkel
cf0057ecd9 Add view state to method modeling panel
This adds a view state to the method modeling panel similar to the
model editor. This will be used to send the state of the show multiple
models feature flag to the webview so this can be used to selectively
show/hide components in the method modeling panel.
2023-10-06 14:04:06 +02:00
Charis Kyriakou
1d691c2b7f UI polish for modeling panel (#2917)
* Don't push content down with unsaved tag

* Adjust spacing between components
2023-10-06 11:57:52 +01:00
Charis Kyriakou
20c63921f7 Wire up modeling panel empty states (#2915) 2023-10-06 11:27:16 +01:00
Koen Vlaswinkel
9c275130a5 Fix duplicate modeled methods
Co-authored-by: Robert <robertbrignull@github.com>
2023-10-06 12:09:00 +02:00
Henry Mercer
b1df4a4f0a Merge pull request #2916 from github/henrymercer/remove-ml-powered-queries
Packaging: Remove ML-powered queries pack from known list
2023-10-06 11:02:27 +01:00
Henry Mercer
08a4457e39 Packaging: Remove ML-powered queries pack from known list
ML-powered queries are [now deprecated](https://github.blog/changelog/2023-09-29-codeql-code-scanning-deprecates-ml-powered-alerts/).
2023-10-06 10:38:14 +01:00
Charis Kyriakou
db3d24236c Add empty states for modeling panel (#2914) 2023-10-06 09:34:54 +01:00
Robert
9d40d9a703 Remove method and modeledMethods from SaveModeledMethods message 2023-10-05 16:56:05 +01:00
Robert
0fabcda49b Convert RevealMethodMessage to only include method signature 2023-10-05 16:41:56 +01:00
Robert
2b0bd840e6 Place setup before initialising listener 2023-10-05 15:25:42 +01:00
Robert
d499ff3cf4 Merge branch 'main' into robertbrignull/telemetry 2023-10-05 15:19:07 +01:00
Charis Kyriakou
1806108166 Remove unnecessary TODOs (#2900) 2023-10-05 08:04:17 +00:00
Andrew Eisenberg
02af432d5f Merge pull request #2885 from github/aeisenberg/multi-token
Adds `MultiCancellationToken`
2023-10-04 13:33:46 -07:00
Andrew Eisenberg
76ec9e2e50 Make DisposableObject a concrete class 2023-10-04 20:10:42 +00:00
Robert
5ba64a1db3 Add test for when there's no modeled method 2023-10-04 18:46:17 +01:00
Robert
f87b1c46de Add some simple tests of rendering multiple models 2023-10-04 18:46:17 +01:00
Robert
8eef4eb4f2 Add story with multiple modelings 2023-10-04 18:46:17 +01:00
Robert
252c7a20c4 Convert MethodRow to display multiple modelings 2023-10-04 18:46:13 +01:00
Robert
86d7d8345c Convert ApiOrMethodCell to ApiOrMethodRow 2023-10-04 18:17:34 +01:00
Robert
a704cd7bae Convert getModelingStatus to take ModeledMethod[] 2023-10-04 18:17:34 +01:00
Robert
e75eccb416 Change MethodRow to accept ModelEditorViewState object instead of just Mode 2023-10-04 18:17:34 +01:00
Charis Kyriakou
17947fb7c2 Use base postMessage instead of webview one (#2909) 2023-10-04 17:23:49 +01:00
Charis Kyriakou
c00207cccc Move method modeling panel out of explorer (#2908) 2023-10-04 15:38:07 +01:00
Andrew Eisenberg
801df7b14a Merge branch 'main' into aeisenberg/multi-token 2023-10-04 07:09:21 -07:00
Koen Vlaswinkel
a6c7af09d4 Merge pull request #2907 from github/koesie10/eslint-memory
Increase memory limit when running ESLint
2023-10-04 15:11:26 +02:00
Koen Vlaswinkel
96668928aa Increase memory limit when running ESLint 2023-10-04 14:46:32 +02:00
Koen Vlaswinkel
a6c97077fb Merge pull request #2904 from github/koesie10/convert-yaml-modeled-methods
Convert `yaml.ts` to handle multiple models per method
2023-10-04 14:01:02 +02:00
Robert
6d7fbfc4f8 Merge pull request #2903 from github/robertbrignull/multiple-models-feature-flag
Add feature flag for showing multiple modelings
2023-10-04 12:55:42 +01:00
Koen Vlaswinkel
c5175e040e Convert modeled-method-fs.ts to handle multiple models per method
This will change the input/output types for modeled methods in the
`modeled-method-fs.ts` file to take in multiple models per method. This
removes the need for conversion functions between this file and
`yaml.ts` files. Instead, the conversion functions are done when calling
any functions defined in `modeled-method-fs.ts` files.
2023-10-04 13:47:30 +02:00
Anders Starcke Henriksen
55af9bc47c Merge pull request #2894 from github/starcke/lang-context-history
Add support for filtering history panel.
2023-10-04 13:38:38 +02:00
Koen Vlaswinkel
ada62ffd33 Convert yaml.ts to handle multiple models per method
This changes YAML parsing/creating functions for the model editor to
handle multiple models per method. The changes in the actual YAML
handling are fairly small because the format itself already supports
multiple models per method.

I've introduced a few helper functions to convert between the old and
new types. This should only be necessary while we're in the middle of
the transition to the new types and can be removed later. For now,
we'll just take the first model in the array when converting from the
new to the old type. This is a change in the behavior since currently
we always take the last model in the array but this behavior is
undocumented and unsupported, so it should be fine to change it.
2023-10-04 13:23:54 +02:00
Robert
e10e3adc14 Add feature flag for showing multiple modelings 2023-10-04 12:21:47 +01:00
Koen Vlaswinkel
16af4c49ea Merge pull request #2902 from github/koesie10/actions-nvmrc
Use .nvmrc file for setting up Node version in Actions
2023-10-04 11:36:22 +02:00
Koen Vlaswinkel
c970c3bc19 Use .nvmrc file for setting up Node version in Actions 2023-10-04 10:00:56 +02:00
Andrew Eisenberg
3699f0b3b3 Add BasicDisposableObject
Use it for `MultiCancellationToken`. And ensure that adding a
cancellation requested listener to the `MultiCancellationToken` will
forward any cancellation requests to all constituent tokens.
2023-10-03 21:42:00 +00:00
Andrew Eisenberg
ccbe4ee974 Merge branch 'main' into aeisenberg/multi-token 2023-10-03 07:52:54 -07:00
Anders Starcke Henriksen
486180d149 Fix and add tests. 2023-10-03 13:57:16 +02:00
Anders Starcke Henriksen
9362447338 Add support for filtering history panel. 2023-10-03 13:55:01 +02:00
Anders Starcke Henriksen
ff34079247 Merge pull request #2892 from github/starcke/local-query-lang-dto
Add language to local query history items
2023-10-03 13:53:32 +02:00
Koen Vlaswinkel
7cd99cb000 Merge pull request #2897 from github/dependabot/npm_and_yarn/extensions/ql-vscode/p-queue-7.4.1
Bump p-queue from 6.6.2 to 7.4.1 in /extensions/ql-vscode
2023-10-03 12:53:55 +02:00
Koen Vlaswinkel
21fd0cfd29 Transform p-queue and p-timeout modules in Jest tests 2023-10-03 11:52:51 +02:00
dependabot[bot]
db3337cc1b Bump p-queue from 6.6.2 to 7.4.1 in /extensions/ql-vscode
Bumps [p-queue](https://github.com/sindresorhus/p-queue) from 6.6.2 to 7.4.1.
- [Release notes](https://github.com/sindresorhus/p-queue/releases)
- [Commits](https://github.com/sindresorhus/p-queue/compare/v6.6.2...v7.4.1)

---
updated-dependencies:
- dependency-name: p-queue
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-03 09:29:01 +00:00
Koen Vlaswinkel
a525499c2a Merge pull request #2818 from github/dependabot/npm_and_yarn/extensions/ql-vscode/nanoid-5.0.1
Bump nanoid from 3.3.6 to 5.0.1 in /extensions/ql-vscode
2023-10-03 11:26:00 +02:00
Anders Starcke Henriksen
6d2859cee5 Fix typo. 2023-10-03 11:23:32 +02:00
Koen Vlaswinkel
ac9128735f Merge pull request #2896 from github/koesie10/reveal-in-editor
Add reveal in editor button to method modeling panel
2023-10-03 11:12:44 +02:00
Anders Starcke Henriksen
2c0838e393 Merge branch 'main' into starcke/local-query-lang-dto 2023-10-03 11:01:46 +02:00
Anders Starcke Henriksen
b294e16c44 Add to changelog. 2023-10-03 11:01:03 +02:00
Koen Vlaswinkel
f678f49bc9 Transform nanoid module in Jest tests 2023-10-03 10:48:08 +02:00
dependabot[bot]
99dabb0779 Bump nanoid from 3.3.6 to 5.0.1 in /extensions/ql-vscode
Bumps [nanoid](https://github.com/ai/nanoid) from 3.3.6 to 5.0.1.
- [Release notes](https://github.com/ai/nanoid/releases)
- [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ai/nanoid/compare/3.3.6...5.0.1)

---
updated-dependencies:
- dependency-name: nanoid
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-03 08:13:33 +00:00
Koen Vlaswinkel
add7a25578 Merge pull request #2877 from github/robertbrignull/upgrade_msw
Upgrade MSW
2023-10-03 10:08:34 +02:00
Koen Vlaswinkel
487a753ede Reveal method in editor view
This will reveal a method for which "Review in editor" is clicked in the
model editor view: it will expand the group (library/package) in which
the method is located, scroll to the method, and highlight the method.

If the user clicks anywhere on the page, the highlight will be removed,
but the group will remain expanded.
2023-10-03 09:49:00 +02:00
Koen Vlaswinkel
79ea901a52 Send message to model editor view on revealing method
This will call a method on the correct model editor view when the user
clicks on "Review in editor". This does not yet do anything to the view;
this will be added in a follow-up commit.
2023-10-03 09:48:59 +02:00
Koen Vlaswinkel
2872a2dcaf Add model editor view tracker
This is used for registering which model editor views are currently
active. This will be used to determine which view to send the "reveal
method" command to. It can also be used in the future to limit the
number of instances of the model editor that can be opened for a
database.

This uses the same pattern as variant analyses with a separate interface
for the view to avoid having circular dependencies.
2023-10-03 09:48:17 +02:00
Koen Vlaswinkel
8b8bacb718 Add button for reveal method in editor 2023-10-03 09:47:52 +02:00
Koen Vlaswinkel
83e38c811f Update CHANGELOG 2023-10-03 09:36:59 +02:00
Koen Vlaswinkel
8107bf7cb1 Merge remote-tracking branch 'origin/main' into robertbrignull/upgrade_msw 2023-10-03 09:36:03 +02:00
Andrew Eisenberg
625b3a5c37 Merge branch 'main' into aeisenberg/multi-token 2023-10-02 20:07:31 -07:00
Andrew Eisenberg
0fa3cf5d8e Use EventEmitter in MultiCancellationToken 2023-10-02 10:21:17 -07:00
Charis Kyriakou
558b9329c5 Extract base functionality for WebviewViewProviders into an abstract class (#2895) 2023-10-02 16:31:52 +01:00
Koen Vlaswinkel
e15b7681db Bump @types/vscode to 1.82.0 2023-10-02 11:14:42 +02:00
Koen Vlaswinkel
6539417d2d Fix recording of binary response bodies 2023-10-02 11:13:18 +02:00
Koen Vlaswinkel
095d56ee37 Fix typo in BasicErrorResponse 2023-10-02 11:02:44 +02:00
Koen Vlaswinkel
7578697e92 Fix response bodies when recording 2023-10-02 11:02:20 +02:00
Anders Starcke Henriksen
6e06e7934b Merge pull request #2889 from github/starcke/lang-context-queries
Apply language context to queries panel
2023-10-02 10:27:00 +02:00
Charis Kyriakou
58249e3efe Dispose event subscriptions in method modeling view (#2882) 2023-10-02 08:57:33 +01:00
Andrew Eisenberg
75540b449f Merge pull request #2884 from github/aeisenberg/avoid-double-restart
Avoid double restarts of the query server
2023-09-29 11:04:37 -07:00
Andrew Eisenberg
04dfc4e647 Move location of multi-cancellation-token
This avoids a code-scanning warning.
2023-09-29 08:31:20 -07:00
Andrew Eisenberg
3ba1712be0 Update Changelog 2023-09-29 08:30:51 -07:00
Andrew Eisenberg
e8f68c1b5f Adds MultiCancellationToken
This is a cancellation token that cancels when any of its constituent
cancellation tokens are cancelled.

This token is used to fix a bug in Find Definitions. Previously, when
clicking `CTRL` (or `CMD` on macs) inside a source file in an archive
and hovering over a token, this will automatically invoke the
definitions finder (in preparation for navigating to the definition).
The only way to cancel is to move down to the message popup and click
cancel there.

However, this is a bug. What _should_ happen is that if a user moves
their mouse away from the token, the operation should cancel.

The underlying problem is that the extension was only listening to the
cancellation token from inside `getLocationsForUriString` the
cancellation token used by the Language Server protocol to cancel
operations in flight was being ignored.

This fix will ensure we are listening to _both_ cancellation tokens
and cancel the query if either are cancelled.
2023-09-29 08:28:35 -07:00
Andrew Eisenberg
a9edb36242 Merge branch 'main' into aeisenberg/avoid-double-restart 2023-09-29 08:26:53 -07:00
Koen Vlaswinkel
40b79f2e61 Improve scenario recording 2023-09-29 14:34:12 +02:00
Charis Kyriakou
3489c26ef6 Styling updates to method modeling panel (#2888) 2023-09-29 13:02:29 +01:00
Koen Vlaswinkel
6b522819fd Merge pull request #2893 from github/version/bump-to-v1.9.2
Bump version to v1.9.2
2023-09-29 13:20:59 +02:00
Koen Vlaswinkel
15b8d2bdb4 Merge pull request #2890 from github/koesie10/add-missing-feature-flag-to-test-plan
Add missing feature flag to test plan
2023-09-29 13:10:27 +02:00
github-actions[bot]
213a03555a Bump version to v1.9.2 2023-09-29 10:27:33 +00:00
Koen Vlaswinkel
0a9a9792ad Merge pull request #2891 from github/koesie10/dispose-webview
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
Dispose tracked objects when panel is disposed
2023-09-29 12:19:56 +02:00
Anders Starcke Henriksen
c4fe868826 Add a way to show language for qury history. 2023-09-29 12:15:55 +02:00
Koen Vlaswinkel
4cf67ef799 Fix disposing in ResultsView 2023-09-29 12:00:26 +02:00
Anders Starcke Henriksen
c43d0fa805 Add language to local queries. 2023-09-29 11:54:45 +02:00
Koen Vlaswinkel
0a27c0538d Dispose tracked objects when panel is disposed
This will change the `AbstractWebview` to dispose its tracked objects
(using `this.push`) when the panel is disposed rather than when the
view is disposed. This makes `this.push` actually useful in a view.
Before, the objects would only get disposed when the extension itself
was disposed.
2023-09-29 11:34:59 +02:00
Koen Vlaswinkel
e798663bbb Add missing feature flag to test plan 2023-09-29 11:12:04 +02:00
Anders Starcke Henriksen
169a425e0b Update and add tests. 2023-09-29 11:07:06 +02:00
Koen Vlaswinkel
66fdabf4c8 Merge pull request #2887 from github/v1.9.1
Release v1.9.1
2023-09-29 10:30:40 +02:00
Koen Vlaswinkel
f249b36660 v1.9.1 2023-09-29 10:05:43 +02:00
Anders Starcke Henriksen
1e6b7a6619 Add support for filtering queries panel. 2023-09-29 09:28:44 +02:00
Anders Starcke Henriksen
552a4f6eb3 Merge pull request #2873 from github/starcke/language-context-store
Add language context store.
2023-09-29 09:24:31 +02:00
Andrew Eisenberg
2b17979b6c Update changelog 2023-09-28 14:29:40 -07:00
Andrew Eisenberg
3999ae3728 Avoid double restarts of the query server
Previously, if there was an explicit restart of the query server (eg-
by changing a configuration setting), then the query server process
would be started twice: once by the `close` handler and once by the
restart command.

By adding the `removeAllListeners` to the dispose method, we ensure that
when the query server shuts down gracefully, there won't be a `close`
listener that is going to restart it a second time if there is a
different way of restarting it.
2023-09-28 14:25:35 -07:00
Shati Patel
493e8d915e Hide the language filter behind an extra flag (#2881) 2023-09-28 14:47:25 +00:00
Anders Starcke Henriksen
dc632d5c3d Change to use QueryLanguage | undefined. 2023-09-28 16:43:33 +02:00
Koen Vlaswinkel
ae2d6ce16e Upgrade Node version to 18.15.0 2023-09-28 16:38:54 +02:00
Charis Kyriakou
27a7474f2b Add modeling indicator to method usages panel (#2876) 2023-09-28 15:33:46 +01:00
Koen Vlaswinkel
8b1c52886a Fix typing error for Octokit 2023-09-28 16:09:16 +02:00
Koen Vlaswinkel
f9ddb4080c Switch to stable VS Code version for tests 2023-09-28 16:07:34 +02:00
Koen Vlaswinkel
3afa15a0ce Remove redundant query params 2023-09-28 16:07:05 +02:00
Koen Vlaswinkel
f22714777c Use AppOctokit in tests 2023-09-28 16:06:34 +02:00
Koen Vlaswinkel
469f65a392 Merge pull request #2854 from github/koesie10/bump-min-version
Bump minimum VS Code version to 1.82
2023-09-28 16:04:57 +02:00
Koen Vlaswinkel
9b10a09727 Fix MSW JSON responses 2023-09-28 14:32:33 +02:00
Koen Vlaswinkel
3c10e87529 Switch Octokit to use node-fetch
It seems like Node's native `fetch` implementation isn't quite working
right with Octokit and MSW. This switches to using `node-fetch` like
we're already doing for all other requests (e.g. downloading databases).
2023-09-28 14:32:32 +02:00
Koen Vlaswinkel
a1ea1f8135 Upgrade Octokit and MSW 2023-09-28 14:32:16 +02:00
Robert
ffc90a0c30 Remove startServer method as it now does nothing 2023-09-28 14:32:15 +02:00
Robert
e34f4ed485 Only start server when loading a scenario 2023-09-28 14:32:15 +02:00
Robert
7c1b6e2ff6 Use new types 2023-09-28 14:32:15 +02:00
Robert
e719df711a Upgrade msw to the @next tag 2023-09-28 14:32:15 +02:00
Anders Starcke Henriksen
6accba66fe Rename state to languageFilter. 2023-09-28 14:28:31 +02:00
Anders Starcke Henriksen
a657df4468 Move context manipulation into store and fix initial state. 2023-09-28 14:19:07 +02:00
Koen Vlaswinkel
6aab4b4090 Merge pull request #2875 from github/koesie10/update-csharp-query
Update model editor C# query to return method parameters with parentheses
2023-09-28 14:10:50 +02:00
Anders Starcke Henriksen
c7e5922bd5 Merge branch 'main' into starcke/language-context-store 2023-09-28 14:08:26 +02:00
Anders Starcke Henriksen
bb25874299 Remove TODO. 2023-09-28 14:05:31 +02:00
Shati Patel
d5c78fd67b Indicate which language is selected in the databases view (#2871) 2023-09-28 12:30:11 +02:00
Koen Vlaswinkel
6c5f160eee Update model editor C# query to return method parameters with parentheses 2023-09-28 12:17:06 +02:00
Nora
ecbc458106 Merge pull request #2802 from github/nora/minor-integration-test-improvement
Minor test updates for `db-panel.test`
2023-09-28 12:16:54 +02:00
Koen Vlaswinkel
93652fc75f Merge pull request #2872 from github/koesie10/resolve-queries-from-ql
Resolve model editor queries from CodeQL packs if present
2023-09-28 12:14:41 +02:00
Nora
859eca0195 Merge pull request #2812 from github/nora/remove-rate-limit-code-search
Code Search: don't show rate limit warnings to users
2023-09-28 11:57:15 +02:00
Koen Vlaswinkel
905eaf66aa Implement PR feedback 2023-09-28 11:27:42 +02:00
Nora
7af8b7a274 Use BaseLogger instead of ExtLogger 2023-09-28 08:50:35 +00:00
Nora
a6b6b5a7d6 Show rate limit messages in extension output 2023-09-28 08:24:58 +00:00
Nora
9aff9891d3 Fix comment 2023-09-28 08:18:44 +00:00
Nora
681a15ce45 Extract dbConfigFilePath 2023-09-28 08:17:38 +00:00
Nora
f82b51f7c5 Add comment 2023-09-28 08:17:38 +00:00
Nora
5b7124683a Replace void with await 2023-09-28 08:17:38 +00:00
Charis Kyriakou
031b5076db Update modeling panel when clicking 'view' on model editor (#2874) 2023-09-27 16:59:39 +01:00
Dave Bartolomeo
f1533dde2d Merge pull request #2858 from github/dbartol/long-strings
Use streaming when creating log symbols file.
2023-09-27 09:55:25 -04:00
Koen Vlaswinkel
e9b67dd90c Resolve model editor queries from ql if present 2023-09-27 15:32:01 +02:00
Anders Starcke Henriksen
7bfe0df901 Add language context store. 2023-09-27 15:28:11 +02:00
Koen Vlaswinkel
b1debee244 Merge pull request #2868 from github/koesie10/new-model-editor-queries
Update model editor queries
2023-09-27 12:03:48 +02:00
Charis Kyriakou
3b00d74f47 Hook method modeling view to modeling store (#2870) 2023-09-27 09:57:27 +00:00
Koen Vlaswinkel
4efd3f8fe8 Merge pull request #2865 from github/github-action/bump-cli
Bump CLI Version to v2.14.6 for integration tests
2023-09-27 11:23:40 +02:00
Koen Vlaswinkel
95c512e3e8 Fix compilation errors when using submodule with updated queries 2023-09-27 11:20:57 +02:00
Koen Vlaswinkel
7501f9b81e Merge pull request #2864 from github/koesie10/right-align-format-numbers
Right align and format raw result numbers
2023-09-27 11:03:12 +02:00
Charis Kyriakou
a98b998e5f Add selected method and usage state to modeling store (#2869) 2023-09-27 08:15:51 +01:00
Koen Vlaswinkel
e03d106bc2 Update model editor queries
This updates the model editor queries to the version that will be merged
into the CodeQL repository. There are some slight changes to the output
format, so we slightly need to change the BQRS decoding of those
queries.

The queries themselves were copied from the two PRs with some minor
additions at the end since these were changes in core CodeQL library
files.
2023-09-27 09:05:15 +02:00
Dave Bartolomeo
3c63df2221 Unit tests for SplitBuffer 2023-09-26 17:54:47 -04:00
Charis Kyriakou
c6996771ab Add unsaved tag on method modeling panel (#2867) 2023-09-26 20:17:16 +01:00
Koen Vlaswinkel
e475036721 Right align and format raw result numbers
This changes the formatting for both the local raw results table and the
variant analysis raw results table to right align and format numbers.
2023-09-26 16:18:42 +02:00
Charis Kyriakou
42192fa922 Move modeling status code to its own module (#2866)
* Move ModelingStatus to its own file

* Move getModelingStatus to modeling status module
2023-09-26 13:52:04 +00:00
Koen Vlaswinkel
947084d792 Merge pull request #2863 from github/koesie10/refactor-raw-results-table
Split out components in variant analysis raw results table
2023-09-26 15:41:47 +02:00
Charis Kyriakou
6c1cd71743 Move modeled and modified method state to store (#2861) 2023-09-26 14:23:12 +01:00
github-actions[bot]
c4b890597d Bump CLI version from v2.14.5 to v2.14.6 for integration tests 2023-09-26 13:19:05 +00:00
Charis Kyriakou
93251f8d57 Make MethodModelingViewProvider a disposable object (#2862) 2023-09-26 13:53:23 +01:00
Koen Vlaswinkel
452329b07a Extract RawResultRow to separate file 2023-09-26 14:46:42 +02:00
Koen Vlaswinkel
1afee02e78 Extract RawResultCell to separate file 2023-09-26 14:46:39 +02:00
Koen Vlaswinkel
cbb1de4faf Merge pull request #2847 from github/dependabot/npm_and_yarn/extensions/ql-vscode/types/js-yaml-4.0.6
Bump @types/js-yaml from 3.12.5 to 4.0.6 in /extensions/ql-vscode
2023-09-26 12:41:11 +02:00
Charis Kyriakou
9e92c6c304 Merge pull request #2857 from github/charisk/initial-modeling-store
Introduce modeling store and move some state there
2023-09-26 11:36:46 +01:00
Koen Vlaswinkel
7864844ddd Fix missing string type on dataExtensions 2023-09-26 11:58:33 +02:00
Charis Kyriakou
c77a300f24 Move methods, hideModeledMethods and active editor state to the modeling store 2023-09-26 09:52:59 +00:00
Koen Vlaswinkel
f5fbd7f4cc Switch tests to new types 2023-09-26 11:32:25 +02:00
Koen Vlaswinkel
405292ecd4 Introduce type for QlPackFile 2023-09-26 11:29:19 +02:00
Shati Patel
3be7eb9e15 Add ability to filter DB view by language (#2856) 2023-09-26 09:20:40 +00:00
Dave Bartolomeo
c972a5c0de Use streaming when creating log symbols file. 2023-09-25 14:24:10 -04:00
Koen Vlaswinkel
5ae67fecda Do not export unused types 2023-09-25 15:54:26 +02:00
Charis Kyriakou
d33c26798d Introduce modeling store 2023-09-25 13:42:57 +00:00
Koen Vlaswinkel
9392fb75c8 Format generated schema files with Prettier 2023-09-25 15:35:02 +02:00
Koen Vlaswinkel
e0509f684b Merge pull request #2845 from github/dependabot/npm_and_yarn/extensions/ql-vscode/zip-a-folder-3.1.2
Bump zip-a-folder from 2.0.0 to 3.1.2 in /extensions/ql-vscode
2023-09-25 15:26:01 +02:00
Koen Vlaswinkel
c55e87c64b Generate schema for extension pack file 2023-09-25 15:25:40 +02:00
Koen Vlaswinkel
bc01d73ba5 Fix some type errors in tests 2023-09-25 15:25:39 +02:00
Koen Vlaswinkel
db55e9cd42 Generate schema for extension pack metadata
After the upgrade to the correct types for js-yaml, the return type
of `load` is correctly typed as `unknown`. This means that we can't
use the return value directly, but need to validate it first.

This adds such validation by generating a JSON schema for a newly
created typed. The JSON schema generation is very similar to how we do
it in https://github.com/github/codeql-variant-analysis-action.
2023-09-25 15:25:37 +02:00
Charis Kyriakou
19890b8591 Merge pull request #2855 from github/charisk/tidy-castings
Don't use 'as any' when checking open view
2023-09-25 13:52:14 +01:00
Shati Patel
df1c12f2ba Rearrange DB panel UI commands (#2853) 2023-09-25 14:10:34 +02:00
Charis Kyriakou
bd67afe799 Extract logic into reusable function 2023-09-25 10:08:52 +00:00
Koen Vlaswinkel
7a2876faad Bump zip-a-folder to v3.1.3
This fixes an issue with TypeScript declarations.

See: https://redirect.github.com/maugenst/zip-a-folder/issues/48
2023-09-25 12:07:01 +02:00
Charis Kyriakou
4c9ce2d537 Don't use 'as any' when checking open view 2023-09-25 09:48:57 +00:00
Charis Kyriakou
868ffd79a5 Hide modeling panel when modeling editor is active (#2851) 2023-09-25 10:39:43 +01:00
Koen Vlaswinkel
eb3900f642 Bump minimum VS Code version for warnings 2023-09-25 11:38:39 +02:00
Charis Kyriakou
3934ba7e69 Remove redundant argument from onChange (#2852) 2023-09-25 09:41:36 +01:00
Charis Kyriakou
3e259f14c9 Add modeling inputs to method modeling panel (#2849) 2023-09-22 15:13:40 +00:00
Charis Kyriakou
4323aad254 Fix MethodRow stories to not all show as modeled (#2850) 2023-09-22 11:38:36 +00:00
Charis Kyriakou
cd7c26f2ff Merge pull request #2848 from github/dependabot/npm_and_yarn/extensions/ql-vscode/graphql-16.8.1
Bump graphql from 16.6.0 to 16.8.1 in /extensions/ql-vscode
2023-09-22 11:43:04 +01:00
dependabot[bot]
6e9280b97e Bump graphql from 16.6.0 to 16.8.1 in /extensions/ql-vscode
Bumps [graphql](https://github.com/graphql/graphql-js) from 16.6.0 to 16.8.1.
- [Release notes](https://github.com/graphql/graphql-js/releases)
- [Commits](https://github.com/graphql/graphql-js/compare/v16.6.0...v16.8.1)

---
updated-dependencies:
- dependency-name: graphql
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-21 17:49:46 +00:00
dependabot[bot]
e43adb6424 Bump @types/js-yaml from 3.12.5 to 4.0.6 in /extensions/ql-vscode
Bumps [@types/js-yaml](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/js-yaml) from 3.12.5 to 4.0.6.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/js-yaml)

---
updated-dependencies:
- dependency-name: "@types/js-yaml"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-21 13:06:11 +00:00
dependabot[bot]
54435d78cf Bump zip-a-folder from 2.0.0 to 3.1.2 in /extensions/ql-vscode
Bumps [zip-a-folder](https://github.com/maugenst/zip-a-folder) from 2.0.0 to 3.1.2.
- [Commits](https://github.com/maugenst/zip-a-folder/commits)

---
updated-dependencies:
- dependency-name: zip-a-folder
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-21 13:04:12 +00:00
Charis Kyriakou
3a1431ca31 Merge pull request #2843 from github/charisk/model-kind-dropdown
Update KindInput component to bring it inline with others
2023-09-21 08:24:54 +01:00
Charis Kyriakou
73f161cdac Clean up model editor onChange callback (#2844) 2023-09-21 08:16:11 +01:00
Robert
ef008a1659 Merge pull request #2840 from github/robertbrignull/node-version
Add docs about the Node.js version
2023-09-20 17:27:18 +01:00
Charis Kyriakou
dc33784dbc Update ModelKindDropdown to be more self-contained 2023-09-20 14:59:11 +00:00
Charis Kyriakou
c4396b764c Rename KindInput to ModelKindDropdown 2023-09-20 14:59:10 +00:00
Charis Kyriakou
4e096400db Extract model output dropdown to its own component (#2839) 2023-09-20 15:58:24 +01:00
Robert
f99177ac21 Merge pull request #2842 from github/robertbrignull/revert-node18
Switch back to Node.js version 16
2023-09-20 14:41:04 +01:00
Robert
f95bf6889b Revert "Disable unit tests using MockGitHubApiServer"
This reverts commit 26450e9236.
2023-09-20 13:48:21 +01:00
Robert
ed48f4ac76 Revert "Change node version to 18.15.0"
This reverts commit 8136328ad6.
2023-09-20 13:48:12 +01:00
Charis Kyriakou
d2f4f33bea Extract type for modeled method kind (#2835) 2023-09-20 13:36:41 +01:00
Robert
a68d5df13b Apply suggestions from code review 2023-09-20 12:25:30 +01:00
Robert
495f632ae2 Update node-version.md 2023-09-20 11:57:16 +01:00
Robert
929f54333b Create vscode-version.md 2023-09-20 11:55:13 +01:00
Charis Kyriakou
4f1a92d09c Extract model input dropdown to its own component (#2837) 2023-09-20 11:25:26 +01:00
Robert
91866971dd Update node-version.md 2023-09-20 11:17:14 +01:00
Robert
9b15b35274 Add files via upload 2023-09-20 11:15:55 +01:00
Robert
b3544b461a Update releasing.md 2023-09-20 11:15:35 +01:00
Robert
53fccdfb2e Create node-version.md 2023-09-20 11:14:06 +01:00
Charis Kyriakou
606bfd7f87 Remove unnecessary spread of modeled method (#2836) 2023-09-20 10:56:47 +01:00
Charis Kyriakou
7d088b749b Update import to fix build (#2838) 2023-09-20 09:53:44 +00:00
Charis Kyriakou
315021ef35 Minor redesign of method modeling title (#2832) 2023-09-20 10:10:40 +01:00
Charis Kyriakou
1dc70fe625 Extract model type dropdown to its own component (#2833) 2023-09-20 10:02:12 +01:00
Charis Kyriakou
36f6531fc4 Move method factories to factories/model-editor (#2834) 2023-09-20 08:55:02 +00:00
Robert
4227ff6338 Mock env.itTelemetryEnable 2023-09-19 17:24:53 +01:00
Robert
ca96cdf879 Mock sendTelemetryErrorEvent and check appropriately 2023-09-19 17:23:47 +01:00
Robert
aad1fee787 Stop mocking sendTelemetryException because we don't use that anywhere in the program 2023-09-19 17:18:38 +01:00
Koen Vlaswinkel
fc735cb83b Merge pull request #2829 from github/koesie10/fix-return-value
Fix incorrect `ReturnType` instead of `ReturnValue`
2023-09-19 17:52:20 +02:00
Robert
48399a9aeb Merge branch 'main' into robertbrignull/telemetry 2023-09-19 16:40:07 +01:00
Robert
c514575bc8 Merge pull request #2831 from github/version/bump-to-v1.9.1
Bump version to v1.9.1
2023-09-19 15:22:21 +01:00
Charis Kyriakou
651bc51ed6 Only download automodel query pack when relevant (#2830) 2023-09-19 15:11:15 +01:00
github-actions[bot]
dea6426c0b Bump version to v1.9.1 2023-09-19 13:49:34 +00:00
Koen Vlaswinkel
96a8bea50a Fix incorrect ReturnType instead of ReturnValue 2023-09-19 15:29:45 +02:00
Robert
297260af88 Merge pull request #2828 from github/v1.9.0
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
Release v1.9.0
2023-09-19 13:43:40 +01:00
Robert
26450e9236 Disable unit tests using MockGitHubApiServer 2023-09-19 11:37:25 +01:00
Robert
8d74933c70 v1.9.0 2023-09-19 10:13:20 +01:00
Robert
8136328ad6 Change node version to 18.15.0 2023-09-19 10:11:55 +01:00
Robert
d3df14f860 Merge pull request #2827 from github/robertbrignull/any/stderr
Avoid use of "as any" during error handling
2023-09-19 09:52:51 +01:00
Robert
31e233cc59 Add getChildProcessErrorMessage 2023-09-18 16:34:20 +01:00
Robert
23641a01d9 Avoid checking err.stderr when it's not necessary 2023-09-18 16:33:54 +01:00
Robert
209edf86e7 Merge pull request #2825 from github/robertbrignull/any/preview.ts
Avoid using "as any" in .storybook/preview.ts
2023-09-18 16:32:42 +01:00
Robert
3d410c9ce2 Merge pull request #2826 from github/robertbrignull/any/deploy.ts
Avoid use of "as any" in gulpfile.ts/deploy.ts
2023-09-18 16:27:28 +01:00
Robert
ef38ffaa6d Move resolution of package.json path to inside deployPackage 2023-09-18 15:49:06 +01:00
Robert
f195e93d91 Import type of package.json 2023-09-18 15:47:37 +01:00
Robert
26c301603d Include .storybook in deadcode detection 2023-09-18 15:36:56 +01:00
Robert
b9367095cf Avoid use of "as any" in gulpfile.ts/deploy.ts 2023-09-18 15:26:18 +01:00
Robert
3d415d2852 Avoid using "as any" in preview.ts 2023-09-18 15:14:28 +01:00
Robert
177c770f4d Delete config values that we on longer read directly 2023-09-18 11:15:34 +01:00
Robert
d4033615c8 Use onDidChangeTelemetryEnabled instead of listening for config value changes 2023-09-18 11:14:11 +01:00
Robert
9ec6590548 Use env.isTelemetryEnabled instead of checking configuration values ourselves 2023-09-18 11:14:11 +01:00
Robert
5fc9a73e20 Add telemtry tag to settings 2023-09-18 11:14:11 +01:00
Robert
af5547fb77 Use correct values of telemtetry level 2023-09-18 11:14:03 +01:00
Robert
1b0f0f4566 Merge pull request #2823 from github/robertbrignull/model-editor-changelog
Add changelog entry for model editor
2023-09-18 09:56:45 +01:00
Robert
1c81eb1b07 Merge pull request #2822 from github/robertbrignull/model-editor-feature-flag
Remove codeQL.model.editor feature flag
2023-09-18 09:56:32 +01:00
Robert
a506276635 Update custom telemetry setting description 2023-09-15 16:14:34 +01:00
Robert
f3e72a0ab8 Delete unused relevantSettings field 2023-09-15 16:04:58 +01:00
Robert
c7a9337ac0 Use .qualifiedName instead of writing out manually 2023-09-15 16:04:58 +01:00
Robert
c7bd343f54 Use sendTelemetryErrorEvent when sending errors 2023-09-15 16:04:58 +01:00
Robert
9c76ba35f1 Check both telemetry.telemetryLevel and telemetry.enableTelemetry 2023-09-15 16:04:13 +01:00
Robert
90093fb9f5 Rearrange settings so the telemetry settings are clearer 2023-09-15 15:01:32 +01:00
Robert
f183703b34 Add link to PR 2023-09-15 14:20:35 +01:00
Robert
49a3b534ae Add changelog entry for model editor 2023-09-15 14:19:38 +01:00
Koen Vlaswinkel
d83ca35f0c Merge pull request #2817 from github/koesie10/model-editor-row-tests
Add tests for model editor row and grid components
2023-09-15 14:04:53 +02:00
Koen Vlaswinkel
8bc8ffe1a1 Merge pull request #2820 from github/koesie10/cleanup-temp-directories
Cleanup temporary directories in model editor
2023-09-15 14:04:42 +02:00
Robert
ea2454742c Remove codeQL.model.editor feature flag 2023-09-15 12:22:22 +01:00
Koen Vlaswinkel
d970b51a7c Merge pull request #2814 from github/koesie10/test-model-editor-view
Add simple test for ModelEditorView
2023-09-15 13:19:13 +02:00
Koen Vlaswinkel
69f5d2c134 Cleanup model editor query dir after use 2023-09-15 11:59:11 +02:00
Koen Vlaswinkel
4d4a72bddb Cleanup automodel temporary pack after use 2023-09-15 11:59:11 +02:00
Koen Vlaswinkel
ac9355edd1 Rename restoreView test and add comment 2023-09-15 11:26:25 +02:00
Koen Vlaswinkel
2a9c8ef9dd Merge pull request #2816 from github/koesie10/simple-model-editor-react-tests
Add some simple model editor React unit tests
2023-09-15 11:22:37 +02:00
Koen Vlaswinkel
48f0b92d67 Merge pull request #2819 from github/github-action/bump-cli
Bump CLI Version to v2.14.5 for integration tests
2023-09-15 10:16:46 +02:00
Koen Vlaswinkel
57dcf58518 Merge pull request #2813 from github/koesie10/use-app-in-webview
Use `App` instead of `ExtensionContext` for webviews
2023-09-15 10:12:34 +02:00
github-actions[bot]
43efc9cc4c Bump CLI version from v2.14.4 to v2.14.5 for integration tests 2023-09-14 15:17:49 +00:00
Koen Vlaswinkel
17e0291bb5 Add tests for MethodRow 2023-09-14 14:41:03 +02:00
Koen Vlaswinkel
499060d549 Add tests for ModeledMethodDataGrid 2023-09-14 14:24:24 +02:00
Koen Vlaswinkel
a359fd7054 Add tests for ModeledMethodsList 2023-09-14 14:11:40 +02:00
Koen Vlaswinkel
d3a9426411 Add story and tests for LibraryRow 2023-09-14 14:06:36 +02:00
Koen Vlaswinkel
72faf86678 Add some simple model editor React unit tests 2023-09-14 13:45:45 +02:00
Koen Vlaswinkel
7f20921984 Add simple test for ModelEditorView 2023-09-14 12:20:01 +02:00
Koen Vlaswinkel
d7565fb849 Use App instead of ExtensionContext for webviews 2023-09-14 12:03:18 +02:00
Robert
9175449323 Merge pull request #2811 from github/robertbrignull/fix-jump-to-usage
Fix jumping to usage and updating method modeling panel
2023-09-13 13:07:24 +01:00
Robert
c8487c9431 Fix jumping to usage and updating method modeling panel 2023-09-13 12:41:53 +01:00
Robert
93fc90fcd0 Merge pull request #2790 from github/dependabot/github_actions/actions/checkout-4
Bump actions/checkout from 3 to 4
2023-09-12 16:53:57 +01:00
Robert
0a705a6bfa Merge pull request #2808 from github/robertbrignull/rename_hideModeledMethods_code
Rename hideModeledApis => hideModeledMethods throughout the code
2023-09-12 16:48:46 +01:00
Robert
b424157ab0 Merge pull request #2806 from github/robertbrignull/rename_externalApiUsages
Renames remaining references to "external API usage" in the code
2023-09-12 16:45:51 +01:00
github-actions[bot]
8c13124dfd Bump CLI version from v2.14.3 to v2.14.4 for integration tests (#2809)
Co-authored-by: github-actions[bot] <github-actions@github.com>
2023-09-12 15:13:34 +00:00
Robert
cbf0f279b9 Update extensions/ql-vscode/src/model-editor/model-editor-view.ts 2023-09-12 15:53:24 +01:00
Robert
a5b22fd0b9 Update extensions/ql-vscode/test/unit-tests/model-editor/bqrs.test.ts 2023-09-12 15:50:48 +01:00
Robert
c6736e8576 Merge pull request #2807 from github/robertbrignull/rename_hideModeledMethods_checkbox
Rename checkbox for hide modeled APIs => methods
2023-09-12 15:47:45 +01:00
Nick Rolfe
acf7270e39 Relax 'resolve ram' test (#2805) 2023-09-12 14:35:42 +01:00
Robert
3ae55e92b8 Rename hideModeledApis => hideModeledMethods throughout 2023-09-12 14:30:22 +01:00
Robert
c3fa83f301 Rename checkbox for hide modeled APIs => methods 2023-09-12 14:18:28 +01:00
Robert
9018cac91a Rename decodeBqrsToExternalApiUsages => decodeBqrsToMethods 2023-09-12 14:02:23 +01:00
Robert
aec742a508 Rename loadExternalApiUsages => loadMethods 2023-09-12 13:59:29 +01:00
Robert
64f6a770c3 Merge pull request #2800 from github/robertbrignull/num-hidden-methods
Add a row to the model editor tables showing how many methods have been hidden
2023-09-12 11:38:48 +01:00
Koen Vlaswinkel
7a2b61432c Merge pull request #2804 from github/koesie10/source-archive-model-editor
Do not add source archive folder for "Model dependency"
2023-09-12 12:10:58 +02:00
Robert
b04ecc959a Use pluralize 2023-09-12 10:18:26 +01:00
Robert
3ee16f88f2 Pull out props to separate variables instead of referencing props.foo 2023-09-12 10:14:10 +01:00
github-actions[bot]
ca079e085d Bump version to v1.8.13 (#2803)
Co-authored-by: github-actions[bot] <github-actions@github.com>
2023-09-11 14:52:33 +00:00
Koen Vlaswinkel
c93dd7a25b Do not add source archive folder for "Model dependency" 2023-09-11 15:45:46 +02:00
Shati Patel
9925b4e3bc v1.8.12 (#2801)
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
2023-09-11 14:02:23 +01:00
Koen Vlaswinkel
27f46062ae Merge pull request #2799 from github/koesie10/upgrade-semver
Upgrade transitive semver dependencies
2023-09-11 13:08:48 +02:00
Robert
e379320015 Add row showing how many methods are hidden 2023-09-11 11:57:18 +01:00
Robert
bbacb147d2 Hide table entirely if there aren't any non-hidden methods 2023-09-11 11:56:33 +01:00
Robert
58d38ff867 Move calculation of hidden/modelable rows into ModeledMethodDataGrid 2023-09-11 11:52:37 +01:00
Koen Vlaswinkel
90972defed Upgrade transitive semver dependencies 2023-09-11 10:51:07 +02:00
Andrew Eisenberg
3a8028cb6f Merge pull request #2786 from github/aeisenberg/extensible-predicate-metadata
Copy more files into the synthetic variant analysis pack
2023-09-08 09:38:49 -07:00
Koen Vlaswinkel
6e802b1212 Merge pull request #2798 from github/koesie10/group-framework-mode-models
Group framework mode model files by package
2023-09-08 17:17:53 +02:00
Koen Vlaswinkel
c868bdcdec Merge pull request #2797 from github/koesie10/sort-methods-alphabetically
Sort methods alphabetically
2023-09-08 16:54:52 +02:00
Koen Vlaswinkel
b1412912ec Merge pull request #2795 from github/koesie10/switch-mode-loading
Set loading state when switching between modes
2023-09-08 16:54:27 +02:00
Koen Vlaswinkel
708c5bc3ef Group framework mode model files by package 2023-09-08 16:08:13 +02:00
Koen Vlaswinkel
6f020d4b33 Sort methods alphabetically 2023-09-08 14:41:19 +02:00
Anders Starcke Henriksen
1b7a68a43e Merge pull request #2791 from github/starcke/model-editor-test-plan
Test plan for model editor.
2023-09-08 14:38:01 +02:00
Shati Patel
8f7befd031 Make "databases" the top panel in the CodeQL sidebar (#2796) 2023-09-08 12:23:01 +00:00
Koen Vlaswinkel
3157ffab88 Set empty array in ModelEditorView 2023-09-08 14:20:45 +02:00
Koen Vlaswinkel
bf024943a8 Merge pull request #2794 from github/koesie10/improve-model-editor
Improve responsiveness of model editor
2023-09-08 13:40:29 +02:00
Koen Vlaswinkel
b0eab8b9fe Set loading state when switching between modes 2023-09-08 13:34:08 +02:00
Koen Vlaswinkel
72ab83f15b Remove createLockFile argument 2023-09-08 12:56:02 +02:00
Koen Vlaswinkel
567cb10a57 Merge pull request #2793 from github/koesie10/feature-flag-flow-generation
Add feature flag for flow generation
2023-09-08 12:48:59 +02:00
Koen Vlaswinkel
13c2f5979e Add feature flag for flow generation 2023-09-08 12:07:27 +02:00
Koen Vlaswinkel
cecd8033bb Improve responsiveness of model editor 2023-09-08 12:06:26 +02:00
Anders Starcke Henriksen
35dfebd353 Fix linter. 2023-09-08 10:28:56 +02:00
Anders Starcke Henriksen
6e50d4af7b Address feedback. 2023-09-08 10:20:15 +02:00
Anders Starcke Henriksen
f8a90e5fba Update docs/test-plan.md
Co-authored-by: Koen Vlaswinkel <koesie10@users.noreply.github.com>
2023-09-08 10:01:02 +02:00
Robert
45312865b1 Merge pull request #2782 from github/robertbrignull/calculateModeledPercentage
Change calculateModeledPercentage to accept Method instead of using Pick
2023-09-07 16:51:53 +01:00
Robert
0897cdd96d Merge branch 'main' into dependabot/github_actions/actions/checkout-4 2023-09-07 16:37:03 +01:00
Robert
2e45dcd7b9 Merge pull request #2777 from github/robertbrignull/model-remove-disableAutoNameExtensionPack
Remove the disableAutoNameExtensionPack feature flag
2023-09-07 16:35:59 +01:00
Robert
4b93d341fe Merge pull request #2784 from github/robertbrignull/saving-progress
Make progress notifications more useful when calling loadExternalApiUsages
2023-09-07 16:35:28 +01:00
Robert
5922bdf0e0 Merge pull request #2785 from github/robertbrignull/in-progress-dropdown
Adjust styling of disabled dropdowns when automodeling is in progress
2023-09-07 16:31:15 +01:00
dependabot[bot]
709c49542e Bump actions/checkout from 3 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-07 13:19:53 +00:00
Anders Starcke Henriksen
860507dfa5 Merge pull request #2789 from github/version/bump-to-v1.8.12
Bump version to v1.8.12
2023-09-07 15:16:15 +02:00
github-actions[bot]
3a07e143de Bump version to v1.8.12 2023-09-07 12:40:41 +00:00
Anders Starcke Henriksen
baf959efa9 Test plan for model editor. 2023-09-07 14:35:17 +02:00
Anders Starcke Henriksen
df5a7bce19 Merge pull request #2788 from github/v1.8.11
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
v1.8.11
2023-09-07 13:51:35 +02:00
Anders Starcke Henriksen
1b3dc7d132 v1.8.11 2023-09-07 13:31:03 +02:00
Andrew Eisenberg
d8fb227cc7 Fix failing test 2023-09-05 14:49:36 -07:00
Andrew Eisenberg
767051e43f Update changelog 2023-09-05 13:31:18 -07:00
Andrew Eisenberg
d264bca304 Copy more files into the synthetic variant analysis pack
Before this change and starting with CLI v2.14.3, if you wanted to run
a variant analysis query and the pack it is contained in has at least
one query that contains an extensible predicate, this would be an error.

The reason is that v2.14.3 introduced deep validation for data
extensions. We are not copying the query that contains an extensible
predicate to the synthetic pack we are generating. This means that deep
validation will fail because there will be extensions that target the
missing extensible predicate.

This change avoids the problem by copying any query files that contain
extensible predicates to the synthetic pack. It uses the internal
`generate extensible-predicate-metadata` command to discover which
query files contain extensible predicates and copies them.
2023-09-05 13:28:53 -07:00
Robert
a2f1710aa5 Add story for when modeling is in progress 2023-09-05 16:58:10 +01:00
Robert
fd1c7f338d Make onChange optional 2023-09-05 16:58:10 +01:00
Robert
040a91a6d7 Use custom disabled placeholder text for InProgressDropdown 2023-09-05 16:58:10 +01:00
Robert
1e2acb0acb Clarify progress message from loadExternalApiUsages 2023-09-05 16:53:01 +01:00
Robert
2171ec1a03 Include cliServer.resolveQlpacks in the progress notification so there isn't a gap with no updates 2023-09-05 16:48:25 +01:00
Robert
8407516b31 Move progress notification to cover entire saveModeledMethods message handler 2023-09-05 16:45:50 +01:00
Robert
899cfb058c Store externalApiQueriesProgressMaxStep as a constant 2023-09-05 16:43:31 +01:00
Robert
95e4b04471 Move custom progress editing from loadExternalApiUsages into runExternalApiQueries 2023-09-05 16:43:03 +01:00
Robert
816b66c57c Move withProgress out of loadExternalApiUsages 2023-09-05 16:36:01 +01:00
Robert
247ba4e8ea Merge pull request #2779 from github/robertbrignull/dropdown-disabled
Adjust styling of disabled dropdowns to make their state clearer
2023-09-05 16:20:40 +01:00
Robert
a1c6a3a642 Change calculateModeledPercentage to accept Method instead of using Pick 2023-09-05 15:23:31 +01:00
Robert
e9a2028c10 Delete askForWorkspaceFolder 2023-09-05 11:03:01 +01:00
Shati Patel
a3ce9f516a Queries Panel: Create query from welcome view (#2780) 2023-09-05 10:34:38 +01:00
Robert
f6b3f28039 Merge pull request #2781 from github/robertbrignull/model-editor-telemetry
Emit telemetry for all messages sent from model editor
2023-09-05 10:04:14 +01:00
Robert
ba423376cd Emit telemetry for all messages sent from model editor 2023-09-04 17:13:29 +01:00
Robert
e9b459adaf Merge pull request #2778 from github/robertbrignull/MethodRow_stories
Provide stories for all states of MethodRow
2023-09-04 15:42:59 +01:00
Robert
074f3fb402 Move dropdown arrow away from the right-hand edge 2023-09-04 15:23:21 +01:00
Robert
c316d52514 Set opacity to 40% when disabled 2023-09-04 15:23:03 +01:00
Robert
9af0239041 Show a dash when dropdown is disabled 2023-09-04 15:22:52 +01:00
Robert
5cf6786e9c Merge branch 'main' into robertbrignull/MethodRow_stories 2023-09-04 14:19:35 +01:00
Charis Kyriakou
09077a0e24 Rename ExternalApiUsage to Method (#2776) 2023-09-04 14:10:10 +02:00
Robert
47c897e9bd Include stories for all modeled method types 2023-09-04 11:12:07 +01:00
Robert
096e6e8ffd Wrap MethodRow in a VSCodeDataGrid during story 2023-09-04 11:00:55 +01:00
Robert
480fa517ea Remove the disableAutoNameExtensionPack feature flag 2023-09-04 10:16:08 +01:00
Charis Kyriakou
2d033bff57 Update jump to usage to include the method (#2773) 2023-09-01 13:30:54 +01:00
Robert
1861692055 Merge pull request #2768 from github/robertbrignull/mocked-treeview
Use mockedObject for TreeView
2023-09-01 12:41:27 +01:00
Charis Kyriakou
ac7a37c02e Add ability to set method for modeling in the modeling panel (#2767) 2023-09-01 11:16:10 +00:00
Robert
b5d6c4d84c Merge pull request #2771 from github/robertbrignull/normalize-feature-flag
Make methodModelingView match the naming of other flags
2023-09-01 11:05:10 +01:00
Anders Starcke Henriksen
cdd6553735 Merge pull request #2772 from github/starcke/fix-rename-comment
Fix a comment that should be renamed.
2023-09-01 11:52:00 +02:00
Anders Starcke Henriksen
6bb0854ff2 Fix a comment that should be renamed. 2023-09-01 11:26:33 +02:00
Robert
c51aaf7790 Make methodModelingView match the other flags 2023-09-01 10:19:12 +01:00
Anders Starcke Henriksen
a6745379c4 Merge pull request #2766 from github/starcke/rename-ff
Rename feature flags.
2023-09-01 10:35:28 +02:00
Robert
1178e4c3ae Merge pull request #2770 from github/robertbrignull/model-beta-label
Add beta label to model editor
2023-08-31 15:49:27 +01:00
Robert
59c567a8fa Add beta label to model editor 2023-08-31 15:25:54 +01:00
Shati Patel
4f2b46aa85 Add "create query" button to queries panel (#2764) 2023-08-31 15:02:25 +01:00
Shati Patel
66f12bfbef Make the "Create query" location workspace-specific (#2769) 2023-08-31 15:02:10 +01:00
Robert
2b5d233847 Use mockedObject for TreeView 2023-08-31 12:01:49 +01:00
Robert
11ca60f213 Merge pull request #2738 from github/robertbrignull/useScrollIntoView
Convert ScrollIntoViewHelper into a React hook
2023-08-31 10:58:50 +01:00
Robert
dea6bc257a Merge branch 'main' into robertbrignull/useScrollIntoView 2023-08-31 10:37:16 +01:00
Charis Kyriakou
26b602399a Extract external api usage name component and reuse it (#2765) 2023-08-31 10:12:19 +01:00
Anders Starcke Henriksen
0836307f29 Rename feature flags. 2023-08-31 09:46:22 +02:00
Anders Starcke Henriksen
e61f619f8f Merge pull request #2763 from github/starcke/rename-vars
Starcke/rename vars
2023-08-31 09:17:20 +02:00
Nora
fad674b1c5 Merge pull request #2760 from github/nora/add-components-to-modeling-panel
Adds container and header css to new method model sidebar
2023-08-30 17:37:34 +02:00
Nora
4d2856699b polish 2023-08-30 15:14:51 +00:00
Shati Patel
b51d027b0c Make "create query" command available when queries panel is enabled (#2762) 2023-08-30 16:09:39 +01:00
Nora
595249a9d6 Addning props and minor changes 2023-08-30 15:05:11 +00:00
Anders Starcke Henriksen
00b3ea473c Misc renames. 2023-08-30 16:36:17 +02:00
Anders Starcke Henriksen
46f80efa4c Rename in strings. 2023-08-30 16:36:17 +02:00
Anders Starcke Henriksen
05a7d933d1 Rename DataExtensionsEditor 2023-08-30 16:36:17 +02:00
Anders Starcke Henriksen
6da39ee79f Rename "DataExtensionEditor". 2023-08-30 16:36:17 +02:00
Anders Starcke Henriksen
bb4d97999e Merge pull request #2761 from github/starcke/rename-files2
Rename files.
2023-08-30 16:35:52 +02:00
Anders Starcke Henriksen
af3434b87c Remove spurious theme. 2023-08-30 16:08:42 +02:00
Nora
083b232bb3 Fix merge conflict 2023-08-30 13:35:03 +00:00
Nora
a65c91c84e Add Container and Header 2023-08-30 13:33:32 +00:00
Anders Starcke Henriksen
23f8c48b06 Rename files. 2023-08-30 15:06:45 +02:00
Anders Starcke Henriksen
7fbb1286b9 Merge pull request #2759 from github/starcke/rename-files
Starcke/rename files
2023-08-30 14:50:51 +02:00
Anders Starcke Henriksen
571e6f285f Update webview enum. 2023-08-30 13:59:51 +02:00
Anders Starcke Henriksen
e64cf4073c Rename data-extension-editor files. 2023-08-30 13:46:48 +02:00
Anders Starcke Henriksen
e3a2a11b3d Merge pull request #2754 from github/starcke/rename-directories
Starcke/rename directories
2023-08-30 09:11:00 +02:00
Anders Starcke Henriksen
9b121d56c2 Merge branch 'main' into starcke/rename-directories 2023-08-29 15:38:08 +02:00
Anders Starcke Henriksen
b548bbd43b Merge pull request #2758 from github/starcke/more-java-update
Change the java query to work for multiple java versions.
2023-08-29 15:37:28 +02:00
Anders Starcke Henriksen
ccdb46a1bb Merge branch 'main' into starcke/rename-directories 2023-08-29 15:16:33 +02:00
Anders Starcke Henriksen
d1a342beaf Merge pull request #2757 from github/starcke/automodel-pack
Use auto-model pack to run auto-model queries.
2023-08-29 15:12:03 +02:00
Anders Starcke Henriksen
eeac123ee5 Update non-build references. 2023-08-29 14:39:22 +02:00
Anders Starcke Henriksen
73c596c87a Rename other directories. 2023-08-29 14:38:18 +02:00
Anders Starcke Henriksen
c6f40b3152 Rename main directory. 2023-08-29 14:38:18 +02:00
Anders Starcke Henriksen
3a0843219e Change the java query to work for multiple java versions. 2023-08-29 13:57:16 +02:00
Anders Starcke Henriksen
b00a2cc803 Use auto-model pack to run auto-model queries. 2023-08-29 13:39:44 +02:00
Anders Starcke Henriksen
14b9f932ab Merge pull request #2731 from github/starcke/no-submodule
Make automodel and flow queries work without submodule.
2023-08-29 12:45:22 +02:00
Anders Starcke Henriksen
f3e32baec4 Update extensions/ql-vscode/src/data-extensions-editor/external-api-usage-queries.ts
Co-authored-by: Charis Kyriakou <charisk@users.noreply.github.com>
2023-08-29 11:45:32 +02:00
Anders Starcke Henriksen
20e5429af8 Merge pull request #2755 from github/starcke/fix-neutral-fetch
Fix ql code in neutral fetch.
2023-08-29 09:29:59 +02:00
Dave Bartolomeo
d23178be85 Merge pull request #2756 from github/github-action/bump-cli
Bump CLI Version to v2.14.3 for integration tests
2023-08-28 12:18:48 -04:00
Andrew Eisenberg
b09e9942b2 Add more path triggers for cli-test.yml 2023-08-28 15:25:00 +00:00
github-actions[bot]
fc5cfd0aec Bump CLI version from v2.14.2 to v2.14.3 for integration tests 2023-08-28 13:45:42 +00:00
Anders Starcke Henriksen
259159df45 Add missing pack download and fix lock file creation. 2023-08-28 13:22:03 +02:00
Anders Starcke Henriksen
bc7c97e216 Fix ql code in neutral fetch. 2023-08-28 09:42:04 +02:00
Charis Kyriakou
af22a1573b Add new method modeling panel (#2752) 2023-08-25 15:47:57 +00:00
Anders Starcke Henriksen
d2eb366e74 Make automodel and flow queries work without submodule. 2023-08-25 14:57:54 +02:00
Anders Starcke Henriksen
6a6028bf63 Merge pull request #2746 from github/starcke/update-editor-name
Update editor name in visible strings.
2023-08-25 14:13:19 +02:00
Charis Kyriakou
3c7e1fc192 Remove codeQL.dataExtensions.frameworkMode setting (#2753) 2023-08-25 11:28:21 +00:00
Anders Starcke Henriksen
0433f899fd Merge pull request #2750 from github/starcke/fetch-queries-out-of-view
Starcke/fetch queries out of view
2023-08-25 13:25:04 +02:00
Charis Kyriakou
c82f00eb45 Rename ModelDetail to MethodsUsage in types and functions (#2751) 2023-08-25 11:06:21 +01:00
Shati Patel
94edb9bf16 Merge pull request #2749 from github/shati-patel/implement-dropdown
Make "result format" dropdown determine result display
2023-08-25 10:52:23 +01:00
Shati Patel
4a87a6fddf Merge pull request #2745 from github/shati-patel/result-format-view
Display "result format" dropdown in results view for (path-)problem queries
2023-08-25 09:46:54 +01:00
Anders Starcke Henriksen
9543ab339f Update tests. 2023-08-25 09:50:01 +02:00
Anders Starcke Henriksen
398f16c4cb Change fetch queries to use shared methods. 2023-08-25 09:49:57 +02:00
Anders Starcke Henriksen
ea14767f2a Rename methods in fetch queries. 2023-08-25 09:28:46 +02:00
Anders Starcke Henriksen
b6deb8e0ea Merge pull request #2744 from github/starcke/general-setup
Move pack setup out of fetch queries.
2023-08-25 09:26:01 +02:00
Nora
7b78fc1dd9 Merge pull request #2748 from github/nora/rename-method-usages-folder
Rename methods usage folder and command
2023-08-24 20:02:28 +02:00
shati-patel
0ccd39a368 Update changelog 2023-08-24 17:37:40 +01:00
shati-patel
24b93e247c Make "result format" dropdown determine result display 2023-08-24 17:28:54 +01:00
Nora
6e3b0b245c Merge pull request #2747 from github/nora/rename-model-details-files
Rename methods usage panel files
2023-08-24 18:12:39 +02:00
Nora
6939caa6a5 Rename command and folders 2023-08-24 15:22:13 +00:00
Nora
2e8e7cae47 Rename files only 2023-08-24 15:13:01 +00:00
shati-patel
f8d542d141 Only show the "result format" dropdown for (path-)problem queries 2023-08-24 15:44:08 +01:00
shati-patel
6715669036 Add "result format" dropdown to MRVA view 2023-08-24 15:44:07 +01:00
Shati Patel
c38a01e937 Add a dropdown for choosing MRVA result format (#2743) 2023-08-24 14:42:44 +00:00
Anders Starcke Henriksen
74a12b9fed Move test to separate file. 2023-08-24 16:16:24 +02:00
Anders Starcke Henriksen
906af36337 Update editor name in visible strings. 2023-08-24 16:07:33 +02:00
Anders Starcke Henriksen
359e23fc59 Fix test. 2023-08-24 13:53:34 +02:00
Anders Starcke Henriksen
b13dd7545c Merge branch 'main' into starcke/general-setup 2023-08-24 13:45:00 +02:00
Anders Starcke Henriksen
ac0dfa5e83 Merge pull request #2742 from github/starcke/flow-queries-refactor
Starcke/flow queries refactor
2023-08-24 13:38:13 +02:00
Shati Patel
2ffb7894d4 Always read BQRS results file (#2741) 2023-08-24 12:11:51 +01:00
Nora
422f6de05e Merge pull request #2735 from github/nora/test-model-details-view
Add tests for Model Details View
2023-08-24 12:33:51 +02:00
Shati Patel
ee88ea1658 Store query @kind when running a variant analysis (#2740) 2023-08-24 10:18:20 +01:00
Nora
0daa06bc0d rename test and remove boolean type 2023-08-24 08:58:37 +00:00
Anders Starcke Henriksen
c584d02805 Merge pull request #2734 from github/starcke/automodel-queries-refactor
Starcke/automodel queries refactor
2023-08-24 09:57:32 +02:00
Nora
c56936e2f6 create and use factories 2023-08-23 16:06:30 +00:00
Anders Starcke Henriksen
1fc735639b Merge pull request #2733 from github/starcke/refactor-names
Rename query files to have consistent suffix.
2023-08-23 12:58:18 +02:00
Charis Kyriakou
0352629eb4 Rename WebviewView to WebviewKind (#2739) 2023-08-23 11:27:58 +01:00
Anders Starcke Henriksen
877fc51494 Move pack setup out of fetch queries. 2023-08-23 11:27:18 +02:00
Anders Starcke Henriksen
886f211441 Change flow queries to use shared methods. 2023-08-23 11:27:03 +02:00
Anders Starcke Henriksen
75d275c93f Rename methods in flow queries. 2023-08-23 11:27:03 +02:00
Anders Starcke Henriksen
5d1fa1d6b5 Reorder methods in flow queries. 2023-08-23 11:27:03 +02:00
Anders Starcke Henriksen
4fce448717 Address comments. 2023-08-23 11:26:23 +02:00
Robert
610c936690 Add useScrollIntoView hook 2023-08-22 17:01:25 +01:00
Robert
d777427c0a Merge pull request #2737 from github/robertbrignull/AlertTable-functional
Convert AlertTable to a function component
2023-08-22 16:59:00 +01:00
Charis Kyriakou
81924af1e4 Don't download artifacts for repos with no results in MRVA (#2736)
* Don't download artifacts for repos with no results

* Remove getVariantAnalysisRepoResult requests for repos with no results

* Run fix-scenario-file-numbering for mrva-problem-query-success scenario

* Update CHANGELOG
2023-08-22 16:23:40 +01:00
Nora
45f7d22d2a Add reveal test 2023-08-22 13:11:46 +00:00
Robert
dcef43c6d5 Convert updateSelectionCallback to use useCallback 2023-08-22 14:08:14 +01:00
Robert
160642ec73 Convert toggle to use useCallback 2023-08-22 14:07:54 +01:00
Robert
240dd51dc0 Convert handleNavigationEvent to use useCallback 2023-08-22 14:07:54 +01:00
Robert
ad42b060b7 Decompose props earlier 2023-08-22 14:07:54 +01:00
Robert
23b2327bd0 Convert AlertTable to a function component 2023-08-22 14:07:52 +01:00
Robert
450d294bab Move render to the end of the component 2023-08-22 14:04:48 +01:00
Robert
4e376063ee Move getNewSelection to before it is used 2023-08-22 14:02:56 +01:00
Anders Starcke Henriksen
39cb219e56 Fix broken reference in test. 2023-08-22 14:53:04 +02:00
Anders Starcke Henriksen
e01fb9172f Update tests. 2023-08-22 14:23:26 +02:00
Anders Starcke Henriksen
1764151bf7 Change automodel queries to use shared methods. 2023-08-22 14:20:59 +02:00
Anders Starcke Henriksen
82c40c69e6 Add generalized run query method. 2023-08-22 14:18:19 +02:00
Anders Starcke Henriksen
1a34d782e8 Reorder methods in automodel queries. 2023-08-22 14:16:18 +02:00
Anders Starcke Henriksen
08c1b57661 Rename query files to have consistent suffix. 2023-08-22 14:06:22 +02:00
Robert
5fc34248b3 Merge pull request #2732 from github/robertbrignull/AlertTable-decompose
Split AlertTable into smaller components
2023-08-22 12:24:12 +01:00
Robert
bee7d81fb4 Merge branch 'main' into robertbrignull/AlertTable-decompose 2023-08-22 11:40:45 +01:00
Charis Kyriakou
3094405f68 Split out CLI version tests to separate workflow (#2729) 2023-08-22 11:28:36 +01:00
Nora
392e76d8f2 Add getChildren tests 2023-08-22 08:56:42 +00:00
Nora
6e4e89a006 Move dataProvider creation to beforeEach 2023-08-22 08:56:07 +00:00
Nora
cb2802e2e7 Add mode details panel test 2023-08-22 08:55:25 +00:00
Robert
af1af074dc Convert updateSelectionCallback to not use double-nested methods 2023-08-21 17:17:37 +01:00
Robert
d65ce3e24a Use useCallback when calling toggleExpanded 2023-08-21 17:13:49 +01:00
Robert
13ce5f7e3c Merge pull request #2730 from github/robertbrignull/details-ship
Remove config.codeQL.dataExtensions.modelDetailsView feature flag
2023-08-21 14:53:24 +01:00
Robert
eebe11e5dd Simplify passing similar props 2023-08-21 14:52:42 +01:00
Robert
bd5d361de1 Pass around toggle instead of toggler 2023-08-21 14:26:10 +01:00
Robert
e3596db8e7 Remove rows array and render AlertTableResultRow inline 2023-08-21 14:26:10 +01:00
Robert
21b1c997c6 Move rendering of AlertTablePathRow to inside of AlertTableResultRow 2023-08-21 14:26:09 +01:00
Robert
9ecf97152a Move rendering of msg to inside AlertTableResuiltRow 2023-08-21 14:25:42 +01:00
Robert
3983087bc8 Use useMemo for callback passed to SarifLocation.onClick in AlertTableResultRow 2023-08-21 14:25:08 +01:00
Robert
636d0bf025 Move rendering of locationCells to inside AlertTableResuiltRow 2023-08-21 14:25:08 +01:00
Robert
fe4d87dae5 Teach AlertTableResultRow how to render results without codeFlows 2023-08-21 14:25:06 +01:00
Robert
1794c6b7f7 Simplify rendering in AlertTable 2023-08-21 14:24:36 +01:00
Robert
23d815ff05 Use useMemo for callback passed to AlertTableDropdownIndicatorCell.onClick in AlertTableResultRow 2023-08-21 14:24:25 +01:00
Robert
8945abcb57 Pull out AlertTableResultRow to a separate component 2023-08-21 14:23:57 +01:00
Robert
a576dace04 Do all rendering in AlertTablePathRow in one place 2023-08-21 14:23:05 +01:00
Robert
3e7577c984 Use useMemo for callback passed to AlertTableDropdownIndicatorCell.onClick in AlertTablePathRow 2023-08-21 14:21:58 +01:00
Robert
acb76a64ef Pull out AlertTablePathRow to a separate component 2023-08-21 14:20:45 +01:00
Robert
ba0cf9a22d Use useMemo for callback passed to SarifLocation.onClick in AlertTablePathNodeRow 2023-08-21 14:19:54 +01:00
Robert
443c9ac56c Inline some rendering in AlertTablePathNodeRow 2023-08-21 14:19:53 +01:00
Robert
91e69c93be Pull out AlertTablePathNodeRow to a separate component 2023-08-21 14:19:53 +01:00
Robert
7e31b6e42a Construct rows using maps instead of mutating array from multiple places 2023-08-21 14:19:52 +01:00
Robert
cff7170fdc Move AlertTableTruncatedMessage to a new component in a new file 2023-08-21 14:17:47 +01:00
Robert
ca40963238 Move AlertTableNoResults to a new component in a new file 2023-08-21 14:17:45 +01:00
Robert
b1ff75b646 Remove config.codeQL.dataExtensions.modelDetailsView feature flag 2023-08-21 12:32:45 +01:00
Robert
e5ab1118ee Merge pull request #2719 from github/koesie10/fix-button-accessibility
Fix button accessibility
2023-08-21 11:48:36 +01:00
Robert
d90fb69e39 Merge branch 'main' into koesie10/fix-button-accessibility 2023-08-21 11:11:35 +01:00
Robert
2f4eed4a4d Merge pull request #2726 from github/koesie10/fix-alert-table-accessibility
Fix accessibility of alert table
2023-08-21 11:04:41 +01:00
Nora
2cb520d603 Merge pull request #2717 from github/nora/hide-modeled-on-model-details-view
Respect the "Hide modeled APIs" checkbox in the model details view
2023-08-21 11:09:48 +02:00
Charis Kyriakou
4a752d27c4 Moves mock GitHub API to /common (#2728)
* Move mock GitHub API to /common

* Rename MRVA mock scenarios

* Update mock GitHub API docs
2023-08-21 08:49:27 +01:00
Nora
6cfd20eca4 Set hodeModeledApis variable 2023-08-21 07:29:37 +00:00
dependabot[bot]
36259b21db Bump @testing-library/jest-dom in /extensions/ql-vscode (#2723)
Bumps [@testing-library/jest-dom](https://github.com/testing-library/jest-dom) from 5.16.5 to 6.0.0.
- [Release notes](https://github.com/testing-library/jest-dom/releases)
- [Changelog](https://github.com/testing-library/jest-dom/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/jest-dom/compare/v5.16.5...v6.0.0)

---
updated-dependencies:
- dependency-name: "@testing-library/jest-dom"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Charis Kyriakou <charisk@users.noreply.github.com>
2023-08-18 15:39:28 +01:00
dependabot[bot]
cd14a37f79 Bump lint-staged from 13.2.0 to 14.0.0 in /extensions/ql-vscode (#2722)
Bumps [lint-staged](https://github.com/okonet/lint-staged) from 13.2.0 to 14.0.0.
- [Release notes](https://github.com/okonet/lint-staged/releases)
- [Commits](https://github.com/okonet/lint-staged/compare/v13.2.0...v14.0.0)

---
updated-dependencies:
- dependency-name: lint-staged
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Charis Kyriakou <charisk@users.noreply.github.com>
2023-08-18 14:55:10 +01:00
Koen Vlaswinkel
d6e0c6a4a7 Fix accessibility of alert table dropdown 2023-08-18 13:28:17 +02:00
Koen Vlaswinkel
9f589880df Split alert table dropdown indicator cell 2023-08-18 13:26:45 +02:00
Koen Vlaswinkel
b7a4419420 Add story for AlertTable 2023-08-18 13:26:19 +02:00
Koen Vlaswinkel
1d2ef805fb Merge remote-tracking branch 'origin/main' into koesie10/fix-button-accessibility 2023-08-18 10:03:54 +02:00
Koen Vlaswinkel
2888fddf61 Move all ResultTablesHeader styles to styled-components 2023-08-18 10:03:36 +02:00
Koen Vlaswinkel
a5c675b8c7 Add story for ResultTablesHeader 2023-08-18 09:58:34 +02:00
Shati Patel
d05dba4bba Fix changelog entry (#2725) 2023-08-17 16:13:40 +00:00
Shati Patel
2db0ca8ecc Group extension settings in the VS Code UI (#2706) 2023-08-17 16:48:15 +01:00
Robert
497dc31819 Merge pull request #2716 from github/robertbrignull/data-renames
Rename files in src/view/results to match their components
2023-08-17 15:23:38 +01:00
Nora
cd309aece6 Adjust badge number 2023-08-17 12:53:24 +00:00
Nora
aaaf799557 Add test 2023-08-17 12:27:16 +00:00
Nora
ece54b8f7d Make all setStage arguments mandatory 2023-08-17 12:26:13 +00:00
Nora
0824892507 Move post message and use effect 2023-08-17 11:02:20 +00:00
Nora
082268e201 Rename constant file 2023-08-17 11:00:45 +00:00
Nora
27bce4a1e9 Add tests 2023-08-17 09:19:01 +00:00
Nora
56ecd1a84c hide unmodeled apis 2023-08-17 09:19:01 +00:00
Nora
84ab602277 Send message from from view 2023-08-17 09:19:01 +00:00
Koen Vlaswinkel
a86a373e19 Merge pull request #2718 from github/koesie10/upgrade-storybook
Upgrade Storybook
2023-08-17 10:04:36 +02:00
Koen Vlaswinkel
90a39ec293 Use button instead of a for raw results link 2023-08-16 16:45:51 +02:00
Koen Vlaswinkel
3dd8583116 Use button instead of a for clickable location links 2023-08-16 16:45:47 +02:00
Koen Vlaswinkel
b0663669b0 Use button instead of a for compare table queries 2023-08-16 16:45:44 +02:00
Koen Vlaswinkel
493c9cb5fe Add story for compare table 2023-08-16 16:45:41 +02:00
Robert
99dd9166b3 Merge pull request #2709 from github/robertbrignull/details-visible
Only show the details view when a data extensions editor is open
2023-08-16 15:28:38 +01:00
Koen Vlaswinkel
10604808e0 Upgrade Storybook 2023-08-16 15:45:28 +02:00
Robert
3164c3f11f Rename results.tsx => ResultsApp.tsx 2023-08-16 13:21:07 +01:00
Robert
ed36fb725b Rename raw-results-table.tsx => RawTable.tsx 2023-08-16 13:21:07 +01:00
Robert
67b138f0c2 Rename graph.tsx => Graph.tsx 2023-08-16 13:21:04 +01:00
Robert
fed9870a0c Only show the details view when a data extensions editor is open 2023-08-16 13:06:14 +01:00
Robert
51844bb541 Merge pull request #2705 from github/robertbrignull/details-multiple-editors
Allow the details view to handle multiple open data extensions editors
2023-08-16 12:47:44 +01:00
Robert
0acd06f773 Rename alert-table.tsx => AlertTable.tsx 2023-08-16 10:35:59 +01:00
Robert
acb9669e9f Merge pull request #2714 from github/robertbrignull/EmptyQueryResultsMessage
Move EmptyQueryResultsMessage out of results-table-utils
2023-08-16 10:05:58 +01:00
Charis Kyriakou
2a71183695 Start with collapsed items in data extensions editor (#2713) 2023-08-15 17:06:12 +01:00
Robert
1c3d3428e4 Merge pull request #2712 from github/robertbrignull/AlertTableHeader-filename
Rename alert-table-header.tsx => AlertTableHeader.tsx
2023-08-15 16:58:55 +01:00
Robert
c77bb2b9c2 Rename result-table-utils.tsx => result-table-utils.ts 2023-08-15 16:44:29 +01:00
Robert
d3d96a1dbe Make EmptyQueryResultsMessage into a component 2023-08-15 16:42:10 +01:00
Robert
7c62176f59 Rename alert-table-header.tsx => AlertTableHeader.tsx 2023-08-15 16:31:55 +01:00
Robert
87754a9ec9 Move mostRecentlyActiveView variable to DataExtensionsEditorModule 2023-08-15 15:36:14 +01:00
Robert
ee78df683a Add onPanelWasDisposed 2023-08-15 15:16:37 +01:00
Robert
3764a7e567 Split isTheMostRecentlyActivePanel into two methods 2023-08-15 15:14:15 +01:00
Robert
552baa5570 Merge branch 'main' into robertbrignull/details-multiple-editors 2023-08-15 14:57:45 +01:00
Charis Kyriakou
57262446fb Merge pull request #2711 from github/version/bump-to-v1.8.11
Bump version to v1.8.11
2023-08-15 14:07:35 +01:00
Robert
5b128711e5 Merge pull request #2708 from github/robertbrignull/details-updates
Only update the details view when data has changed
2023-08-15 14:01:35 +01:00
Robert
6787deed04 Use not.toHaveBeenCalled() 2023-08-15 11:16:44 +01:00
Robert
381e8c0849 Fix test name 2023-08-15 11:15:32 +01:00
github-actions[bot]
74c6f3ce54 Bump version to v1.8.11 2023-08-15 10:08:02 +00:00
Charis Kyriakou
0c2773481a v1.8.10 (#2710)
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
2023-08-15 10:41:34 +01:00
Robert
96660ebbf9 Merge pull request #2702 from github/robertbrignull/ResultTables
Convert ResultTables to a function component
2023-08-15 09:45:56 +01:00
Dave Bartolomeo
e308c2b8c9 Merge pull request #2685 from github/shati-patel/get-current-query
Fix `getCurrentQuery` to look at active tabs instead of active text editors
2023-08-14 12:35:56 -04:00
Robert
35622a94f2 Move ProblemsViewCheckbox to a separate component 2023-08-14 17:08:13 +01:00
Robert
2ff0ee58fc Move ResultCount to a separate component 2023-08-14 16:54:33 +01:00
Alexander Eyers-Taylor
a965ea4044 Graph: Set fill color for all graph text (#2707)
Grapviz no longer sets it to the default so we don't have anything to
override
2023-08-14 15:53:25 +00:00
Robert
194c8d5cfc Make hook imports consistent 2023-08-14 16:49:43 +01:00
Robert
4e70c8999f Only update the details view when data has changed 2023-08-14 15:55:01 +01:00
Shati Patel
2569f631a2 Add code lens for "Open referenced file" (#2704) 2023-08-14 15:26:43 +01:00
Robert
6005e3ab70 Update details view on view state changes, and remember the most recently active panel 2023-08-14 15:02:40 +01:00
Robert
7c93c7046e Store the latest set of external API usages on the view class 2023-08-14 14:08:10 +01:00
Koen Vlaswinkel
a46209b22d Merge pull request #2701 from github/koesie10/fix-duplicate-test-running
Fix running tests twice when test paths are passed
2023-08-14 13:28:54 +02:00
Robert
408d38dc88 Merge pull request #2703 from github/robertbrignull/InProgressMethods_immutable
Make InProgressMethods immutable so it's safer to use as react state
2023-08-14 12:26:24 +01:00
Robert
55aeb3ce86 Update extensions/ql-vscode/src/data-extensions-editor/shared/in-progress-methods.ts
Co-authored-by: Koen Vlaswinkel <koesie10@users.noreply.github.com>
2023-08-14 11:27:38 +01:00
Robert
37c461a89b Make InProgressMethods immutable so it's safer to use as react state 2023-08-14 10:46:24 +01:00
Robert
1595f7c879 Merge pull request #2700 from github/robertbrignull/data-rows
Fix spacing of columns
2023-08-14 10:32:20 +01:00
Robert
a893bf7a77 Merge pull request #2688 from github/robertbrignull/data-view-jump
Implementing expanding/selecting item in details view when clicking "view"
2023-08-14 10:15:17 +01:00
Robert
81579351cd Convert resultSet to use useMemo 2023-08-14 09:47:07 +01:00
Koen Vlaswinkel
1b0bcb3d2f Fix running tests twice when test paths are passed
When running tests using `--runTestsByPath <some-path>`, the tests were
being run twice because jest-runner-vscode
[resolves test paths](0c98dc12ad/packages/jest-runner-vscode/src/runner.ts (L57-L66)),
while the original arguments were also still passed to Jest. So, the
arguments Jest would receive would look something like
`test/vscode-tests/no-workspace/databases/local-databases/locations.test.ts /Users/koesie10/github/vscode-codeql/extensions/ql-vscode/test/vscode-tests/no-workspace/databases/local-databases/locations.test.ts`
which would cause Jest to run the tests twice. This fixes this by
resolving the paths to their absolute paths, and then removing any
duplicates.
2023-08-14 10:22:24 +02:00
Robert
8713a5403f Convert resultSets to use useMemo 2023-08-11 17:32:31 +01:00
Robert
943a61b6a9 Convert getOffset to just a number 2023-08-11 17:31:44 +01:00
Robert
3652e52312 Convert alertTableExtras to use useMemo 2023-08-11 17:30:14 +01:00
Robert
94a8536f28 Move condition check into alertTableExtras 2023-08-11 17:27:02 +01:00
Robert
4e0ab5b46e Convert handleCheckboxChanged to use useCallback 2023-08-11 17:24:42 +01:00
Robert
f761083342 Move handleCheckboxChanged out of alertTableExtras 2023-08-11 17:24:03 +01:00
Robert
57241c906e Convert onTableSelectionChange to use useCallback 2023-08-11 17:23:06 +01:00
Robert
ee20a28fdc Add dependencies to useEffect hooks 2023-08-11 17:22:43 +01:00
Robert
d173ff3c48 Convert vscodeMessageHandler to use useCallback 2023-08-11 17:22:21 +01:00
Robert
da8f959c42 Convert handleMessage to use useCallback 2023-08-11 17:21:24 +01:00
Robert
3d9f34e658 Naiely convert to function component 2023-08-11 17:17:50 +01:00
Robert
c124192879 Delete sendResultsPageChangedTelemetry as it is unused 2023-08-11 17:08:25 +01:00
Robert
2cb6a95ffd Move handleMessage and componentDidMount to be before render method 2023-08-11 16:48:50 +01:00
Robert
c0568a837c Move vscodeMessageHandler to before it is used 2023-08-11 16:46:45 +01:00
Robert
1f20836d53 Fix spacing of columns 2023-08-11 16:16:07 +01:00
Robert
5bf56baab8 Merge branch 'main' into robertbrignull/data-view-jump 2023-08-11 15:56:31 +01:00
Robert
dd0534b353 Merge pull request #2666 from github/robertbrignull/ResultTables-Header
Move ResultTablesHeader to its own component
2023-08-11 15:45:41 +01:00
Robert
dd89f0d337 Merge branch 'main' into robertbrignull/ResultTables-Header 2023-08-11 14:48:07 +01:00
Shati Patel
616bdb9021 Merge branch 'main' into shati-patel/get-current-query 2023-08-11 13:51:42 +01:00
github-actions[bot]
3b7f7e5528 Bump CLI version from v2.14.1 to v2.14.2 for integration tests (#2699)
Co-authored-by: github-actions[bot] <github-actions@github.com>
2023-08-11 12:26:41 +00:00
Charis Kyriakou
11a9668e44 Merge pull request #2698 from github/charisk/remove-automodel-v1
Remove automodel v1 code
2023-08-11 13:22:16 +01:00
Robert
1e0a7555f9 Merge branch 'main' into robertbrignull/data-view-jump 2023-08-11 12:28:54 +01:00
Robert
a52e067636 Merge branch 'main' into robertbrignull/ResultTables-Header 2023-08-11 12:26:21 +01:00
Charis Kyriakou
feb4bb61fe Drop v2 from automodel code 2023-08-11 11:07:25 +00:00
Charis Kyriakou
2a5b6ea95b Remove automodel v1 2023-08-11 11:07:19 +00:00
Nora
217114777f Merge pull request #2683 from github/nora/model-details-view-styling
Add icons and main badge to Model Details View
2023-08-11 11:52:15 +02:00
Koen Vlaswinkel
2cac3181a8 Merge pull request #2697 from github/koesie10/downgrade-octokit
Revert "Bump @octokit/plugin-retry from 4.1.6 to 6.0.0"
2023-08-11 10:41:10 +02:00
Koen Vlaswinkel
9ebf99a572 Merge pull request #2693 from github/dependabot/npm_and_yarn/extensions/ql-vscode/patch-package-8.0.0
Bump patch-package from 7.0.0 to 8.0.0 in /extensions/ql-vscode
2023-08-11 10:35:42 +02:00
Koen Vlaswinkel
3059e78ca4 Merge pull request #2694 from github/dependabot/npm_and_yarn/extensions/ql-vscode/cosmiconfig-8.2.0
Bump cosmiconfig from 7.1.0 to 8.2.0 in /extensions/ql-vscode
2023-08-11 10:32:22 +02:00
Koen Vlaswinkel
7d9d1077fd Revert "Bump @octokit/plugin-retry from 4.1.6 to 6.0.0 in /extensions/ql-vscode (#2602)"
This reverts commit e938a6a9cb.
2023-08-11 10:15:01 +02:00
Anders Starcke Henriksen
b3e81ffa53 Merge pull request #2691 from github/starcke/more-kinds
Add more sink and source kinds.
2023-08-11 09:45:42 +02:00
Koen Vlaswinkel
0ef688792b Merge pull request #2692 from github/dependabot/npm_and_yarn/extensions/ql-vscode/eslint-config-prettier-9.0.0
Bump eslint-config-prettier from 8.5.0 to 9.0.0 in /extensions/ql-vscode
2023-08-10 17:19:56 +02:00
Koen Vlaswinkel
fa66b2757a Merge pull request #2695 from github/dependabot/npm_and_yarn/extensions/ql-vscode/ts-unused-exports-10.0.0
Bump ts-unused-exports from 9.0.5 to 10.0.0 in /extensions/ql-vscode
2023-08-10 17:03:09 +02:00
Robert
9069ba2d62 Use sourceLocationPrefix to get relative path inside database 2023-08-10 15:06:41 +01:00
dependabot[bot]
5e1a9a330b Bump ts-unused-exports from 9.0.5 to 10.0.0 in /extensions/ql-vscode
Bumps [ts-unused-exports](https://github.com/pzavolinsky/ts-unused-exports) from 9.0.5 to 10.0.0.
- [Changelog](https://github.com/pzavolinsky/ts-unused-exports/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pzavolinsky/ts-unused-exports/commits)

---
updated-dependencies:
- dependency-name: ts-unused-exports
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-10 13:48:45 +00:00
dependabot[bot]
49df14eeb8 Bump cosmiconfig from 7.1.0 to 8.2.0 in /extensions/ql-vscode
Bumps [cosmiconfig](https://github.com/cosmiconfig/cosmiconfig) from 7.1.0 to 8.2.0.
- [Changelog](https://github.com/cosmiconfig/cosmiconfig/blob/main/CHANGELOG.md)
- [Commits](https://github.com/cosmiconfig/cosmiconfig/compare/v7.1.0...v8.2.0)

---
updated-dependencies:
- dependency-name: cosmiconfig
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-10 13:48:17 +00:00
dependabot[bot]
0c0a4fe78d Bump patch-package from 7.0.0 to 8.0.0 in /extensions/ql-vscode
Bumps [patch-package](https://github.com/ds300/patch-package) from 7.0.0 to 8.0.0.
- [Release notes](https://github.com/ds300/patch-package/releases)
- [Changelog](https://github.com/ds300/patch-package/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ds300/patch-package/compare/v7.0.0...v8.0.0)

---
updated-dependencies:
- dependency-name: patch-package
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-10 13:47:43 +00:00
dependabot[bot]
50b8ae5713 Bump eslint-config-prettier from 8.5.0 to 9.0.0 in /extensions/ql-vscode
Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 8.5.0 to 9.0.0.
- [Changelog](https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-config-prettier/compare/v8.5.0...v9.0.0)

---
updated-dependencies:
- dependency-name: eslint-config-prettier
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-10 13:47:08 +00:00
Nora
ebc5ef2d90 Adjust message 2023-08-10 12:36:28 +00:00
Anders Starcke Henriksen
c676ffdc13 Add more sink and source kinds. 2023-08-10 14:31:06 +02:00
Charis Kyriakou
b8ba32f028 Minor auto-model polish (#2689) 2023-08-10 13:03:02 +01:00
Charis Kyriakou
52a8704786 Improve auto-modeling in-progress state handling (#2687) 2023-08-10 11:58:49 +01:00
Robert
23ddc83c52 Inline methods that are small and only used from one place 2023-08-10 11:47:41 +01:00
Robert
54ec146c8e Jump to usage as well as revealing in details view 2023-08-10 11:43:05 +01:00
Robert
b04f316730 Call revealItemInDetailsPanel when clicking view 2023-08-10 11:05:17 +01:00
Robert
2b58edaa84 Implement getParent by searching all usages 2023-08-10 11:05:17 +01:00
Robert
6aea8fee3a Covert to canonical usage object before calling reveal 2023-08-10 11:05:17 +01:00
Robert
e37a833c9a Add revealItem method and pass through to DataExtensionsEditorView 2023-08-10 11:05:17 +01:00
Robert
805bb74a8a Include full usage in jumpToUsage message 2023-08-10 11:05:17 +01:00
Charis Kyriakou
209822e093 Add auto-model mock API scenario (#2684) 2023-08-10 09:55:17 +00:00
Charis Kyriakou
5d2e20516b Rename 'dependency' to 'package' in auto-modeling code (#2686) 2023-08-10 09:06:33 +00:00
Nora
c905814393 Show line numbers and file path 2023-08-10 08:10:38 +00:00
Charis Kyriakou
b1dc862392 Merge pull request #2682 from github/charisk/batch-automodeling
Batch automodeling
2023-08-10 08:58:23 +01:00
shati-patel
c5febb4b48 Fix getCurrentQuery to look at active tabs instead of active text editors 2023-08-09 17:07:33 +01:00
Nora
df880496cc Add icons and main badge 2023-08-09 16:41:45 +02:00
Charis Kyriakou
4b0f59983a Add ability to stop automodeling 2023-08-09 12:25:14 +00:00
Charis Kyriakou
4f7126296e Break up automodeling into batches 2023-08-09 12:24:44 +00:00
Robert
bd6a7b263f Merge pull request #2679 from github/robertbrignull/data-details-jump
Implementing jumping to location when clicking on a usage in the details panel
2023-08-09 13:04:08 +01:00
Charis Kyriakou
6791ddb445 Pass dependency name around when automodeling (#2681) 2023-08-09 12:39:05 +01:00
Charis Kyriakou
6dc0b14be7 Merge pull request #2680 from github/charisk/move-automodeling
Move automodeling logic out of view
2023-08-09 12:00:06 +01:00
Robert
1139790620 Rename command from codeQLDataExtensions => codeQLDataExtensionsEditor 2023-08-09 11:57:19 +01:00
Charis Kyriakou
0cc8e68155 Extract modeling of specific set of candidates into its own function 2023-08-08 15:56:51 +00:00
Robert
f52a512794 Merge pull request #2672 from github/robertbrignull/sarif-processing-no-location
Handle when an alert message contains links to files outside of the repository source
2023-08-08 16:56:03 +01:00
Charis Kyriakou
75882710ad Move automodeling logic to AutoModeler class 2023-08-08 15:52:03 +00:00
Robert
7443b35ebc Jump to location when clicking on usage 2023-08-08 16:34:15 +01:00
Robert
16d5f0f12b Add DatabaseItem to model details panel state 2023-08-08 16:34:10 +01:00
Robert
946607098a Add command to jump to usage location 2023-08-08 16:26:33 +01:00
Robert
f4d6990c1f Move duplicated error handling into showResolvableLocation 2023-08-08 16:26:27 +01:00
Robert
daf389a5ed Merge pull request #2678 from github/robert-nora/model-details-data
Populate details panel with external API usages
2023-08-08 14:20:00 +01:00
Robert
29916be143 Send externalApiUsages data to details view whenever new data is calculated 2023-08-08 10:52:59 +01:00
Robert
aa227357e9 Add blank data provider for codeQLModelDetails view 2023-08-07 17:19:13 +01:00
Nora
0aae7392f0 Merge pull request #2677 from github/robert-nora/set-up-model-details-view
Set up model details view
2023-08-07 18:03:45 +02:00
Nora
81294ecf3a Focus on panel when clicking view button 2023-08-07 14:38:34 +00:00
Nora
839e4d6246 Set up empty panel tab 2023-08-07 14:24:35 +00:00
Nora
ae6dc879ef Create new feature flag 2023-08-07 14:11:42 +00:00
Charis Kyriakou
55557df53f Add in-progress UI state for modeling methods (#2675) 2023-08-07 11:58:41 +00:00
Charis Kyriakou
f1204ce8f4 Move automodel version split further up (#2676) 2023-08-07 11:54:47 +00:00
Anders Starcke Henriksen
234760efd3 Merge pull request #2670 from github/starcke/apply-slice-filter
Use filtering queries to do batched AI querying
2023-08-07 11:37:40 +02:00
Robert
61f8f5fb88 Merge pull request #2673 from github/robertbrignull/unused_npm_dependencies
Remove unused NPM dependencies
2023-08-07 10:35:00 +01:00
Charis Kyriakou
4109da6a50 Add support for automodel requests in the mock API server (#2674) 2023-08-07 09:58:39 +01:00
Anders Starcke Henriksen
9bd2286660 Update extensions/ql-vscode/src/data-extensions-editor/auto-model-codeml-queries.ts
Co-authored-by: Aditya Sharad <6874315+adityasharad@users.noreply.github.com>
2023-08-07 10:21:12 +02:00
Robert
c068769af7 Uninstall ts-protoc-gen dependency 2023-08-04 16:19:33 +01:00
Robert
30fd9c28ac Uninstall @types/stream-chain dependency 2023-08-04 15:22:26 +01:00
Robert
3238c0eb0e Uninstall @types/jszip dependency 2023-08-04 15:20:14 +01:00
Robert
997e12c358 Uninstall @types/gulp-sourcemaps dependency 2023-08-04 15:18:52 +01:00
Robert
79f29a812e Uninstall @types/google-protobuf dependency 2023-08-04 15:16:54 +01:00
Robert
91cfeb9acb Uninstall stream-chain dependency 2023-08-04 15:13:35 +01:00
Robert
27d5169ce7 Uninstall stream dependency 2023-08-04 15:10:03 +01:00
Robert
ed91dafc25 Uninstall minimist dependency 2023-08-04 15:01:26 +01:00
Robert
461bf2d645 Uninstall minimatch dependency 2023-08-04 14:59:37 +01:00
Anders Starcke Henriksen
d4137b2c43 Address comments. 2023-08-04 15:59:25 +02:00
Robert
6a12dc23bb Assert alert message in test 2023-08-04 14:45:41 +01:00
Anders Starcke Henriksen
12abf81623 Apply suggestions from code review
Co-authored-by: Charis Kyriakou <charisk@users.noreply.github.com>
2023-08-04 15:35:12 +02:00
Robert
62e45a2c1c Handle when a related location has no region 2023-08-04 12:26:32 +01:00
Robert
fef55e3ec5 Add failing test when a related location is undefined 2023-08-04 12:26:03 +01:00
Anders Starcke Henriksen
f6c492dca4 Use filtering queries to do batched AI quering. 2023-08-04 13:09:59 +02:00
Robert
69c92b4434 Check key / keyCode in onKeyDownHandler 2023-08-04 11:29:29 +01:00
dependabot[bot]
7530920a0b Bump @typescript-eslint/eslint-plugin from 5.41.0 to 6.2.1 in /extensions/ql-vscode (#2668) 2023-08-04 10:10:16 +00:00
dependabot[bot]
e938a6a9cb Bump @octokit/plugin-retry from 4.1.6 to 6.0.0 in /extensions/ql-vscode (#2602)
Bumps [@octokit/plugin-retry](https://github.com/octokit/plugin-retry.js) from 4.1.6 to 6.0.0.
- [Release notes](https://github.com/octokit/plugin-retry.js/releases)
- [Commits](https://github.com/octokit/plugin-retry.js/compare/v4.1.6...v6.0.0)

---
updated-dependencies:
- dependency-name: "@octokit/plugin-retry"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-04 10:46:08 +01:00
Robert
de8d0df818 Merge pull request #2671 from github/robertbrignull/sarif-parser-unit-test
Move sarif-parser.test.ts from no-workspace to unit-tests
2023-08-04 10:16:32 +01:00
Robert
f7b07a0892 Move test sarif data to a more shared location + fix links 2023-08-04 09:56:58 +01:00
dependabot[bot]
2b9aad34f8 Bump styled-components from 5.3.9 to 6.0.2 in /extensions/ql-vscode (#2585) 2023-08-04 09:45:17 +01:00
dependabot[bot]
a3c0896d37 Bump @typescript-eslint/parser in /extensions/ql-vscode (#2669) 2023-08-03 16:58:37 +00:00
Robert
3e6466d717 Move sarif-parser.test.ts from no-workspace to unit-tests 2023-08-03 17:28:33 +01:00
Robert
3960ece3e4 Merge pull request #2667 from github/robertbrignull/scrubber_tests
Try to fix flakes in query history scrubber tests
2023-08-03 17:05:27 +01:00
Andrew Eisenberg
87bbf2933b Merge pull request #2660 from github/aeisenberg/qhelp-preview
Ensure the qhelp preview is refreshed after editing
2023-08-03 08:38:03 -07:00
Robert
8952874bb6 Merge branch 'main' into robertbrignull/ResultTables-Header 2023-08-03 16:14:24 +01:00
Robert
36f92da9ac Merge pull request #2664 from github/robertbrignull/ResultTables-naming
Make sure ResultTable and ResultTables are in correctly named files
2023-08-03 15:48:57 +01:00
Robert
23a8927df1 Merge branch 'main' into robertbrignull/ResultTables-naming 2023-08-03 15:03:57 +01:00
Nora
4993e7b6a5 Merge pull request #2663 from github/version/bump-to-v1.8.10
Bump version to v1.8.10
2023-08-03 16:00:17 +02:00
Robert
2ffbb9c14c Perform dirSync inside beforeEach block 2023-08-03 14:19:12 +01:00
Robert
8bce7b531c Use a jest.fn() to track calls to the scrubber, instead of a local variable counter 2023-08-03 14:17:23 +01:00
Robert
28a0075fe4 Move creation of the mock context to a function 2023-08-03 14:16:43 +01:00
Robert
428014ce35 Move timestamp constants to be outside of describe block 2023-08-03 14:01:45 +01:00
Robert
6b21f3f29d Merge pull request #2665 from github/robertbrignull/ResultTables-untoggleProblemsView
Delete untoggleProblemsView as it is unused
2023-08-03 13:55:56 +01:00
Robert
892f052227 Move ResultTablesHeader to its own component 2023-08-03 12:36:05 +01:00
Robert
fed2a22062 Delete untoggleProblemsView as it is unused
As far as I can tell it's been unused as far as back as
https://github.com/github/vscode-codeql/pull/602 when it was introduced.
It seems just to be an error in that PR.
2023-08-03 12:14:50 +01:00
Robert
aa1edfc231 Move ResultTable to its own file 2023-08-03 11:36:52 +01:00
Robert
ab442c4dde Rename result-tables.tsx => ResultTables.tsx 2023-08-03 11:36:52 +01:00
github-actions[bot]
69490b1948 Bump version to v1.8.10 2023-08-03 09:53:59 +00:00
Nora
9ed6b011a5 Merge pull request #2662 from github/v1.8.9
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
Release prep for v1.8.9
2023-08-03 10:52:15 +02:00
Nora
912254fd3c Update extensions/ql-vscode/CHANGELOG.md
Co-authored-by: Charis Kyriakou <charisk@users.noreply.github.com>
2023-08-03 10:31:41 +02:00
Nora
7eab911cc5 v1.8.9 2023-08-03 08:17:20 +00:00
Andrew Eisenberg
d7d1351957 Remove unused import 2023-08-02 12:31:53 -07:00
Nora
80ae9a4b36 Merge pull request #2658 from github/nora-koen/data-extensions-editor-without-ql-submodule
Remove submodules dependency from data extension editor
2023-08-02 17:30:46 +02:00
Nora
868fae093d Reorder db language check 2023-08-02 14:25:39 +00:00
Andrew Eisenberg
2ce5ff7085 Update extensions/ql-vscode/CHANGELOG.md
Co-authored-by: Robert <robertbrignull@github.com>
2023-08-01 12:54:16 -07:00
Andrew Eisenberg
1289ab509c Merge pull request #2659 from github/aeisenberg/download-pack-in-tests2
Install `java-all` and transitive dependencies
2023-08-01 07:43:40 -07:00
Nora
5f489212d4 Add test for setup 2023-08-01 12:39:30 +00:00
Nora
fea45ea04d wrap all describe blocks in external api usage test 2023-08-01 12:39:30 +00:00
Nora
a39e55590a Move query setup to query file 2023-08-01 12:39:30 +00:00
Nora
6e4641f2c1 Clean up runQyery test 2023-08-01 12:39:30 +00:00
Nora
553e5cb4a1 Remove automodel qll file 2023-08-01 12:39:29 +00:00
Nora
4c0f68f193 Adjust picker test 2023-08-01 12:39:29 +00:00
Nora
1ee9cdaadd Add test for error log 2023-08-01 12:39:29 +00:00
Nora
098437b463 Cleanup 2023-08-01 12:39:29 +00:00
Nora
558a70e3c8 Adjust external api query test 2023-08-01 12:39:29 +00:00
Nora
7c10447bb5 Add .github folder manually 2023-08-01 12:39:29 +00:00
Nora
9fd6cb8c1f Cleanup and install pack dependencies 2023-08-01 12:39:29 +00:00
Koen Vlaswinkel
f4da522953 wip: data extensions editor without ql submodule 2023-08-01 12:39:29 +00:00
Robert
6dfe1736f8 Merge pull request #2657 from github/robertbrignull/clean-test-dir
Add `npm run clean-test-dir`
2023-08-01 09:19:42 +01:00
Andrew Eisenberg
f067c6540b Ensure the qhelp preview is refreshed after editing
This commit fixes a bug in the extension where the qhelp preview was not
being refreshed after the first time the preview was rendered. The
reason is that vscode will not refresh the markdown preview unless the
original file with the markdown in it is already open in the editor.

This fix will briefly open the raw markdown, refresh the preview and
close the raw markdown.
2023-07-31 16:21:09 -07:00
Andrew Eisenberg
b46e0ab175 Install java-all and transitive dependencies
need to install all transitive dependencies of `java-all` as well. This
will do it.
2023-07-31 11:14:59 -07:00
Andrew Eisenberg
34fa629054 Merge pull request #2655 from github/aeisenberg/download-pack-in-tests
Download `codeql/java-all` in tests
2023-07-31 10:02:14 -07:00
Robert
5107086a93 Switch to using find 2023-07-31 11:09:31 +01:00
Robert
58c5c0e5f5 Add npm run clean-test-dir 2023-07-31 11:09:31 +01:00
Charis Kyriakou
5427b5718f Only show automodel button for Java (#2656) 2023-07-31 09:43:07 +00:00
Andrew Eisenberg
0cc399507f Download codeql/java-all in tests
An upcoming change in the CLI will require that the extensible
predicates that are targeted by a data extension needs to be available
in order for the `resolve extensions` command to succeed.

There are a handful of tests that are failing with this new CLI. This
change will update the tests so that the `codeql/java-all` pack is
available in the tests and ensures they pass.
2023-07-28 14:49:55 -07:00
Robert
bb9299e0e2 Merge pull request #2646 from github/robertbrignull/fix_alert_461
Split codeQL.copyVariantAnalysisRepoList into two commands
2023-07-28 10:56:35 +01:00
Robert
e8afa54584 Fix test by mocking the correct function 2023-07-28 10:26:52 +01:00
Robert
d94443e025 Merge pull request #2652 from github/robertbrignull/data_narrow
Make the data extensions editor look a little bit better at small screen sizes
2023-07-28 10:15:28 +01:00
Robert
0e5cb1a3e8 Merge pull request #2653 from github/robertbrignull/dependencies_versions
Change all dependencies to use ^ instead of ~
2023-07-28 10:09:57 +01:00
Robert
59958a5b32 Log a ui-interaction telemetry event when copying repository lists 2023-07-28 10:09:12 +01:00
Robert
3d9b2da514 Remove codeQL.copyVariantAnalysisRepoListView command and instead call copyRepoListToClipboard directly 2023-07-28 10:09:11 +01:00
Robert
3b8cea8df4 Remove codeQL.copyVariantAnalysisRepoListQueryHistory command and instead call copyRepoListToClipboard directly 2023-07-28 10:00:38 +01:00
Robert
6adf683c87 Merge branch 'main' into robertbrignull/dependencies_versions 2023-07-28 09:51:43 +01:00
Robert
37f1c62ee6 Merge branch 'main' into robertbrignull/data_narrow 2023-07-28 09:51:27 +01:00
Chuan-kai Lin
c1107d7423 Merge pull request #2649 from github/cklin/remove-legacy-query-server-test
legacy-query.test.ts: skip if CLI supports new query server
2023-07-27 09:48:36 -07:00
Chuan-kai Lin
72fa1c5583 legacy-query.test.ts: skip if CLI supports new query server 2023-07-27 09:10:04 -07:00
github-actions[bot]
5f65498e0a Bump CLI version from v2.14.0 to v2.14.1 for integration tests (#2650)
Co-authored-by: github-actions[bot] <github-actions@github.com>
2023-07-27 16:04:05 +00:00
Shati Patel
6e21706c15 Implement "Hide modeled APIs" checkbox and make it the default (#2651) 2023-07-27 15:49:41 +00:00
Robert
4dcca4e97c Change all dependencies to use ^ instead of ~ 2023-07-27 16:15:39 +01:00
Robert
84492d2fb9 Make sure the classifications don't wrap 2023-07-27 16:00:38 +01:00
Robert
a2c9ac792b Move the method classification to the start of the row 2023-07-27 15:57:45 +01:00
Robert
18704558d3 Make the method name column 50% 2023-07-27 15:57:34 +01:00
Robert
ca16dca7ed Merge pull request #2645 from github/robertbrignull/fix_alert_546
Don't alert for multiple usages of built-in VS Code commands
2023-07-27 15:20:39 +01:00
Robert
f05d5d9766 Split codeQL.copyVariantAnalysisRepoList into two commands 2023-07-27 12:22:19 +01:00
Robert
aacc243bae Don't report multiply usages of builtin VS Code commands 2023-07-27 11:24:18 +01:00
Robert
396dc3e915 Merge pull request #2644 from github/robertbrignull/fix_alert_384
Fix alert by rewriting query history scrubbed to do fewer file operations
2023-07-27 11:22:10 +01:00
Robert
d3b2d0fce8 Fix indentation in query 2023-07-27 11:14:14 +01:00
Robert
4d4cd4c2d6 Use getErrorMessage 2023-07-27 10:32:19 +01:00
Shati Patel
72512da3b5 Data extensions editor: Allow users to pick an existing database from their workspace (#2643) 2023-07-27 10:09:12 +01:00
Koen Vlaswinkel
c2ed98eb85 Merge pull request #2633 from github/koesie10/automodel-v2
Add LLM functionality using auto-model V2
2023-07-27 10:02:55 +02:00
Koen Vlaswinkel
bebe130fb0 Do not use mocked URI in locations test 2023-07-27 09:40:37 +02:00
Koen Vlaswinkel
db065584fa Merge remote-tracking branch 'origin/main' into koesie10/automodel-v2 2023-07-27 09:18:59 +02:00
Robert
844f25ed98 Rewrite query history scrubbed to do fewer file operations 2023-07-26 16:56:02 +01:00
Koen Vlaswinkel
546f668301 Move createMockUri to mocking helpers 2023-07-26 14:35:15 +02:00
Koen Vlaswinkel
a79753d0a5 Move all runAutoModelQuery arguments into the options object 2023-07-26 14:32:43 +02:00
Koen Vlaswinkel
32c44cdfe3 Rename Options to AutoModelQueriesOptions 2023-07-26 14:31:28 +02:00
Koen Vlaswinkel
de5dbea69f Use promisify for gzip 2023-07-26 14:28:45 +02:00
Robert
3f896751f3 Merge pull request #2640 from github/robertbrignull/fix_alert_547
Fix alert by replacing regex with path.basename
2023-07-26 11:18:40 +01:00
Robert
41f5beb619 Merge pull request #2638 from github/robertbrignull/data_new_header
Add new data extensions header UI elements
2023-07-26 11:12:25 +01:00
Koen Vlaswinkel
5e5535653b Merge pull request #2642 from github/koesie10/remove-path-browserify
Remove path-browserify
2023-07-26 12:09:47 +02:00
Robert
af50d90bcb Merge branch 'main' into robertbrignull/data_new_header 2023-07-26 10:29:22 +01:00
Robert
c5a4c53a1a Merge branch 'main' into robertbrignull/fix_alert_547 2023-07-26 10:26:24 +01:00
Koen Vlaswinkel
016940f2ce Remove path-browserify 2023-07-26 11:23:39 +02:00
Robert
e877695a14 Merge pull request #2641 from github/robertbrignull/LockFileForStandardQueryResult
Unexport LockFileForStandardQueryResult
2023-07-26 10:22:53 +01:00
Robert
e2256e28ba Unexport LockFileForStandardQueryResult 2023-07-26 10:06:55 +01:00
Robert
5c08083336 Merge pull request #2639 from github/robertbrignull/data_progress
Remove custom progress bar and use normal VS Code notification for progress
2023-07-26 10:05:05 +01:00
Robert
07b8732a31 Use custom implementation of basename instead of path-browserify version 2023-07-26 09:59:02 +01:00
Robert
3e49d05ef9 Text is uppercased automatically by styling 2023-07-26 09:51:51 +01:00
Koen Vlaswinkel
83cc9835e8 Merge pull request #2634 from github/koesie10/cleanup-query-resolver
Make query resolver more generic
2023-07-26 09:36:32 +02:00
Robert
c5af8bdcd7 Replace regex with path.basename 2023-07-25 17:29:34 +01:00
Robert
55b21c2add Remove custom progress bar and use normal VS Code notification for progress 2023-07-25 15:33:39 +01:00
Charis Kyriakou
b87fe94a92 Remove most recent commit information and sorting (#2637) 2023-07-25 14:15:08 +00:00
Robert
493de4c190 Add new header UI elements 2023-07-25 15:01:27 +01:00
Shati Patel
8f99ed2478 Data extensions editor: Change "already modeled" message (#2636) 2023-07-25 13:40:54 +00:00
Shati Patel
cdcbdc60fb Data extensions editor: Remove buttons that are no longer needed (#2635) 2023-07-25 14:12:16 +01:00
Robert
e1bbbd6e9c Merge pull request #2631 from github/robertbrignull/deadcode_ci
Add check for deadcode for CI
2023-07-25 13:09:44 +01:00
Koen Vlaswinkel
84de8ad252 Add creation of auto-model request V2 2023-07-25 10:35:19 +02:00
Koen Vlaswinkel
57bcfbbe29 Extract creation of lock file to more generic function 2023-07-25 10:03:01 +02:00
Koen Vlaswinkel
32656c1cb8 Extract query resolving to more generic functions 2023-07-25 10:03:01 +02:00
Robert
5572cece83 Convert find-deadcode to a script 2023-07-24 18:00:30 +01:00
Robert
08675e6713 Rename to tsconfig.deadcode.json 2023-07-24 17:27:39 +01:00
Robert
abee109dbd Merge branch 'main' into robertbrignull/deadcode_ci 2023-07-24 17:26:18 +01:00
Robert
ef27730e5e Merge pull request #2632 from github/robertbrignull/deadcode_changes
Remove or fix dead code / unused exports
2023-07-24 16:32:13 +01:00
Robert
10c6708db5 Fix reference to tsconfig.json 2023-07-24 14:29:01 +01:00
Robert
a618aed415 Mark fileMock and styleMock as allowable exports 2023-07-24 14:28:41 +01:00
Robert
8e8e0faa9e Unexport types that are unused outside of their source file 2023-07-24 14:22:23 +01:00
Robert
41ce5086e7 Mark the extension activation function as allowed to be exported but unused 2023-07-24 14:22:23 +01:00
Robert
a79b71cff6 Switch ALLOW_HTTP_SETTING for allowHttp() 2023-07-24 14:22:23 +01:00
Robert
f0318b0c84 Delete vsCodeGetConfiguration 2023-07-24 14:22:23 +01:00
Robert
814acfa74a Add find-deadcode to CI linting workflow 2023-07-24 11:23:04 +01:00
Robert
d73276c136 Add find-deadcode npm script 2023-07-24 11:23:01 +01:00
Robert
44b58280e8 Merge pull request #2628 from github/robertbrignull/disposable
Merge definitions of Disposable where possible
2023-07-24 11:20:39 +01:00
Robert
49a05c412c Delete pathRowClassName 2023-07-24 11:11:55 +01:00
Robert
f57bbc2b52 Delete decimalFormatter 2023-07-24 11:11:55 +01:00
Robert
e620120144 Delete getTestDirectory 2023-07-24 11:11:55 +01:00
Robert
6fbe95a334 Delete isRemoteSystemDefinedListDbItem 2023-07-24 11:11:55 +01:00
Robert
cb4dcc81ea Delete remoteDbKinds and localDbKinds 2023-07-24 11:11:55 +01:00
Robert
3126c8d1a8 Delete PAGE_SIZE 2023-07-24 11:11:55 +01:00
Robert
0d7814c778 Delete InspectionResult 2023-07-24 11:11:55 +01:00
Robert
f70ea71885 Delete isVariantAnalysisLiveResultsEnabled 2023-07-24 11:11:55 +01:00
Robert
04df20a732 Install ts-unused-exports 2023-07-24 11:10:19 +01:00
Robert
c7b556e748 Merge pull request #2624 from github/robertbrignull/autoClosingPairs
Delete autoClosingPairs from LanguageConfiguration to appease proposed API
2023-07-24 11:04:52 +01:00
Charis Kyriakou
8314a5486d Merge pull request #2627 from github/charisk/remove-deprecated-version-support
Remove conditionals and version constraints for unsupported CLI versions
2023-07-24 10:07:34 +01:00
Charis Kyriakou
e80ef7c1dc Remove CLI_VERSION_WITH_PER_QUERY_EVAL_LOG constraint 2023-07-24 08:24:07 +00:00
Robert
f1a928994a Merge all our DisposableObject definitions 2023-07-21 17:06:53 +01:00
Charis Kyriakou
0f594704d5 Remove CLI_VERSION_WITH_STRUCTURED_EVAL_LOG constraint 2023-07-21 15:37:56 +00:00
Charis Kyriakou
3064415068 Remove setting of evaluator log verbosity level 2023-07-21 15:33:07 +00:00
Charis Kyriakou
f03ef66596 Update handling of return value from packlist command 2023-07-21 15:31:57 +00:00
Robert
0617e3ec7f Merge pull request #2626 from github/robertbrignull/data-make-selected
Instead of resetting the database after importing, pass through makeSelected = false
2023-07-21 16:20:37 +01:00
Shati Patel
dacaf4e394 Update title in Data extensions editor tab (#2625) 2023-07-21 14:44:41 +01:00
Robert
e6566b910a Instead of resetting the database after importing, pass through makeSelected = false 2023-07-21 12:49:36 +01:00
Robert
778f839e8e Merge pull request #2623 from github/robertbrignull/data-model-dependency
Implement "model dependency" button in application mode
2023-07-21 12:10:15 +01:00
Robert
52711c5cc1 Delete autoClosingPairs from LanguageConfiguration to appease proposed API 2023-07-21 11:31:55 +01:00
Robert
d8687b5985 Merge pull request #2621 from github/robertbrignull/data-saving
Load existing modeled methods before saving, to avoid overwriting data
2023-07-20 08:54:29 +01:00
Robert
19ad237427 Pull out common code for importing and resetting the current database 2023-07-19 16:29:13 +01:00
Robert
bb246144c2 Add comments to createDataExtensionYamlsForFrameworkMode too 2023-07-19 16:22:00 +01:00
Robert
fa01b33dfa Implement modelDependency message 2023-07-19 16:14:44 +01:00
Robert
00780442dd Send modelDependency message 2023-07-19 16:14:44 +01:00
Robert
5b170d02eb Avoiding overwriting any existing modeled methods from the files 2023-07-19 11:44:12 +01:00
Robert
db4dc89e42 Split loadModeledMethods into loading all files individually and then merging them 2023-07-19 11:44:12 +01:00
Robert
b5b606d486 Make loadModeledMethodFiles return relative paths from the extension pack 2023-07-19 11:43:57 +01:00
Robert
f2c7c41117 Merge pull request #2406 from Marcono1234/location-url-column
Include column numbers in location URLs
2023-07-19 11:01:20 +01:00
Robert
152e194655 Merge branch 'main' into location-url-column 2023-07-19 09:58:46 +01:00
Robert
f12ba96389 Update CHANGELOG.md 2023-07-19 09:57:58 +01:00
Koen Vlaswinkel
add3296071 Merge pull request #2618 from github/dependabot/npm_and_yarn/extensions/ql-vscode/word-wrap-1.2.4
Bump word-wrap from 1.2.3 to 1.2.4 in /extensions/ql-vscode
2023-07-19 10:04:56 +02:00
Koen Vlaswinkel
a90b85c2a6 Merge pull request #2259 from github/koesie10/upgrade-storybook-7
Upgrade to Storybook 7
2023-07-19 09:51:13 +02:00
dependabot[bot]
3568d4a780 Bump word-wrap from 1.2.3 to 1.2.4 in /extensions/ql-vscode
Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.4)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-18 23:40:55 +00:00
Robert
d3a5a5e669 Merge pull request #2611 from github/robertbrignull/data-unsaved-checkbox
Show whether changes to a method are saved or not
2023-07-18 16:31:46 +01:00
Robert
fc77a52c46 Merge pull request #2614 from github/robertbrignull/Locations
Move components for rendering locations to a separate file
2023-07-18 15:31:15 +01:00
Robert
5617331598 Pass in methodIsUnsaved instead of modifiedSignatures 2023-07-18 15:26:34 +01:00
Robert
76a7a266ff Rename jumpToLocationHandler => handleClick 2023-07-18 15:11:54 +01:00
Robert
b6c60b26cd Rename handleClick => onClick 2023-07-18 15:11:22 +01:00
Robert
30d8303320 Pull out getModelingStatus method and avoid useMemo 2023-07-18 15:07:26 +01:00
Robert
5c12a4b205 Merge pull request #2605 from github/robertbrignull/data-modeled-methods-tests
Refactor the code for loading/saving modeled methods to disk, and add tests
2023-07-18 14:34:21 +01:00
Koen Vlaswinkel
b830781e48 Replace deprecated uses of ComponentMeta and ComponentStory 2023-07-18 15:29:11 +02:00
Koen Vlaswinkel
8329dedd7f Upgrade to Storybook 7 2023-07-18 15:07:15 +02:00
Robert
70e04a1c99 Rename to MdelingStatusIndicator and move to a separate file 2023-07-18 10:59:08 +01:00
Marcono1234
768b95d3a9 Fix typo in CHANGELOG.md (#2617) 2023-07-17 19:39:38 +00:00
Shati Patel
8e4ee5df3d Update release test plan (#2616) 2023-07-17 19:05:25 +01:00
Alexander Eyers-Taylor
baa2a7fed3 Add comma as a word boundary charecter. (#2615)
* Add comma as a word boundary charecter.

* Add changelog for missing trailing commas.
2023-07-17 16:12:36 +00:00
Robert
1f16294d7e Avoid else blocks when we're returning early 2023-07-17 17:04:41 +01:00
Robert
679266c0b7 Remove unnecessarily forcing non-undefined 2023-07-17 17:02:59 +01:00
Robert
f1e96f7812 Use more standard name for callback 2023-07-17 17:02:16 +01:00
Robert
f8e6ccea23 Do event propogation cancelation before other work 2023-07-17 16:59:26 +01:00
Robert
8f46052459 Use optional call instead of explicit if-then 2023-07-17 16:58:52 +01:00
Robert
b210d83210 Use named Props interfaces instead of defining types inline 2023-07-17 16:58:08 +01:00
Robert
eaf8d68dd1 Remove all usages of NonClickableLocation outside of Location 2023-07-17 16:56:16 +01:00
Robert
c4ebee8e8d Have each component in a separate file 2023-07-17 16:56:15 +01:00
Robert
2962306094 Specify that tmp dir is under homedir on windows 2023-07-17 15:48:20 +01:00
Robert
a4c0365a95 Move components for rendering locations to a separate file 2023-07-17 14:36:08 +01:00
Shati Patel
2abc4d542b Merge pull request #2613 from github/version/bump-to-v1.8.9
Bump version to v1.8.9
2023-07-17 12:01:59 +01:00
github-actions[bot]
700b9bf348 Bump version to v1.8.9 2023-07-17 10:35:30 +00:00
Shati Patel
6be797d9d2 Merge pull request #2612 from github/v1.8.8
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
Release prep for v1.8.8
2023-07-17 11:10:54 +01:00
Robert
9924f87473 Add a test that calls loadModeledMethods 2023-07-17 11:07:24 +01:00
Robert
f19b600287 Fix semantic merge conflict in imports 2023-07-17 11:07:10 +01:00
Robert
14200a5011 Merge branch 'main' into robertbrignull/data-modeled-methods-tests 2023-07-17 11:06:40 +01:00
shati-patel
3fa7590187 v1.8.8 2023-07-17 10:17:54 +01:00
Marcono1234
fffb692ca8 Include column numbers in location URLs 2023-07-15 22:00:21 +02:00
Shati Patel
6cfc7d5ced Remove support for CodeQL CLI versions older than 2.9.4 (#2610) 2023-07-14 16:13:46 +00:00
Philip Ginsbach
7ea6cd871b Merge pull request #2609 from github/ginsbach/AdditionalAndDefaultKeywords
add `additional` and `default` keywords to the TextMate grammar
2023-07-14 16:23:50 +01:00
Shati Patel
5631d33b20 Change the data extension's webview icon (#2608) 2023-07-14 15:17:56 +00:00
Robert
de7d65fc8b Replace checkbox with an icon that shows saved status 2023-07-14 16:16:30 +01:00
Robert
e73421dabb Track changed signatures instead of unsaved models 2023-07-14 16:16:27 +01:00
Philip Ginsbach
e1e55d1d01 link to the PR from the changelog entry 2023-07-14 15:23:55 +01:00
Robert
421fe11664 Normalize paths before doing string comparisons 2023-07-14 15:12:12 +01:00
Philip Ginsbach
0b18492946 add changelog entry for 'additional' and 'default' keywords 2023-07-14 14:57:46 +01:00
Philip Ginsbach
f3ad6ec105 recompile the TextMate grammar 2023-07-14 14:57:46 +01:00
Philip Ginsbach
d97e4d1ba1 add 'additional' and 'default' annotation keywords to grammar 2023-07-14 14:47:07 +01:00
Koen Vlaswinkel
ccda490ab4 Merge pull request #2566 from github/koesie10/library-version
Add library versions to data extensions editor
2023-07-14 15:43:42 +02:00
Robert
1dcd048268 Move version check next to existing check 2023-07-14 14:20:58 +01:00
Robert
12511922ad Remove version check in resolveExtensions method 2023-07-14 14:15:07 +01:00
Robert
2392d7c7b6 Merge pull request #2606 from github/robertbrignull/data-modeled-method-signature
Add signature and related fields to ModeledMethod
2023-07-14 14:11:40 +01:00
Koen Vlaswinkel
4158df197c Improve library version matching regex 2023-07-14 14:13:23 +02:00
Robert
1782239c7c Add in CodeQL CLI version check for the "resolve extensions" command 2023-07-14 11:38:07 +01:00
Robert
e2b211ad53 Merge branch 'main' into robertbrignull/data-modeled-method-signature
pick 2db42e3e Pull out createDataExtensionYamls into yaml.ts
pick 52f7cac0 Move saveModeledMethods to a separate file
pick ba27230e Move loadModeledMethods to a separate file
pick c512a11e Split out listModelFiles from loadModeledMethods
pick 752cf8ab Add some tests of listModelFiles
2023-07-14 11:05:14 +01:00
Koen Vlaswinkel
f91da95081 Add library versions to data extensions editor 2023-07-14 12:02:05 +02:00
Koen Vlaswinkel
10d9213dbe Merge pull request #2563 from github/koesie10/classification
Add call classification and supported kind to data extensions editor
2023-07-14 12:01:58 +02:00
Robert
bb110152f2 Fix expected values in tests 2023-07-14 10:55:43 +01:00
Koen Vlaswinkel
bd6c302360 Add tooltip to classifications container 2023-07-14 11:38:45 +02:00
Koen Vlaswinkel
1272ddd696 Decrease text size of test and generated tags 2023-07-14 11:36:00 +02:00
Koen Vlaswinkel
ca7ba89a68 Move method classifications to separate component 2023-07-14 11:32:34 +02:00
Andrew Eisenberg
39465d9ad9 Merge pull request #2607 from github/github-action/bump-cli 2023-07-13 14:45:20 -07:00
github-actions[bot]
b419b8d308 Bump CLI version from v2.13.5 to v2.14.0 for integration tests 2023-07-13 18:34:27 +00:00
Robert
169221305f Remove the ModeledMethodWithSignature type in favour of just ModeledMethod 2023-07-13 16:55:04 +01:00
Robert
97a331cf6a Remove the ModeledExternalApiUsage type in favour of just ModeledMethod 2023-07-13 16:55:04 +01:00
Robert
16f98491e7 Remove the ExternalApiUsageByType in favour of just ModeledMethod 2023-07-13 16:55:04 +01:00
Robert
111dfff7fb Add signature to ModeledMethod 2023-07-13 16:55:04 +01:00
Robert
f927ac9f1c Split out MethodSignature from ExternalApiUsage 2023-07-13 16:55:04 +01:00
Koen Vlaswinkel
6a0cae58e0 Remove call type for unmodelable methods
This removes the call type as shown for an unmodelable method. We still
need to decide how to show this information, so this may be added back
in later.
2023-07-13 16:44:43 +02:00
Koen Vlaswinkel
1efc276c24 Show labels for methods only classified in test and generated 2023-07-13 16:36:37 +02:00
Koen Vlaswinkel
94015a0ac2 Show type for supported methods 2023-07-13 16:33:34 +02:00
Koen Vlaswinkel
048552093b Add classification and type to types 2023-07-13 16:19:05 +02:00
Koen Vlaswinkel
0560f4fe76 Add classification and type to queries 2023-07-13 16:15:58 +02:00
Robert
752cf8ab16 Add some tests of listModelFiles 2023-07-13 10:29:52 +01:00
Robert
c512a11e7e Split out listModelFiles from loadModeledMethods 2023-07-13 09:50:54 +01:00
Robert
ba27230e3c Move loadModeledMethods to a separate file 2023-07-13 09:29:42 +01:00
Robert
52f7cac0a9 Move saveModeledMethods to a separate file 2023-07-13 09:20:00 +01:00
Robert
2db42e3eb0 Pull out createDataExtensionYamls into yaml.ts 2023-07-13 08:54:11 +01:00
Robert
31fdc794e5 Merge pull request #2600 from github/robertbrignull/data-supported
Show more clearly when a method is already modeled
2023-07-12 17:26:10 +01:00
Robert
e55800ae2d Tweak message 2023-07-12 16:37:44 +01:00
Robert
0f39d41e50 fix typo 2023-07-12 16:37:18 +01:00
Robert
31118a514f Merge pull request #2599 from github/nora/make-result-table-functional-component
Convert ResultTable to a functional component
2023-07-12 16:34:57 +01:00
Robert
fa5c24d837 Display an explanatory message on unmodelable methods 2023-07-12 14:56:15 +01:00
Robert
8ec08ef43f Remove ugly jumpToUsage prop 2023-07-12 14:36:40 +01:00
Robert
7d59224407 Pull out ModelableMethodRow as a separate component 2023-07-12 14:36:40 +01:00
Robert
aba574e423 Pull out UmmodelableMethodRow to a separate component 2023-07-12 14:36:39 +01:00
Robert
799b96e7f6 Convert modelTypeOptions to be a const 2023-07-12 14:35:42 +01:00
Nora
60f33e573e Convert ResultTable 2023-07-12 13:12:14 +00:00
Robert
5fa338e460 Return early if method cannot be modeled 2023-07-12 14:04:58 +01:00
Robert
8529c05396 Move boolean showXCell variables to be later and together 2023-07-12 14:02:39 +01:00
Robert
70b2e68ce7 Rename showModelTypeCell => methodCanBeModeled 2023-07-12 14:01:01 +01:00
Robert
8432f6cdfe Move predicate variable closer to where it's used 2023-07-12 13:50:31 +01:00
Robert
39d53f469f Merge pull request #2598 from github/robertbrignull/data-framework-model
Don't show model from source button in framework mode
2023-07-12 10:22:24 +01:00
Robert
c8ba8d6e1b Merge branch 'main' into robertbrignull/data-framework-model 2023-07-12 10:05:06 +01:00
Robert
28c6ab36ce Merge pull request #2597 from github/robertbrignull/data-view-state
Clear up how we pass around view state
2023-07-12 10:04:39 +01:00
Dave Bartolomeo
3e5985955d Merge pull request #2538 from github/dbartol/save-before-start
Save dirty documents before evaluating queries
2023-07-11 15:55:03 -04:00
Dave Bartolomeo
a4cff531be Remove more debugging code 2023-07-11 15:32:09 -04:00
Dave Bartolomeo
c18bb39f40 Remove more debugging code 2023-07-11 14:49:32 -04:00
Dave Bartolomeo
d93f2b67c8 Remove some debugging code 2023-07-11 14:42:57 -04:00
Robert
5b65e08fdf Don't show model from source button in framework mode 2023-07-11 17:32:12 +01:00
Robert
79a567b478 Avoid passing in both viewState and mode at the same time 2023-07-11 16:53:12 +01:00
Robert
5e84b5f055 Enforce that viewState is defined and show a loading screen otherwise 2023-07-11 16:47:44 +01:00
Robert
aa4df082bf Merge pull request #2594 from github/robertbrignull/data-unsaved-changes
Include in addModeledMethods whether the methods are unsaved or not
2023-07-11 16:26:44 +01:00
Robert
370872d005 Split addModeledMethods into that and loadModeledMethods 2023-07-11 15:23:30 +01:00
Robert
930103b3a8 Merge branch 'main' into robertbrignull/data-unsaved-changes 2023-07-11 15:11:24 +01:00
dependabot[bot]
6cf2f32705 Bump @octokit/plugin-retry from 3.0.9 to 4.1.6 in /extensions/ql-vscode (#2518)
Bumps [@octokit/plugin-retry](https://github.com/octokit/plugin-retry.js) from 3.0.9 to 4.1.6.
- [Release notes](https://github.com/octokit/plugin-retry.js/releases)
- [Commits](https://github.com/octokit/plugin-retry.js/compare/v3.0.9...v4.1.6)

---
updated-dependencies:
- dependency-name: "@octokit/plugin-retry"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Charis Kyriakou <charisk@users.noreply.github.com>
2023-07-11 13:02:04 +01:00
Robert
83a25006ec Merge pull request #2586 from github/dependabot/npm_and_yarn/extensions/ql-vscode/prettier-3.0.0
Bump prettier from 2.7.1 to 3.0.0 in /extensions/ql-vscode
2023-07-11 11:11:21 +01:00
Robert
38d0d0ee7d Merge pull request #2593 from github/dependabot/npm_and_yarn/extensions/ql-vscode/tough-cookie-4.1.3
Bump tough-cookie from 4.1.2 to 4.1.3 in /extensions/ql-vscode
2023-07-11 10:51:42 +01:00
Robert
296922c193 Merge pull request #2595 from github/robertbrignull/data-generate-from-source
Hook up generating from source in the new collapsible section
2023-07-11 09:54:07 +01:00
Robert
e5ae41328b Run: npm run format 2023-07-11 09:51:28 +01:00
Robert
0fc3adf29a Upgrade eslint-plugin-prettier to 5.0.0 2023-07-11 09:43:58 +01:00
dependabot[bot]
49954b5af0 Bump prettier from 2.7.1 to 3.0.0 in /extensions/ql-vscode
Bumps [prettier](https://github.com/prettier/prettier) from 2.7.1 to 3.0.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.7.1...3.0.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-10 15:19:00 +00:00
Nora
f493ba102b Merge pull request #2596 from github/nora/update-eslint
Update eslint
2023-07-10 17:17:01 +02:00
Nora
43aa06a248 Update eslint 2023-07-10 13:49:55 +00:00
Robert
c8fd00b983 Hook up generating from source 2023-07-10 13:03:28 +01:00
Robert
c25619332c Merge pull request #2569 from github/robertbrignull/convert-ResultsApp
Convert ResultsApp to a function component
2023-07-10 11:36:32 +01:00
Robert
f4b37c96e4 Merge branch 'main' into robertbrignull/convert-ResultsApp 2023-07-10 11:16:57 +01:00
Robert
f7239b073a Include in addModeledMethods whether the methods are unsaved or not 2023-07-10 10:48:33 +01:00
Robert
bf0032d8de Merge pull request #2592 from github/robertbrignull/data-supported-doc
Add documentation to ExternalApiUsage fields
2023-07-10 10:04:52 +01:00
dependabot[bot]
7eeec834ed Bump tough-cookie from 4.1.2 to 4.1.3 in /extensions/ql-vscode
Bumps [tough-cookie](https://github.com/salesforce/tough-cookie) from 4.1.2 to 4.1.3.
- [Release notes](https://github.com/salesforce/tough-cookie/releases)
- [Changelog](https://github.com/salesforce/tough-cookie/blob/master/CHANGELOG.md)
- [Commits](https://github.com/salesforce/tough-cookie/compare/v4.1.2...v4.1.3)

---
updated-dependencies:
- dependency-name: tough-cookie
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-09 22:27:45 +00:00
Robert
5eab1f8882 Add documentation to ExternalApiUsage fields 2023-07-07 17:10:06 +01:00
Robert
2525ae80b9 Merge pull request #2591 from github/robertbrignull/data-llm-section
Use AI to model just a single section
2023-07-07 16:16:42 +01:00
Robert
8423c73bdd Merge pull request #2590 from github/robertbrignull/data-button-features
Only show LLM / framework mode when the view state says to show the button
2023-07-07 16:09:10 +01:00
Robert
37980612ac Define separate no-op handler 2023-07-07 15:31:08 +01:00
Robert
c4912b1a65 Show framework mode button when available 2023-07-07 14:28:18 +01:00
Robert
ae3b6eccc3 Only show AI button when available 2023-07-07 14:28:01 +01:00
Robert
48ffca3103 Use AI to model just a single section 2023-07-07 12:37:10 +01:00
Robert
dae74e8772 Merge pull request #2588 from github/robertbrignull/data-save-single-model
Implement saving only one model at a time
2023-07-07 09:50:19 +01:00
Robert
e2dc0d6db5 Merge pull request #2589 from github/robertbrignull/data-title-buttons-background
Use better colours for title buttons
2023-07-07 09:26:03 +01:00
Robert
bf087d2114 Merge branch 'main' into robertbrignull/data-title-buttons-background 2023-07-07 08:41:58 +01:00
Shati Patel
8fab24f424 Merge pull request #2587 from github/shati-patel/unsaved-tag
Data extensions editor: Update styling of "unsaved" tag
2023-07-07 08:39:33 +01:00
Robert
7bda76347c Changes buttons to avoid custom styling 2023-07-06 17:02:01 +01:00
dependabot[bot]
5db2b90212 Bump zip-a-folder from 1.1.3 to 2.0.0 in /extensions/ql-vscode (#2517)
Bumps [zip-a-folder](https://github.com/maugenst/zip-a-folder) from 1.1.3 to 2.0.0.
- [Commits](https://github.com/maugenst/zip-a-folder/commits)

---
updated-dependencies:
- dependency-name: zip-a-folder
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Charis Kyriakou <charisk@users.noreply.github.com>
2023-07-06 17:01:50 +01:00
shati-patel
2b13645b6f Move "Save" button slightly to the left 2023-07-06 16:32:34 +01:00
shati-patel
4acc6f9e41 Use native "VS Code Tag" instead of custom span 2023-07-06 16:31:29 +01:00
Robert
e67f93c7bc Implement saving only one model at a time 2023-07-06 16:28:29 +01:00
Robert
261f11e30e Merge pull request #2582 from github/robertbrignull/data-table
Update data extensions modelling table to new designs
2023-07-06 16:27:06 +01:00
Robert
a07e829bf1 Make view link not wrap 2023-07-06 15:25:39 +01:00
Robert
afc9635d43 Use --vscode styles 2023-07-06 15:25:27 +01:00
Robert
7a54b00d29 Merge pull request #2583 from github/robertbrignull/data-unsaved-changes
Show when there are unsaved changes to a model
2023-07-06 12:08:01 +01:00
Robert
903e8c6688 Convert dropdown to a full component 2023-07-06 11:46:57 +01:00
Robert
d5c4f33d6e Use a native select instead of VSCodeDropdown 2023-07-06 11:22:17 +01:00
Robert
7688542aa2 Merge branch 'main' into robertbrignull/data-unsaved-changes 2023-07-06 10:14:15 +01:00
Dave Bartolomeo
614a8d123c Merge pull request #2584 from github/github-action/bump-cli
Bump CLI Version to v2.13.5 for integration tests
2023-07-05 14:33:43 -04:00
github-actions[bot]
e3ff6ace08 Bump CLI version from v2.13.4 to v2.13.5 for integration tests 2023-07-05 15:31:44 +00:00
Robert
fc866acae3 Show when there are unsaved changes to a model 2023-07-05 12:16:40 +01:00
Robert
f75b358e6c Disable buttons instead of hiding them 2023-07-04 17:21:55 +01:00
Robert
e82bfb4153 Pull out booleans controlling visibility of each cell 2023-07-04 17:10:10 +01:00
Charis Kyriakou
7541b64ec8 Move some top level files (#2580)
* Move code-tour.ts to /code-tour

* Move qlpack-generator.ts to /local-queries

* Move query-status.ts to /query-history

* Move skeleton-query-wizard.ts to /local-queries
2023-07-04 16:08:26 +00:00
Robert
12e9de85c7 Merge pull request #2575 from github/robertbrignull/data-editor-story
Use more varied data for the number of usages
2023-07-04 17:01:20 +01:00
Shati Patel
5afdef1ec8 Merge pull request #2581 from github/shati-patel/data-ui-background
Data extensions UI: Change background colour of library container
2023-07-04 17:00:27 +01:00
Robert
870827085d Remove colouring of the methods 2023-07-04 16:57:13 +01:00
Robert
e384f2447c Convert data table to new column layout 2023-07-04 16:57:13 +01:00
Shati Patel
2c5b1da7b2 Merge pull request #2579 from github/shati-patel/bottom-bar
Data extensions UI: Add save button
2023-07-04 16:38:03 +01:00
shati-patel
c7295e66bc Change background colour of library container 2023-07-04 16:35:15 +01:00
Shati Patel
5e49bd5491 Merge pull request #2578 from github/data-ext-divider
Data extensions UI: Add divider between title and status containers
2023-07-04 16:32:28 +01:00
shati-patel
33cb206fed Add save button 2023-07-04 16:07:39 +01:00
shati-patel
882352fcbf Add divider between title and status containers 2023-07-04 16:06:47 +01:00
Robert
f8ad72233a Merge pull request #2574 from github/robertbrignull/data-title
Update data extensions modelling table title bar
2023-07-04 15:57:45 +01:00
Charis Kyriakou
31e94a877d Add code search functionality to test plan (#2577) 2023-07-04 14:47:49 +01:00
Charis Kyriakou
545286b8d9 Add ability to record and replay mock code search requests (#2576) 2023-07-04 14:47:30 +01:00
Robert
c178d251a1 Use more varied data for the number of usages 2023-07-04 11:20:06 +01:00
Robert
97219b9f63 Remove old status info 2023-07-03 16:01:35 +01:00
Robert
15be27c4c3 Add new buttons to title bar 2023-07-03 16:01:34 +01:00
Nora
a3921b7afa Merge pull request #2562 from github/nora/refactor-graph
Convert Graph to a functional component
2023-07-03 15:08:53 +02:00
Nora
9ba5701874 implement merge comments 2023-07-03 11:31:02 +00:00
Robert
4d8694e78b Merge pull request #2571 from github/robertbrignull/AlertTableHeader
Pull out AlertTableHeader to a separate component/file
2023-07-03 12:22:05 +01:00
Robert
e5d4545150 Remove unnecessary function 2023-07-03 10:55:27 +01:00
Robert
0a0b9e590b Merge pull request #2523 from github/robertbrignull/queries-loading
Display different message when queries are loading vs no queries found
2023-07-03 10:52:33 +01:00
Robert
f0af593b67 Simplify comparisons with undefined 2023-07-03 10:51:52 +01:00
Robert
08a8d6396c Remove column arg where it is always "alert-message" 2023-07-03 10:47:02 +01:00
Robert
c876867753 Rename to folder/file items 2023-07-03 09:52:09 +01:00
Robert
eec2f33cba Check for underfined before filtering 2023-07-03 09:44:07 +01:00
Robert
78e794ccdf Convert back to type import 2023-07-03 09:40:05 +01:00
Robert
6acfb8d151 Merge pull request #2570 from github/robertbrignull/AlertTable-rename
Rename PathTable => AlertTable
2023-07-03 09:35:10 +01:00
Dave Bartolomeo
e80a06c5c1 Try grabbing screenshot 2023-06-30 13:36:58 -04:00
Dave Bartolomeo
c70ec7159a Try different default for saveBeforeStart 2023-06-30 10:50:26 -04:00
Dave Bartolomeo
c25410ed5d Log config settings 2023-06-30 10:16:49 -04:00
Dave Bartolomeo
81b2407a47 Log content of untitled docs 2023-06-30 09:57:47 -04:00
Dave Bartolomeo
1f5b3919b0 Dump dirty documents 2023-06-30 09:37:28 -04:00
Dave Bartolomeo
b859bca25f Even more logging 2023-06-30 08:50:06 -04:00
Robert
bfae001b3c Pull out AlertTableHeader to a separate component/file 2023-06-30 10:07:11 +01:00
Robert
2c2b0ecd79 Rename PathTable => AlertTable 2023-06-30 10:01:34 +01:00
Dave Bartolomeo
53a51ab1c9 More logging 2023-06-29 15:33:34 -04:00
Dave Bartolomeo
9f077b0810 Run Jest in verbose mode 2023-06-29 15:14:48 -04:00
Dave Bartolomeo
bf36051054 Increase timeout 2023-06-29 14:52:19 -04:00
Dave Bartolomeo
dbd257e2c0 More logging 2023-06-29 14:39:30 -04:00
Dave Bartolomeo
9fd0697868 Fix format 2023-06-29 12:15:36 -04:00
Dave Bartolomeo
adf0ccb48b Disable workspace trust for CLI integration tests 2023-06-29 12:10:39 -04:00
Robert
3ff649a49a Convert ResultsApp to a function component 2023-06-29 14:49:15 +01:00
Robert
dc5826a848 Rearrange functions so they are defined earlier in the file from where they are called 2023-06-29 14:47:45 +01:00
Anders Starcke Henriksen
4e92688900 Merge pull request #2567 from github/version/bump-to-v1.8.8
Bump version to v1.8.8
2023-06-29 15:30:29 +02:00
github-actions[bot]
08544a4248 Bump version to v1.8.8 2023-06-29 12:22:33 +00:00
Anders Starcke Henriksen
c00adc01f1 Merge pull request #2565 from github/v1.8.7
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
v1.8.7
2023-06-29 13:04:42 +02:00
Anders Starcke Henriksen
65a3ba96c0 v1.8.7 2023-06-29 10:43:05 +02:00
Dave Bartolomeo
d27efb3a17 Merge remote-tracking branch 'origin/main' into dbartol/save-before-start 2023-06-28 20:07:12 -04:00
Dave Bartolomeo
8ff1db13f7 Fix bad diff 2023-06-28 19:55:43 -04:00
Alexander Eyers-Taylor
67d342f2ed Give visibility information to the ide-server. (#2482)
* Add version constraint for Check errors

* Refactor parts of the ideserver out of extension.ts

* Give visibility information to the ide-server.

This allows it to report errors on visible files
eagerly.
2023-06-28 18:21:55 +00:00
Robert
d1838ba0f7 Convert to match style from DB panel 2023-06-28 17:00:44 +01:00
Nora
98d1a24a43 Convert Graph to a functional component 2023-06-28 12:11:55 +00:00
Robert
66d233d669 Merge pull request #2561 from github/enable-a11y-linting-rules
Enable accessibility linting rules and comment out existing violations
2023-06-28 11:54:50 +01:00
Koen Vlaswinkel
a64f44bc41 Merge pull request #2559 from github/koesie10/framework-mode-refresh-button
Add a refresh button to the data extensions editor
2023-06-28 12:38:04 +02:00
Sam Partington
b8b15a53dc Enable accessibility linting rules and comment out existing violations
cf https://github.com/github/code-stats-collector/pull/390 /
https://github.com/github/code-scanning/issues/9347
2023-06-28 10:59:18 +01:00
Robert
6be9e5359c fix typo 2023-06-28 10:37:19 +01:00
Koen Vlaswinkel
266b1e5818 Add a refresh button to the data extensions editor
This adds a refresh button to the data extensions editor when the
framework mode feature flag is enabled. If you are using framework mode,
you can have multiple tabs of the data extensions editor open in which
you are modeling the library separately from the application. When you
save the library in framework mode, the application mode will not
refresh and show that these calls have been modeled. Rather than using
apply, which might also save all modeled methods, you can now use the
refresh button to refresh the external API usages and whether they are
supported.
2023-06-28 11:33:21 +02:00
Koen Vlaswinkel
001179056e Merge pull request #2558 from github/koesie10/exclude-test-methods-in-framework-mode
Exclude methods in tests in framework mode
2023-06-28 11:14:55 +02:00
Koen Vlaswinkel
bcbbb42b41 Exclude methods in tests in framework mode
This excludes methods defined in tests in framework mode, significantly
cutting down on the number of methods shown that would need to be
modeled.

For C#, this just checks that the file is not a test file, as defined
by the QL library.

For Java, this makes a copy of the internal
[`ModelExclusions.qll`](249f9f863d/java/ql/lib/semmle/code/java/dataflow/internal/ModelExclusions.qll)
file to avoid the use of internal modules. This module will tell us
whether a method is "interesting" to model or not. Not all of the checks
in this module need to happen for framework mode, but these checks might
be useful for telling a user whether a method is interesting to model
in application mode.
2023-06-28 10:21:26 +02:00
Koen Vlaswinkel
6465786411 Merge pull request #2557 from github/koesie10/jump-to-def-framework-mode
Add jump to definition in framework mode
2023-06-28 09:49:45 +02:00
Robert
d290b56649 Display custom text message when there are no queries found 2023-06-27 17:04:26 +01:00
Robert
cf49d5dcde Change welcome message to say we're searching for queries 2023-06-27 17:04:26 +01:00
Robert
94fe3e0020 Always trigger pathsChanged listener after initial refresh 2023-06-27 17:04:26 +01:00
Shati Patel
9314b3ba56 Merge pull request #2554 from github/shati-patel/run-all-context-menu
Queries panel: Run all queries in folder (context menu)
2023-06-27 16:51:40 +01:00
Nora
af366afcff Merge pull request #2556 from github/nora/release-run-from-tab
Release run query from file tab icon
2023-06-27 17:46:35 +02:00
Robert
6fe7b82397 Only return something from getPathData once discover has run at least once 2023-06-27 16:20:30 +01:00
Koen Vlaswinkel
1579859c9d Merge pull request #2555 from github/koesie10/nested-name-csharp
Add `nestedName` function for C#
2023-06-27 17:00:23 +02:00
Koen Vlaswinkel
5349a75bd0 Add jump to definition in framework mode
This makes the method name and parameters in framework mode a link to
the definition of the method. In framework mode, the `usages` contains
1 element, which is the location of the definition of the method.
Therefore, we can simply use `jumpToUsage` to jump to the definition.
2023-06-27 16:57:46 +02:00
Nora
46a32081d9 Release run query from file tab 2023-06-27 14:40:48 +00:00
Nora
82977519ce Merge pull request #2552 from github/nora/run-all-queries-panel
Queries Panel: run-all queries of a folders
2023-06-27 16:37:43 +02:00
Nora
32555cc4f2 Merge pull request #2548 from github/dependabot/npm_and_yarn/extensions/ql-vscode/semver-7.5.2
Bump semver from 7.3.7 to 7.5.2 in /extensions/ql-vscode
2023-06-27 16:33:16 +02:00
Koen Vlaswinkel
4b8cdf872a Merge pull request #2553 from github/koesie10/nested-name
Use `nestedName` for getting the name of an API
2023-06-27 16:17:43 +02:00
Koen Vlaswinkel
8af0ba7411 Add nestedName function for C#
Similar to https://github.com/github/vscode-codeql/pull/2553, this
changes the C# query to correctly report the name of nested types. I
couldn't find a `nestedName` method for C#, so this adds one in the
`AutomodelVsCode` library.

C# seems to use `+` as a separator for nested types, as reported by
`getQualifiedName()`:

```
GitHub.Nested.MyFirstClass+NestedClass
```

The `getApiName()` will now report:

```
GitHub.Nested#MyFirstClass+NestedClass.Test()
```
2023-06-27 16:14:42 +02:00
shati-patel
02b356cf86 Queries panel: Run all queries in folder (context menu)
Adds a command to run all queries in a certain folder.
This uses the existing `runQueries` command, which lets you run multiple queries against the selected local database.
We don't have a corresponding command for running multiple variant analysis queries, so I haven't implemented that.
2023-06-27 15:03:23 +01:00
Koen Vlaswinkel
3ad3644219 Merge pull request #2542 from github/koesie10/override-extension-directory
Allow overriding the data extensions editor extensions directory
2023-06-27 15:13:59 +02:00
Koen Vlaswinkel
77495df97d Merge pull request #2550 from github/koesie10/refactor-duplication-queries
Refactor data extensions editor queries to reduce duplication
2023-06-27 15:13:50 +02:00
Nora
a591c82b3c Add run all on folders 2023-06-27 15:08:30 +02:00
Shati Patel
ee68156574 Merge pull request #2547 from github/shati-patel/run-query-context-menu-remote
Run variant analysis from Queries Panel context menu
2023-06-27 13:38:25 +01:00
Koen Vlaswinkel
a053792d6e Use nestedName for getting the name of an API
This changes the Java `CallableMethod.getApiName()` to use `nestedName`
instead of `getSourceDeclaration`. `getSourceDeclaration` would return a
`RefType`, on which the `toString()` method returns its `getName`().
However, for nested types this wouldn't work and wouldn't include the
enclosing type. This fixes it by using `nestedName` which matches the
method that is also used for determining whether a type matches an
extensible predicate.
2023-06-27 14:38:19 +02:00
Alexander Eyers-Taylor
b0699ee524 Add quick eval count to the command palette (#2475)
* Add version constraint for quick-eval-count

* Add quick eval count context.

* Add support for running quick-eval-count from the command pallete

* Adjust name for quick-eval-count-queries

* Add changenote for quick-eval-count.

* QuickEval:Address review comments

* Fix rebase conflict in changelog
2023-06-27 11:28:28 +01:00
Koen Vlaswinkel
bd0e5604a8 Fix incorrect JAR name being displayed in application mode 2023-06-27 11:22:03 +02:00
Nora
2a332f90c4 Merge pull request #2551 from github/nora/fix-merge-conflict-mistake
Fix merge conflict error: Re-add icon
2023-06-27 10:46:00 +02:00
Shati Patel
7b73ff4231 Merge pull request #2546 from github/shati-patel/run-query-context-menu-local
Run local query from Queries Panel context menu
2023-06-26 17:08:42 +01:00
Shati Patel
0d0ae6449f Merge branch 'main' into shati-patel/run-query-context-menu-local 2023-06-26 16:46:24 +01:00
Nora
3c156b858c Re-add icon 2023-06-26 14:54:17 +00:00
Koen Vlaswinkel
7e8578a22c Refactor data extensions editor queries to reduce duplication
This refactors the data extensions editor queries to use a new
`AutomodelVsCode` module. This module is based on the `ExternalApi`
module, but is more general and can be used for retrieving public
methods from the source as well. The actual conditions are now in the
queries themselves.

This reduces the duplicated module in the framework mode query and will
mean that when we update the `ExternalApi` module, we will just have to
port it to the `AutomodelVsCode` module, and not to the `ExternalApi`
and a separate framework mode query.
2023-06-26 16:33:05 +02:00
Koen Vlaswinkel
aa4d3f4399 Merge pull request #2549 from github/koesie10/consistent-sorting
Sort methods sent to LLM the same way as the UI
2023-06-26 16:11:38 +02:00
Nora
75d2f76658 Merge pull request #2544 from github/nora/queries-panel-file-tab
Queries Panel: run local query from file tab
2023-06-26 16:09:03 +02:00
Robert
75cffd50b1 Merge pull request #2539 from github/robertbrignull/raw-results-react
Convert RawTable to a function component
2023-06-26 14:23:19 +01:00
Nora
10d8bbfe63 Add run icon to file tab 2023-06-26 14:48:48 +02:00
Koen Vlaswinkel
90c8391fea Sort methods sent to LLM the same way as the UI
This changes the sorting of the methods sent to LLM to match the order
shown in the data extensions editor. This will ensure that the methods
which are shown first in the data extensions editor are also modeled
first.
2023-06-26 14:26:31 +02:00
Koen Vlaswinkel
a8aee6a8e1 Extract sorting to separate functions 2023-06-26 14:08:46 +02:00
dependabot[bot]
d41e9ef163 Bump semver from 7.3.7 to 7.5.2 in /extensions/ql-vscode
Bumps [semver](https://github.com/npm/node-semver) from 7.3.7 to 7.5.2.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v7.3.7...v7.5.2)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-26 11:57:15 +00:00
Nora
13a5b7854f Merge pull request #2534 from github/nora/run-local-query-panel
Queries Panel: run local query from panel
2023-06-26 13:56:08 +02:00
shati-patel
3a3264302a Run variant analysis from Queries Panel context menu 2023-06-26 11:53:01 +01:00
shati-patel
9704b498fe Run local query from Queries Panel context menu 2023-06-26 10:51:18 +01:00
Nora
2b48991494 Rename command 2023-06-26 09:04:06 +00:00
Nora
ff41e50954 Show run button only when db is selected 2023-06-26 09:04:06 +00:00
Nora
24683f34de Adjust command lint tests 2023-06-26 09:04:06 +00:00
Nora
7db84b0276 Always show run button 2023-06-26 09:04:06 +00:00
Nora
655294db06 Use only one command 2023-06-26 09:04:06 +00:00
Nora
5845e9e59e Merge comments and mock command 2023-06-26 09:04:06 +00:00
Nora
c0c42d36b9 Use corret Uri method and extract feature flag guard 2023-06-26 09:04:06 +00:00
Nora
2898acd67f Hide new command behind feature flag 2023-06-26 09:04:06 +00:00
Robert
7409fe8a56 rename commands to match linter 2023-06-26 09:04:06 +00:00
Robert
f25d7baa56 Expose QueryServerCommandManager from app 2023-06-26 09:04:06 +00:00
Nora
3f1b619904 Create new runQuery command for the queries panel 2023-06-26 09:04:06 +00:00
Nora
12c0c57c25 hook up new command and make runQuery executable 2023-06-26 09:04:06 +00:00
Nora
c78db22599 Hide run button when no local database is selected 2023-06-26 09:04:06 +00:00
Nora
fea0c3ce46 Add icon 2023-06-26 09:04:06 +00:00
Robert
0e033b48d4 Avoid creating and throwing away Scroller each render 2023-06-26 10:03:15 +01:00
Koen Vlaswinkel
971d1461c8 Merge pull request #2543 from github/koesie10/exclude-anonymous-classes
Exclude methods from anonymous classes in framework mode
2023-06-26 10:00:04 +02:00
Koen Vlaswinkel
a76bd4627c Merge pull request #2535 from github/koesie10/framework-mode
Add initial implementation of framework mode
2023-06-23 13:57:09 +02:00
Koen Vlaswinkel
6e16f826fb Exclude methods from anonymous classes in framework mode 2023-06-23 13:45:06 +02:00
Koen Vlaswinkel
4f367119cb Fix data extensions editor story 2023-06-23 11:59:26 +02:00
Koen Vlaswinkel
01da0f1d34 Fix incorrect comment on method 2023-06-23 11:58:43 +02:00
Koen Vlaswinkel
aec5ff3902 Allow overriding the extensions directory
This will allow users to override the default directory in which
extension packs are created by using the
`codeQL.dataExtensions.extensionsDirectory` setting. This setting can be
overriden per language, so the user could create the following
configuration to set the extension pack setting for Java only:

```json
"[java]": {
  "codeQL.dataExtensions.extensionsDirectory": "/Users/user/github/vscode-codeql-starter/codeql-custom-queries-java",
}
```
2023-06-23 11:37:58 +02:00
Koen Vlaswinkel
f90d538743 Add feature flag for framework mode 2023-06-23 11:12:28 +02:00
Koen Vlaswinkel
72a91efde9 Add tests for framework mode YAML generation 2023-06-23 10:45:12 +02:00
Koen Vlaswinkel
8c36e572cb Create model filenames for framework mode 2023-06-23 10:04:37 +02:00
Koen Vlaswinkel
2351346440 Change data flow generator for framework mode 2023-06-23 09:53:53 +02:00
Koen Vlaswinkel
d26d886d09 Add grouping by package and remove usages for framework mode 2023-06-23 09:53:53 +02:00
Koen Vlaswinkel
48b78c1ac1 Change tests to include framework mode queries 2023-06-23 09:53:53 +02:00
Koen Vlaswinkel
526e7474a5 Add switching of mode 2023-06-23 09:53:52 +02:00
Koen Vlaswinkel
31e1bef548 Add framework mode queries 2023-06-23 09:53:01 +02:00
Koen Vlaswinkel
82cdf03d8c Merge pull request #2521 from github/koesie10/auto-create-model-files
Automatically create different model files per library
2023-06-23 09:52:39 +02:00
Dave Bartolomeo
d9a1aa8a23 Just kidding, _this_ time it's fixed for reals 2023-06-22 14:40:26 -04:00
Dave Bartolomeo
3705464766 Seriously, I think they'll pass for reals this time. 2023-06-22 14:32:25 -04:00
Dave Bartolomeo
ff2d67d930 Merge remote-tracking branch 'origin/main' into dbartol/save-before-start 2023-06-22 17:32:05 +00:00
Dave Bartolomeo
ec71f53e38 Fix more test failures 2023-06-22 13:31:12 -04:00
Robert
fa23441efb Merge pull request #2541 from github/robertbrignull/move-pure-4
Move tests out of pure directory
2023-06-22 17:08:58 +01:00
Dave Bartolomeo
6bdc095d27 Fix test failure 2023-06-22 11:45:54 -04:00
Robert
ecfa0ff5b9 Convert dataRows to a useMemo 2023-06-22 16:45:23 +01:00
Robert
3957d356f0 Import react hooks explicitly 2023-06-22 16:45:23 +01:00
Robert
f08ef1b742 Use useRef instead of useMemo for scroller 2023-06-22 16:45:21 +01:00
Robert
e29bfc83c8 Use useEffect instead of calling directly every time 2023-06-22 16:20:32 +01:00
Robert
8b95320ba8 Move tests out of pure directory 2023-06-22 15:19:47 +01:00
Robert
480bd48a8d Merge pull request #2533 from github/robertbrignull/assert-pure
Update assert-pure.ql now that the /pure directory has been removed
2023-06-22 15:19:25 +01:00
Robert
1499d909c8 Merge pull request #2537 from github/robertbrignull/move-pure-3
Move files from /pure to the /common (and other) directories (part 3 of 3)
2023-06-22 15:15:31 +01:00
Dave Bartolomeo
2397ead586 Fix test failure 2023-06-22 10:02:10 -04:00
Koen Vlaswinkel
b42457c50b Merge pull request #2540 from github/koesie10/update-external-api-qll
Update ExternalApi.qll dependencies
2023-06-22 15:21:10 +02:00
Robert
f5fef92f0f Move variant-analysis-filter-sort to shared directory 2023-06-22 13:42:12 +01:00
Robert
fc36eaab4b Move variant-analysis-filter-sort.ts to /variant-analysis 2023-06-22 13:37:13 +01:00
Robert
08fdddeefc Move result-keys.ts to /view/results 2023-06-22 13:37:13 +01:00
Robert
8e58854302 Move log-summary-parser.ts to /log-insights 2023-06-22 13:37:13 +01:00
Robert
1750594d11 Move new-messages.ts to /query-server 2023-06-22 13:37:10 +01:00
Koen Vlaswinkel
2e7c86d107 Update ExternalApi.qll dependencies 2023-06-22 14:33:28 +02:00
Robert
6143bd30d8 Convert RawTable to a functional component 2023-06-22 12:41:23 +01:00
Dave Bartolomeo
0bd0bf1944 _Correctly_ emulate VS Code's saveBeforeStart 2023-06-22 07:30:53 -04:00
Robert
cd69e5934b Merge pull request #2536 from github/robertbrignull/throw-instead-of-fail
Throw error instead of using fail method
2023-06-22 11:48:49 +01:00
Koen Vlaswinkel
669f4a6430 Add .model suffix to model filenames 2023-06-22 11:44:20 +02:00
Koen Vlaswinkel
b7b4302c1e Automatically create different model files per library
This will remove the user input for a model file and will instead create
1 model file per library (JAR/DLL). The model filename will be based on
the JAR/DLL name, but will remove the version number and the file
extension. It will also normalize the name.

These files will be created automatically, and the editor now also reads
in all files contained in an extension pack to read the modeled methods.
This could result in duplicates if the user has created a different file
to contain the same modeled methods, but this is an edge-case that we're
explicitly not handling.
2023-06-22 11:44:18 +02:00
Koen Vlaswinkel
100b557823 Merge pull request #2520 from github/koesie10/auto-name-extension-pack
Automatically name extension packs
2023-06-22 11:34:37 +02:00
Koen Vlaswinkel
7249f4c343 Add comment to explain heuristic 2023-06-22 10:08:11 +02:00
Koen Vlaswinkel
e4e849d14c Merge remote-tracking branch 'origin/main' into koesie10/auto-name-extension-pack 2023-06-22 10:01:51 +02:00
Dave Bartolomeo
b182d7afef Fix PR feedback 2023-06-21 17:20:32 -04:00
Dave Bartolomeo
1da96c5a55 Allow languageId: scopes in tests 2023-06-21 17:01:13 -04:00
Dave Bartolomeo
de38b1fd20 Stop overriding saveBeforeStart for ql language 2023-06-21 14:27:57 -04:00
Dave Bartolomeo
7a46bac078 Save dirty documents before evaluating queries 2023-06-21 18:12:42 +00:00
Robert
f8b0583c5f Move messages-shared.ts to /query-server 2023-06-21 16:31:57 +01:00
Robert
b0e6478bfe Move legacy-messages.ts to /query-server 2023-06-21 16:31:57 +01:00
Robert
0031c1acc0 Throw error instead of using fail method 2023-06-21 16:02:57 +01:00
Robert
0451dd8d1b Merge pull request #2532 from github/robertbrignull/move-pure-2
Move files from /pure to the /common directory (part 2 of 3)
2023-06-21 13:15:38 +01:00
Robert
8559d3baa0 Update assert-pure.ql now that the /pure directory has been removed 2023-06-21 12:33:32 +01:00
Robert
f12b62fa9d Move zip.ts to /common 2023-06-21 12:19:35 +01:00
Robert
90e94e04fc Move word.ts to /common 2023-06-21 12:19:35 +01:00
Robert
236a317fa0 Move time.ts to /common 2023-06-21 12:19:35 +01:00
Robert
1bf14e393f Move text-utils.ts to /common 2023-06-21 12:19:35 +01:00
Robert
655adfcd51 Move sarif-utils.ts to /common 2023-06-21 12:19:35 +01:00
Robert
b11a675004 Move ql.ts to /common 2023-06-21 12:19:35 +01:00
Robert
855cac628b Move number.ts to /common 2023-06-21 12:19:35 +01:00
Robert
5b168dfb7e Move location-link-utils.ts to /common 2023-06-21 12:19:35 +01:00
Robert
704ebf1ff6 Move interface-types.ts to /common 2023-06-21 12:19:35 +01:00
Robert
9903982bb1 Merge pull request #2530 from github/robertbrignull/move-pure-1
Move files from /pure to the /common directory (part 1 of 3)
2023-06-21 11:54:11 +01:00
Robert
d0df2966c5 Merge branch 'main' into robertbrignull/move-pure-1 2023-06-21 11:23:42 +01:00
Koen Vlaswinkel
7f9208f1e1 Merge pull request #2531 from github/koesie10/remove-common-index
Remove `common/index.ts` and vscode from `common/logging`
2023-06-21 12:11:19 +02:00
Robert
e92b676820 Merge branch 'main' into robertbrignull/move-pure-1 2023-06-21 10:37:39 +01:00
Robert
a054290c50 Merge pull request #2529 from github/robertbrignull/queries-panel-errors
Ensure errors for one path don't stop discovery of other paths
2023-06-21 10:09:45 +01:00
Koen Vlaswinkel
eeb867624e Remove common/index.ts and vscode from common/logging
The `logging` part of `common` was exported in `common/index.ts` and
could be imported by importing `common`. I don't think this makes a lot
of sense, so I removed it.

The `common/logging/index.ts` also contained exports of the
`common/logging/vscode` directory, which means that importing
`common/logging` automatically brings in the `vscode` module. This
removes that export, so now there are two separate imports needed for
importing the common part and the `vscode` specific part. This should
make it easier to keep them separate and be more explicit about what
you're importing.
2023-06-21 10:20:19 +02:00
Robert
2813576f07 Move helpers-pure.ts to /common 2023-06-21 09:10:26 +01:00
Robert
1ced7a90fd Move files.ts to /common 2023-06-21 09:06:38 +01:00
Robert
4cbd0b7fb8 Move errors.ts to /common 2023-06-21 09:03:16 +01:00
Robert
af97077095 Move distribution.ts to /common 2023-06-21 08:59:51 +01:00
Robert
a5aa0c4cf3 Move disposable-object.ts to /common 2023-06-21 08:56:59 +01:00
Koen Vlaswinkel
d092e69abf Add detection of root workspace directory using .git folder 2023-06-21 09:55:29 +02:00
Robert
7cab02de60 Move date.ts to /common 2023-06-21 08:53:51 +01:00
Robert
dc91028cee Move bqrs-utils.ts to /common 2023-06-21 08:50:39 +01:00
Robert
f228ec9645 Move bqrs-cli-types.ts to /common 2023-06-21 08:50:35 +01:00
Koen Vlaswinkel
f32a240e24 Exclude workspace folders in the system temp dir 2023-06-21 09:44:39 +02:00
Robert
7135d39aad Log error message 2023-06-21 08:24:22 +01:00
Shati Patel
c628454e25 Allow queries panel to be visible in non-dev mode too (#2528) 2023-06-20 16:46:31 +01:00
Robert
fa773a0029 Ensure errors for one path don't stop discovery of other paths 2023-06-20 16:21:20 +01:00
Koen Vlaswinkel
2c97ca95aa Merge pull request #2527 from github/koesie10/replace-faker-uuid
Replace deprecated faker.datatype.uuid by faker.string.uuid
2023-06-20 16:50:30 +02:00
Koen Vlaswinkel
d3a179744e Merge branch 'main' into koesie10/replace-faker-uuid 2023-06-20 16:22:51 +02:00
Koen Vlaswinkel
8fb1229c49 Merge pull request #2524 from github/koesie10/grouping-improvements
Improve grouping of libraries
2023-06-20 15:22:33 +02:00
Robert
23173bf441 Merge pull request #2525 from github/robertbrignull/sendRequest_progress
Remove ProgressCallback / CancellationToken arguments where they aren't used
2023-06-20 14:16:36 +01:00
Koen Vlaswinkel
1cc6aa5303 Merge branch 'main' into koesie10/auto-name-extension-pack 2023-06-20 15:12:15 +02:00
Koen Vlaswinkel
2800ccb74c Add extra sorting parameters for libraries 2023-06-20 14:24:56 +02:00
Robert
3685575c11 Merge branch 'main' into robertbrignull/sendRequest_progress 2023-06-20 13:24:30 +01:00
github-actions[bot]
c40be89636 Bump CLI version from v2.13.3 to v2.13.4 for integration tests (#2526)
Co-authored-by: github-actions[bot] <github-actions@github.com>
2023-06-20 11:28:25 +01:00
Robert
f99957435d Fix expected args in tests 2023-06-20 11:09:13 +01:00
Koen Vlaswinkel
ff491bb706 Replace deprecated faker.datatype.uuid by faker.string.uuid 2023-06-20 11:48:31 +02:00
Koen Vlaswinkel
cfc66a4e17 Store extension packs in .github/codeql/extensions 2023-06-20 11:16:23 +02:00
Robert
4d8506b3f5 Add back in manual progress update 2023-06-20 09:42:59 +01:00
Koen Vlaswinkel
ab6db71727 Move workspace folder functions to separate file 2023-06-20 10:06:52 +02:00
Koen Vlaswinkel
ddd97f08a3 Add chevron to show whether row is expanded 2023-06-20 09:32:57 +02:00
Koen Vlaswinkel
32d8968c56 Use pluralize function for pluralization 2023-06-20 09:32:57 +02:00
Koen Vlaswinkel
768c10734e Make libraries collapsible 2023-06-20 09:32:57 +02:00
Koen Vlaswinkel
a833f78151 Sort libraries by supported and usages 2023-06-20 09:32:57 +02:00
Robert
c93449ab9f Remove ProgressCallback / CancellationToken arguments where they aren't used 2023-06-19 17:13:40 +01:00
Robert
d8c3410641 Merge pull request #2490 from github/robertbrignull/resolve-queries-manual
Add manual discovery of queries and query packs
2023-06-19 14:40:50 +01:00
Robert
d2b69b1316 Normalize tmp path to ensure correct comparrison on windows 2023-06-19 14:13:09 +01:00
Koen Vlaswinkel
e83ad364f5 Merge pull request #2522 from github/koesie10/group-by-library
Group modeled methods by library in the data extensions editor
2023-06-19 15:01:19 +02:00
Koen Vlaswinkel
fe29a1a32a Add more comments 2023-06-19 13:54:17 +02:00
Koen Vlaswinkel
3323fd4e3b Add more tests for auto pack naming 2023-06-19 13:51:24 +02:00
Koen Vlaswinkel
3c60708b55 Separate pack naming and create interface 2023-06-19 13:47:27 +02:00
Koen Vlaswinkel
8980aabbfc Split flows for checking existing extension pack 2023-06-19 13:34:35 +02:00
Robert
a30ec907d0 Add tiny sleep to fix tests 2023-06-19 11:32:55 +01:00
Robert
96bb7058a2 Make note about NodeJS.ErrnoException 2023-06-19 11:09:08 +01:00
Koen Vlaswinkel
5dcadd2f1f Merge pull request #2519 from github/koesie10/add-library-to-data-extensions-editor
Add library to data extensions editor
2023-06-19 12:07:34 +02:00
Robert
1f18cc3f2c Use Readonly and ReadonlyArray 2023-06-19 10:58:26 +01:00
Robert
989ef8b681 Fix typo 2023-06-19 10:57:20 +01:00
Robert
70681253eb Only expose event to subclasses, instead of event emitter 2023-06-19 10:57:10 +01:00
Koen Vlaswinkel
bbc39b060f Remove library column 2023-06-19 11:52:09 +02:00
Koen Vlaswinkel
590e908886 Group modeled methods by library 2023-06-19 11:39:47 +02:00
Koen Vlaswinkel
487c0a66f4 Create ModeledMethodDataGrid component 2023-06-19 11:33:45 +02:00
Koen Vlaswinkel
23745ba93f Change jar to library for Java query 2023-06-19 11:25:40 +02:00
Robert
af62a92c5b Make pathData private to FilePathDiscovery 2023-06-16 16:40:11 +01:00
Robert
da92a67834 Introduce recomputeAllData to avoid mutating pathData from outside of FilePathDiscovery 2023-06-16 16:35:58 +01:00
Robert
c6a7e1fb3c Rename from path to pathData where appropriate 2023-06-16 16:23:39 +01:00
Robert
d626cea837 Use getOnDiskWorkspaceFolders instead of getOnDiskWorkspaceFoldersObjects when all we need is the path 2023-06-16 16:14:08 +01:00
Robert
bdea0c2c20 Use one lstat call instead of calling exists first 2023-06-16 16:12:29 +01:00
Robert
44327cac23 Use sets instead of custom expectArraysEqual 2023-06-16 15:23:32 +01:00
Koen Vlaswinkel
5d83ac84e3 Fix tests on Windows 2023-06-16 16:01:30 +02:00
Robert
3a0aaa0ae9 Use jest.SpiedFunction instead of jest.SpyInstance 2023-06-16 12:35:59 +01:00
Robert
18e7431a44 Make conditional easier to read 2023-06-16 12:33:21 +01:00
Koen Vlaswinkel
549884d507 Automatically name extension packs
This will change how extension packs are named in the data extensions
editor. Before, the user had to pick a workspace folder and a name for
the extension pack. Now, the workspace folder will be picked
automatically if we can detect it (i.e. it follows the naming structure
we expect), or the user will still need to select it. The extension pack
name is always auto-generated based on the database name and the
database language.

This adds a new `codeQL.dataExtensions.disableAutoNameExtensionPack`
setting to disable this behavior while we are still working on changing
how the data extensions editor works.
2023-06-16 13:31:31 +02:00
Robert
6504e46011 Invert condition to reduce nesting 2023-06-16 12:31:12 +01:00
Robert
ce6a21c65a Use pathExists instead of exists 2023-06-16 12:21:36 +01:00
Robert
fce27d02dc Use a plain Set intead of custom FilePathSet 2023-06-16 11:29:38 +01:00
Robert
f7a72c6d45 Use QueryLanguage where possible 2023-06-16 11:29:28 +01:00
Koen Vlaswinkel
55d1f14ac4 Add library to data extensions editor
This adds a new library column to the data extensions editor containing
the JAR or DLL file the method is defined in. This will be used to group
methods by library in the future. For now, it just shows in a column.
2023-06-16 12:01:30 +02:00
Robert
959c3fbcb8 Fix typos 2023-06-16 10:47:07 +01:00
Koen Vlaswinkel
0f9d127b4c Merge pull request #2513 from github/koesie10/show-telemetry-without-vscode
Make the `showAndLogExceptionWithTelemetry` function work without the `vscode` module
2023-06-16 09:39:12 +02:00
Andrew Eisenberg
f9a415c377 Merge pull request #2516 from github/aeisenberg/modernize
Modernize query packs
2023-06-15 08:01:22 -07:00
Koen Vlaswinkel
539284b902 Merge pull request #2511 from github/koesie10/show-and-log-without-vscode
Make the showAndLog family of functions usable without the `vscode` module
2023-06-15 09:29:18 +02:00
Andrew Eisenberg
244bc3bdab Modernize query packs
Remove legacy `libraryPathDependencies`. We are making some
changes internally that will cause legacy packs with lock
files to throw an error.
2023-06-14 20:56:45 +00:00
Robert
5cbb7b49d7 Update QueryDiscovery to use FilePathDiscovery and QueryPackDiscovery 2023-06-14 17:30:40 +01:00
Robert
a9d59aecb8 Add QueryPackDiscovery 2023-06-14 17:30:37 +01:00
Robert
17b5e000f8 Add FilePathDiscovery 2023-06-14 17:30:33 +01:00
Robert
790c33c661 Add silent arg to resolveLibraryPath 2023-06-14 16:09:42 +01:00
Robert
51b94e3fed Add FilePathSet 2023-06-14 16:09:42 +01:00
Robert
b0441956df Remove the update method from the Discovery class
See https://github.com/github/vscode-codeql/pull/2490#discussion_r1226437598
for more explanation. This will make the class more useful for future usecases
where we don't want the behaviour of only calling update when there isn't
another refresh scheduled. I also think it doesn't negatively affect other
users such as the query test discovery. The effect should be that we'll see
more updates to the UI. These updates will get overwritten quickly, but they
are all genuine snapshots of the filesystem at the point the discovery process
ran, so they aren't incorrect, or aren't more incorrect than continuing to show
the old state before any discovery ran.
2023-06-14 16:09:42 +01:00
Koen Vlaswinkel
8803433fa4 Merge pull request #2515 from github/version/bump-to-v1.8.7
Bump version to v1.8.7
2023-06-14 14:53:24 +02:00
github-actions[bot]
ab448e51d5 Bump version to v1.8.7 2023-06-14 12:20:00 +00:00
Koen Vlaswinkel
2905f5340a Merge pull request #2514 from github/v1.8.6
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
v1.8.6
2023-06-14 13:51:21 +02:00
Koen Vlaswinkel
170fce8815 v1.8.6 2023-06-14 13:17:03 +02:00
Koen Vlaswinkel
7a76e20841 Move showAndLogExceptionWithTelemetry out of vscode directory 2023-06-14 11:59:14 +02:00
Koen Vlaswinkel
d03d355513 Add telemetry as argument to showAndLogExceptionWithTelemetry 2023-06-14 11:19:50 +02:00
Koen Vlaswinkel
959728d1ca Add telemetry to App 2023-06-14 11:19:46 +02:00
Koen Vlaswinkel
fefb2f6694 Add AppTelemetry interface 2023-06-14 11:19:16 +02:00
Koen Vlaswinkel
08786055e3 Move telemetry to common/vscode 2023-06-14 11:19:10 +02:00
Koen Vlaswinkel
108d5268b0 Fix tests mocking showAndLog functions 2023-06-14 11:17:49 +02:00
Koen Vlaswinkel
fcbe3bea1e Use app logger instead of extLogger where possible
To increase the use of the `app` logger, this replaces the direct use of
`extLogger` by the `app.logger` where possible. This should not change
the behavior since the `extLogger` is the logger used by the `app`.
2023-06-14 11:17:37 +02:00
Koen Vlaswinkel
2b85690c68 Change logger on app to NotificationLogger 2023-06-14 11:17:18 +02:00
Koen Vlaswinkel
67c081921b Move show and log functions to common
This moves the `showAndLog` family of functions to the `common/logging`
directory. It explicitly moves the `showAndLogExceptionWithTelemetry`
function to the `common/vscode/logging.ts` file because it still has a
dependency on the `telemetryListener`, which depends on the `vscode`
module.
2023-06-14 11:17:17 +02:00
Koen Vlaswinkel
9ff2d568c8 Change showAndLog functions to take NotificationLogger 2023-06-14 11:16:52 +02:00
Koen Vlaswinkel
d54ee0c0e5 Merge pull request #2508 from github/koesie10/split-helpers-4
Split helpers.ts [Part 4]
2023-06-14 11:15:04 +02:00
Nora
fa7d85ea58 Merge pull request #2512 from github/nora/remove-code-search-flag
Remove code search feature flag
2023-06-14 10:41:19 +02:00
Koen Vlaswinkel
179942680e Merge pull request #2506 from github/koesie10/split-helpers-3
Move show and log functions out of helpers
2023-06-14 10:28:43 +02:00
Koen Vlaswinkel
f67f53dd68 Merge remote-tracking branch 'origin/main' into koesie10/split-helpers-3 2023-06-14 09:30:41 +02:00
Koen Vlaswinkel
c6c56284ff Merge pull request #2505 from github/koesie10/split-helpers-2
Split `helpers.ts` [Part 2]
2023-06-14 09:29:58 +02:00
Nora
afa2f426b8 Update Changelog 2023-06-13 14:55:14 +00:00
Nora
fd381640a0 Remove feature flag 2023-06-13 14:55:02 +00:00
Robert
019e3772ef Merge pull request #2510 from github/robertbrignull/use_contains_path
Use containsPath where possible
2023-06-13 10:19:01 +01:00
Nora
a03b3dca86 Merge pull request #2507 from github/nora/remove-1000-list-limit
Remove limit of 1000 repos per list
2023-06-13 09:57:16 +02:00
Robert
cad651d6bd Use containsPath where possible 2023-06-12 16:33:35 +01:00
Robert
400bde6e03 Merge pull request #2509 from github/robertbrignull/contains_path
Fix containsPath for paths that share a prefix
2023-06-12 16:17:39 +01:00
Robert
3a9fa42790 Merge branch 'main' into robertbrignull/contait push origin robertbrignull/contains_pathns_path 2023-06-12 15:39:47 +01:00
Robert
c920b7e49e Remove explicit check for windows 2023-06-12 15:16:43 +01:00
Koen Vlaswinkel
ccf38a98fb Move incorrectly named helpers.test.ts 2023-06-12 15:55:10 +02:00
Koen Vlaswinkel
00240e56f4 Rename helpers.ts to tmp-dir.ts 2023-06-12 15:55:10 +02:00
Koen Vlaswinkel
1096ed8bf5 Move upgradesTmpDir out of helpers 2023-06-12 15:55:10 +02:00
Koen Vlaswinkel
61ac19f715 Move createTimestampFile out of helpers 2023-06-12 15:55:09 +02:00
Koen Vlaswinkel
9a32556b4d Move query language functions out of helpers 2023-06-12 15:55:09 +02:00
Koen Vlaswinkel
2cd88cecde Move tryGetQueryMetadata out of helpers 2023-06-12 15:55:09 +02:00
Robert
6dbbd22c0a Merge pull request #2497 from github/robertbrignull/cleanup_workspace_folders
Remove workspaceFolders from app because it turned out not to be useful
2023-06-12 14:50:00 +01:00
Robert
aa4c459cdd Use relative instead of startsWith to handle paths with the same prefix 2023-06-12 14:41:31 +01:00
Robert
f7c1f06354 Add another test case for case insensitivity on windows 2023-06-12 14:41:31 +01:00
Robert
6e3d0147c9 Add test cases for paths with the same prefix 2023-06-12 14:41:31 +01:00
Robert
300503e1c9 Remove platform arg as it's never not the process.platform 2023-06-12 14:41:31 +01:00
Robert
bdd2319297 Update docs to mention about paths being equal 2023-06-12 14:41:21 +01:00
Nora
4c16888624 Remove limit of 1000 to repo lists 2023-06-12 12:46:40 +00:00
Koen Vlaswinkel
d71f210647 Merge pull request #2504 from github/koesie10/split-helpers
Split helpers.ts file
2023-06-12 14:42:32 +02:00
Koen Vlaswinkel
c16d363b08 Move show and log functions out of helpers 2023-06-12 14:24:04 +02:00
Robert
8b1e49c6c0 Use more descriptive names 2023-06-12 12:50:01 +01:00
Koen Vlaswinkel
50f958067c Move prepareCodeTour to separate file 2023-06-12 12:12:18 +02:00
Koen Vlaswinkel
7f3e9607aa Move dialog functions to separate file 2023-06-12 12:09:36 +02:00
Koen Vlaswinkel
0cfbf0cb2a Move workspace folder functions to separate file 2023-06-12 12:02:45 +02:00
Koen Vlaswinkel
bfead07592 Move walkDirectory to pure files file 2023-06-12 11:13:57 +02:00
Koen Vlaswinkel
8c98401efe Move isQueryLanguage to query language file 2023-06-12 11:11:47 +02:00
Koen Vlaswinkel
a4e4c67bf2 Move getInitialQueryContents to separate file 2023-06-12 11:10:23 +02:00
Koen Vlaswinkel
754fa675f9 Move db contents heuristics to separate file 2023-06-12 11:07:25 +02:00
Koen Vlaswinkel
b0c18b3300 Move unused languageToDbScheme 2023-06-12 11:01:42 +02:00
Koen Vlaswinkel
706c6b8a7a Move qlpacks helpers to separate file 2023-06-12 10:59:42 +02:00
Nora
fe21a21ca2 Merge pull request #2501 from github/nora/polish-code-search-copy
Code search: Use correct link and text
2023-06-12 07:44:25 +02:00
Koen Vlaswinkel
bca8e8fdb9 Merge pull request #2503 from github/koesie10/move-interface
Move interface.ts to local-queries/results-view.ts
2023-06-09 17:11:51 +02:00
Koen Vlaswinkel
5259456fe8 Merge pull request #2502 from github/koesie10/move-interface-utils
Move interface-utils to local-queries/webview
2023-06-09 17:11:39 +02:00
Robert
adc64c37c5 Merge pull request #2498 from github/robertbrignull/queries-panel-codeowners
Mark the queries panel as owned by secexp
2023-06-09 15:27:29 +01:00
Koen Vlaswinkel
2f1a3e95bf Move interface.ts to local-queries/results-view.ts 2023-06-09 16:24:32 +02:00
Koen Vlaswinkel
00b32376d5 Move interface-utils to local-queries/webview 2023-06-09 16:20:30 +02:00
Koen Vlaswinkel
dfef8104c8 Merge pull request #2485 from github/koesie10/move-location-utils
Move functions for resolving locations
2023-06-09 15:59:48 +02:00
Nora
f0a8f79c2e Use correct link and test 2023-06-09 13:25:39 +00:00
Charis Kyriakou
d485ff0015 Deal with no predictions gracefully (#2499) 2023-06-09 13:17:26 +01:00
Robert
7b5fb5b3aa Mark the queries panel as owned by secexp 2023-06-09 10:49:32 +01:00
Robert
eb938034fb Pass in just the environment instead of full app 2023-06-09 10:26:50 +01:00
Robert
a19c40bd66 Avoid using app.createEventEmitter 2023-06-09 10:24:07 +01:00
Koen Vlaswinkel
6b8169c479 Merge pull request #2494 from github/dependabot/npm_and_yarn/extensions/ql-vscode/eslint-plugin-jest-dom-5.0.1
Bump eslint-plugin-jest-dom from 4.0.2 to 5.0.1 in /extensions/ql-vscode
2023-06-09 11:19:26 +02:00
Koen Vlaswinkel
71ac6c73cd Merge pull request #2496 from github/dependabot/npm_and_yarn/extensions/ql-vscode/xml2js-and-vscode/vsce-and-azure/core-http-0.5.0
Bump xml2js, @vscode/vsce and @azure/core-http in /extensions/ql-vscode
2023-06-09 11:19:15 +02:00
Koen Vlaswinkel
8b3ca1035c Merge pull request #2495 from github/koesie10/remove-xml2js-types
Remove `@types/xml2js` dependency
2023-06-09 11:18:51 +02:00
Robert
f0cf4a0105 Remove onDidChangeWorkspaceFolders from app 2023-06-09 10:18:22 +01:00
Robert
1bd78649e7 Remove workspaceFolders from app 2023-06-09 09:57:23 +01:00
dependabot[bot]
f2ab949417 Bump xml2js, @vscode/vsce and @azure/core-http in /extensions/ql-vscode
Bumps [xml2js](https://github.com/Leonidas-from-XIV/node-xml2js) to 0.5.0 and updates ancestor dependencies [xml2js](https://github.com/Leonidas-from-XIV/node-xml2js), [@vscode/vsce](https://github.com/Microsoft/vsce) and [@azure/core-http](https://github.com/Azure/azure-sdk-for-js). These dependencies need to be updated together.


Updates `xml2js` from 0.4.23 to 0.5.0
- [Commits](https://github.com/Leonidas-from-XIV/node-xml2js/commits/0.5.0)

Updates `@vscode/vsce` from 2.15.0 to 2.19.0
- [Release notes](https://github.com/Microsoft/vsce/releases)
- [Commits](https://github.com/Microsoft/vsce/compare/v2.15.0...v2.19.0)

Updates `@azure/core-http` from 2.2.7 to 2.3.2
- [Release notes](https://github.com/Azure/azure-sdk-for-js/releases)
- [Changelog](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/Changelog-for-next-generation.md)
- [Commits](https://github.com/Azure/azure-sdk-for-js/compare/@azure/core-http_2.2.7...@azure/core-http_2.3.2)

---
updated-dependencies:
- dependency-name: xml2js
  dependency-type: indirect
- dependency-name: "@vscode/vsce"
  dependency-type: direct:development
- dependency-name: "@azure/core-http"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-09 08:44:18 +00:00
Koen Vlaswinkel
7869225cf1 Remove @types/xml2js
We don't seem to be using this dependency anymore, so we can remove it.
2023-06-09 10:38:19 +02:00
Koen Vlaswinkel
95828cdc61 Add @testing-library/dom as devDependency 2023-06-09 10:35:05 +02:00
Andrew Eisenberg
afb490b64b Merge pull request #2441 from github/RasmusWL/codeql-executable-wording
Expand description for `codeQL.cli.executablePath`
2023-06-09 01:19:09 -07:00
dependabot[bot]
c3299f92c4 Bump eslint-plugin-jest-dom from 4.0.2 to 5.0.1 in /extensions/ql-vscode
Bumps [eslint-plugin-jest-dom](https://github.com/testing-library/eslint-plugin-jest-dom) from 4.0.2 to 5.0.1.
- [Release notes](https://github.com/testing-library/eslint-plugin-jest-dom/releases)
- [Commits](https://github.com/testing-library/eslint-plugin-jest-dom/compare/v4.0.2...v5.0.1)

---
updated-dependencies:
- dependency-name: eslint-plugin-jest-dom
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-08 13:58:25 +00:00
Koen Vlaswinkel
dc9f648452 Merge pull request #2470 from github/dependabot/npm_and_yarn/extensions/ql-vscode/faker-js/faker-8.0.2
Bump @faker-js/faker from 7.5.0 to 8.0.2 in /extensions/ql-vscode
2023-06-08 14:52:15 +02:00
Shati Patel
ee11805060 Update changelog (MRVA -> variant analysis) (#2492) 2023-06-08 12:47:59 +00:00
Koen Vlaswinkel
a24f640dc0 Replace faker.datatype.hexadecimal by faker.string.hexadecimal 2023-06-08 13:47:03 +02:00
Koen Vlaswinkel
4d2a935e80 Merge pull request #2469 from github/dependabot/npm_and_yarn/extensions/ql-vscode/css-loader-6.8.1
Bump css-loader from 3.1.0 to 6.8.1 in /extensions/ql-vscode
2023-06-08 12:57:59 +02:00
Koen Vlaswinkel
bbffc16b64 Replace faker.random.word by faker.word.sample 2023-06-08 12:50:42 +02:00
Koen Vlaswinkel
a4f90b7197 Replace faker.datatype.number by faker.number.int 2023-06-08 12:48:48 +02:00
Charis Kyriakou
286018ccea Colour draft modeled methods with orange (#2491) 2023-06-08 11:33:51 +01:00
Koen Vlaswinkel
d2df162afd Switch to Webpack asset modules
css-loader 6 deprecates the use of `file-loader`. As a replacement,
we can use asset modules which generates very similar results. This is a
fairly simple change, and this makes fonts work again.

See: https://github.com/webpack-contrib/css-loader/releases/tag/v6.0.0
See: https://webpack.js.org/guides/asset-modules/
2023-06-08 11:38:20 +02:00
dependabot[bot]
a73c39a29a Bump css-loader from 3.1.0 to 6.8.1 in /extensions/ql-vscode
Bumps [css-loader](https://github.com/webpack-contrib/css-loader) from 3.1.0 to 6.8.1.
- [Release notes](https://github.com/webpack-contrib/css-loader/releases)
- [Changelog](https://github.com/webpack-contrib/css-loader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/css-loader/compare/v3.1.0...v6.8.1)

---
updated-dependencies:
- dependency-name: css-loader
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-08 09:31:26 +00:00
dependabot[bot]
5113b04b36 Bump @faker-js/faker from 7.5.0 to 8.0.2 in /extensions/ql-vscode
Bumps [@faker-js/faker](https://github.com/faker-js/faker) from 7.5.0 to 8.0.2.
- [Release notes](https://github.com/faker-js/faker/releases)
- [Changelog](https://github.com/faker-js/faker/blob/next/CHANGELOG.md)
- [Commits](https://github.com/faker-js/faker/compare/v7.5.0...v8.0.2)

---
updated-dependencies:
- dependency-name: "@faker-js/faker"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-08 09:30:06 +00:00
Koen Vlaswinkel
8db5c6de65 Merge pull request #2488 from github/koesie10/fix-locale-lower-case
Add locale to `toLocaleLowerCase` calls
2023-06-08 11:14:07 +02:00
Koen Vlaswinkel
a46a8d06ec Merge pull request #2489 from github/koesie10/add-cli-tests-timeout
Add timeout to CLI tests
2023-06-08 09:45:30 +02:00
Koen Vlaswinkel
3569c77626 Add timeout to CLI tests
It seems like some CLI tests are hanging and only completing after 6
hours when they run into the default timeout. This updates the timeout
to 30 minutes. All CLI tests should complete in 30 minutes, so this
should ensure that they are cancelled when they are stuck.
2023-06-07 15:41:42 +02:00
Koen Vlaswinkel
0b22a6f34d Add locale to toLocaleLowerCase calls 2023-06-07 14:51:03 +02:00
Anders Starcke Henriksen
7c47a99805 Merge pull request #2486 from github/starcke/candidate-selection
Tweak candidate selection
2023-06-07 14:16:50 +02:00
Anders Starcke Henriksen
15c2a86725 Use Argument[this] instead of Argument[-1] 2023-06-07 13:14:31 +02:00
Anders Starcke Henriksen
e14b4c3040 Update extensions/ql-vscode/src/data-extensions-editor/auto-model.ts
Co-authored-by: Koen Vlaswinkel <koesie10@users.noreply.github.com>
2023-06-07 11:56:46 +02:00
Anders Starcke Henriksen
e3f192b76d Add new test. 2023-06-07 11:24:06 +02:00
Anders Starcke Henriksen
222c0d72bd Update tests. 2023-06-07 11:24:06 +02:00
Anders Starcke Henriksen
895c22ea85 Fix supported. 2023-06-07 11:24:02 +02:00
Nora
805d71286f Merge pull request #2487 from github/version/bump-to-v1.8.6
Bump version to v1.8.6
2023-06-07 10:18:17 +02:00
github-actions[bot]
2e01836f55 Bump version to v1.8.6 2023-06-06 15:16:08 +00:00
Koen Vlaswinkel
bca8885513 Merge pull request #2484 from github/koesie10/move-webview-html
Move Webview HTML generation out of `interface-utils.ts`
2023-06-06 17:14:09 +02:00
Anders Starcke Henriksen
76fb55f918 Tweak candidate selection:
- At most 6 usages.
- Send -1 for `this` argument.
- Do not send only some arguments for candidate or sample.
2023-06-06 16:49:50 +02:00
Nora
999b24a40d Merge pull request #2466 from github/v1.8.5
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
v1.8.5
2023-06-06 15:15:28 +02:00
Nora
e612c8efcc Update Changelog 2023-06-06 12:23:36 +00:00
Koen Vlaswinkel
ba9f5e35cb Remove dependency on interface types from jumpToLocation 2023-06-06 11:27:57 +02:00
Koen Vlaswinkel
aa87fa8cda Move functions for resolving locations 2023-06-06 11:25:43 +02:00
Koen Vlaswinkel
a98e31fffb Merge pull request #2483 from github/koesie10/fix-locale-compare
Fix remaining `localeCompare` without locale set
2023-06-06 11:14:28 +02:00
Koen Vlaswinkel
461ff9bd21 Move Webview HTML generation out of interface-utils.ts
This moves the Webview HTML generation used by `AbstractWebview` out of
`interface-utils.ts` and into a new file `webview-html.ts` in the
`common/vscode` directory.
2023-06-06 11:12:05 +02:00
Koen Vlaswinkel
a678f8b3bc Fix remaining localeCompare without locale set 2023-06-06 10:55:15 +02:00
Nora
cc9fb826b3 v1.8.5 2023-06-06 08:48:01 +00:00
Nora
a7a24fc0e9 Merge pull request #2476 from github/nora/use-code-search-api
Code search: use code search api
2023-06-06 10:29:43 +02:00
Koen Vlaswinkel
10bd774bcb Merge pull request #2479 from github/koesie10/validate-scoped-pack-name
Only allow scoped extension pack names
2023-06-06 10:09:11 +02:00
Robert
ead138ee13 Merge pull request #2480 from github/robertbrignull/app-environment
Add EnvironmentContext so common code can do localisation
2023-06-06 08:44:12 +01:00
Nora
945594d47a Adjust error response wording 2023-06-05 15:55:18 +00:00
Nora
876b92aa98 Move code search api call to its own file 2023-06-05 15:42:10 +00:00
Nora
b47006129d Move octokit initialization to db panel to send log messages to the user 2023-06-05 15:42:10 +00:00
Nora
fef28806b1 Use showAndLogWarning to surface rateLimit 2023-06-05 15:42:10 +00:00
Nora
5467c50395 Implement throttling 2023-06-05 15:42:10 +00:00
Nora
6da1f936dd Add no-language option 2023-06-05 15:42:10 +00:00
Robert
b722fb4d70 Convert to using a getter for AppEnvironmentContext.language 2023-06-05 14:04:27 +01:00
Nora
9672a0b1f1 Merge pull request #2478 from github/nora/code-search-feature-flag
Protect codeSearch feature for now
2023-06-05 14:33:09 +02:00
Robert
0e65c79c92 Pass in app.environment instead of vscode.env 2023-06-05 13:27:17 +01:00
Nora
897ad5bb57 Add 'codeSearch' feature flag 2023-06-05 11:55:50 +00:00
Robert
1d80cbb496 Add EnvironmentContext to App 2023-06-05 11:50:50 +01:00
Koen Vlaswinkel
b0d45cefe9 Only allow scoped extension pack names
When packaging an extension pack, unscoped extension pack names are not
allowed and calling `codeql pack bundle` will fail with an error. This
command will be called when running a variant analysis, so these packs
will not work for a variant analysis.

To improve the user experience, we now only allow scoped extension pack
names. This means that the user will now have to enter a scope when
creating a new extension pack.
2023-06-05 12:30:20 +02:00
Shati Patel
af9af99f09 Queries panel: display the query language in the UI (#2472) 2023-06-05 11:07:59 +01:00
Koen Vlaswinkel
0d390aa984 Merge pull request #2468 from github/koesie10/remove-ignore-source-archive-option
Remove `ignoreSourceArchive` option from databases
2023-06-05 09:41:14 +02:00
Andrew Eisenberg
610a349f26 Merge pull request #2405 from Marcono1234/simpler-location-url
Simplify location URLs if start and end line are the same
2023-06-02 11:07:07 -07:00
Andrew Eisenberg
afbf762d22 Merge branch 'main' into simpler-location-url 2023-06-02 10:47:23 -07:00
Charis Kyriakou
c96fd817b3 Allow unclassified methods to be marked as neutral (#2477) 2023-06-02 15:08:29 +00:00
Charis Kyriakou
134c4405f9 Handle 429 from auto-model service (#2474) 2023-06-02 12:51:40 +00:00
Koen Vlaswinkel
7250e82055 Merge pull request #2421 from github/koesie10/data-extension-editor-provenance
Add provenance support to data extensions editor
2023-06-02 14:13:40 +02:00
Koen Vlaswinkel
4ef520dc10 Merge pull request #2407 from github/koesie10/query-language
Use `QueryLanguage` type for representing query languages
2023-06-02 14:13:04 +02:00
Koen Vlaswinkel
cae72396d3 Merge pull request #2416 from github/koesie10/resolve-data-extensions-editor-queries
Resolve queries instead of hardcoding the path
2023-06-02 13:45:55 +02:00
Koen Vlaswinkel
e7ef449874 Add support for auto-model provenance 2023-06-02 12:21:04 +02:00
Koen Vlaswinkel
1cc77c0a26 Merge remote-tracking branch 'origin/main' into koesie10/data-extension-editor-provenance 2023-06-02 12:09:23 +02:00
Koen Vlaswinkel
c1edd08662 Remove unnecessary export on resolveQueries 2023-06-02 12:07:41 +02:00
Koen Vlaswinkel
96a28100b7 Merge remote-tracking branch 'origin/main' into koesie10/resolve-data-extensions-editor-queries 2023-06-02 12:06:18 +02:00
Koen Vlaswinkel
98844769a9 Merge remote-tracking branch 'origin/main' into koesie10/query-language 2023-06-02 12:03:16 +02:00
Nora
12615f19f8 Merge pull request #2473 from github/nora/move-cached-operation-to-common
Move CachedOperation to language-support contextual
2023-06-02 11:34:22 +02:00
Nora
b2adbf63eb Move file to language-support/contextual 2023-06-02 08:33:09 +00:00
Koen Vlaswinkel
f115412cec Merge branch 'main' into koesie10/remove-ignore-source-archive-option 2023-06-02 10:16:34 +02:00
Koen Vlaswinkel
26d27f832e Merge pull request #2467 from github/koesie10/fix-neutral-definition
Fix neutral definition for CodeQL 2.13.3
2023-06-02 09:46:39 +02:00
Andrew Eisenberg
f5c96025cb Merge pull request #2461 from aibaars/selected-line-column
View CFG: export selected line and column position
2023-06-01 10:15:54 -07:00
Andrew Eisenberg
51be504f6d Merge branch 'main' into selected-line-column 2023-06-01 08:07:18 -07:00
Koen Vlaswinkel
831b2499a2 Merge branch 'main' into koesie10/fix-neutral-definition 2023-06-01 16:59:31 +02:00
github-actions[bot]
cf343785a7 Bump CLI version from v2.13.1 to v2.13.3 for integration tests (#2465)
Co-authored-by: github-actions[bot] <github-actions@github.com>
2023-06-01 15:57:18 +01:00
Koen Vlaswinkel
0e47709d10 Remove ignoreSourceArchive option from databases
This option was used to ignore source archives for `.testproj`
databases. It is only set to `true` or `false` when creating the
database and could not be changed, so I don't think we need this option.
It can simply be derived from the database URI. This simplifies handling
of databases a bit.
2023-06-01 15:32:30 +02:00
Koen Vlaswinkel
2b915b82e4 Fix neutral definition for CodeQL 2.13.3
In CodeQL 2.13.3, the definition of the neutralModel predicate has
changed to include the `kind`. This updates the definition of the
data extensions editor to match the new definition.

One caveat is that when selecting a `kind` other than `summary`, the
method will not be shown as supported. This is because a
`NeutralCallable` only calls into `neutralSummaryElement`. This matches
the previous behavior because setting the `kind` to `source` or `sink`
only says that the method is either not a source or not a sink, but not
both. Only `summary` fully models the method.

See: https://github.com/github/codeql/pull/12931
See: ff78ac98d2/java/ql/lib/semmle/code/java/dataflow/internal/FlowSummaryImpl.qll (L338)
See: ff78ac98d2/java/ql/lib/semmle/code/java/dataflow/internal/FlowSummaryImplSpecific.qll (L160)
2023-06-01 14:59:47 +02:00
Koen Vlaswinkel
2f61cfe693 Merge pull request #2457 from github/koesie10/auto-model-usages-sarif
Retrieve external API usage snippets using SARIF
2023-06-01 11:28:42 +02:00
Shati Patel
5387546e93 Don't log the resolve queries CLI command (#2454) 2023-06-01 09:49:35 +01:00
Koen Vlaswinkel
dd268af9e9 Use type in auto model usages query file
Co-authored-by: Charis Kyriakou <charisk@users.noreply.github.com>
2023-06-01 10:47:16 +02:00
Robert
bc342022cb Merge pull request #2464 from github/robertbrignull/invocation-rate-limiter
Move the invocation rate limiter class out of helpers.ts
2023-05-31 16:45:17 +01:00
Robert
50c46b603a Remove MockGlobalStorage 2023-05-31 16:21:28 +01:00
Nora
157210ffc5 Merge pull request #2439 from github/nora/search-prompt
Feed code search results into variant analysis repo lists
2023-05-31 17:08:44 +02:00
Robert
0b6bcfdfd6 Merge pull request #2459 from github/robertbrignull/discovery-logging
Avoid vscode reference rfom discovery.ts
2023-05-31 15:12:43 +01:00
Robert
9b84e0f831 "Fix" distribution tests 2023-05-31 14:59:23 +01:00
Robert
e7a5def15f Merge pull request #2462 from github/robertbrignull/cached-operation
Move CachedOperation to a new file
2023-05-31 14:55:52 +01:00
Robert
1f6d8f215e Merge branch 'main' into robertbrignull/discovery-logging 2023-05-31 14:53:56 +01:00
Koen Vlaswinkel
c017530410 Fix incorrect order in BQRS unit test 2023-05-31 15:20:53 +02:00
Koen Vlaswinkel
c654bfa4c4 Add some comments for the auto model usages query 2023-05-31 15:20:53 +02:00
Koen Vlaswinkel
bce097d939 Create type for usage snippets by signature 2023-05-31 15:20:53 +02:00
Koen Vlaswinkel
1920a2c6b4 Remove use of Pick in auto model usages query 2023-05-31 15:20:53 +02:00
Robert
00bd7b7d3e Merge pull request #2458 from github/robertbrignull/common-vscode
Make assert-pure.ql ignore all /vscode/ directories
2023-05-31 14:09:39 +01:00
Robert
6b4726bc2b Move InvocationRateLimiter to common 2023-05-31 13:47:59 +01:00
Robert
79dccaa12f Pass in a Memento instead of a full ExtensionContext 2023-05-31 13:47:59 +01:00
Robert
b9c0f2bc14 Move InvocationRateLimiter to a separate file 2023-05-31 13:47:59 +01:00
Arthur Baars
7c47cf0968 View CFG: export selected line and column position
Fixes: #2456
2023-05-31 14:30:37 +02:00
Robert
d30e58b2cb Merge pull request #2453 from github/robertbrignull/refresh-promise
Add ability to await the discovery refresh promise
2023-05-31 13:29:35 +01:00
Nora
0739c46fed Add comments to gh api client and fix total number of returned repos 2023-05-31 11:30:31 +00:00
Nora
42436e623b Add JSDoc to db config store 2023-05-31 11:30:00 +00:00
Robert
8badc1c407 Merge pull request #2460 from github/robertbrignull/selection-commond-vscode
Move selection-commands.ts to be in the vscode directory
2023-05-31 12:27:17 +01:00
Robert
56d6f19365 Move CachedOperation to a new file 2023-05-31 11:57:26 +01:00
Koen Vlaswinkel
a4d875af8d Fix typo 2023-05-31 12:33:51 +02:00
Robert
b7a7329aff Move selection-commands.ts to be in the vscode directory 2023-05-31 11:33:12 +01:00
Koen Vlaswinkel
a117e09796 Use a single SARIF-compatible query instead of two separate queries 2023-05-31 12:32:41 +02:00
Robert
a4a67856a5 Avoid vscode reference rfom discovery.ts 2023-05-31 11:26:25 +01:00
Robert
b8b378ffd4 Make assert-pure.ql ignore all /vscode/ directories 2023-05-31 10:59:50 +01:00
Robert
a0e6317559 Keep all updates of currentDiscoveryPromise in refresh 2023-05-31 10:45:36 +01:00
Robert
d2bb1b844e Fix comment to be more accurate 2023-05-31 10:45:36 +01:00
Robert
82766d1033 Rename: getCurrentRefreshPromise => waitForCurrentRefresh 2023-05-31 10:45:32 +01:00
Robert
81fb1264e4 Merge pull request #2455 from github/robertbrignull/import-path-problem
Expand assert-pure.ql to cover common and be a path-problem query
2023-05-31 09:15:54 +01:00
Nora
4087620bf5 Polish copy 2023-05-30 14:30:07 +00:00
Alexander Eyers-Taylor
22172d5d74 Add support for quick eval count to the query runner (#2417)
* Add support for quick eval count to the query runner

This only adds support internally to the query runner,
without any UI support.

* Fix some tests
2023-05-30 14:12:47 +01:00
Alexander Eyers-Taylor
af3be543f5 Cache MRVA queries correctly (#2435) 2023-05-30 14:12:26 +01:00
Koen Vlaswinkel
5c81671e67 Retrieve external API usage snippets using SARIF 2023-05-30 13:46:14 +02:00
Robert
c462bc0243 Use edges from select clause 2023-05-30 11:42:36 +01:00
Robert
e1894afb16 Extend ImportDeclaration instead of AstNode 2023-05-30 11:39:47 +01:00
Koen Vlaswinkel
5a66d6ff2d Merge pull request #2448 from github/koesie10/auto-model
Add initial implementation of auto-modeling
2023-05-30 12:19:22 +02:00
Koen Vlaswinkel
d27f3d2699 Remove incorrect explanations 2023-05-30 11:21:01 +02:00
Koen Vlaswinkel
695dc3f883 Improve sorting of input/output arguments 2023-05-30 11:17:52 +02:00
Koen Vlaswinkel
558f51b962 Add comment to parsePredictedClassifications method 2023-05-30 11:04:13 +02:00
Koen Vlaswinkel
2e29d0cda4 Fix incorrect signature reconstruction 2023-05-30 10:04:33 +02:00
Andrew Eisenberg
3b4f236426 Merge pull request #2440 from JarLob/patch-1
Retry results download if connection times out
2023-05-26 11:31:31 -07:00
Robert
b8770a2896 Convert assert-pure.ql to be a path-problem query 2023-05-26 16:28:40 +01:00
Andrew Eisenberg
e24377f9f3 Merge pull request #2446 from github/aeisenberg/use-orig-pack-name
Use the original pack name for generated pack
2023-05-26 08:12:01 -07:00
Andrew Eisenberg
deb268465f Fix failing test 2023-05-26 07:52:49 -07:00
Koen Vlaswinkel
f52ad04afe Improve parsing of predicted classifications 2023-05-26 16:18:59 +02:00
Koen Vlaswinkel
4b54e4f31f Use 20 candidates and 100 samples 2023-05-26 13:40:12 +02:00
Robert
1f4b19cd37 Add getCurrentRefreshPromise 2023-05-26 10:15:14 +01:00
Robert
9dd7476c90 Use refresh promise in tests 2023-05-26 10:15:14 +01:00
Robert
5405b1bf29 Convert refresh to return a promise 2023-05-26 10:15:13 +01:00
Robert
5a2cb8bc41 Convert launchDiscovery to use async 2023-05-26 10:14:19 +01:00
Robert
35a7eee3c0 Merge pull request #2449 from github/robertbrignull/queries-welcome
Add welcome text for the queries panel
2023-05-25 17:01:13 +01:00
Andrew Eisenberg
efabcaefe3 Update extensions/ql-vscode/src/variant-analysis/run-remote-query.ts
Co-authored-by: Koen Vlaswinkel <koesie10@users.noreply.github.com>
2023-05-25 08:30:24 -07:00
Robert
a27b0a469e Merge pull request #2447 from github/robertbrignull/QueryDiscovery-tests
Add integration tests of QueryDiscovery
2023-05-25 16:19:37 +01:00
Robert
472b1769c5 Update extensions/ql-vscode/test/vscode-tests/minimal-workspace/queries-panel/query-discovery.test.ts
Co-authored-by: Shati Patel <42641846+shati-patel@users.noreply.github.com>
2023-05-25 15:38:49 +01:00
Koen Vlaswinkel
7bbba38cfb Merge pull request #2450 from github/koesie10/move-database-item-refresh
Extract `DatabaseItem.refresh` method to `DatabaseManager`
2023-05-25 16:32:01 +02:00
Koen Vlaswinkel
adcc3d0b39 Remove unnecessary if-statements before slice 2023-05-25 15:52:00 +02:00
Robert
8be2dd805b Use path.sep 2023-05-25 14:44:05 +01:00
Koen Vlaswinkel
09fc0f3040 Extract DatabaseItem.refresh to DatabaseManager
This moves the `refresh` method from `DatabaseItem` to `DatabaseManager`
and makes it private. This makes the `DatabaseItem` interface smaller
and more focused and ensures that `refresh` cannot be called from
outside of the `DatabaseManager`.
2023-05-25 15:03:30 +02:00
Koen Vlaswinkel
295a08f85a Use DatabaseItemImpl where possible in DatabaseManager
This will allow us to implement specific behavior on the
`DatabaseItemImpl` which is not available on the `DatabaseItem`. This
will allow us to make the surface area of the `DatabaseItem` smaller.
2023-05-25 14:36:38 +02:00
Robert
394b51f4f3 Add welcome text 2023-05-25 12:49:01 +01:00
Koen Vlaswinkel
a88e683ebf Add initial implementation of auto-modeling 2023-05-25 13:28:32 +02:00
Nora
250089a9e3 Renaming and smaller merge comments 2023-05-25 10:02:22 +00:00
Nora
2e12b8d756 Rename command from importCodeSearch to importFromCodeSearch 2023-05-25 09:11:37 +00:00
Robert
f236e65f68 Add integration tests of QueryDiscovery 2023-05-25 09:57:52 +01:00
Robert
301149fd32 Don't create array entry if workspace contains no queries 2023-05-25 09:57:52 +01:00
Koen Vlaswinkel
b8557d337c Merge pull request #2445 from github/koesie10/move-local-databases
Split up `local-databases.ts` file into multiple files
2023-05-25 09:30:23 +02:00
Andrew Eisenberg
b4506cf6e5 Use the original pack name for generated pack
Generated variant analysis packs will use the original name
of the pack that the query is located in. This is to support
some future work where we do extra validation of data extensions.

If the query is not in a pack, the default name is used.
2023-05-24 21:46:54 +00:00
Nora
49f3f5673d Show progress information when sending search api request 2023-05-24 16:26:08 +00:00
Robert
ff88a8d491 Merge pull request #2444 from github/robertbrignull/QueryTreeDataProvider-tests
Add tests of QueryTreeDataProvider
2023-05-24 16:25:08 +01:00
Koen Vlaswinkel
0707155603 Fix imports for tests 2023-05-24 17:08:00 +02:00
Koen Vlaswinkel
c004f18720 Remove outdated comment 2023-05-24 17:04:36 +02:00
Koen Vlaswinkel
6b9c3491ec Move local-databases.ts to local-databases/index.ts 2023-05-24 17:04:14 +02:00
Koen Vlaswinkel
d608c057a4 Remove unused getUpgradesDirectories function 2023-05-24 17:03:14 +02:00
Koen Vlaswinkel
60cfc311e5 Move DatabaseManager to separate file 2023-05-24 17:02:39 +02:00
Koen Vlaswinkel
59482c2b2c Move DatabaseChangedEvent to separate file 2023-05-24 17:00:52 +02:00
Koen Vlaswinkel
7888d210c4 Move DatabaseResolver to separate file 2023-05-24 16:58:29 +02:00
Koen Vlaswinkel
67983c64ca Move DatabaseContents to separate file 2023-05-24 16:55:31 +02:00
Koen Vlaswinkel
d02e53fbd2 Move DatabaseItemImpl to separate file 2023-05-24 16:53:59 +02:00
Koen Vlaswinkel
4bb4627d30 Move DatabaseItem to separate file 2023-05-24 16:52:53 +02:00
Koen Vlaswinkel
6331cddbfd Move DatabaseOptions to separate file 2023-05-24 16:51:38 +02:00
Robert
5d7a7237a3 Merge pull request #2443 from github/robertbrignull/query-constructor
Remove member variables that could be local variables
2023-05-24 14:34:06 +01:00
Nora
2b4e302e29 Surface truncated repos when a list hits 1000 items 2023-05-24 10:58:13 +00:00
Nora
d07b7c8c05 Add db manager test 2023-05-24 10:57:13 +00:00
Robert
27a88032f7 Add QueryTreeDataProvider tests 2023-05-24 11:42:23 +01:00
Robert
b9ce91cff9 Add a QueryDiscoverer interface to make testing QueryTreeDataProvider easier 2023-05-24 11:42:23 +01:00
Robert
9dee2a132e Remove member variables that could be local variables 2023-05-24 10:37:22 +01:00
jarlob
69f9ecc2f4 Delete unfinished downloads in case of retry 2023-05-24 11:25:50 +02:00
jarlob
9bd852a71b Add error message to logging. 2023-05-24 11:20:52 +02:00
Shati Patel
7ef35af68a Don't create "." directory in queries/tests tree view (#2442) 2023-05-24 10:15:34 +01:00
Nora
dd01832ebe Add no more than 1000 items to a list plus tests 2023-05-24 08:06:31 +00:00
Nora
f76d7bfd96 Use pagination for code search api call 2023-05-24 08:05:30 +00:00
Jaroslav Lobačevski
6f6c229ca3 Update extensions/ql-vscode/src/variant-analysis/variant-analysis-manager.ts 2023-05-23 23:24:18 +02:00
jarlob
65cfd851f2 Add logging 2023-05-23 23:21:51 +02:00
jarlob
32fb4e5db6 Move max retry to a constant 2023-05-23 22:47:13 +02:00
Rasmus Wriedt Larsen
c82ba1bdff Expand description for codeQL.cli.executablePath
To match what the code actually does.
2023-05-23 12:05:19 +02:00
Robert
f6b0ae2032 Merge pull request #2437 from github/robertbrignull/query-event-emitter
Use app.createEventEmitter in QueryDiscovery
2023-05-23 10:27:20 +01:00
Jaroslav Lobačevski
e964ce6713 Retry results download if connection times out 2023-05-23 10:51:46 +02:00
Robert
57f04fcae5 Add type to onDidChangeQueriesEmitter 2023-05-23 09:46:04 +01:00
Nora
4d9e8d98b4 Ask for user input and add response to list 2023-05-23 07:13:05 +00:00
Nora
fed6158615 Add GH client method to query search endpoint 2023-05-22 15:48:41 +00:00
Robert
da5d0d2a84 Use app.createEventEmitter in QueryDiscovery 2023-05-22 14:34:44 +01:00
Robert
73f359c0d0 Merge pull request #2434 from github/robertbrignull/disposable-event-emitter
Mark AppEventEmitter as disposable
2023-05-22 13:54:34 +01:00
Robert
f855d81526 Make sure DbManager is also disposed 2023-05-22 13:34:48 +01:00
Robert
73e41f8d61 Mark AppEventEmitter as disposable 2023-05-22 12:28:24 +01:00
Robert
018440f266 Merge pull request #2433 from github/robertbrignull/query-discovery
Hook queries panel up to real data
2023-05-22 11:51:25 +01:00
Koen Vlaswinkel
189a1328cd Merge pull request #2428 from github/koesie10/unsupported-cli-version-check
Add warning when using unsupported CLI version
2023-05-22 12:49:52 +02:00
Robert
cda3483b01 Use getOnDiskWorkspaceFoldersObjects early instead of getting all folders and filtering later 2023-05-22 10:51:32 +01:00
Robert
78f11397e2 Exclude src archives and other non-normal workspace folders 2023-05-22 10:42:47 +01:00
Robert
935c9b996f Don't include bad workspace roots in the list 2023-05-22 10:41:49 +01:00
Koen Vlaswinkel
e91e9d2654 Merge branch 'main' into koesie10/unsupported-cli-version-check 2023-05-22 11:37:58 +02:00
Koen Vlaswinkel
791a445342 Update copy of deprecation warning message
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2023-05-22 11:37:42 +02:00
Koen Vlaswinkel
4ea1bb5f1c Merge pull request #2427 from github/koesie10/export-copy-selected-text
Update export/copy buttons copy when repositories are selected
2023-05-22 11:36:31 +02:00
Koen Vlaswinkel
8f3fe7412e Merge branch 'main' into koesie10/export-copy-selected-text 2023-05-22 10:52:01 +02:00
Robert
4e46d87a77 Use name from file tree instead of calculating from path 2023-05-19 17:09:21 +01:00
Robert
a8f8990793 Hook query discovery results up to query panel 2023-05-19 17:09:21 +01:00
Robert
0a534ae360 Add QueryDiscovery class 2023-05-19 17:09:21 +01:00
Robert
13f8f19339 Add resolveQueries to CodeQL CLI 2023-05-19 17:09:21 +01:00
Robert
a3f2b7b1ca Merge pull request #2431 from github/robertbrignull/app-workspace
Add workspace folders to App interface
2023-05-19 17:08:59 +01:00
Robert
6371356b4b Merge pull request #2432 from github/robertbrignull/tree-node-shared
Pull out node classes to shared location
2023-05-19 17:06:24 +01:00
Robert
a7f6401be7 Add workspace folders to App interface 2023-05-19 15:28:04 +01:00
Robert
a5af2f2e4b Pull out node classes to shared location 2023-05-19 13:04:58 +01:00
Andrew Eisenberg
3ebd13df57 Merge pull request #2425 from github/aeisenberg/truncated-log-msg
Ensure full stack traces are included in log messages
2023-05-17 08:51:35 -07:00
Koen Vlaswinkel
d28ee6dbf1 Merge branch 'main' into koesie10/unsupported-cli-version-check 2023-05-17 17:12:23 +02:00
Andrew Eisenberg
4ad3f7cb1f Merge branch 'main' into aeisenberg/truncated-log-msg 2023-05-17 08:08:34 -07:00
Andrew Eisenberg
0f1f00dfc8 Merge pull request #2424 from github/aeisenberg/update-changelog
Update changelog
2023-05-17 08:08:07 -07:00
Koen Vlaswinkel
3e9b4273c3 Update CHANGELOG 2023-05-17 16:55:11 +02:00
Robert
b47f018b69 Merge pull request #2426 from github/robertbrignull/open-on-click
Open query file on click
2023-05-17 15:54:11 +01:00
Koen Vlaswinkel
5a7f5c2ff1 Update CHANGELOG 2023-05-17 16:46:35 +02:00
Koen Vlaswinkel
ee2d78fbfc Add warning when using unsupported CLI version
This adds a warning when the user is using an unsupported version of the
CodeQL CLI. The warning is shown once per session, and only if the
version is older than the oldest supported version.
2023-05-17 16:25:06 +02:00
shati-patel
565a7a53e0 Only implement "open file" when you click a file node (not a folder) 2023-05-17 14:43:43 +01:00
Koen Vlaswinkel
0125d10ffb Take filtered state into account for buttons text
When the user filters the repositories, the buttons should reflect that
the results are filtered and that the user is not exporting or copying
all the results. If the user has selected repositories, the buttons
should still say that they are exporting selected results.
2023-05-17 15:08:55 +02:00
Koen Vlaswinkel
fa39bd1c2c Update export/copy buttons copy when repositories are selected
This changes the text of the export/copy buttons on a variant analysis
when at least one repository is selected. This makes it more clear that
the user is only exporting/copying the results of the selected
repositories.
2023-05-17 15:03:28 +02:00
Nora
1955086cb6 Add new command and add it to db panel 2023-05-17 12:11:45 +00:00
Robert
ec1fda21d0 Open query file on click 2023-05-17 12:16:09 +01:00
Robert
baea36561d Merge pull request #2423 from github/robertbrignull/query-tree-types
Simplify types around query panel
2023-05-17 10:39:43 +01:00
Andrew Eisenberg
55b65e33ad Update changelog 2023-05-16 14:51:03 -07:00
Andrew Eisenberg
276e2cfdcf Ensure full stack traces are included in log messages
Pass in the `fullMessage` to `internalShowAndLog` so that stack traces
aren't truncated.
2023-05-16 14:48:19 -07:00
Andrew Eisenberg
91c58f3618 Update changelog
For #2422.
2023-05-16 12:32:29 -07:00
Robert
1ceccc8b4d Avoid double-declaring fields that are inherited from TreeItem 2023-05-16 16:57:02 +01:00
Robert
b0371b5075 Simplify types on TreeDataProvider methods 2023-05-16 16:55:52 +01:00
Shati Patel
9ce95a3554 Queries panel: Expand/collapse child nodes (#2419) 2023-05-16 15:45:59 +00:00
Andrew Eisenberg
1dc83c5628 Merge pull request #2422 from github/aeisenberg/compare-view-quick-eval
Allow compare view to work with quick-eval
2023-05-16 08:41:12 -07:00
Koen Vlaswinkel
d00624cc85 Merge pull request #2420 from github/koesie10/cancel-monitor-on-404
Cancel monitoring variant analysis on 404 response
2023-05-16 11:57:26 +02:00
Koen Vlaswinkel
7d41cd7ae6 Rename editor-manual to manual
There is a defined list of of valid origin values for the provenance.
This does not include `editor`, so to make sure all values are valid we
use `manual` instead.

See ac1df4de91/java/ql/lib/semmle/code/java/dataflow/internal/FlowSummaryImpl.qll (L221-L229)
2023-05-16 10:23:21 +02:00
Andrew Eisenberg
4c33c06d55 Allow compare view to work with quick-eval
The compare view typically works by matching the results sets of
queries. It only allows the results sets of queries with identical
names to be compared.

Manually run queries use `#select` as the default result set. However,
quick eval queries use a different, generated, name. Therefore, these
two kinds of queries cannot be compared.

This commit changes the heuristics so that if there are no identical;y
named results sets, the first result set of each query that is prefixed
with `#` is used (this is the default result set).

It also makes a slightly nicer error message if there are no comparable
results sets.
2023-05-15 15:51:48 -07:00
Andrew Eisenberg
2d8c6905bf Merge branch 'main' into simpler-location-url 2023-05-15 10:10:42 -07:00
Koen Vlaswinkel
dc3966e113 Add provenance support to data extensions editor
The data extensions editor was always setting the `provenance` field of
MaD to `manual`. This will change the `provenance` to be either
`editor-manual` (for models which were added by the user),
`df-generated` (for models generated by the dataflow generator), and
`df-manual` (for models generated and then edited). This makes it easier
to trace the origin of a model.
2023-05-15 17:05:35 +02:00
Koen Vlaswinkel
2d2a1fb2d1 Add tests for variant analysis monitor 2023-05-15 15:41:15 +02:00
Koen Vlaswinkel
5b9ed39f4f Restart variant analysis monitor when reauthenticating 2023-05-15 15:08:32 +02:00
Koen Vlaswinkel
9e74ae0bbf Cancel monitoring variant analysis on 404 2023-05-15 15:08:32 +02:00
Koen Vlaswinkel
927a0f0691 Track currently monitoring variant analyses 2023-05-15 14:50:13 +02:00
Shati Patel
e9552df395 Create a basic tree view for the queries panel (#2418) 2023-05-15 11:10:51 +00:00
Koen Vlaswinkel
0f3b36cf87 Resolve queries instead of hardcoding the path
This will change the data extensions editor generator to resolve the
queries based on the `modelgenerator` tag. This removes the requirement
of having a `ql` folder in the workspace.

I chose to use the path instead of the `id` for now to avoid having to
resolve the query 4 times. This also avoids the need to map the language
names to the language ID in the tag (i.e. `csharp` -> `cs`).
2023-05-11 15:02:43 +02:00
Alexander Eyers-Taylor
3e6372d6fa Better error handling for unexpected query server termination. (#2404)
* Log stdout when servers are terminated with errors.

This logs the last stdout chunk (probabaly the last line) if things
went wrong. This can sometimes be useful for debugging.

It also prints the signal when killed by a signal
(rather than printing null)

* Restart/Abort the queryserver if the process dies.

This cancels any running tasks and gives a limited number of restarts.

* Update extensions/ql-vscode/src/codeql-cli/cli.ts

Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>

* Update extensions/ql-vscode/src/query-server/query-server-client.ts

Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>

---------

Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2023-05-11 12:39:31 +01:00
Shati Patel
d0ca885e80 Move Discovery class into common folder (#2414) 2023-05-10 16:58:26 +00:00
Shati Patel
7fd984a7d0 Add a new blank "queries" panel (#2412) 2023-05-10 13:23:43 +01:00
Koen Vlaswinkel
00f4bc1fda Merge pull request #2411 from github/koesie10/remove-deprecated-url-parse
Remove deprecated use of `url.parse`
2023-05-10 11:09:06 +02:00
Koen Vlaswinkel
7dfa6f0f58 Merge pull request #2408 from github/koesie10/replace-deprecated-storage-path
Replace deprecated `storagePath` by `storageUri`
2023-05-10 11:08:52 +02:00
Koen Vlaswinkel
8a75399cb7 Merge branch 'main' into koesie10/remove-deprecated-url-parse 2023-05-10 09:30:57 +02:00
Koen Vlaswinkel
6e5188fbbe Replace Uri.parse by Uri.file 2023-05-10 09:30:53 +02:00
Koen Vlaswinkel
87be402a57 Improve unsupported language error message 2023-05-10 09:30:11 +02:00
Koen Vlaswinkel
ddbe3cdc2b Add test cases for containsPath 2023-05-09 14:20:15 +02:00
Koen Vlaswinkel
9290f57b62 Use normalized path for checking inclusion 2023-05-09 14:20:15 +02:00
Koen Vlaswinkel
a414213804 Replace deprecated storagePath by storageUri
This replaces access to the deprecated `storagePath` and
`globalStoragePath` to use `storageUri` and `globalStorageUri` instead.
2023-05-09 14:20:15 +02:00
Andrew Eisenberg
3ad006de92 Merge pull request #2401 from github/github-action/bump-cli
Bump CLI Version to v2.13.1 for integration tests
2023-05-09 03:58:53 -07:00
Shati Patel
e722bf3e0b Merge branch 'main' into github-action/bump-cli 2023-05-09 11:19:48 +01:00
Koen Vlaswinkel
9e7678de7a Remove deprecated use of url.parse
`url.parse` is deprecated and should be replaced by the WHATWG URL API,
so this makes that change. The `protocol` and `host` properties are
unchanged, so no other changes are needed.
2023-05-09 10:15:58 +02:00
Nora
a4f1f49506 Merge pull request #2409 from github/nora/split-codeql-goto-commands
Split codeQL.goto and codeQL.previewQueryHelp command
2023-05-08 17:00:21 +02:00
Nora
6deb04bd26 Split codeQL.previewQueryHelp command 2023-05-08 12:27:12 +00:00
Nora
b6df591329 Split codeQL.goto command 2023-05-08 12:15:07 +00:00
Koen Vlaswinkel
b20a65a3a7 Use QueryLanguage type for representing query languages
This will make both the `askForLanguage` and `findLanguage` functions
return a `QueryLanguage` instead of a `string`. This will make it harder
to make mistakes when using these functions.

There are also some other changes with regards to `QueryLanguage` such
that we never need to use `as QueryLanguage` explicitly anymore, except
for the new `isQueryLanguage` function. The only remaining place that I
know of where we're using a `string` to represent the `QueryLanguage`
is in a database item's language, but this is harder to change and may
be relied upon by language authors.
2023-05-08 13:56:11 +02:00
Marcono1234
788eb2b663 Simplify location URLs if start and end line are the same 2023-05-07 19:54:49 +02:00
Andrew Eisenberg
5084b32152 Merge branch 'main' into github-action/bump-cli 2023-05-05 16:07:33 -07:00
Robert
bf9eb2469b Merge pull request #2370 from github/robertbrignull/undefined_codeflows
Avoid crashing when SARIF file contains invalid thread flow locations
2023-05-05 17:43:58 +01:00
Robert
78c4cc17e9 Revert change to generation of blank lines 2023-05-05 17:19:07 +01:00
Andrew Eisenberg
62f44c9f56 Merge pull request #2403 from github/aeisenberg/fix-integration-tests 2023-05-05 07:24:53 -07:00
Andrew Eisenberg
e4a2760470 Run integration tests on 1.77.3
This avoids a bug on 1.78.0 on linux. See
https://github.com/github/vscode-codeql/issues/2402
2023-05-05 14:04:32 +00:00
github-actions[bot]
67bd603327 Bump CLI version from v2.13.0 to v2.13.1 for integration tests 2023-05-04 18:10:07 +00:00
Elena Tanasoiu
3a5a81a599 Merge pull request #2359 from github/yer-a-ternary-choice-query
Add configuration option to turn off skeleton pack generation
2023-05-04 08:53:17 +01:00
Robert
ecfa701159 Add tests of tryGetFilePath 2023-05-03 17:24:41 +01:00
Robert
a3a6784539 Rename to teyGetFilePath to fit other methods 2023-05-03 17:20:00 +01:00
Elena Tanasoiu
9515e3bdf8 Merge branch 'main' into yer-a-ternary-choice-query 2023-05-03 17:16:50 +01:00
Robert
e097bc13fa Merge pull request #2400 from github/robertbrignull/test-plan
Update the test plan and add non-MRVA cases
2023-05-03 17:12:35 +01:00
Robert
b199d9485d Merge branch 'main' into robertbrignull/undefined_codeflows 2023-05-03 17:11:31 +01:00
Elena Tanasoiu
cc8f1fd839 Merge branch 'main' into yer-a-ternary-choice-query 2023-05-03 16:08:37 +01:00
Elena Tanasoiu
a85d9d1434 Update comment 2023-05-03 15:07:24 +00:00
Shati Patel
71611e03fe Add config options for default sorting/filtering values in variant analysis results view (#2392) 2023-05-03 14:52:35 +00:00
Robert
ff20bceaa8 Add test cases of non-MRVA areas 2023-05-03 15:21:08 +01:00
Robert
5edbb1e96c Categorise test cases as mrva / local / general 2023-05-03 14:54:56 +01:00
Robert
bcd58181bf List pre-release checks in the order you'll want to do them 2023-05-03 14:50:02 +01:00
Robert
0f5df90ee5 Add files via upload 2023-05-03 14:41:55 +01:00
Robert
992d8dd4be Update MRVA tests in test-plan.md 2023-05-03 14:38:41 +01:00
Elena Tanasoiu
9ecb5035e0 Reduce options to "ask" and "never"
And update descriptions for them.
2023-05-03 12:14:23 +00:00
Robert
70a9ee6b1d Merge pull request #2399 from github/version/bump-to-v1.8.5
Bump version to v1.8.5
2023-05-03 12:35:59 +01:00
Robert
c53bebd1ce Merge pull request #2397 from github/robertbrignull/vscode-node-version
Add note about how to find VSCode node version
2023-05-03 12:21:55 +01:00
github-actions[bot]
ba9bfb57d1 Bump version to v1.8.5 2023-05-03 11:09:07 +00:00
Robert
ab9dd6a74f Merge pull request #2398 from github/v1.8.4
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
v1.8.4
2023-05-03 11:23:03 +01:00
Robert
1c2fc37175 Remove changelog entry for #2385 2023-05-03 11:07:23 +01:00
Robert
29dd24c733 Update extensions/ql-vscode/CHANGELOG.md
Co-authored-by: Shati Patel <42641846+shati-patel@users.noreply.github.com>
2023-05-03 11:05:26 +01:00
Robert
0f6714d9f6 Update extensions/ql-vscode/CHANGELOG.md
Co-authored-by: Shati Patel <42641846+shati-patel@users.noreply.github.com>
2023-05-03 11:05:14 +01:00
Robert
3102a177fb v1.8.4 2023-05-03 10:41:14 +01:00
Robert
2111ba01ac Add missing changelog entries 2023-05-03 10:40:33 +01:00
Robert
bb4060bcb6 Add note about how to find VSCode node version 2023-05-03 10:38:06 +01:00
Elena Tanasoiu
42320fcb87 Don't try to restore setting 2023-05-03 08:35:40 +00:00
Elena Tanasoiu
530ae689d3 Use strictly type choices for config setting 2023-05-03 07:58:35 +00:00
Elena Tanasoiu
c8b0b1c769 Use parent setting for "Create Query" config 2023-05-03 07:52:37 +00:00
Elena Tanasoiu
62597f1eb5 Remove extra space 2023-05-03 07:49:22 +00:00
Elena Tanasoiu
9c47a2718c Remove "default" option
Since it's not defining a real option, we can get rid of it.
2023-05-03 07:35:49 +00:00
Robert
e8403cf5d2 Reject all file URIs 2023-05-02 17:08:52 +01:00
Robert
5ff5384551 Simplify adding indentation 2023-05-02 16:01:18 +01:00
Koen Vlaswinkel
5360f03700 Merge pull request #2396 from github/koesie10/suppress-error-message
Suppress similar error messages when monitor MRVA
2023-05-02 16:55:02 +02:00
Koen Vlaswinkel
5f3466404c Add tests for suppressing error message 2023-05-02 16:19:53 +02:00
Koen Vlaswinkel
14eb7ff564 Merge pull request #2395 from github/koesie10/bqrs-use-select
Prefer `#select` result set over other result sets
2023-05-02 15:51:52 +02:00
Koen Vlaswinkel
e8ee43d955 Suppress similar error messages when monitor MRVA
This will suppress showing the same error message when monitoring the
variant analysis fails multiple times in a row. This is useful when
e.g. the internet is disconnected or the endpoint is non-functional for
any other reason.

This will show the error message at least once, and then only show it
if there has been a successful attempt in between or when the error
message is different. This should result in a much less noisy
experience.
2023-05-02 14:39:04 +02:00
Koen Vlaswinkel
36be323c89 Prefer #select result set over other result sets
For `@kind problem` queries, it seems like the BQRS contains four
result sets: `edges`, `nodes`, `subpaths`, and `#select`. The user is
probably interested in the results of `#select` since that contains the
direct result of the query. This changes the extraction of raw (BQRS)
results to always prefer `#select` over any other result set. If it
can't find a result set named `#select`, it will fall back to the first
result set in the BQRS like before.
2023-05-02 14:22:36 +02:00
Andrew Eisenberg
467e5ce452 Merge pull request #2385 from github/aeisenberg/no-cache-contextual
Add `codeQL.contextualQueries.disableCache`
2023-05-01 07:30:34 -07:00
Andrew Eisenberg
67110d7afb Merge pull request #2393 from github/aeisenberg/fix-cfg-viewer
Fix CFG viewer
2023-05-01 07:29:26 -07:00
Andrew Eisenberg
c650afbf6e Fix CFG viewer
After some bit of refactoring, the templates are no longer being
passed to the CFG viewer and this is preventing the viewer from
running.

This change fixes it.
2023-04-28 09:19:31 -07:00
Charis Kyriakou
c319d61dd5 Merge pull request #2391 from github/charisk/move-query-testing-files
Move query testing related files to /query-testing
2023-04-28 17:04:25 +01:00
Charis Kyriakou
331487dbab Move qltest-discovery.ts to /query-testing/qltest-discovery.ts 2023-04-28 13:51:48 +00:00
Charis Kyriakou
82abaa6e13 Move discovery.ts to /query-testing/discovery.ts 2023-04-28 13:51:48 +00:00
Charis Kyriakou
feb92de0c4 Move test-ui.ts to /query-testing/test-ui.ts 2023-04-28 13:51:48 +00:00
Charis Kyriakou
6415978db5 Move test-tree-node.ts to /query-testing/test-tree-node.ts 2023-04-28 13:51:48 +00:00
Charis Kyriakou
c215072d2e Move test-runner.ts to /query-testing/test-runner.ts 2023-04-28 13:51:48 +00:00
Charis Kyriakou
7662b3900f Move test-manager-base.ts to /query-testing/test-manager-base.ts 2023-04-28 13:51:48 +00:00
Charis Kyriakou
863e7d207f Move test-adapter.ts to /query-testing/test-adapter.ts 2023-04-28 13:51:48 +00:00
Charis Kyriakou
27ebc3e67f Merge pull request #2388 from github/charisk/move-common-vscode-files
Move vscode utils to /common/vscode
2023-04-28 14:51:10 +01:00
Robert
afa7b1dea9 Merge pull request #2389 from github/robertbrignull/successful_repos_changelog
Add missing changelog entry for #2349
2023-04-28 12:31:44 +01:00
Robert
86ecd9bfad Add changelog entry for https://github.com/github/vscode-codeql/pull/2349 2023-04-28 11:52:35 +01:00
Charis Kyriakou
b034c31db8 Move progress.ts to /common/vscode/progress.ts 2023-04-28 10:14:55 +00:00
Charis Kyriakou
4f1315aeae Move authentication.ts to /common/vscode/authentication.ts 2023-04-28 10:14:55 +00:00
Charis Kyriakou
8500f20c2b Move archive-filesystem-provider.ts to /common/vscode/archive-filesystem-provider.ts 2023-04-28 10:14:55 +00:00
Charis Kyriakou
d1db456e2e Move abstract-webview.ts to /common/vscode/abstract-webview.ts 2023-04-28 09:33:02 +00:00
Charis Kyriakou
ff47310133 Move vscode-uitls/multi-file-system-watcher.ts to /common/vscode/multi-file-system-watcher.ts 2023-04-28 09:33:02 +00:00
Charis Kyriakou
5c6e8a46a3 Move vscode-uitls/external-files.ts to /common/vscode/external-files.ts 2023-04-28 09:33:02 +00:00
Charis Kyriakou
48dd3dc57c Merge pull request #2387 from github/charisk/move-some-common-files
Move some common files into /common
2023-04-28 10:22:24 +01:00
Charis Kyriakou
8b59c12701 Move log-insights/jsonl-reader.ts to /common/jsonl-reader.ts 2023-04-28 07:35:54 +00:00
Charis Kyriakou
616e2be99b Move sarif-parser.ts to /common/sarif-parser.ts 2023-04-28 07:35:54 +00:00
Andrew Eisenberg
5ce45761a0 Add codeQL.contextualQueries.disableCache
An internal option to help library authours to run and debug
the find references and find dependencies contetextual queries
without relying on the implicit cache.
2023-04-27 21:00:39 +00:00
dependabot[bot]
f4a3115a6a Bump patch-package from 6.5.0 to 7.0.0 in /extensions/ql-vscode (#2383)
Bumps [patch-package](https://github.com/ds300/patch-package) from 6.5.0 to 7.0.0.
- [Release notes](https://github.com/ds300/patch-package/releases)
- [Changelog](https://github.com/ds300/patch-package/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ds300/patch-package/compare/v6.5.0...v7.0.0)

---
updated-dependencies:
- dependency-name: patch-package
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-27 10:04:51 -07:00
Robert
686d8749d0 Merge pull request #2384 from github/robertbrignull/makeSelected
Fix not setting database as selected if it already exists
2023-04-27 17:19:01 +01:00
Charis Kyriakou
39b890dd70 Merge pull request #2382 from github/charisk/move-mocks
Move mock GitHub API server files
2023-04-27 17:07:05 +01:00
Robert
b786b56c70 Fix tests 2023-04-27 16:53:25 +01:00
Robert
44a096202d Add changelog entry 2023-04-27 16:51:33 +01:00
Elena Tanasoiu
f10185abc8 Write correct value to setting 2023-04-27 15:42:04 +00:00
Charis Kyriakou
431988f9fd Move mock GitHub API server files
:   scripts/lint-scenarios.ts
2023-04-27 15:24:09 +00:00
Robert
e0cb1df68c Update expected args in test 2023-04-27 15:43:43 +01:00
Robert
92f23d18fb Change default value of makeSelected from false to true 2023-04-27 15:17:01 +01:00
Robert
9941a42dd9 Set makeSelected to true for two calls 2023-04-27 15:13:36 +01:00
Robert
62737146fe Make database selected even if it's already in the list 2023-04-27 15:06:46 +01:00
Charis Kyriakou
977c7f57b1 Merge pull request #2381 from github/charisk/move-cli-files
Move CodeQL CLI files
2023-04-27 14:06:13 +01:00
Elena Tanasoiu
d242117240 Fix comment to list correct options
I initially started defining an enum, but I'm not able to import it in package.json,
where the list of options is defined (under `codeQL.createQuery.autogenerateQlPacks`).
2023-04-27 12:35:06 +00:00
Elena Tanasoiu
c71a83b9c7 Correct test descriptions to say ternary instead of binary 2023-04-27 12:35:06 +00:00
Elena Tanasoiu
025ec257a5 Convert autogenerateQlPacks to use enum 2023-04-27 12:35:06 +00:00
Elena Tanasoiu
6034105462 Rename codeQL.autogenerateQlPacks -> codeQL.createQuery.autogenerateQlPacks 2023-04-27 12:35:06 +00:00
Elena Tanasoiu
9aeb520841 Rename SKELETON_WIZARD_FOLDER -> QL_PACK_LOCATION
To make it clear what it's supposed to be storing.
2023-04-27 12:35:06 +00:00
Elena Tanasoiu
4e2b26f285 Rename codeQL.createQuery.folder -> codeQL.createQuery.qlPackLocation 2023-04-27 12:35:06 +00:00
Elena Tanasoiu
c877f6cc60 Fix error in skeleton wizard tests
We modify both these options in the beforeEach(). We should reset
them in the afterEach().
2023-04-27 12:35:06 +00:00
Elena Tanasoiu
f2601432d3 Remember user's choice to not be prompted again
By writing the setting to our new `codeQL.autogenerateQlPacks` setting.
2023-04-27 12:35:04 +00:00
Elena Tanasoiu
8392284cc1 Introduce new dialog box with "No, never ask me again" option 2023-04-27 12:33:51 +00:00
Elena Tanasoiu
ae320d0fef Set up new config setting for auto generating QL packs
In the next commit we will write to this setting when the user chooses
to disable the QL pack generation and prefers to never be asked again
about it.
2023-04-27 12:33:16 +00:00
Elena Tanasoiu
3eef0e9797 Give modal methods their own describe blocks 2023-04-27 12:33:16 +00:00
Robert
562f926be5 Merge pull request #2349 from github/robertbrignull/countSuccessfulRepos
Show number of successful repos instead of completed repos in variant analysis results view header
2023-04-27 12:58:15 +01:00
Charis Kyriakou
ae8766a296 Move distribution.ts to /codeql-cli/distribution.ts 2023-04-27 11:57:07 +00:00
Charis Kyriakou
8bdb51d281 Move cli-version.ts to /codeql-cli/cli-version.ts 2023-04-27 11:57:07 +00:00
Charis Kyriakou
732c67e6cd Move cli.ts to /codeql-cli/cli.ts 2023-04-27 11:57:07 +00:00
Charis Kyriakou
84f482fcb7 Merge pull request #2379 from github/charisk/move-packaging-files
Move packaging files
2023-04-27 12:51:02 +01:00
Charis Kyriakou
287a2d1ef2 Update paths to data files to fix tests 2023-04-27 11:16:24 +00:00
Robert
9d7ea8ecd8 Make test names clearer 2023-04-27 12:10:51 +01:00
Robert
68c41d346c Merge branch 'main' into robertbrignull/countSuccessfulRepos 2023-04-27 12:09:09 +01:00
Robert
29d04837ab Merge pull request #2287 from github/robertbrignull/selection
Introduce helpers for commands that operate on selections
2023-04-27 11:38:22 +01:00
Shati Patel
988df04b0b Change internal name for variant analysis SortKey values (#2380)
Follow-up to https://github.com/github/vscode-codeql/pull/2373
2023-04-27 10:37:14 +00:00
Robert
392c59ed2c Remove unnecessary check of undefined 2023-04-27 10:56:25 +01:00
Shati Patel
af75fa9f2f Update wording in the "sorting dropdown" of the variant analysis results view (#2373) 2023-04-27 10:41:32 +01:00
Robert
37459a1405 fix typo 2023-04-27 10:33:46 +01:00
Robert
0bc756766a Merge branch 'main' into robertbrignull/selection
Conflicts:
	extensions/ql-vscode/src/databases/local-databases-ui.ts
	extensions/ql-vscode/src/query-history/query-history-manager.ts
2023-04-27 10:32:24 +01:00
Charis Kyriakou
80ac593bec Add index.ts for packaging module 2023-04-27 08:52:52 +00:00
Charis Kyriakou
38af88805c Move packaging.ts to /packaging/packaging.ts 2023-04-27 08:52:52 +00:00
Charis Kyriakou
8c9c38e1ae Merge pull request #2377 from github/charisk/move-databse-files
Move database files
2023-04-27 09:44:03 +01:00
Charis Kyriakou
0941417caf Move local-databases.ts to /databases/local-databases.ts 2023-04-26 13:52:16 +00:00
Charis Kyriakou
845197a95f Move local-databases-ui.ts to /databases/local-databases-ui.ts 2023-04-26 13:52:16 +00:00
Charis Kyriakou
2e96ba90e6 Move databaseFetcher.ts to /databases/database-fetcher.ts 2023-04-26 13:52:16 +00:00
Charis Kyriakou
57cc9657ed Merge pull request #2376 from github/charisk/move-query-evaluation-log-files
Move query evaluation logging files
2023-04-26 14:15:54 +01:00
Nora
099e8723bc Merge pull request #2375 from github/version/bump-to-v1.8.4
Bump version to v1.8.4
2023-04-26 14:59:00 +02:00
Charis Kyriakou
de36944425 Add index for query-evaluation-logging module 2023-04-26 12:32:06 +00:00
Charis Kyriakou
1edecfae57 Move eval-log-viewer.ts to query-evaluation-logging/eval-log-viewer.ts and related tests 2023-04-26 12:32:06 +00:00
Charis Kyriakou
2d4d15aed8 Move eval-log-tree-builder.ts to query-evaluation-logging/eval-log-tree-builder.ts and related tests 2023-04-26 12:32:06 +00:00
Nora
77fbaea1c7 Merge pull request #2368 from github/nora/move-files-misc1
Move contextual and ast-viewer files into language-support
2023-04-26 14:15:35 +02:00
Nora
b6b3d3b541 improve imports 2023-04-26 09:56:45 +00:00
github-actions[bot]
e1e05725cf Bump version to v1.8.4 2023-04-26 09:47:12 +00:00
Nora
3b53c5a14f Merge pull request #2374 from github/v1.8.3
Some checks failed
Release / Release (push) Has been cancelled
Release / Publish to VS Code Marketplace (push) Has been cancelled
Release / Publish to Open VSX Registry (push) Has been cancelled
v1.8.3
2023-04-26 11:03:51 +02:00
Nora
1614c833eb v1.8.3 2023-04-26 10:20:20 +02:00
Robert
86b53a8def Merge pull request #2358 from github/robertbrignull/handleCompareWith
Fiddle with handleCompareWith to make it cleaner
2023-04-25 16:29:49 +01:00
Robert
912a9e167f Add LocalQueryInfo.databaseName getter 2023-04-25 15:57:20 +01:00
Robert
ab7ec589ff Rename allItemsSelected => allSelectedItems 2023-04-25 15:52:41 +01:00
Robert
1a87ad8a33 Make comments clearer 2023-04-25 15:51:48 +01:00
Robert
1317dfa581 Pull out getFromQueryToCompare 2023-04-25 15:44:53 +01:00
Shati Patel
298176d8f1 React tests: Wrap code that causes state updates in act() (#2372) 2023-04-25 14:01:53 +00:00
Nora
9a317b7651 move ast test data files 2023-04-25 13:46:08 +00:00
Nora
ba85e98f8b move language-support/contextual/ast-builder to language-support/ast-viewer/ast-builder 2023-04-25 13:46:08 +00:00
Nora
8d3d5dbf45 move src/astViewer to src/language-support/ast-viewer/ast-viewer including test 2023-04-25 13:46:08 +00:00
Nora
3757911d34 move src/ast-cfg-commands to language-support/ast-viewer/ast-cfg-commands 2023-04-25 13:46:08 +00:00
Nora
c9f7b7aacf create index.ts and adjust imports and exports 2023-04-25 13:46:08 +00:00
Nora
e5845b1c21 move contextual -> language-support/contextual including tests and kebab-caseing 2023-04-25 13:46:08 +00:00
Koen Vlaswinkel
2d68c1c735 Merge pull request #2371 from github/koesie10/switch-to-argument-this
Rename `Argument[-1]` to `Argument[this]`
2023-04-25 14:20:49 +02:00
Koen Vlaswinkel
92b57bf1e2 Rename Argument[-1] to Argument[this]
See: https://github.com/github/codeql/pull/12556
2023-04-25 13:31:52 +02:00
Robert
72c646c29b Ignore invalid file paths when parsing sarif 2023-04-25 11:21:56 +01:00
Robert
274cb9a6e8 Handle codeSnippet not being defined in markdown generation 2023-04-25 10:40:33 +01:00
Robert
0394bd5e1e Make codeSnippet optional 2023-04-25 10:40:10 +01:00
Robert
e31ef662f8 Avoid using "as ThreadFlow" to force the type system 2023-04-24 17:32:21 +01:00
Robert
14952cf7d3 Delete assertSingleQuery 2023-04-24 16:08:46 +01:00
Robert
dbf3f26d13 Convert handleExportResults to use createSingleSelectionCommand 2023-04-24 16:08:46 +01:00
Robert
a6a2f9776a Convert handleCopyRepoList to use createSingleSelectionCommand 2023-04-24 16:08:46 +01:00
Robert
be6f356437 Convert handleOpenOnGithub to use createSingleSelectionCommand 2023-04-24 16:08:46 +01:00
Robert
1ea0f1429d Convert handleViewDil to use createSingleSelectionCommand 2023-04-24 16:08:46 +01:00
Robert
9c711eda97 Convert handleViewCsvAlerts to use createSingleSelectionCommand 2023-04-24 16:08:46 +01:00
Robert
b74cd15752 Convert handleViewCsvResults to use createSingleSelectionCommand 2023-04-24 16:08:46 +01:00
Robert
ef93ab9e70 Convert handleViewSarifAlerts to use createSingleSelectionCommand 2023-04-24 16:08:46 +01:00
Robert
288a2bf62a Convert handleShowQueryText to use createSingleSelectionCommand 2023-04-24 16:08:46 +01:00
Robert
b2f0e2efd9 Convert handleCancel to use createMultiSelectionCommand 2023-04-24 16:08:46 +01:00
Robert
28819dfe76 Convert handleShowEvalLogViewer to use createSingleSelectionCommand 2023-04-24 16:08:46 +01:00
Robert
43c0d15be3 Convert handleShowEvalLogSummary to use createSingleSelectionCommand 2023-04-24 16:08:46 +01:00
Robert
ccd73b2a16 Convert handleShowEvalLog to use createSingleSelectionCommand 2023-04-24 16:08:46 +01:00
Robert
921cf60f5e Convert handleOpenQueryDirectory to use createSingleSelectionCommand 2023-04-24 16:08:46 +01:00
Robert
21757ae9b6 Convert handleShowQueryLog to use createSingleSelectionCommand 2023-04-24 16:08:46 +01:00
Robert
a0a4a06430 Convert handleItemClicked to use createSingleSelectionCommand 2023-04-24 16:08:46 +01:00
Robert
b17251b36c Convert handleRenameItem to call createSingleSelectionCommand 2023-04-24 16:08:46 +01:00
Robert
d29c24d06c Convert handleRemoveHistoryItem to use createMultiSelectionCommand 2023-04-24 16:08:46 +01:00
Robert
0b0a03396c Convert handleOpenQuery to use createSingleSelectionCommand 2023-04-24 16:08:46 +01:00
Robert
d1e528e48a Convert runQueries to use createMultiSelectionCommand 2023-04-24 16:08:46 +01:00
Robert
491cf2a58d Convert handleAddSource to use createMultiSelectionCommand 2023-04-24 16:08:46 +01:00
Robert
5394891691 Convert handleOpenFolder to use createMultiSelectionCommand 2023-04-24 16:08:46 +01:00
Robert
be392b5415 Convert handleRenameDatabase to use createSingleSelectionCommand 2023-04-24 16:08:46 +01:00
Robert
5bee5c6672 Convert handleRemoveDatabase to use createMultiSelectionCommand 2023-04-24 16:08:46 +01:00
Robert
4a957adda3 Convert handleUpgradeDatabase to use createMultiSelectionCommand 2023-04-24 16:08:46 +01:00
Robert
40f3092244 Convert handleUpgradeDatabaseInternal to just take an array of databases 2023-04-24 16:08:46 +01:00
Robert
08eb7f811e Add functions for creation selection commands 2023-04-24 16:08:46 +01:00
Dave Bartolomeo
be3efd79a8 Merge pull request #2369 from github/dbartol/qltest-error
Only attempt to discover QL tests in on-disk workspace folders
2023-04-24 11:06:15 -04:00
Dave Bartolomeo
f8a269c277 Only attempt to discover QL tests in on-disk workspace folders
This was only a problem for the new test UI, because the third-party Test Explorer extension we used before must have had this filter in its implementation.
2023-04-24 10:46:11 -04:00
Nora
f0ef98539c Merge pull request #2367 from github/nora/move-local-query-files
Move local query files
2023-04-24 13:47:37 +02:00
Nora
a4dd26a13f adjust index.ts, imports and export in quick-eval-code-lens-provider 2023-04-24 09:29:14 +00:00
Nora
aebf9be5d7 move /src/quickEvalCodeLensProvider.ts to /src/local-queries/quick-eval-code-lens-provider 2023-04-24 09:23:51 +00:00
Nora
7d711f3fb3 move src/quick-query to src/local-queries/quick-query 2023-04-24 09:22:18 +00:00
Nora
c708e5f595 Merge pull request #2360 from github/nora/move-language-support
Move language support files
2023-04-24 11:17:57 +02:00
Nora
d455c1aa76 Introduce and use index.ts 2023-04-24 08:25:31 +00:00
Nora
a175cac5f0 Move and rename languageSupport to language-support 2023-04-24 08:25:31 +00:00
Nora
f866545a40 Move query-editor 2023-04-24 08:25:31 +00:00
Nora
01c1888ded Move ide-server 2023-04-24 08:25:31 +00:00
github-actions[bot]
4fafdbc58b Bump CLI version from v2.12.7 to v2.13.0 for integration tests (#2366)
Co-authored-by: github-actions[bot] <github-actions@github.com>
2023-04-21 08:38:34 +00:00
Shati Patel
5fb001632b Don't throw error if user cancels out of choosing a language (#2365)
When running "Create Query", if the user escapes out of the language quickpick we don't need to throw an error. Instead we can just show a `UserCancellationException` notice.
2023-04-21 07:29:09 +00:00
Robert
b0cdae7c9f Merge branch 'main' into robertbrignull/handleCompareWith
uick 6363a6a4 Remove the determineSelection method
2023-04-20 16:03:41 +01:00
Robert
f0d41f6d3d Merge pull request #2356 from github/robertbrignull/query_history_selection
Remove determineSelection and simplify selection commands for the query history
2023-04-20 16:01:51 +01:00
Robert
42f8916124 Remove test of impossible behaviour 2023-04-20 12:42:22 +01:00
Robert
ed9e9ddadf Delete tests for determineSelection 2023-04-20 12:30:25 +01:00
Andrew Eisenberg
091985a164 Merge pull request #2351 from github/github-action/bump-cli
Bump CLI Version to v2.12.7 for integration tests
2023-04-20 02:51:23 -07:00
Shati Patel
0afe982ccf Merge branch 'main' into github-action/bump-cli 2023-04-20 10:30:07 +01:00
Nora
d4fa420201 Merge pull request #2357 from github/charisk-nora/query-server-move
Move Query Server files
2023-04-20 10:21:20 +02:00
Koen Vlaswinkel
fbe782f4ef Merge pull request #2354 from github/koesie10/clear-pack-cache-on-create
Clear pack cache on create and delete
2023-04-20 09:51:46 +02:00
Robert
3c77e81fd8 Make handleCompareWith cleaner 2023-04-19 17:35:23 +01:00
Nora
d9dc061312 Introduce index.ts 2023-04-19 15:05:30 +00:00
Nora
5cfb93980e Rename legacyRunner to query-runner (kebab-case) 2023-04-19 14:11:05 +00:00
Nora
f97105ba41 Move queryRunner to query-server/queryRunner 2023-04-19 14:11:05 +00:00
Nora
e05defad3b Rename query-runner to new-query-runner to match class and file 2023-04-19 14:11:05 +00:00
Nora
6d9a87c6e8 Rename legacy/legacyRunner to legacy/legacy-query-runner (kebab-case and class-file name) 2023-04-19 14:11:05 +00:00
Nora
ee66530d0d Rename queryserver-client to query-sever-client (kebab-case) 2023-04-19 14:11:05 +00:00
Nora
78f1a88924 Rrename legacy/queryserver-client to legacy/query-sever-client (kebab-case) 2023-04-19 14:11:05 +00:00
Nora
222bf024f3 Rename json-rpc-server to server-process to match class and filename 2023-04-19 14:11:05 +00:00
Nora
4ee8e5a00e Move json-rpc-server.ts 2023-04-19 14:11:05 +00:00
Charis Kyriakou
4097ee0255 Move legacy-query-server/ to query-server/legacy/ 2023-04-19 14:11:04 +00:00
Charis Kyriakou
274182718a Introduce index.ts for local-queries module (#2355) 2023-04-19 14:30:47 +01:00
Elena Tanasoiu
30c3ffad01 Merge pull request #2321 from github/elena/yer-a-flag-query
Enable skeleton wizard in codespaces-codeql template
2023-04-19 14:11:14 +01:00
Elena Tanasoiu
5f8ec14ad6 Merge branch 'main' into elena/yer-a-flag-query 2023-04-19 13:53:49 +01:00
Koen Vlaswinkel
686a9e4095 Clear pack cache on create and delete
We were only clearing the pack cache when a pack file was modified. When
using a script to create a new pack, the pack file is created at once
without a change event firing. This will change the behavior to also
clear the pack cache when a pack file is created or deleted.
2023-04-19 14:36:39 +02:00
Robert
6363a6a493 Remove the determineSelection method 2023-04-19 12:53:07 +01:00
Nora
7f3f3380ad Merge pull request #2350 from github/nora/remove-query-history-title-bar-actions
Remove query history title actions
2023-04-19 13:50:19 +02:00
Nora
043adbf797 Merge pull request #2347 from github/nora/break-down-local-queries-1
Break down local-queries.ts
2023-04-19 13:49:30 +02:00
Elena Tanasoiu
aa2eceea4c Merge branch 'main' into elena/yer-a-flag-query 2023-04-19 12:27:52 +01:00
Elena Tanasoiu
724dc45991 Fix typo 2023-04-19 11:25:33 +00:00
Elena Tanasoiu
2f811057b8 Enable skeleton wizard in codespaces template
Once we're satisfied with testing this flow (including with a single
rooted workspace) we can enable it in the codespaces-template.
2023-04-19 11:25:08 +00:00
Elena Tanasoiu
5ab24c0eea Merge pull request #2330 from github/yer-a-sorted-database-query
Select latest database when creating skeleton query
2023-04-19 12:22:30 +01:00
Robert
cf78dbba92 Merge pull request #2343 from github/robertbrignull/results_filter
Add a component for filtering repositories based on their results
2023-04-19 12:19:37 +01:00
Robert
b5ad37a094 Don't say analyses failed when the workflow was canceled 2023-04-19 11:52:39 +01:00
Nora
82c8068b64 Update changelog 2023-04-19 08:59:05 +00:00
Nora
2be0c16f22 Remove unused type 2023-04-19 08:47:30 +00:00
Nora
1d8bcd476a Remove titel actions 2023-04-19 08:47:30 +00:00
Elena Tanasoiu
02e17516d9 Convert db item methods to be static
So that we make it clear we should be passing state as params instead
of reading it off `this`.
2023-04-19 08:39:25 +00:00
Elena Tanasoiu
02dffe08d5 Fetch the latest database from the new sorted list
And add tests to check this.

I've had to adapt the existing `findExistingDatabaseItem` method
so receive params so that I'm better able to send it a language
and a list of database items.
2023-04-19 08:39:25 +00:00
Elena Tanasoiu
561e07a689 Sort database items by dateAdded
Before selecting an existing database, let's sort them by date.

We're opting to exclude databases with errors during the sorting
process.
2023-04-19 08:39:24 +00:00
Elena Tanasoiu
dce94e8510 Merge pull request #2341 from github/yer-an-input-box-query
Prompt non-codespace users for storage path
2023-04-19 09:36:42 +01:00
Koen Vlaswinkel
3f7b8a6409 Merge pull request #2348 from github/koesie10/non-existing-model-file
Hide link when model file does not exist
2023-04-19 10:21:21 +02:00
Elena Tanasoiu
7335e37c16 Merge branch 'main' into yer-an-input-box-query 2023-04-19 08:58:52 +01:00
Elena Tanasoiu
154fab845a Don't mention workspace 2023-04-19 07:56:06 +00:00
github-actions[bot]
7c18934dde Bump CLI version from v2.12.6 to v2.12.7 for integration tests 2023-04-18 20:36:27 +00:00
Elena Tanasoiu
5e76d0b1ad Fix typos
Co-authored-by: Shati Patel <42641846+shati-patel@users.noreply.github.com>
2023-04-18 16:30:31 +00:00
Elena Tanasoiu
467c2a550e Merge pull request #2328 from github/yer-a-single-rooted-workspace-query
Ensure we're selecting database in single rooted workspace
2023-04-18 17:25:09 +01:00
Elena Tanasoiu
1106e5959a Remove canary flag
Once we're satisfied with testing this flow (including with a single
rooted workspace) we can remove this flag.
2023-04-18 15:51:53 +00:00
Robert
2844fed863 Merge branch 'main' into robertbrignull/results_filter 2023-04-18 16:41:45 +01:00
Robert
93acb76099 Use punctuation to make test names clearer 2023-04-18 16:38:56 +01:00
Robert
dd630bfca8 Split tests up into describe blocks 2023-04-18 16:38:39 +01:00
Robert
a8a84a6f8c Add changelog entry 2023-04-18 16:34:34 +01:00
Elena Tanasoiu
db35cb294d Add new setting to package.json 2023-04-18 15:34:21 +00:00
Elena Tanasoiu
e0bf1ca40f Rename skeletonWizard setting to createQuery 2023-04-18 15:33:46 +00:00
Elena Tanasoiu
57d48a7b04 Prompt non-codespace users for storage path
Offer non-codespace users the option to configure their storage folder for skeleton packs.

Suggested here:
https://github.com/github/vscode-codeql/pull/2310#issuecomment-1507428217

At the moment we're choosing to create our skeleton packs in the first
folder in the workspace.

This is fine for the codespace template because we can control the
folder structure in that repo.

For users outside of this we'd like to offer them the option to choose
where to save their skeleton packs.
2023-04-18 15:33:45 +00:00
Andrew Eisenberg
72a3e8d44a Merge pull request #2307 from github/aeisenberg/cli-version-telemetry
Add the CLI version to telemetry events
2023-04-18 08:27:46 -07:00
Elena Tanasoiu
93a2b06b35 Remove unnecessary assignment to variable
This was flagged by CodeQL.
2023-04-18 15:14:54 +00:00
Elena Tanasoiu
30ebe0ab57 Don't use shorthand boolean for large method calls
To make it clear what the search is doing and make the code more readable.

Co-authored-by: Robert Brignull <robertbrignull@github.com>
2023-04-18 15:14:54 +00:00
Elena Tanasoiu
28745da7b8 Replace setCurrentDatabaseItem with openDatabase 2023-04-18 15:14:51 +00:00
Elena Tanasoiu
6e4124115f Ensure we're selecting database in single rooted workspace
After some testing of the wizard with a single rooted workspace
(`github/code-scanning`) we discovered a general VSCode extension
bug whereby after we download a database, we don't select it.

This isn't an issue in the wizard, but it does affect us as it means
we'll generate the QL pack, download the db for you but then you won't
know that we haven't selected your database.

So let's make sure our flow works for this case by explicitly selecting
the database once it's downloaded.

We've noticed by testing that we need to set the current database item
before we call `addDatabaseSourceArchiveFolder()`. Once that method is
called, the call to `setCurrentDatabaseItem()` is ignored.

We've had to make some changes to the openDatabase() method to select
a database item by default, since most places where we call `openDatabase()`
also immediately select the item.

There is one exception [1] in the test-runner.ts file, where we set the
current database item under special conditions.

For this reason, we've made the behaviour configurable and tried to add
some descriptive naming to the params so that it's easy to understand
what the config is doing.

[1]: 4170e7f7a7/extensions/ql-vscode/src/test-runner.ts (L120-L124)
2023-04-18 15:11:00 +00:00
Shati Patel
10adbd6fbc Suggest smaller databases in "create query" setup (#2346) 2023-04-18 14:55:07 +01:00
Robert
7b03a6ed14 Fix story or cancelled analysis 2023-04-18 14:52:55 +01:00
Robert
6398ede2e2 Pull icon out to function 2023-04-18 14:52:55 +01:00
Robert
276d675242 Add labels to icons 2023-04-18 14:52:53 +01:00
Robert
3db0f2bdfe Show an error if not all repos completed successfully 2023-04-18 14:52:53 +01:00
Robert
aa9e2fb5fc Remove "Succeeded warnings" text 2023-04-18 14:52:53 +01:00
Robert
8291e52a9b Pass in successfulRepositoryCount 2023-04-18 14:52:50 +01:00
Koen Vlaswinkel
23abc5de0d Hide link when model file does not exist
This removes the link to the model file when it does not exist. It will
still show the filename of the model file. When clicking on "Apply", it
will refresh whether the model file exists after writing the file.
2023-04-18 15:47:18 +02:00
Nora
a1b020a5f7 Create new folder and split classes into it 2023-04-18 13:12:36 +00:00
Robert
612628fa98 Replace showWarning by passing in skippedRepositoryCount 2023-04-18 13:56:44 +01:00
Elena Tanasoiu
34d4fd4d41 Always check for an existing database
This fixes an issue where we would download a database every time
we create a new QL pack. Sometimes, a database is already available
so let's always check for it, regardless of the existence of a QL
pack.
2023-04-18 12:54:10 +00:00
Elena Tanasoiu
a5fc96397c Rename selectExistingDatabase -> selectOrDownloadDatabase
Make it clear that this method can also download a database if it fails
to find one.
2023-04-18 12:54:10 +00:00
Elena Tanasoiu
d3ef29410b Extract finding existing database item into separate method 2023-04-18 12:54:10 +00:00
Koen Vlaswinkel
b9c8983bb3 Merge pull request #2345 from github/koesie10/filter-extension-packs-for-language
Filter extension packs by database item language
2023-04-18 14:50:24 +02:00
Robert
52972f0d69 Make completedRepositoryCount non-optional
We're always passing in a non-undefined number anyway, so this optional value isn't giving us any benefit.
2023-04-18 13:23:52 +01:00
Anders Starcke Henriksen
6f11eca069 Merge pull request #2344 from github/starcke/csharp-fix-query
Fix C# query to give results in the same format as java.
2023-04-18 14:09:34 +02:00
Koen Vlaswinkel
46fbaf0657 Filter extension packs by database item language
This will filter the extension packs shown to the user when selecting an
extension pack to use in the data extension editor to only include the
extension packs that are compatible with the language of the database
item.

Unfortunately, this required quite some changes to the tests to ensure
the extension packs are actually setup properly since it's now reading
the extension pack files.
2023-04-18 13:48:20 +02:00
Anders Starcke Henriksen
6ec8df2c89 Fix C# query to give results in the same format as java. 2023-04-18 11:58:25 +02:00
Anders Starcke Henriksen
4170e7f7a7 Merge pull request #2338 from github/starcke/update-java-lib
Update library used by java query.
2023-04-18 11:32:10 +02:00
Koen Vlaswinkel
8d016a828e Merge pull request #2340 from github/koesie10/show-extension-pack-name
Show extension pack name in data extensions editor
2023-04-18 11:15:29 +02:00
Anders Starcke Henriksen
d99b6c36a6 Merge pull request #2336 from github/starcke/sort-modeled
Sort on supported status.
2023-04-18 11:12:26 +02:00
Koen Vlaswinkel
1ae5589728 Update extension pack picker tests 2023-04-18 10:31:28 +02:00
Koen Vlaswinkel
18946b2dfd Merge remote-tracking branch 'origin/main' into koesie10/show-extension-pack-name 2023-04-18 10:17:03 +02:00
Koen Vlaswinkel
a1ecb3dee6 Merge pull request #2339 from github/koesie10/model-filename
Show model filename in data extensions editor
2023-04-18 10:12:49 +02:00
Koen Vlaswinkel
94aee8abcb Merge pull request #2337 from github/koesie10/fix-not-exists-error
Fix error when model file does not exist
2023-04-18 09:33:53 +02:00
Koen Vlaswinkel
b0b626c946 Merge pull request #2342 from github/koesie10/revert-2320
Revert "Bump @storybook/builder-webpack5 (#2320)"
2023-04-18 09:24:31 +02:00
Dave Bartolomeo
dbdab13d03 Merge pull request #2291 from github/dbartol/debug-adapter
Implement basic CodeQL debug adapter
2023-04-17 21:33:45 -04:00
Andrew Eisenberg
02f14821c8 Merge pull request #2332 from jrozner/http-database
Allow HTTP connections to fetch database
2023-04-17 17:16:16 -07:00
Andrew Eisenberg
d20600320f Fix invalid variable reference 2023-04-17 15:47:06 -07:00
Andrew Eisenberg
26459ded79 Update changelog 2023-04-17 15:43:07 -07:00
Andrew Eisenberg
8336df9483 Update extensions/ql-vscode/package.json
Fix typo
2023-04-17 15:39:54 -07:00
Joe Rozner
961f71d8a5 Changes requested from PR 2023-04-17 12:40:38 -07:00
Joe Rozner
99eb274029 Allow HTTP connections to fetch database
Introduce a new config option to allow requests over HTTP when fetching
a database from a URL.
2023-04-17 12:40:38 -07:00
Dave Bartolomeo
70b4aacf35 Merge pull request #2306 from github/dbartol/new-test-ui
Use native VS Code test UI on canary
2023-04-17 13:49:35 -04:00
Andrew Eisenberg
18f2d79aab Merge branch 'main' into aeisenberg/cli-version-telemetry 2023-04-17 09:18:38 -07:00
Andrew Eisenberg
cc241d08b7 Merge pull request #2331 from github/aeisenberg/fix-flakes
Fix various test flakiness
2023-04-17 09:01:47 -07:00
Robert
ec35293e21 Add storybook for repository filter component 2023-04-17 16:28:43 +01:00
Robert
7fb9975cfa Add UI for repository filter component 2023-04-17 16:28:43 +01:00
Robert
2701cd4824 Add tests of the new filter key 2023-04-17 16:28:43 +01:00
Robert
0685218c6a Clarify some behaviour in filterAndSortRepositoriesWithResults 2023-04-17 16:28:43 +01:00
Koen Vlaswinkel
15bf338b8a Revert "Bump @storybook/builder-webpack5 (#2320)"
This reverts commit 8e40d7d61d because
of mismatched package versions in Storybook which cause it to fail to
start.
2023-04-17 17:09:48 +02:00
Robert
72c07a397f Implement support for new filterKey 2023-04-17 15:57:22 +01:00
Robert
049b4c27cc Change matchesFilter to accept a FilterAndSortableResult 2023-04-17 15:57:22 +01:00
Robert
18d7c898a6 Split out FilterAndSortableResultWithIds to mirror RepositoriesFilterSortStateWithIds 2023-04-17 15:57:22 +01:00
Koen Vlaswinkel
744a516a44 Show extension pack name in data extensions editor
This will add the extension pack name to the data extensions editor and
allow the user to click on it to go to the folder of the extension pack
in the explorer panel.
2023-04-17 16:35:46 +02:00
Robert
563720b1af Rename SortableResult => FilterAndSortableResult 2023-04-17 15:26:00 +01:00
Robert
d30ca71585 Add FilterKey type 2023-04-17 15:25:59 +01:00
Koen Vlaswinkel
fe2f37fdf5 Show model filename in data extensions editor
This adds the model filename to the data extensions editor and will also
allow the user to go to the model file by clicking on the filename.

This also updates the general UI to be somewhat more compact by moving
the modeled percentages to be below the header in 1 line.
2023-04-17 16:19:03 +02:00
Anders Starcke Henriksen
0d11075a5d No indentation. 2023-04-17 15:50:33 +02:00
Anders Starcke Henriksen
7b901b4814 Update library used by java query. 2023-04-17 15:42:53 +02:00
Koen Vlaswinkel
3c16b81f25 Fix error when model file does not exist
When you have just created a model file using the quick picker/input
box, the data extension editor will try to read it and fail with an
error message. This adds a check to ensure the model file exists and if
it doesn't, it will not try to read in the file.

This should always be safe since the model file picker will only allow
you to select existing files.
2023-04-17 15:40:34 +02:00
Anders Starcke Henriksen
0ee090b6e1 Merge pull request #2335 from github/starcke/rename-sup-modelled
Rename supported to modelled.
2023-04-17 15:39:10 +02:00
Anders Starcke Henriksen
cbf1f7b7a7 Update test. 2023-04-17 15:38:10 +02:00
Anders Starcke Henriksen
42335c9947 Sort on supported status. 2023-04-17 15:24:31 +02:00
Anders Starcke Henriksen
fb4f39dcfb Modelled -> Modeled. 2023-04-17 15:00:41 +02:00
Koen Vlaswinkel
3c0b3e467e Merge pull request #2333 from github/koesie10/data-extension-editor-csharp
Add better support for different languages in data extension editor
2023-04-17 14:55:15 +02:00
Koen Vlaswinkel
97e9129023 Merge pull request #2334 from github/koesie10/data-extension-editor-language-check
Add database language check to data extensions editor
2023-04-17 14:55:02 +02:00
Anders Starcke Henriksen
7ce0e0a75a Rename supported to modelled. 2023-04-17 14:48:04 +02:00
Koen Vlaswinkel
79c39a0826 Add database language check to data extensions editor
This will not allow the user to open the data extensions editor for a
database if it is not one of the supported languages. The supported
languages is a list of `string` rather than a list of `QueryLanguage`
because a database item's language is also a `string`.
2023-04-17 14:38:15 +02:00
Koen Vlaswinkel
923e13fce3 Add better support for different languages in data extension editor
There were still some places where we were hardcoding Java in the data
extension editor. This changes these places to use the database item
language instead.
2023-04-17 14:25:57 +02:00
Anders Starcke Henriksen
1367d386db Merge pull request #2329 from github/starcke/ext-csharp-query
Add support for running C# query.
2023-04-17 10:21:01 +02:00
Anders Starcke Henriksen
1e42c1152f Update query ID. 2023-04-17 10:06:00 +02:00
Anders Starcke Henriksen
a7f87658bb Update extensions/ql-vscode/test/vscode-tests/no-workspace/data-extensions-editor/external-api-usage-query.test.ts
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2023-04-17 09:28:42 +02:00
Dave Bartolomeo
a52391b264 Merge branch 'dbartol/new-test-ui' of https://github.com/github/vscode-codeql into dbartol/new-test-ui 2023-04-14 18:47:44 -04:00
Dave Bartolomeo
a151adec06 Stop sending debug events after forcible disconnection 2023-04-14 18:32:45 -04:00
Dave Bartolomeo
74c3db7392 Fix crash in codeql.debugQuery when run from command palette 2023-04-14 17:56:58 -04:00
Elena Tanasoiu
9b647ff432 Merge pull request #2310 from github/yer-a-workspace-query
Stop pushing QL pack as top level folder to avoid confusing the user
2023-04-14 21:24:43 +01:00
Dave Bartolomeo
8c2c25e85f Fix PR feedback 2023-04-14 15:24:08 -04:00
Dave Bartolomeo
7602d8e317 Merge remote-tracking branch 'origin/main' into dbartol/debug-adapter 2023-04-14 15:10:50 -04:00
Dave Bartolomeo
103e39726c Move debugger tests into subdirectory 2023-04-14 15:01:29 -04:00
Andrew Eisenberg
9a40decc09 Remove timeout in test
A global timeout has already been set.
2023-04-14 11:31:28 -07:00
Dave Bartolomeo
aa9ca6e413 Remove unused code 2023-04-14 14:10:56 -04:00
Dave Bartolomeo
ad2c065413 Better error message UI for bad debug configuration 2023-04-14 14:00:46 -04:00
Dave Bartolomeo
55644d5f2a Simplify nested ternaries 2023-04-14 13:51:16 -04:00
Andrew Eisenberg
35e8ce1654 Fix various test flakiness
This commit addresses various test flakiness:

1. Bump timeouts for queries tests
2. Add a dispose handler to queryserver-client. This will help us during
   tests because if there is a test that timesout while a query is
   running, the query's progress callback won't be invoked. We will
   still get a timeout error in the first test, but the second test will
   not get a spurious error.
3. Handle a disposed query server in `deregisterDatabase`. This method
   will remove the database from the currently running query server.
   If there is no query server, then there is nothing to remove. So,
   this error is safe to ignore.
4. Explicitly `end()` a connection `ServerProcess`. I'm not 100% sure if
   this is necessary, but it seems like it prevents responses from being
   handled and erroring out.
5. Better handling of ideServer restarts. Previously, if you quickly
   called `CodeQL: Restart Query Server` twice in a row, you would get
   an error from the ideServer restart. Restart fails if the server is
   not already started. So, in this case just call a start.
2023-04-14 10:50:27 -07:00
Dave Bartolomeo
d1b5ab645c Merge branch 'dbartol/debug-adapter' of https://github.com/github/vscode-codeql into dbartol/debug-adapter 2023-04-14 13:41:19 -04:00
Dave Bartolomeo
ce2fecd506 Don't await showAndLog... 2023-04-14 13:41:03 -04:00
Dave Bartolomeo
03ceb738c0 Update extensions/ql-vscode/src/common/commands.ts
Co-authored-by: Koen Vlaswinkel <koesie10@users.noreply.github.com>
2023-04-14 13:31:26 -04:00
Dave Bartolomeo
6fa775777c Merge branch 'dbartol/debug-adapter' of https://github.com/github/vscode-codeql into dbartol/debug-adapter 2023-04-14 13:29:48 -04:00
Dave Bartolomeo
14a4247ffa Update extensions/ql-vscode/test/vscode-tests/cli-integration/debug-controller.ts
Co-authored-by: Koen Vlaswinkel <koesie10@users.noreply.github.com>
2023-04-14 13:29:23 -04:00
Dave Bartolomeo
95dda2b3dd Update extensions/ql-vscode/src/run-queries-shared.ts
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2023-04-14 12:57:45 -04:00
Dave Bartolomeo
60fd868579 Remove unused code 2023-04-14 12:56:25 -04:00
Dave Bartolomeo
59dcea6fea Add comment about disposal of debug adapter tracker 2023-04-14 12:56:06 -04:00
Dave Bartolomeo
30b9d7eb7f Merge branch 'dbartol/debug-adapter' of https://github.com/github/vscode-codeql into dbartol/debug-adapter 2023-04-14 12:47:39 -04:00
Dave Bartolomeo
d3b118bc5f Update extensions/ql-vscode/src/debugger/debug-configuration.ts
Co-authored-by: Koen Vlaswinkel <koesie10@users.noreply.github.com>
2023-04-14 12:47:11 -04:00
Dave Bartolomeo
6efdd116ee Use preferred cast style 2023-04-14 12:45:51 -04:00
Dave Bartolomeo
22679b8972 Update extensions/ql-vscode/src/local-databases.ts
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2023-04-14 12:44:26 -04:00
Dave Bartolomeo
2da689598d Rework debug query evaluation code to avoid lots of state-dependent properties 2023-04-14 12:38:49 -04:00
Dave Bartolomeo
a0a3af2759 Remove unused commands 2023-04-14 12:18:12 -04:00
Elena Tanasoiu
9c79799558 Merge branch 'main' into yer-a-workspace-query 2023-04-14 14:00:28 +01:00
Anders Starcke Henriksen
90936780bd Add support for running C# query. 2023-04-14 14:47:20 +02:00
Koen Vlaswinkel
ffa643c91b Merge pull request #2326 from github/koesie10/raise-cli-integration-timeout
Set default higher timeout on CLI integration tests
2023-04-14 14:38:21 +02:00
Elena Tanasoiu
70d533f073 Make check platform agnostic
The separator character is different on Windows.
2023-04-14 12:31:25 +00:00
Elena Tanasoiu
bfc5f49d44 Check specifically for the starter workspace
We've made an exception to fetch the parent folder when we're
in the vscode-codeql-starter workspace.

We'd like to make this more specific so that it doesn't interfere
with other repos.
2023-04-14 11:01:18 +00:00
Koen Vlaswinkel
d4b6259961 Merge pull request #2302 from github/koesie10/kind-dropdown
Change kind input to a dropdown
2023-04-14 12:22:39 +02:00
Elena Tanasoiu
4a8ba1377d Don't offer to create skeleton pack again
When running Create Query in the codespaces-codeql repo, it successfully
creates codeql-custom-queries-xxx as a subfolder of the first workspace
folder, and then adds a database.  After the database gets added, we get
prompted with this message:

```
We've noticed you don't have a CodeQL pack available to analyze this
database. Can we set up a query pack for you?
```

which would try to create another QL pack.

Since we're no longer pushing QL packs as top level folders in the
workspace when we use the new "Create Query" flow, we also need to adapt
the original flow to take into account subfolders.

Just as a reminder, the original flow is:
- Be in the codespace template
- Download a database from GitHub
- The extension will offer to create a QL pack for the database

The new flow:
- Run the "Create Query" command
- Choose a language
- Create a QL pack
- Download a database for it

In the new flow the last step of downloading a database would trigger
the extension to offer to create a QL pack.

Let's fix this by detecting subfolders as well and exiting early.
2023-04-14 09:55:18 +00:00
Koen Vlaswinkel
0ad3ffaba3 Merge pull request #2319 from github/dependabot/npm_and_yarn/extensions/ql-vscode/glob-10.0.0
Bump glob from 9.3.2 to 10.0.0 in /extensions/ql-vscode
2023-04-14 11:51:18 +02:00
Koen Vlaswinkel
02424984bb Merge remote-tracking branch 'origin/main' into koesie10/kind-dropdown 2023-04-14 11:17:59 +02:00
Koen Vlaswinkel
47d7533ad5 Merge pull request #2300 from github/koesie10/create-extension-pack
Add creating extension packs when opening the editor
2023-04-14 11:17:35 +02:00
Koen Vlaswinkel
5a3630a954 Merge pull request #2296 from github/koesie10/create-extension-model-file
Allow creating new model file in existing data extension
2023-04-14 11:09:20 +02:00
Charis Kyriakou
05d68d0bbe Move local query mappers to separate files (#2322) 2023-04-14 09:59:34 +01:00
Koen Vlaswinkel
370874a02f Merge branch 'main' into koesie10/create-extension-model-file 2023-04-14 10:56:27 +02:00
Koen Vlaswinkel
fd98f3400b Add Tuple type 2023-04-14 10:53:38 +02:00
Koen Vlaswinkel
5766db9285 Set default higher timeout on CLI integration tests
This sets a default timeout of 3 minutes on CLI integration tests. This
is because these tests call into the CLI and execute queries, so these
are expected to take a lot longer than the default 5 seconds. This
allows us to remove all the individual `jest.setTimeout` calls with
different values from the test files.
2023-04-14 10:46:33 +02:00
Koen Vlaswinkel
69c66f3b53 Merge pull request #2325 from github/koesie10/raise-queries-timeout
Raise timeout of queries tests
2023-04-14 10:44:52 +02:00
Koen Vlaswinkel
1419ff2a9a Raise timeout of queries tests 2023-04-14 10:28:59 +02:00
Koen Vlaswinkel
e95e4a366f Merge pull request #2314 from github/koesie10/use-query-in-extension
Add external APIs query in extension
2023-04-14 10:27:01 +02:00
Charis Kyriakou
013701d262 Merge pull request #2315 from github/charisk/variant-analysis-store-mappers
Introduce mapping layer for variant analysis history items
2023-04-14 09:26:30 +01:00
Koen Vlaswinkel
9261519636 Merge remote-tracking branch 'origin/main' into koesie10/create-extension-model-file 2023-04-14 09:29:39 +02:00
Koen Vlaswinkel
ff405a66c9 Merge remote-tracking branch 'origin/main' into koesie10/use-query-in-extension 2023-04-14 09:26:30 +02:00
Charis Kyriakou
a15eef823d Update test data to match actual data format 2023-04-14 07:23:04 +00:00
Charis Kyriakou
2a9911dac2 Minor function rename to match convention 2023-04-14 07:22:27 +00:00
Dave Bartolomeo
8f5f43f29c Merge branch 'main' into dbartol/new-test-ui 2023-04-13 18:27:04 -04:00
Dave Bartolomeo
d861772eb1 Merge pull request #2323 from github/dbartol/update-vscode-types
Update `@types/vscode` and fix naming conflicts
2023-04-13 18:25:48 -04:00
Dave Bartolomeo
da3f482a97 Reconsider the fanciness of CodeQL tests 2023-04-13 18:03:07 -04:00
Dave Bartolomeo
c9507dff5f Merge branch 'dbartol/update-vscode-types' into dbartol/new-test-ui 2023-04-13 21:46:53 +00:00
Dave Bartolomeo
3eaa99696a Add iterator function to mock environment variable collection 2023-04-13 17:39:50 -04:00
Dave Bartolomeo
78d3de6c86 Fixup rename in test code 2023-04-13 17:35:10 -04:00
Dave Bartolomeo
8f29e1c812 Add separate command for "Accept Output" on test item context menu 2023-04-13 17:27:23 -04:00
Andrew Eisenberg
3826e35cc5 Merge branch 'main' into aeisenberg/cli-version-telemetry 2023-04-13 14:24:01 -07:00
Dave Bartolomeo
64e867d1c4 Update @types/vscode and fix naming conflicts 2023-04-13 17:09:10 -04:00
Dave Bartolomeo
c963cf6f5d Merge branch 'main' into dbartol/new-test-ui 2023-04-13 17:04:16 -04:00
Dave Bartolomeo
eca8cce6b9 Update extensions/ql-vscode/src/test-manager.ts
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com>
2023-04-13 17:03:08 -04:00
Dave Bartolomeo
cb93c84611 Test tests 2023-04-13 17:00:15 -04:00
Andrew Eisenberg
0da40a6819 Use a CLI version changed listener for telemetry events
Set the CLI version in the telemetry listener whenever the version
changes.

A few things to note here:

1. In `CliServer::getVersion()`, avoid calling `supportsPerQueryEvalLog`
   directly. This avoids a recursive call to `CliServer::getVersion()`.
   Currently, it's always safe to do this, but I thought that it would
   be good to avoid recursion here in case we change things in the
   future.
2. Now, we are sending the CLI version with all telemetry events.
2023-04-13 12:16:27 -07:00
dependabot[bot]
8e40d7d61d Bump @storybook/builder-webpack5 in /extensions/ql-vscode (#2320)
Bumps [@storybook/builder-webpack5](https://github.com/storybookjs/storybook/tree/HEAD/lib/core) from 6.5.17-alpha.0 to 7.0.4.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.0.4/lib/core)

---
updated-dependencies:
- dependency-name: "@storybook/builder-webpack5"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-13 10:27:53 -07:00
Elena Tanasoiu
b6eaf93dba Rename workspaceStorage -> firstWorkspaceFolder 2023-04-13 15:57:58 +00:00
Elena Tanasoiu
14d8593d58 Use getOnDiskWorkspaceFolders to fetch folders 2023-04-13 15:57:58 +00:00
Koen Vlaswinkel
42aacce9d4 Merge pull request #2316 from github/koesie10/data-extension-editor-errors
Improve error handling in data extension editor
2023-04-13 17:12:19 +02:00
Elena Tanasoiu
b83d54f285 Add a JSDoc description for the method 2023-04-13 14:59:00 +00:00
Elena Tanasoiu
5634c1ee51 Rename getFirstStoragePath -> getFirstWorkspaceFolder 2023-04-13 14:58:58 +00:00
Charis Kyriakou
1c90fd1353 Rename variant analysis data and domain mappers to follow convention 2023-04-13 14:54:08 +00:00
Koen Vlaswinkel
7e9a7f2156 Fix test for YAML error 2023-04-13 16:48:44 +02:00
Elena Tanasoiu
abe74fce76 Merge pull request #2312 from github/yer-a-database-query
Filter out databases with errors
2023-04-13 15:39:45 +01:00
Dave Bartolomeo
9344499d23 Merge remote-tracking branch 'origin/main' into dbartol/debug-adapter 2023-04-13 10:00:08 -04:00
dependabot[bot]
64af86c6e3 Bump glob from 9.3.2 to 10.0.0 in /extensions/ql-vscode
Bumps [glob](https://github.com/isaacs/node-glob) from 9.3.2 to 10.0.0.
- [Release notes](https://github.com/isaacs/node-glob/releases)
- [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/node-glob/compare/v9.3.2...v10.0.0)

---
updated-dependencies:
- dependency-name: glob
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-13 13:58:06 +00:00
Dave Bartolomeo
785f00983a Merge remote-tracking branch 'origin/main' into dbartol/debug-adapter 2023-04-13 09:54:40 -04:00
Elena Tanasoiu
09396ff4ce Bump test timeout, again
We've added more tests so now the overall duration is over 40 seconds for this file.

I'm increasing the timeout again.
2023-04-13 13:05:56 +00:00
Koen Vlaswinkel
0a304f633a Use enum for query texts 2023-04-13 15:01:43 +02:00
Koen Vlaswinkel
3a761d080b Improve error handling in data extension editor
This improves the error handling in the data extension editor by showing
more errors to the user and adding validation to data extension model
files.
2023-04-13 14:57:19 +02:00
Charis Kyriakou
807eb92c92 Merge pull request #2313 from github/charisk/repo-tasks-store-renaming
Repo tasks store renaming
2023-04-13 13:12:05 +01:00
Charis Kyriakou
7e08bb9efe Introduce mapping layer for variant analysis history items 2023-04-13 13:11:35 +01:00
Charis Kyriakou
73089841a3 Merge pull request #2308 from github/charisk/query-history-store-naming
Query history store renaming
2023-04-13 12:30:25 +01:00
Koen Vlaswinkel
5200871989 Add external APIs query in extension
This adds the external API query text to the extension directly to avoid
users having to copy the query to their local `codeql` submodule or
having to checkout a specific branch.

This is a temporary solution until the queries are stabilized. Once they
are, we will upstream these to `github/codeql` and use them like other
contextual queries.

Since this is just a temporary solution, this is not the prettiest code
and is not intended to be a long-term solution. It does not do proper
caching and will create a new temporary directory for every query run.
The performance hit of this is acceptable and expected.
2023-04-13 13:26:37 +02:00
Charis Kyriakou
86dabae359 Add repo states store index file 2023-04-13 10:56:07 +00:00
Charis Kyriakou
ba75e7cbd9 Rename repo-task-store to repo-tasks-store 2023-04-13 10:56:00 +00:00
Charis Kyriakou
a85f7f9788 Rename repo states domain and dto mappers 2023-04-13 10:55:53 +00:00
Charis Kyriakou
2f9aac9acb Rename mapping functions to follow same patterns and conventions 2023-04-13 10:55:49 +00:00
Charis Kyriakou
46ce1cbc51 Rename repo tasks DTOs 2023-04-13 10:55:41 +00:00
Charis Kyriakou
374d03e845 Move repo tasks store files to repo-tasks-store dir 2023-04-13 10:55:36 +00:00
Charis Kyriakou
9142fed2dc Merge pull request #2311 from github/charisk/repo-state-store-naming
Repo state store naming
2023-04-13 11:40:04 +01:00
Elena Tanasoiu
128803b65b Filter out databases with errors
When we create a skeleton query, we check whether you already have an
existing database with the same name (e.g. `github/codeql`). If we can't
find one, we also check for an existing database with the same language.

If we find one, we select it instead of downloading a new database.

Here we're filtering out databases with errors.
2023-04-13 10:26:52 +00:00
Charis Kyriakou
c0cd038423 Provide mapping functions for top level repo state models 2023-04-13 09:48:36 +00:00
Robert
089d3566ef Merge pull request #2304 from github/robertbrignull/selection_types
Make types for selection commands more precise
2023-04-13 10:45:44 +01:00
Charis Kyriakou
7f5548b1e7 Add repo states store index file 2023-04-13 09:41:06 +00:00
Charis Kyriakou
61d5830196 Rename repo states domain and dto mappers 2023-04-13 09:38:27 +00:00
Charis Kyriakou
05838a0198 Rename mapping functions to follow same patterns and conventions 2023-04-13 09:37:03 +00:00
Charis Kyriakou
296cbe1619 Rename repo states DTOs 2023-04-13 09:32:40 +00:00
Charis Kyriakou
9798c5f307 Move repo state store files to repo-states-store dir 2023-04-13 09:31:28 +00:00
Elena Tanasoiu
6000e72ee5 Stop pushing QL pack as top level folder to avoid confusing the user
In the original flow for creating skeleton packs, we were starting out
by choosing a database (e.g. github/codeql) and having the extension
create the QL pack for us.

At that point, we were storing the QL pack together with the database in
the extension storage because we weren't interested in committing it to
the repo.

This means we weren't able to see it in the file explorer so in order to
make it visible, we decided to push it as a top-level folder in the
workspace.

Hindsight is 20/20.

Let's change this original flow by just creating the folder in the
workspace storage instead of the extension storage (which will make it
visible in the file explorer) and stop pushing it as an extra top level
folder in the workspace.

NB: For this flow, we exit early in the `createSkeletonPacks` method if
the folder already exists so we don't need to check this again.
2023-04-13 09:29:43 +00:00
Elena Tanasoiu
9a2de398f8 Move getFirstStoragePath method into helpers
So that we can re-use it in the QLPackGenerator.
2023-04-13 09:07:45 +00:00
Elena Tanasoiu
8c0d0d800d Merge pull request #2305 from github/elena/yer-a-progress-query
Small fixes to skeleton query wizard
2023-04-13 09:09:19 +01:00
Elena Tanasoiu
03adb70e45 Merge pull request #2298 from github/elena/yer-a-windows-query
Fix problem with detecting storage folder on windows
2023-04-13 08:54:56 +01:00
Charis Kyriakou
a34ded92f6 Update query history store code comments 2023-04-13 07:38:55 +00:00
Charis Kyriakou
be65a568b8 Add query history store index file 2023-04-13 07:29:42 +00:00
Charis Kyriakou
d1366a14ca Move ALLOWED_QUERY_HISTORY_VERSIONS const to store 2023-04-13 07:26:53 +00:00
Charis Kyriakou
6581988d22 Rename domain and dto mappers 2023-04-13 07:26:05 +00:00
Charis Kyriakou
e066e3b33f Rename mapping functions to follow same patterns and conventions 2023-04-13 07:25:13 +00:00
Koen Vlaswinkel
e15f01c4a3 Merge pull request #2295 from github/koesie10/pick-extension-model-file
Add configurable model filename to data extension editor
2023-04-13 08:55:32 +02:00
Andrew Eisenberg
d6b3e51f15 Add the CLI version to telemetry events
This adds the CLI version to telemetry command-usage events.

Note that the CLI server is created after the telemetry listener is
created. The first few telemetry events may have a "not-set" value for
the CLI version.
2023-04-12 19:06:43 -07:00
Dave Bartolomeo
397b5852c1 Fix test adapter tests 2023-04-12 16:54:07 -04:00
Dave Bartolomeo
e986b07bc7 Add missing mock method after @types/vscode upgrade 2023-04-12 16:45:53 -04:00
Dave Bartolomeo
60bf56db45 Extend query runner test timeouts to 30s (from 20s) 2023-04-12 16:14:48 -04:00
Dave Bartolomeo
7ea7d6c1f6 Merge remote-tracking branch 'origin/main' into dbartol/new-test-ui 2023-04-12 19:51:31 +00:00
Dave Bartolomeo
4804220971 Use native VS Code test UI in canary 2023-04-12 15:50:27 -04:00
Dave Bartolomeo
e1dae0bf01 Avoid identifier collision with new VS Code version 2023-04-12 15:49:52 -04:00
Elena Tanasoiu
7f8f0653b0 Merge branch 'main' into elena/yer-a-windows-query 2023-04-12 18:08:43 +01:00
Elena Tanasoiu
eabcd00e75 Merge pull request #2297 from github/elena/improvements-to-wizard
Refactor `digForDatabaseItem` and `digForDatabaseWithSameLanguage` methods for skeleton wizard
2023-04-12 18:08:30 +01:00
Elena Tanasoiu
3627139c8a Hide command behind canary flag
Adding this temporarily
2023-04-12 16:52:05 +00:00
Elena Tanasoiu
77bffd5bb1 Correct error messages to indicate ql pack storage path 2023-04-12 16:52:04 +00:00
Elena Tanasoiu
e981530b20 Import methods instead of whole databaseFetcher object 2023-04-12 16:52:04 +00:00
Elena Tanasoiu
b00e2aa09f Rename codeQL.createSkeletonQuery -> codeQL.createQuery 2023-04-12 16:52:04 +00:00
Elena Tanasoiu
c9f7860621 Move try/catch into execute command
So that we're able to catch any errors when this fails.
2023-04-12 16:52:04 +00:00
Elena Tanasoiu
eff5f1f197 Fix regex expression 2023-04-12 16:52:04 +00:00
Elena Tanasoiu
9f04c712e0 Use progress correctly
By setting maxSteps to the correct number of steps.
2023-04-12 16:52:04 +00:00
Charis Kyriakou
759116dce1 Rename query history top level DTOs 2023-04-12 16:49:28 +00:00
Charis Kyriakou
d740c2356b Rename variant analysis history item DTOs 2023-04-12 16:47:07 +00:00
Charis Kyriakou
f270a2c608 Rename SortDirection data model to SortDirectionDto.
This requires us providing mapping functions for objects that use SortDirection.
2023-04-12 17:44:32 +01:00
Elena Tanasoiu
4c04daafb7 Merge branch 'main' into elena/improvements-to-wizard 2023-04-12 17:40:08 +01:00
Elena Tanasoiu
a48b1f823a Merge pull request #2256 from github/elena/yer-a-lizard-query
Improvements to skeleton query flow
2023-04-12 17:39:47 +01:00
Elena Tanasoiu
e298f2ba09 Take storage path off App instead of extension context 2023-04-12 16:39:14 +00:00
Elena Tanasoiu
b4468d612a Download databases into extension storage path
Now that we've figured out how to set the storage path for both Mac &
Windows, we also want to make sure we're consistent with the location
where we save databases.

At the moment, our change will download databases directly in the
workspace folder.

When we call `downloadGitHubDatabase()` in other places outside the
wizard, we provide `ctx.storageUri.fsPath` as the location. [1] [2] [3]

Let's do the same here.

I've tested this on Mac for the codespaces-codeql & starter workspaces.

[1]: c7bb22c312/extensions/ql-vscode/src/local-databases-ui.ts (L476)
[2]: c7bb22c312/extensions/ql-vscode/src/extension.ts (L710)
[3]: c7bb22c312/extensions/ql-vscode/src/extension.ts (L1120)
2023-04-12 16:30:41 +00:00
Elena Tanasoiu
f8b0ecafcc Merge branch 'main' into elena/yer-a-lizard-query 2023-04-12 17:24:19 +01:00
Elena Tanasoiu
6fc6f399fd Shorten check for progress
Co-authored-by: Koen Vlaswinkel <koesie10@users.noreply.github.com>
2023-04-12 16:11:17 +00:00
Elena Tanasoiu
f377bb93ac Merge pull request #2250 from github/elena/yer-a-wizard-query
Adapt skeleton pack generation to work with new queries panel
2023-04-12 17:07:12 +01:00
Andrew Eisenberg
b3ff1ed52f Merge pull request #2289 from github/aeisenberg/watch-external-config
Restart query server when external config changes
2023-04-12 08:27:27 -07:00
Dave Bartolomeo
d14c84439c Relax linting for debug configuration variable commands 2023-04-12 11:22:11 -04:00
Shati Patel
b5c65b5189 Minor: fix typo in changelog (#2303) 2023-04-12 15:18:19 +00:00
Andrew Eisenberg
6de58ec19d Address review comments 2023-04-12 15:14:54 +00:00
Dave Bartolomeo
809c86f0dc Remove unused command 2023-04-12 11:03:16 -04:00
Robert
0cf7341cc8 Make types for selection commands more precise 2023-04-12 16:01:03 +01:00
Anders Starcke Henriksen
b3e78c33e5 Merge pull request #2301 from github/version/bump-to-v1.8.3
Bump version to v1.8.3
2023-04-12 16:35:25 +02:00
Elena Tanasoiu
785c8c1f22 Rename storagePath -> qlPackStoragePath 2023-04-12 14:25:43 +00:00
Koen Vlaswinkel
f0fbaabd69 Change kind input to a dropdown
This changes the kind input from a text field to a dropdown in the data
extensions editor. The supported values for each extensible predicate
are based on what is currently in-scope for the documentation. Other
kinds are not supported.

The supported kinds are now stored on the
`extensiblePredicateDefinitions` to make it easier to add new kinds in
the future.
2023-04-12 15:51:12 +02:00
Charis Kyriakou
1cd5d922b2 Rename local query history item DTOs 2023-04-12 13:12:53 +00:00
shati-patel
4b01374a6f Use path.join in folder paths 2023-04-12 14:12:33 +01:00
github-actions[bot]
341e0375a6 Bump version to v1.8.3 2023-04-12 12:58:18 +00:00
Koen Vlaswinkel
c1da623d43 Add creating extension packs when opening the editor 2023-04-12 14:55:42 +02:00
shati-patel
a968aab209 Remove explicit Windows test
This should be covered by running the general test suite in CI (on windows-latest)
2023-04-12 13:26:23 +01:00
shati-patel
1e1594b2a7 Use fsPath instead of path everywhere 2023-04-12 13:14:20 +01:00
shati-patel
636be05f2b Fix "invalid characters" bug on Windows
We now use `fsPath` instead of `path`.

Note: I haven't yet fixed the tests, nor checked manually on mac/linux

Tangential change: we now use the `dirname` method, instead of manually splitting paths to get a parent folder.
2023-04-12 12:51:13 +01:00
Koen Vlaswinkel
3664803b34 Add tests for creating model file 2023-04-12 12:50:31 +02:00
Koen Vlaswinkel
9bc53443c4 Fix tests for creating new model file 2023-04-12 12:26:30 +02:00
Koen Vlaswinkel
2c31335908 Merge branch 'koesie10/pick-extension-model-file' into koesie10/create-extension-model-file 2023-04-12 12:08:32 +02:00
Koen Vlaswinkel
5cdf7ed76f Fix model file label on Windows 2023-04-12 12:04:17 +02:00
Elena Tanasoiu
3087886400 Fix problem with detecting storage folder on windows
The `getFirstStoragePath()` method would break on windows:

```
Path contains invalid characters: /c:/git-repo/codespaces-codeql (codeQL.createSkeletonQuery)
```

This makes sense, since we're looking to get the parent folder by splitting for `/`.

In windows, paths use `\` instead of `/`.

So let's detect the platform and add a test for this case.
2023-04-12 09:47:00 +00:00
Elena Tanasoiu
a6ffb6b020 Move back mockCli into beforeEach
This was an attempt to make the tests run in a shorter timeframe, but
we've gone with increasing the timeout to 40s.
2023-04-12 09:38:43 +00:00
Elena Tanasoiu
72b2080b02 Rename search methods
To be consistent with other database item search methods, we're renaming
ours:

`digForDatabaseItem` -> `findDatabaseItemByNwo`
and
`digForDatabaseItemSameLanguage` -> `findDatabaseItemByLanguage`
2023-04-12 09:38:43 +00:00
Elena Tanasoiu
6b26323ee0 Move database Item search methods into skeleton wizard
And the tests for it. We can now re-use the factory from the previous commit.
2023-04-12 09:38:43 +00:00
Elena Tanasoiu
0ff2e83fde Move db mocking into factory file
So we can re-use it.
2023-04-12 09:38:43 +00:00
Koen Vlaswinkel
89c318bdc6 Rename extensions-packs.ts to extension-pack-picker.ts 2023-04-12 11:38:07 +02:00
Elena Tanasoiu
de4afae0a0 Don't track when user doesn't provide repo 2023-04-12 09:17:01 +00:00
Elena Tanasoiu
389d8f04d9 Don't show progress when choosing repo 2023-04-12 09:17:01 +00:00
Koen Vlaswinkel
a876c2ddb7 Add tests for extension pack and model file selection 2023-04-12 11:12:05 +02:00
Elena Tanasoiu
e4406f4c07 Merge branch 'main' into elena/yer-a-wizard-query 2023-04-12 09:47:11 +01:00
Koen Vlaswinkel
cdb6e8a3d3 Move all progress reporting into extension packs file 2023-04-12 10:13:08 +02:00
Koen Vlaswinkel
035456cd31 Rename resolve extensions results 2023-04-12 10:10:41 +02:00
Koen Vlaswinkel
59c0610122 Do not show quick pick when there are no model files 2023-04-12 08:55:24 +02:00
Koen Vlaswinkel
656e7d6d8a Improve data extension pattern checking 2023-04-12 08:54:51 +02:00
Koen Vlaswinkel
649a47d966 Show all found locations in output log 2023-04-12 08:50:51 +02:00
Elena Tanasoiu
919219c084 Show the user a selection box before downloading database
At the moment, we're always deciding which database to download for the
user for an example query.

We'd like to give them a chance to change the database, so here we're
adding a step where we're showing the user a selection box with the
suggested database pre-filled.

They can choose to type in a different database before continuing the
skeleton generation process.
2023-04-11 16:54:09 +00:00
Elena Tanasoiu
3e3eb0da0a Re-use existing database if one for the same language is already downloaded
We'd like to select an existing database for our query, if on is
already downloaded and matches the query language.

Previously we were re-using the database if the language and name
matched (e.g. the name would be `github/codeql`).
2023-04-11 16:53:00 +00:00
Dave Bartolomeo
e8f39fea83 Merge remote-tracking branch 'origin/main' into dbartol/debug-adapter 2023-04-11 16:06:25 +00:00
Dave Bartolomeo
1cbfd0159e Fix determineSelectedQuery tests 2023-04-11 11:50:44 -04:00
Dave Bartolomeo
19e083e473 Use type-safe VSCode commands 2023-04-11 11:22:45 -04:00
Elena Tanasoiu
460da1ea08 Add language to list of params 2023-04-11 15:00:00 +00:00
Elena Tanasoiu
f4a8de0f6b Don't count files that are not example<number>.ql
When we try to determine the next file name for our example query,
we only look at `example<n>.ql` files.

e.g. if the files in the folder are:
- `example.ql`
- `example2.ql`
- `MyQuery.ql`

we will create an `example3.ql` file.

Previously we were counting all existing `.ql` files.
2023-04-11 15:00:00 +00:00
Elena Tanasoiu
c7d9407a4c Rename workoutNextFileName -> determineNextFileName 2023-04-11 15:00:00 +00:00
Elena Tanasoiu
913942625c Increase timeout for skeleton wizard tests
We've now added more tests and pushed the total duration over 5 seconds
for all the tests in this file.

This limitation seems to be a recent development where files with tests
that last longer than 5 seconds start failing in jest.

We're bumping the timeout limit to 40 seconds for now.
2023-04-11 14:59:59 +00:00
Elena Tanasoiu
62bebc02bd Set storage path after the user selects language
And add tests for getFirstStoragePath method
2023-04-11 14:59:59 +00:00
Elena Tanasoiu
16a828938f Shorten logic for deciding when to ask for language
Let's only ask for the language when the language is not provided OR it's invalid.

Let's also add tests for these cases.
2023-04-11 14:59:59 +00:00
Elena Tanasoiu
59909e20b0 Convert folderName property into getter method 2023-04-11 14:59:59 +00:00
Elena Tanasoiu
b794427778 Remove unnecessary casting to DatabaseItem 2023-04-11 14:59:59 +00:00
Elena Tanasoiu
97fb4ea2ed Use Record 2023-04-11 14:59:59 +00:00
Elena Tanasoiu
911c3af225 Use a regular const instead of storing this on the class 2023-04-11 14:59:59 +00:00
Elena Tanasoiu
f949eda5ff Fix error message 2023-04-11 14:59:59 +00:00
Elena Tanasoiu
9c0deaec96 Make it clear we're checking the filename
Replaces `file[0]` with a more meaningful `filename`.
2023-04-11 14:59:58 +00:00
Elena Tanasoiu
fe3e9a713b Get rid of unnecessary ternary 2023-04-11 14:59:58 +00:00
Elena Tanasoiu
30011aaf65 Fail gracefully if we can't open the new query file 2023-04-11 14:59:58 +00:00
Elena Tanasoiu
061f347ea0 Don't obfuscate assignment when we choose language
Instead of assigning this property in a method, let's make the method
return a value and assign it more visibly.
2023-04-11 14:59:58 +00:00
Elena Tanasoiu
95ed076047 Shorten beforeEach to decrease chances of timeout 2023-04-11 14:59:58 +00:00
Elena Tanasoiu
c23b0bf6c8 Replace github/codeql with top databases for querying
We initially defined the default database to download as one from the
`github/codeql` repo as it was convenient.

However, this repo doesn't have a lot of vulnerabilities to discover.

Let's use repos that are in our MRVA top 10 list to allow users to
write more interesting queries.
2023-04-11 14:59:58 +00:00
Elena Tanasoiu
121ebc24a6 skeleton-query.ts -> skeleton-query-wizard.ts 2023-04-11 14:59:58 +00:00
Elena Tanasoiu
f212804634 Make "Create Query" command work with vscode-codeql-starter
We set up the "Create Query" command with the assumption that
the first folder in the workspace is the parent folder.

This is true for the `codespaces-codeql` repo where we expect
to use this command.

However, for the `vscode-codeql-starter` repo, the top level
folders are QL packs:
- codeql-custom-queries-cpp
- codeql-custom-queries-ruby
... etc.

In order to make the command work for people using the starter
repo, we'll need to introduce a check for these QL packs when
we decide the storage path.

The end goal is to replace the starter workspace completely
with the codespaces-codeql repo, so this code can be removed
in the future when we retire the repo.

Until then, the command will need this to be able to work in
both starter workspaces.
2023-04-11 14:59:57 +00:00
Elena Tanasoiu
b9decd8f80 Create QL pack in workspace instead of global storage
We were initially using the storage path of the extension.

We'd like to create these QL packs in the workspace instead.
2023-04-11 14:59:57 +00:00
Elena Tanasoiu
22d9487ab8 Be able to specify language when downloading github database
We offer `github/codeql` as a repo to use for downloading databases
for our skeleton pack.

Once the repo is specified, the user is prompted to choose a language.

At this point, we already know what language the user wants, so let's
change the `downloadGitHubDatabase` and `convertGithubNwoToDatabaseUrl`
methods to accept a language parameter.

We check if the language is in the list of languages received in the
response. If it isn't, we still prompt the user.
2023-04-11 14:59:57 +00:00
Elena Tanasoiu
91c4c9189f Introduce "Create Query" command 2023-04-11 14:59:57 +00:00
Elena Tanasoiu
ddd00d16b0 Introduce SkeletonWizard class
This will be triggered by a "Create Query" command.

It will:
- prompt the user for a language
- create a skeleton pack based on the language chosen
- download a database for the QL pack
- open the new query file

If the skeleton pack already exists, we just create a new query file
in the existing folder.

If the database is already downloaded, we just re-use it.
2023-04-11 14:59:57 +00:00
Elena Tanasoiu
e63f0fc0af Be able to specify the name of the skeleton query file
We introduced this QlPackGenerator a while ago. It always creates an `example.ql` query file as part of the skeleton pack.

We'd like to set the name of the query file, since we'll allow the user to create queries multiple times in the same skeleton pack folder.

The folder will be named `codeql-custom-queries-${language}` and will first receive an `example.ql` file.

If the user then tries to create a new query for the same language, we'll just create an `example2.ql`, `example3.ql` etc. file in the existing folder.
2023-04-11 14:59:57 +00:00
Elena Tanasoiu
2995b0120d Provide a way to search for database items by name and language
We'll use this to check whether a database for our ql pack already exists.

While there are other methods that search for a database item by URI, we
only have a language chosen by the user and an nwo ("github/codeql").

So let's introduce a way to search for the db based on the information we
have.
2023-04-11 14:59:57 +00:00
Elena Tanasoiu
053a1800a9 Export existing language prompt
We plan to ask the user to choose a language, before attempting
to download a corresponding database for them.

The functionality already exists, so let's re-use it.
2023-04-11 14:59:56 +00:00
Elena Tanasoiu
1a2e5d90df Extract functionality to download GitHub database
This was nested in a method that included prompting the user for a
github repo.

We'd like to re-use this to download a database of our choice from
GitHub, based on which language a user chooses.
2023-04-11 14:59:56 +00:00
Koen Vlaswinkel
62619b2364 Switch to outputFile
`outputFile` will create the parent directory if it doesn't exist yet,
so this will allow users to specify a sub-directory for the model file.
2023-04-11 16:58:29 +02:00
Koen Vlaswinkel
a61bae45f0 Allow creating new model file in existing data extension
This will allow a user to create a new model file in an existing data
extension when opening the data extension editor. There is some
validation on the name of the model file, which depends on reading in
the qlpack.
2023-04-11 16:55:31 +02:00
Koen Vlaswinkel
2053b5db2f Add configurable model filename to data extension editor
This adds a pickable model filename from an existing extension pack to
the data extensions editor. This allows the user to edit one of their
existing data extensions. This does not yet add the ability to create
new extension packs and/or new model files.

This uses the `codeql resolve extensions` command to get the list of
available model files. This should be available in all CLI versions
which the data extensions editor supports.
2023-04-11 14:41:06 +02:00
Dave Bartolomeo
7dfa52bbab Debugger tests 2023-04-10 18:18:07 -04:00
Andrew Eisenberg
cbebeec2a1 Update changelog 2023-04-06 14:10:45 -07:00
Andrew Eisenberg
e12fe3f810 Restart query server when external config changes
This avoids manually restarting the query server when this file changes.
2023-04-06 14:08:01 -07:00
Dave Bartolomeo
0a0a9c6428 Fix bad merge 2023-04-06 14:27:09 -04:00
Dave Bartolomeo
61df133f1b Merge remote-tracking branch 'origin/koesie10/fix-result-view-selected' into dbartol/debug-adapter-backup 2023-04-06 17:42:14 +00:00
Dave Bartolomeo
f182f423c2 Merge remote-tracking branch 'origin/main' into dbartol/debug-adapter-backup 2023-04-06 13:41:34 -04:00
Dave Bartolomeo
d0c405a0d8 QuickEval and other debug commands 2023-04-05 14:15:09 -04:00
Dave Bartolomeo
d489d0ec1f QuickEval 2023-04-04 17:43:04 -04:00
Dave Bartolomeo
65b0cb4dc4 Merge remote-tracking branch 'origin/dbartol/local-queries-commands' into dbartol/debug-adapter 2023-03-30 16:11:06 +00:00
Dave Bartolomeo
e2017c7f0c Support extensionPacks debug configuration 2023-03-30 12:10:22 -04:00
Dave Bartolomeo
055bfcd36f Add extension packs to debug configuration 2023-03-30 15:07:56 +00:00
Dave Bartolomeo
a3306da1bc Implement CodeQL debug adapter 2023-03-30 15:07:56 +00:00
842 changed files with 137997 additions and 58686 deletions

View File

@@ -0,0 +1,37 @@
/**
* @name Unwanted dependency on vscode API
* @kind path-problem
* @problem.severity error
* @id vscode-codeql/assert-no-vscode-dependency
* @description The modules stored under `common` should not have dependencies on the VS Code API
*/
import javascript
class VSCodeImport extends ImportDeclaration {
VSCodeImport() { this.getImportedPath().getValue() = "vscode" }
}
class CommonFile extends File {
CommonFile() {
this.getRelativePath().regexpMatch(".*/src/common/.*") and
not this.getRelativePath().regexpMatch(".*/vscode/.*")
}
}
Import getANonTypeOnlyImport(Module m) {
result = m.getAnImport() and not result.(ImportDeclaration).isTypeOnly()
}
query predicate edges(AstNode a, AstNode b) {
getANonTypeOnlyImport(a) = b or
a.(Import).getImportedModule() = b
}
from Module m, VSCodeImport v
where
m.getFile() instanceof CommonFile and
edges+(m, v)
select m, m, v,
"This module is in the 'common' directory but has a transitive dependency on the vscode API imported $@",
v, "here"

View File

@@ -1,21 +0,0 @@
/**
* @name Unwanted dependency on vscode API
* @kind problem
* @problem.severity error
* @id vscode-codeql/assert-pure
* @description The modules stored under `pure` and tested in the `pure-tests`
* are intended to be "pure".
*/
import javascript
class VSCodeImport extends ASTNode {
VSCodeImport() {
this.(Import).getImportedPath().getValue() = "vscode"
}
}
from Module m, VSCodeImport v
where
m.getFile().getRelativePath().regexpMatch(".*src/pure/.*") and
m.getAnImportedModule*().getAnImport() = v
select m, "This module is not pure: it has a transitive dependency on the vscode API imported $@", v, "here"

View File

@@ -1,3 +1,4 @@
name: vscode-codeql-custom-queries-javascript
version: 0.0.0
libraryPathDependencies: codeql-javascript
dependencies:
codeql/javascript-queries: "*"

View File

@@ -15,134 +15,145 @@
* that should be changed to fix the alert.
*/
import javascript
import javascript
/**
* The name of a VS Code command.
*/
class CommandName extends string {
CommandName() { exists(CommandUsage e | e.getCommandName() = this) }
/**
* In how many ways is this command used. Will always be at least 1.
*/
int getNumberOfUsages() { result = count(this.getAUse()) }
/**
* The name of a VS Code command.
*/
class CommandName extends string {
CommandName() { exists(CommandUsage e | e.getCommandName() = this) }
/**
* Get a usage of this command.
*/
CommandUsage getAUse() { result.getCommandName() = this }
/**
* Get the canonical first usage of this command, to use for the location
* of the alert. The implementation of this ordering of usages is arbitrary
* and the usage given may not be the one that should be changed when fixing
* the alert.
*/
CommandUsage getFirstUsage() {
result =
max(CommandUsage use |
use = this.getAUse()
|
use
order by
use.getFile().getRelativePath(), use.getLocation().getStartLine(),
use.getLocation().getStartColumn()
)
}
}
/**
* Represents a single usage of a command, either from within code or
* from the command's definition in package.json
*/
abstract class CommandUsage extends Locatable {
abstract string getCommandName();
}
/**
* A usage of a command from the typescript code, by calling `executeCommand`.
*/
class CommandUsageCallExpr extends CommandUsage, CallExpr {
CommandUsageCallExpr() {
this.getCalleeName() = "executeCommand" and
this.getArgument(0).(StringLiteral).getValue().matches("%codeQL%") and
not this.getFile().getRelativePath().matches("extensions/ql-vscode/test/%")
}
override string getCommandName() { result = this.getArgument(0).(StringLiteral).getValue() }
}
/**
* In how many ways is this command used. Will always be at least 1.
*/
int getNumberOfUsages() { result = count(this.getAUse()) }
/**
* A usage of a command from the typescript code, by calling `CommandManager.execute`.
*/
class CommandUsageCommandManagerMethodCallExpr extends CommandUsage, MethodCallExpr {
CommandUsageCommandManagerMethodCallExpr() {
this.getCalleeName() = "execute" and
this.getReceiver().getType().unfold().(TypeReference).getTypeName().getName() = "CommandManager" and
this.getArgument(0).(StringLiteral).getValue().matches("%codeQL%") and
not this.getFile().getRelativePath().matches("extensions/ql-vscode/test/%")
}
/**
* Get a usage of this command.
*/
CommandUsage getAUse() { result.getCommandName() = this }
override string getCommandName() { result = this.getArgument(0).(StringLiteral).getValue() }
}
/**
* A usage of a command from any menu that isn't the command palette.
* This means a user could invoke the command by clicking on a button in
* something like a menu or a dropdown.
*/
class CommandUsagePackageJsonMenuItem extends CommandUsage, JsonObject {
CommandUsagePackageJsonMenuItem() {
exists(this.getPropValue("command")) and
exists(PackageJson packageJson, string menuName |
packageJson
.getPropValue("contributes")
.getPropValue("menus")
.getPropValue(menuName)
.getElementValue(_) = this and
menuName != "commandPalette"
)
}
override string getCommandName() { result = this.getPropValue("command").getStringValue() }
}
/**
* Is the given command disabled for use in the command palette by
* a block with a `"when": "false"` field.
*/
predicate isDisabledInCommandPalette(string commandName) {
exists(PackageJson packageJson, JsonObject commandPaletteObject |
packageJson
.getPropValue("contributes")
.getPropValue("menus")
.getPropValue("commandPalette")
.getElementValue(_) = commandPaletteObject and
commandPaletteObject.getPropValue("command").getStringValue() = commandName and
commandPaletteObject.getPropValue("when").getStringValue() = "false"
)
}
/**
* Represents a command being usable from the command palette.
* This means that a user could choose to manually invoke the command.
*/
class CommandUsagePackageJsonCommandPalette extends CommandUsage, JsonObject {
CommandUsagePackageJsonCommandPalette() {
this.getFile().getBaseName() = "package.json" and
exists(this.getPropValue("command")) and
exists(PackageJson packageJson |
packageJson.getPropValue("contributes").getPropValue("commands").getElementValue(_) = this
) and
not isDisabledInCommandPalette(this.getPropValue("command").getStringValue())
}
override string getCommandName() { result = this.getPropValue("command").getStringValue() }
}
from CommandName c
where c.getNumberOfUsages() > 1
select c.getFirstUsage(),
"The " + c + " command is used from " + c.getNumberOfUsages() + " locations"
/**
* Get the canonical first usage of this command, to use for the location
* of the alert. The implementation of this ordering of usages is arbitrary
* and the usage given may not be the one that should be changed when fixing
* the alert.
*/
CommandUsage getFirstUsage() {
result =
max(CommandUsage use |
use = this.getAUse()
|
use
order by
use.getFile().getRelativePath(), use.getLocation().getStartLine(),
use.getLocation().getStartColumn()
)
}
}
/**
* Matches one of the members of `BuiltInVsCodeCommands` from `extensions/ql-vscode/src/common/commands.ts`.
*/
class BuiltInVSCodeCommand extends string {
BuiltInVSCodeCommand() {
exists(TypeAliasDeclaration tad |
tad.getIdentifier().getName() = "BuiltInVsCodeCommands" and
tad.getDefinition().(InterfaceTypeExpr).getAMember().getName() = this
)
}
}
/**
* Represents a single usage of a command, either from within code or
* from the command's definition in package.json
*/
abstract class CommandUsage extends Locatable {
abstract string getCommandName();
}
/**
* A usage of a command from the typescript code, by calling `executeCommand`.
*/
class CommandUsageCallExpr extends CommandUsage, CallExpr {
CommandUsageCallExpr() {
this.getCalleeName() = "executeCommand" and
this.getArgument(0).(StringLiteral).getValue().matches("%codeQL%") and
not this.getFile().getRelativePath().matches("extensions/ql-vscode/test/%")
}
override string getCommandName() { result = this.getArgument(0).(StringLiteral).getValue() }
}
/**
* A usage of a command from the typescript code, by calling `CommandManager.execute`.
*/
class CommandUsageCommandManagerMethodCallExpr extends CommandUsage, MethodCallExpr {
CommandUsageCommandManagerMethodCallExpr() {
this.getCalleeName() = "execute" and
this.getReceiver().getType().unfold().(TypeReference).getTypeName().getName() = "CommandManager" and
this.getArgument(0).(StringLiteral).getValue().matches("%codeQL%") and
not this.getFile().getRelativePath().matches("extensions/ql-vscode/test/%")
}
override string getCommandName() { result = this.getArgument(0).(StringLiteral).getValue() }
}
/**
* A usage of a command from any menu that isn't the command palette.
* This means a user could invoke the command by clicking on a button in
* something like a menu or a dropdown.
*/
class CommandUsagePackageJsonMenuItem extends CommandUsage, JsonObject {
CommandUsagePackageJsonMenuItem() {
exists(this.getPropValue("command")) and
exists(PackageJson packageJson, string menuName |
packageJson
.getPropValue("contributes")
.getPropValue("menus")
.getPropValue(menuName)
.getElementValue(_) = this and
menuName != "commandPalette"
)
}
override string getCommandName() { result = this.getPropValue("command").getStringValue() }
}
/**
* Is the given command disabled for use in the command palette by
* a block with a `"when": "false"` field.
*/
predicate isDisabledInCommandPalette(string commandName) {
exists(PackageJson packageJson, JsonObject commandPaletteObject |
packageJson
.getPropValue("contributes")
.getPropValue("menus")
.getPropValue("commandPalette")
.getElementValue(_) = commandPaletteObject and
commandPaletteObject.getPropValue("command").getStringValue() = commandName and
commandPaletteObject.getPropValue("when").getStringValue() = "false"
)
}
/**
* Represents a command being usable from the command palette.
* This means that a user could choose to manually invoke the command.
*/
class CommandUsagePackageJsonCommandPalette extends CommandUsage, JsonObject {
CommandUsagePackageJsonCommandPalette() {
this.getFile().getBaseName() = "package.json" and
exists(this.getPropValue("command")) and
exists(PackageJson packageJson |
packageJson.getPropValue("contributes").getPropValue("commands").getElementValue(_) = this
) and
not isDisabledInCommandPalette(this.getPropValue("command").getStringValue())
}
override string getCommandName() { result = this.getPropValue("command").getStringValue() }
}
from CommandName c
where c.getNumberOfUsages() > 1 and not c instanceof BuiltInVSCodeCommand
select c.getFirstUsage(),
"The " + c + " command is used from " + c.getNumberOfUsages() + " locations"

View File

@@ -33,7 +33,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Bump CLI

111
.github/workflows/cli-test.yml vendored Normal file
View File

@@ -0,0 +1,111 @@
name: Run CLI tests
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- .github/workflows/cli-test.yml
- extensions/ql-vscode/src/codeql-cli/**
- extensions/ql-vscode/src/language-support/**
- extensions/ql-vscode/src/query-server/**
- extensions/ql-vscode/supported_cli_versions.json
jobs:
find-nightly:
name: Find Nightly Release
runs-on: ubuntu-latest
outputs:
url: ${{ steps.get-url.outputs.nightly-url }}
steps:
- name: Get Nightly Release URL
id: get-url
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
shell: bash
# This workflow step gets an unstable testing version of the CodeQL CLI. It should not be used outside of these tests.
run: |
LATEST=`gh api repos/dsp-testing/codeql-cli-nightlies/releases --jq '.[].tag_name' --method GET --raw-field 'per_page=1'`
echo "nightly-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/$LATEST" >> "$GITHUB_OUTPUT"
set-matrix:
name: Set Matrix for cli-test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set the variables
id: set-variables
run: echo "cli-versions=$(cat ./extensions/ql-vscode/supported_cli_versions.json | jq -rc)" >> $GITHUB_OUTPUT
outputs:
cli-versions: ${{ steps.set-variables.outputs.cli-versions }}
cli-test:
name: CLI Test
runs-on: ${{ matrix.os }}
needs: [find-nightly, set-matrix]
timeout-minutes: 30
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
version: ${{ fromJson(needs.set-matrix.outputs.cli-versions) }}
fail-fast: false
env:
CLI_VERSION: ${{ matrix.version }}
NIGHTLY_URL: ${{ needs.find-nightly.outputs.url }}
TEST_CODEQL_PATH: '${{ github.workspace }}/codeql'
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version-file: extensions/ql-vscode/.nvmrc
cache: 'npm'
cache-dependency-path: extensions/ql-vscode/package-lock.json
- name: Install dependencies
working-directory: extensions/ql-vscode
run: |
npm ci
shell: bash
- name: Build
working-directory: extensions/ql-vscode
run: |
npm run build
shell: bash
- name: Decide on ref of CodeQL repo
id: choose-ref
shell: bash
run: |
if [[ "${{ matrix.version }}" == "nightly" ]]
then
REF="codeql-cli/latest"
else
REF="codeql-cli/${{ matrix.version }}"
fi
echo "ref=$REF" >> "$GITHUB_OUTPUT"
- name: Checkout QL
uses: actions/checkout@v4
with:
repository: github/codeql
ref: ${{ steps.choose-ref.outputs.ref }}
path: codeql
- name: Run CLI tests (Linux)
working-directory: extensions/ql-vscode
if: matrix.os == 'ubuntu-latest'
run: |
unset DBUS_SESSION_BUS_ADDRESS
/usr/bin/xvfb-run npm run test:cli-integration
- name: Run CLI tests (Windows)
working-directory: extensions/ql-vscode
if: matrix.os == 'windows-latest'
run: |
npm run test:cli-integration

View File

@@ -19,7 +19,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@main

View File

@@ -11,6 +11,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: 'Dependency Review'
uses: actions/dependency-review-action@v3

View File

@@ -16,13 +16,13 @@ jobs:
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-node@v3
with:
node-version: '16.14.2'
node-version-file: extensions/ql-vscode/.nvmrc
cache: 'npm'
cache-dependency-path: extensions/ql-vscode/package-lock.json
@@ -53,34 +53,18 @@ jobs:
name: vscode-codeql-extension
path: artifacts
find-nightly:
name: Find Nightly Release
runs-on: ubuntu-latest
outputs:
url: ${{ steps.get-url.outputs.nightly-url }}
steps:
- name: Get Nightly Release URL
id: get-url
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
shell: bash
# This workflow step gets an unstable testing version of the CodeQL CLI. It should not be used outside of these tests.
run: |
LATEST=`gh api repos/dsp-testing/codeql-cli-nightlies/releases --jq '.[].tag_name' --method GET --raw-field 'per_page=1'`
echo "nightly-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/$LATEST" >> "$GITHUB_OUTPUT"
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-node@v3
with:
node-version: '16.14.2'
node-version-file: extensions/ql-vscode/.nvmrc
cache: 'npm'
cache-dependency-path: extensions/ql-vscode/package-lock.json
@@ -97,6 +81,8 @@ jobs:
- name: Lint
working-directory: extensions/ql-vscode
env:
NODE_OPTIONS: '--max-old-space-size=4096'
run: |
npm run lint
@@ -110,6 +96,47 @@ jobs:
run: |
npm run lint:scenarios
- name: Find deadcode
working-directory: extensions/ql-vscode
run: |
npm run find-deadcode
generated:
name: Check generated code
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-node@v3
with:
node-version-file: extensions/ql-vscode/.nvmrc
cache: 'npm'
cache-dependency-path: extensions/ql-vscode/package-lock.json
- name: Install dependencies
working-directory: extensions/ql-vscode
run: |
npm ci
shell: bash
- name: Check that repo is clean
run: |
git diff --exit-code
git diff --exit-code --cached
- name: Generate code
working-directory: extensions/ql-vscode
run: |
npm run generate
- name: Check for changes
run: |
git diff --exit-code
git diff --exit-code --cached
unit-test:
name: Unit Test
runs-on: ${{ matrix.os }}
@@ -118,13 +145,13 @@ jobs:
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-node@v3
with:
node-version: '16.14.2'
node-version-file: extensions/ql-vscode/.nvmrc
cache: 'npm'
cache-dependency-path: extensions/ql-vscode/package-lock.json
@@ -152,13 +179,13 @@ jobs:
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/setup-node@v3
with:
node-version: '16.14.2'
node-version-file: extensions/ql-vscode/.nvmrc
cache: 'npm'
cache-dependency-path: extensions/ql-vscode/package-lock.json
@@ -193,39 +220,40 @@ jobs:
run: |
npm run test:vscode-integration
set-matrix:
name: Set Matrix for cli-test
get-latest-cli-version:
name: Get latest CLI version
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set the variables
id: set-variables
run: echo "cli-versions=$(cat ./extensions/ql-vscode/supported_cli_versions.json | jq -rc)" >> $GITHUB_OUTPUT
uses: actions/checkout@v4
- name: Set the variable
id: set-variable
run: |
echo "cli-version=$(cat ./extensions/ql-vscode/supported_cli_versions.json | jq -rc '.[0]')" >> $GITHUB_OUTPUT
echo "$cli-version"
outputs:
cli-versions: ${{ steps.set-variables.outputs.cli-versions }}
cli-version: ${{ steps.set-variable.outputs.cli-version }}
cli-test:
name: CLI Test
runs-on: ${{ matrix.os }}
needs: [find-nightly, set-matrix]
needs: [get-latest-cli-version]
timeout-minutes: 30
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
version: ${{ fromJson(needs.set-matrix.outputs.cli-versions) }}
fail-fast: false
env:
CLI_VERSION: ${{ matrix.version }}
NIGHTLY_URL: ${{ needs.find-nightly.outputs.url }}
CLI_VERSION: ${{ needs.get-latest-cli-version.outputs.cli-version }}
TEST_CODEQL_PATH: '${{ github.workspace }}/codeql'
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '16.14.2'
node-version-file: extensions/ql-vscode/.nvmrc
cache: 'npm'
cache-dependency-path: extensions/ql-vscode/package-lock.json
@@ -241,23 +269,11 @@ jobs:
npm run build
shell: bash
- name: Decide on ref of CodeQL repo
id: choose-ref
shell: bash
run: |
if [[ "${{ matrix.version }}" == "nightly" ]]
then
REF="codeql-cli/latest"
else
REF="codeql-cli/${{ matrix.version }}"
fi
echo "ref=$REF" >> "$GITHUB_OUTPUT"
- name: Checkout QL
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: github/codeql
ref: ${{ steps.choose-ref.outputs.ref }}
ref: 'codeql-cli/${{ needs.get-latest-cli-version.outputs.cli-version }}'
path: codeql
- name: Run CLI tests (Linux)

View File

@@ -18,11 +18,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '16.14.2'
node-version-file: extensions/ql-vscode/.nvmrc
- name: Install dependencies
run: |

View File

@@ -1,4 +1,6 @@
**/* @github/codeql-vscode-reviewers
**/variant-analysis/ @github/code-scanning-secexp-reviewers
**/databases/ @github/code-scanning-secexp-reviewers
**/data-extensions-editor/ @github/code-scanning-secexp-reviewers
**/method-modeling/ @github/code-scanning-secexp-reviewers
**/model-editor/ @github/code-scanning-secexp-reviewers
**/queries-panel/ @github/code-scanning-secexp-reviewers

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 193 KiB

30
docs/node-version.md Normal file
View File

@@ -0,0 +1,30 @@
# Node version
The CodeQL for VS Code extension defines the version of Node.js that it is intended to run with. This Node.js version is used when running most CI and unit tests.
When running in production (i.e. as an extension for a VS Code application) it will use the Node.js version provided by VS Code. This can mean a different Node.js version is used by different users with different versions of VS Code.
We should make sure the CodeQL for VS Code extension works with the Node.js version supplied by all versions of VS Code that we support.
## Checking the version of Node.js supplied by VS Code
You can find this info by seleting "About Visual Studio Code" from the top menu.
![about-vscode](images/about-vscode.png)
## Updating the Node.js version
The following files will need to be updated:
- `extensions/ql-vscode/.nvmrc` - this will enable nvm to automatically switch to the correct Node
version when you're in the project folder. It will also change the Node version the GitHub Actions
workflows use.
- `extensions/ql-vscode/package.json` - the "engines.node: '[VERSION]'" setting
- `extensions/ql-vscode/package.json` - the "@types/node: '[VERSION]'" dependency
Then run `npm install` to update the `extensions/ql-vscode/package-lock.json` file.
## Node.js version used in tests
Unit tests will use whatever version of Node.js is installed locally. In CI this will be the version specified in the workflow.
Integration tests download a copy of VS Code and then will use whatever version of Node.js is provided by VS Code. Our integration tests are currently pinned to an older version of VS Code. See [VS Code version used in tests](./vscode-version.md#vs-code-version-used-in-tests) for more information.

View File

@@ -1,5 +1,6 @@
# Releasing (write access required)
1. Run the ["Run CLI tests" workflow](https://github.com/github/vscode-codeql/actions/workflows/cli-test.yml) and make sure the tests are green. If there were no merges between the time the workflow ran (it runs daily), and the release, you can skip this step.
1. Double-check the `CHANGELOG.md` contains all desired change comments and has the version to be released with date at the top.
* Go through all recent PRs and make sure they are properly accounted for.
* Make sure all changelog entries have links back to their PR(s) if appropriate.
@@ -10,10 +11,7 @@
* New telemetry events are added.
* Deprecation or removal of commands.
* Accumulation of many changes, none of which are individually big enough to warrant a minor bump, but which together are. This does not include changes which are purely internal to the extension, such as refactoring, or which are only available behind a feature flag.
1. Double-check that the node version we're using matches the one used for VS Code. If it doesn't, you will then need to update the node version in the following files:
* `.nvmrc` - this will enable `nvm` to automatically switch to the correct node version when you're in the project folder
* `.github/workflows/main.yml` - all the "node-version: '[VERSION]'" settings
* `.github/workflows/release.yml` - the "node-version: '[VERSION]'" setting
1. Double-check that the node version we're using matches the one used for VS Code. See the [Node.js version instructions](./node-version.md) for more information.
1. Double-check that the extension `package.json` and `package-lock.json` have the version you intend to release. If you are doing a patch release (as opposed to minor or major version) this should already be correct.
1. Create a PR for this release:
* This PR will contain any missing bits from steps 1, 2 and 3. Most of the time, this will just be updating `CHANGELOG.md` with today's date.

View File

@@ -11,16 +11,67 @@ We don't need to test features (and permutations of features) that are covered b
## Before releasing the VS Code extension
- Go through the required test cases listed below
- Run at least one local query and MRVA using the existing version of the extension (to generate "old" query history items).
- Go through the required test cases listed below.
- Check major PRs since the previous release for specific one-off things to test. Based on that, you might want to
choose to go through some of the Optional Test Cases.
- Run a query using the existing version of the extension (to generate an "old" query history item)
## Required Test Cases
### Test Case 1: MRVA - Running a problem path query and viewing results
### Local databases
1. Open the [UnsafeJQueryPlugin query](https://github.com/github/codeql/blob/main/javascript/ql/src/Security/CWE-079/UnsafeJQueryPlugin.ql).
#### Test case 1: Download a database from GitHub
1. Click "Download Database from GitHub" and enter `angular-cn/ng-nice` and select the javascript language if prompted
#### Test case 2: Import a database from an archive
1. Obtain a javascript database for `babel/babel`
- You can do `gh api "/repos/babel/babel/code-scanning/codeql/databases/javascript" -H "Accept: application/zip" > babel.zip` to fetch a database from GitHub.
2. Click "Choose Database from Archive" and select the file you just downloaded above.
### Local queries
#### Test case 1: Running a path problem query and viewing results
1. Open the [javascript UnsafeJQueryPlugin query](https://github.com/github/codeql/blob/main/javascript/ql/src/Security/CWE-079/UnsafeJQueryPlugin.ql).
2. Select the `angular-cn/ng-nice` database (or download it if you don't have one already)
3. Run a local query.
4. Once the query completes:
- Check that the result messages are rendered
- Check that the paths can be opened and paths are rendered correctly
- Check that alert locations can be clicked on
#### Test case 2: Running a problem query and viewing results
1. Open the [javascript ReDoS query](https://github.com/github/codeql/blob/main/javascript/ql/src/Performance/ReDoS.ql).
2. Select the `babel/babel` database (or download it if you don't have one already)
3. Run a local query.
4. Once the query completes:
- Check that the result messages are rendered
- Check that alert locations can be clicked on
#### Test case 3: Running a non-problem query and viewing results
1. Open the [cpp FunLinesOfCode query](https://github.com/github/codeql/blob/main/cpp/ql/src/Metrics/Functions/FunLinesOfCode.ql).
2. Select the `google/brotli` database (or download it if you don't have one already)
3. Run a local query.
4. Once the query completes:
- Check that the results table is rendered
- Check that result locations can be clicked on
#### Test case 4: Can use AST viewer
1. Click on any code location from a previous query to open a source file from a database
2. Open the AST viewing panel and click "View AST"
3. Once the AST is computed:
- Check that it can be navigated
### MRVA
#### Test Case 1: Running a path problem query and viewing results
1. Open the [javascript UnsafeJQueryPlugin query](https://github.com/github/codeql/blob/main/javascript/ql/src/Security/CWE-079/UnsafeJQueryPlugin.ql).
2. Run a MRVA against the following repo list:
```json
@@ -47,40 +98,44 @@ choose to go through some of the Optional Test Cases.
6. Once the query completes:
- Check that the query history item is updated to show the query status as "complete"
### Test Case 2: MRVA - Running a problem query and viewing results
#### Test Case 2: Running a problem query and viewing results
1. Open the [ReDoS query](https://github.com/github/codeql/blob/main/javascript/ql/src/Performance/ReDoS.ql).
1. Open the [javascript ReDoS query](https://github.com/github/codeql/blob/main/javascript/ql/src/Performance/ReDoS.ql).
2. Run a MRVA against the "Top 10" repositories.
3. Check that there is a notification message.
3. Check that a notification message pops up and the results view is opened.
4. Check the query history. It should:
- Show that an item has been added to the query history
- The item should be marked as "in progress".
5. Once the query starts:
- Check that a notification is shown with a link to the results view
5. Once the query completes:
- Check that the results are rendered with an alert message and a highlighted code snippet:
![highlighted-code-snippet](images/highlighted-code-snippet.png)
### Test Case 3: MRVA - Running a non-problem query and viewing results
![highlighted-code-snippet](images/highlighted-code-snippet.png)
1. Open the [FunLinesOfCode query](https://github.com/github/codeql/blob/main/cpp/ql/src/Metrics/Functions/FunLinesOfCode.ql).
#### Test Case 3: Running a non-problem query and viewing results
1. Open the [cpp FunLinesOfCode query](https://github.com/github/codeql/blob/main/cpp/ql/src/Metrics/Functions/FunLinesOfCode.ql).
2. Run a MRVA against a single repository (e.g. `google/brotli`).
3. Once the query starts:
- Open the query results
3. Check that a notification message pops up and the results view is opened.
4. Check the query history. It should:
- Show that an item has been added to the query history
- The item should be marked as "in progress".
5. Once the query completes:
- Check that the results show up in a table:
![results-table](images/results-table.png)
### Test Case 4: MRVA - Interacting with query history
![results-table](images/results-table.png)
#### Test Case 4: Interacting with query history
1. Click a history item (for MRVA):
- Check that exporting results works
- Check that sorting results works
- Check that copying repo lists works
2. Open the query results directory:
2. Click "Open Results Directory":
- Check that the correct directory is opened and there are results in it
3. View logs
3. Click "View Logs":
- Check that the correct workflow is opened
### Test Case 5: MRVA - Canceling a variant analysis run
#### Test Case 5: Canceling a variant analysis run
Run one of the above MRVAs, but cancel it from within VS Code:
@@ -88,16 +143,77 @@ Run one of the above MRVAs, but cancel it from within VS Code:
- Check that the workflow run is also canceled.
- Check that any available results are visible in VS Code.
### Test Case 6: MRVA - Change to a different colour theme
### CodeQL Model Editor
Open one of the above MRVAs, try changing to a different colour theme and check that everything looks sensible.
#### Test Case 1: Opening the model editor
1. Download the `sofastack/sofa-jraft` java database from GitHub.
2. Open the Model Editor with the "CodeQL: Open CodeQL Model Editor" command from the command palette.
- Check that the editor loads and shows methods to model.
- Check that methods are grouped per library (e.g. `rocksdbjni@7.7.3` or `asm@6.0`)
- Check that the "Open database" link works.
- Check that the 'View' button works and the Method Usage panel highlight the correct method and usage
- Check that the Method Modeling panel shows the correct method and modeling state
#### Test Case 2: Model methods
1. Expand one of the libraries.
- Change the model type and check that the other dropdowns change.
- Check that the method modeling panel updates accordingly
2. Save the modeled methods.
3. Click "Open extension pack"
- Check that the file explorer opens a directory with a "models" directory
4. Open the ".model.yml" file corresponding to the library that was changed.
- Check that the file contrains the entries that was modeled.
#### Test Case 3: Model with AI
Note that this test requires the feature flag: `codeQL.model.llmGeneration`
1. Click "Model with AI".
- Check that rows change to "Thinking".
- Check that results come back and rows get filled out.
#### Test Case 4: Model as dependency
Note that this test requires the feature flag: `codeQL.model.flowGeneration`
1. Click "Model as dependency"
- Check that grouping are now per package (e.g. `com.alipay.sofa.rraft.option` or `com.google.protobuf`)
2. Click "Generate".
- Check that rows are filled out.
### General
#### Test case 1: Change to a different colour theme
Open at least one of the above MRVAs and at least one local query, then try changing to a different colour theme and check that everything looks sensible.
Are there any components that are not showing up?
## Optional Test Cases
These are mostly aimed at MRVA, but some of them are also applicable to non-MRVA queries.
### Modeling Flow
### Selecting repositories to run on
1. Check that a method can have multiple models:
- Add a couple of new models for one method in the model editor
- Save and check that the modeling file (use the 'open extension pack' button to open it) shows multiple methods
- Check that the Method Modeling Panel shows the correct multiple models
- Check that you can browse through different models in the Method Modeling Panel
- Check that a 'duplicated classification' error appears in both model editor and modeling panel when a duplicate modeling occurs
- Check that a 'conflicting classification' error appears when a neutral model type is paired with a model of the same kind
- Check that clicking on the error highlights the correct modeling in both the editor and the modeling panel
2. Check the Method Usage Panel
- Check that the Method Usage Panel opens and jumps to the correct usage when clicking on 'View' in the model editor
- Check that the first and following usages are opening when clicking on a usage
- Check that the usage icon color turns green when saving a newly modeled method
- Check that the usage icon color turns red when saving a newly unmodeld method
3. Check the Method Modeling Panel
- Check that the 'Start modeling' button opens a new model editor
- Check that it refreshes the blank state when a model editor is opened/closed
- Check that when modeling in the editor the modeling panel updates accordingly
- Check that when modeling in the modeling panel the model editor updates accordingly
### Selecting MRVA repositories to run on
#### Test case 1: Running a query on a single repository
@@ -127,7 +243,7 @@ These are mostly aimed at MRVA, but some of them are also applicable to non-MRVA
4. The org contains private repositories that are inaccessible
2. The org does not exist
### Using different types of controller repos
### Using different types of controller repos for MRVA
#### Test case 1: Running a query when the controller repository is public
@@ -258,10 +374,9 @@ This requires running a MRVA query and seeing the results view.
2. When the file does not exist
7. Can open query text
8. Can sort repos
1. By name
2. By results
3. By stars
4. By last updated
1. Alphabetically
2. By number of results
3. By popularity
9. Can filter repos
10. Shows correct statistics
1. Total number of results
@@ -321,6 +436,7 @@ This requires running a MRVA query and seeing the results view.
1. Make changes via config file (ensure JSON schema is helping out)
1. Close and re-open VS Code (ensure lists are there)
1. Collapse/expand tree nodes
1. Create a new list, right click and select "Add repositories with GitHub Code Search". Enter the language 'python' and the query "UserMixin". This should show a rate limiting notification after a while but eventually populate the list with roughly 770 items.
Error cases that trigger an error notification:

View File

@@ -133,4 +133,4 @@ Once the scenario has been recorded, it's often useful to remove some of the req
### Scenario data location
Pre-recorded scenarios are stored in `./src/mocks/scenarios`. However, it's possible to configure the location, by setting the `codeQL.mockGitHubApiServer.scenariosPath` configuration property in the VS Code user settings.
Pre-recorded scenarios are stored in `./src/common/mock-gh-api/scenarios`. However, it's possible to configure the location, by setting the `codeQL.mockGitHubApiServer.scenariosPath` configuration property in the VS Code user settings.

33
docs/vscode-version.md Normal file
View File

@@ -0,0 +1,33 @@
# VS Code version
The CodeQL for VS Code extension specifies the versions of VS Code that it is compatible with. VS Code will only offer to install and upgrade the extension when this version range is satisfied.
## Where is the VS Code version specified
1. Hard limit in [`package.json`](https://github.com/github/vscode-codeql/blob/606bfd7f877d9fffe4ff83b78015ab15f8840b12/extensions/ql-vscode/package.json#L16)
This is the value that VS Code understands and respects. If a user does not meet this version requirement then VS Code will not offer to install the CodeQL for VS Code extension, and if the extension is already installed then it will silently refuse to upgrade the extension.
1. Soft limit in [`extension.ts`](https://github.com/github/vscode-codeql/blob/606bfd7f877d9fffe4ff83b78015ab15f8840b12/extensions/ql-vscode/src/extension.ts#L307)
This value is used internally by the CodeQL for VS Code extension and is used to provide a warning to users without blocking them from installing or upgrading. If the extension detects that this version range is not met it will output a warning message to the user prompting them to upgrade their VS Code version to ge the latest features of CodeQL.
## When to update the VS Code version
Generally we should aim to support as wide a range of VS Code versions as we can, so unless there is a reason to do so we do not update the minimum VS Code version requirement.
Reasons for updating the minimum VS Code version include:
- A new feature is included in VS Code. We may want to ensure that it is available to use so we do not have to provide an alternative code path.
- A breaking change has happened in VS Code, and it is not possible to support both new and old versions.
Also consider what percentage of our users are using each VS Code version. This information is available in our telemetry.
## How to update the VS Code version
To provide a good experience to users, it is recommented to update the `MIN_VERSION` in `extension.ts` first and release, and then update the `vscode` version in `package.json` and release again. By stagging this update across two releases it gives users on older VS Code versions a chance to upgrade before it silently refuses to upgrade them.
## VS Code version used in tests
Our integration tests are currently pinned to use an older version of VS Code due to <https://github.com/github/vscode-codeql/issues/2402>.
This version is specified in [`jest-runner-vscode.config.base.js`](https://github.com/github/vscode-codeql/blob/d93f2b67c84e79737b0ce4bb74e31558b5f5166e/extensions/ql-vscode/test/vscode-tests/jest-runner-vscode.config.base.js#L17).
Until this is resolved this will limit us updating our minimum supported version of VS Code.

View File

@@ -65,16 +65,13 @@ const baseConfig = {
"import/no-namespace": "off",
"import/no-unresolved": "off",
"import/no-webpack-loader-syntax": "off",
"jsx-a11y/anchor-is-valid": "off",
"jsx-a11y/no-noninteractive-element-interactions": "off",
"jsx-a11y/no-static-element-interactions": "off",
"jsx-a11y/click-events-have-key-events": "off",
"no-invalid-this": "off",
"no-fallthrough": "off",
"no-console": "off",
"no-shadow": "off",
"github/array-foreach": "off",
"github/no-then": "off",
"react/jsx-key": ["error", { checkFragmentShorthand: true }],
},
};

View File

@@ -1 +1 @@
v16.14.2
v18.15.0

View File

@@ -1,4 +1,4 @@
import type { StorybookConfig } from "@storybook/core-common";
import type { StorybookConfig } from "@storybook/react-webpack5";
const config: StorybookConfig = {
stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
@@ -6,15 +6,16 @@ const config: StorybookConfig = {
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
"@storybook/addon-a11y",
"./vscode-theme-addon/preset.ts",
],
framework: "@storybook/react",
core: {
builder: "@storybook/builder-webpack5",
framework: {
name: "@storybook/react-webpack5",
options: {},
},
features: {
babelModeV7: true,
docs: {
autodocs: "tag",
},
};
module.exports = config;
export default config;

View File

@@ -1,4 +1,4 @@
import { addons } from "@storybook/addons";
import { addons } from "@storybook/manager-api";
import { themes } from "@storybook/theming";
addons.setConfig({

View File

@@ -1,31 +1,44 @@
import { Preview } from "@storybook/react";
import { themes } from "@storybook/theming";
import { action } from "@storybook/addon-actions";
// Allow all stories/components to use Codicons
import "@vscode/codicons/dist/codicon.css";
// https://storybook.js.org/docs/react/configure/overview#configure-story-rendering
export const parameters = {
// All props starting with `on` will automatically receive an action as a prop
actions: { argTypesRegex: "^on[A-Z].*" },
// All props matching these names will automatically get the correct control
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
// Use a dark theme to be aligned with VSCode
docs: {
theme: themes.dark,
},
backgrounds: {
// The background is injected by our theme CSS files
disable: true,
},
};
import type { VsCodeApi } from "../src/view/vscode-api";
(window as any).acquireVsCodeApi = () => ({
declare global {
interface Window {
acquireVsCodeApi: () => VsCodeApi;
}
}
window.acquireVsCodeApi = () => ({
postMessage: action("post-vscode-message"),
setState: action("set-vscode-state"),
});
// https://storybook.js.org/docs/react/configure/overview#configure-story-rendering
const preview: Preview = {
parameters: {
// All props starting with `on` will automatically receive an action as a prop
actions: { argTypesRegex: "^on[A-Z].*" },
// All props matching these names will automatically get the correct control
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
// Use a dark theme to be aligned with VSCode
docs: {
theme: themes.dark,
},
backgrounds: {
// The background is injected by our theme CSS files
disable: true,
},
},
};
export default preview;

View File

@@ -1,14 +1,12 @@
import * as React from "react";
import { FunctionComponent, useCallback } from "react";
import { useGlobals } from "@storybook/api";
import { useGlobals } from "@storybook/manager-api";
import {
IconButton,
Icons,
WithTooltip,
TooltipLinkList,
Link,
WithHideFn,
WithTooltip,
} from "@storybook/components";
import { themeNames, VSCodeTheme } from "./theme";
@@ -26,7 +24,7 @@ export const ThemeSelector: FunctionComponent = () => {
);
const createLinks = useCallback(
(onHide: () => void): Link[] =>
(onHide: () => void) =>
Object.values(VSCodeTheme).map((theme) => ({
id: theme,
onClick() {
@@ -44,8 +42,8 @@ export const ThemeSelector: FunctionComponent = () => {
<WithTooltip
placement="top"
trigger="click"
closeOnClick
tooltip={({ onHide }: WithHideFn) => (
closeOnOutsideClick
tooltip={({ onHide }: { onHide: () => void }) => (
<TooltipLinkList links={createLinks(onHide)} />
)}
>

View File

@@ -1,5 +1,5 @@
import * as React from "react";
import { addons, types } from "@storybook/addons";
import { addons, types } from "@storybook/manager-api";
import { ThemeSelector } from "./ThemeSelector";
const ADDON_ID = "vscode-theme-addon";

View File

@@ -1,4 +1,4 @@
export function config(entry = []) {
export function previewAnnotations(entry = []) {
return [...entry, require.resolve("./preview.ts")];
}

View File

@@ -1,6 +1,5 @@
import { useEffect, useGlobals } from "@storybook/addons";
import { useEffect } from "react";
import type {
AnyFramework,
PartialStoryFn as StoryFunction,
StoryContext,
} from "@storybook/csf";
@@ -34,11 +33,8 @@ const themeFiles: { [key in VSCodeTheme]: string } = {
.default,
};
export const withTheme = (
StoryFn: StoryFunction<AnyFramework>,
context: StoryContext<AnyFramework>,
) => {
const [{ vscodeTheme }] = useGlobals();
export const withTheme = (StoryFn: StoryFunction, context: StoryContext) => {
const { vscodeTheme } = context.globals;
useEffect(() => {
const styleSelectorId =

View File

@@ -1,10 +1,101 @@
# CodeQL for Visual Studio Code: Changelog
## 1.9.3 - 26 October 2023
- Sorted result set filenames now include a hash of the result set name instead of the full name. [#2955](https://github.com/github/vscode-codeql/pull/2955)
- The "Install Pack Dependencies" will now only list CodeQL packs located in the workspace. [#2960](https://github.com/github/vscode-codeql/pull/2960)
- Fix a bug where the "View Query Log" action for a query history item was not working. [#2984](https://github.com/github/vscode-codeql/pull/2984)
- Add a command to sort items in the databases view by language. [#2993](https://github.com/github/vscode-codeql/pull/2993)
- Fix not being able to open the results directory or evaluator log for a cancelled local query run. [#2996](https://github.com/github/vscode-codeql/pull/2996)
- Fix empty row in alert path when the SARIF location was empty. [#3018](https://github.com/github/vscode-codeql/pull/3018)
## 1.9.2 - 12 October 2023
- Fix a bug where the query to Find Definitions in database source files would not be cancelled appropriately. [#2885](https://github.com/github/vscode-codeql/pull/2885)
- It is now possible to show the language of query history items using the `%l` specifier in the `codeQL.queryHistory.format` setting. Note that this only works for queries run after this upgrade, and older items will show `unknown` as a language. [#2892](https://github.com/github/vscode-codeql/pull/2892)
- Increase the required version of VS Code to 1.82.0. [#2877](https://github.com/github/vscode-codeql/pull/2877)
- Fix a bug where the query server was restarted twice after configuration changes. [#2884](https://github.com/github/vscode-codeql/pull/2884).
- Add support for the `telemetry.telemetryLevel` setting. For more information, see the [telemetry documentation](https://codeql.github.com/docs/codeql-for-visual-studio-code/about-telemetry-in-codeql-for-visual-studio-code). [#2824](https://github.com/github/vscode-codeql/pull/2824).
- Add a "CodeQL: Trim Cache" command that clears the evaluation cache of a database except for predicates annotated with the `cached` keyword. Its purpose is to get accurate performance measurements when tuning the final stage of a query, like a data-flow configuration. This is equivalent to the `codeql database cleanup --mode=normal` CLI command. In contrast, the existing "CodeQL: Clear Cache" command clears the entire cache. CodeQL CLI v2.15.1 or later is required. [#2928](https://github.com/github/vscode-codeql/pull/2928)
- Fix syntax highlighting directly after import statements with instantiation arguments. [#2792](https://github.com/github/vscode-codeql/pull/2792)
- The `debug.saveBeforeStart` setting is now respected when running variant analyses. [#2950](https://github.com/github/vscode-codeql/pull/2950)
- The 'open database' button of the model editor was renamed to 'open source'. Also, it's now only available if the source archive is available as a workspace folder. [#2945](https://github.com/github/vscode-codeql/pull/2945)
## 1.9.1 - 29 September 2023
- Add warning when using a VS Code version older than 1.82.0. [#2854](https://github.com/github/vscode-codeql/pull/2854)
- Fix a bug when parsing large evaluation log summaries. [#2858](https://github.com/github/vscode-codeql/pull/2858)
- Right-align and format numbers in raw result tables. [#2864](https://github.com/github/vscode-codeql/pull/2864)
- Remove rate limit warning notifications when using Code Search to add repositories to a variant analysis list. [#2812](https://github.com/github/vscode-codeql/pull/2812)
## 1.9.0 - 19 September 2023
- Release the [CodeQL model editor](https://codeql.github.com/docs/codeql/codeql-for-visual-studio-code/using-the-codeql-model-editor) to create CodeQL model packs for Java frameworks. Open the editor using the "CodeQL: Open CodeQL Model Editor (Beta)" command. [#2823](https://github.com/github/vscode-codeql/pull/2823)
## 1.8.12 - 11 September 2023
- Fix a bug where variant analysis queries would fail for queries in the `codeql/java-queries` query pack. [#2786](https://github.com/github/vscode-codeql/pull/2786)
## 1.8.11 - 7 September 2023
- Update how variant analysis results are displayed. For queries with ["path-problem" or "problem" `@kind`](https://codeql.github.com/docs/writing-codeql-queries/metadata-for-codeql-queries/#metadata-properties), you can choose to display the results as rendered alerts or as a table of raw results. For queries with any other `@kind`, the results are displayed as a table. [#2745](https://github.com/github/vscode-codeql/pull/2745) & [#2749](https://github.com/github/vscode-codeql/pull/2749)
- When running variant analyses, don't download artifacts for repositories with no results. [#2736](https://github.com/github/vscode-codeql/pull/2736)
- Group the extension settings, so that they're easier to find in the Settings UI. [#2706](https://github.com/github/vscode-codeql/pull/2706)
## 1.8.10 - 15 August 2023
- Add a code lens to make the `CodeQL: Open Referenced File` command more discoverable. Click the "Open referenced file" prompt in a `.qlref` file to jump to the referenced `.ql` file. [#2704](https://github.com/github/vscode-codeql/pull/2704)
## 1.8.9 - 3 August 2023
- Remove "last updated" information and sorting from variant analysis results view. [#2637](https://github.com/github/vscode-codeql/pull/2637)
- Links to code on GitHub now include column numbers as well as line numbers. [#2406](https://github.com/github/vscode-codeql/pull/2406)
- No longer highlight trailing commas for jump to definition. [#2615](https://github.com/github/vscode-codeql/pull/2615)
- Fix a bug where the QHelp preview page was not being refreshed after changes to the underlying `.qhelp` file. [#2660](https://github.com/github/vscode-codeql/pull/2660)
## 1.8.8 - 17 July 2023
- Remove support for CodeQL CLI versions older than 2.9.4. [#2610](https://github.com/github/vscode-codeql/pull/2610)
- Implement syntax highlighting for the `additional` and `default` keywords. [#2609](https://github.com/github/vscode-codeql/pull/2609)
## 1.8.7 - 29 June 2023
- Show a run button on the file tab for query files, that will start a local query. This button will only show when a local database is selected in the extension. [#2544](https://github.com/github/vscode-codeql/pull/2544)
- Add a `CodeQL: Quick Evaluation Count` command to generate the count summary statistics of the results set
without spending the time to compute locations and strings. [#2475](https://github.com/github/vscode-codeql/pull/2475)
## 1.8.6 - 14 June 2023
- Add repositories to a variant analysis list with GitHub Code Search. [#2439](https://github.com/github/vscode-codeql/pull/2439) and [#2476](https://github.com/github/vscode-codeql/pull/2476)
## 1.8.5 - 6 June 2023
- Add settings `codeQL.variantAnalysis.defaultResultsFilter` and `codeQL.variantAnalysis.defaultResultsSort` for configuring how variant analysis results are filtered and sorted in the results view. The default is to show all repositories, and to sort by the number of results. [#2392](https://github.com/github/vscode-codeql/pull/2392)
- Fix bug to ensure error messages have complete stack trace in message logs. [#2425](https://github.com/github/vscode-codeql/pull/2425)
- Fix bug where the `CodeQL: Compare Query` command did not work for comparing quick-eval queries. [#2422](https://github.com/github/vscode-codeql/pull/2422)
- Update text of copy and export buttons in variant analysis results view to clarify that they only copy/export the selected/filtered results. [#2427](https://github.com/github/vscode-codeql/pull/2427)
- Add warning when using unsupported CodeQL CLI version. [#2428](https://github.com/github/vscode-codeql/pull/2428)
- Retry variant analysis results download if connection times out. [#2440](https://github.com/github/vscode-codeql/pull/2440)
## 1.8.4 - 3 May 2023
- Avoid repeated error messages when unable to monitor a variant analysis. [#2396](https://github.com/github/vscode-codeql/pull/2396)
- Fix bug where a variant analysis didn't display the `#select` results set correctly when the [query metadata](https://codeql.github.com/docs/writing-codeql-queries/about-codeql-queries/#query-metadata) didn't exactly match the query results. [#2395](https://github.com/github/vscode-codeql/pull/2395)
- On the variant analysis results page, show the count of successful analyses instead of completed analyses, and indicate the reason why analyses were not successful. [#2349](https://github.com/github/vscode-codeql/pull/2349)
- Fix bug where the "CodeQL: Set Current Database" command didn't always select the database. [#2384](https://github.com/github/vscode-codeql/pull/2384)
## 1.8.3 - 26 April 2023
- Added ability to filter repositories for a variant analysis to only those that have results [#2343](https://github.com/github/vscode-codeql/pull/2343)
- Add new configuration option to allow downloading databases from http, non-secure servers. [#2332](https://github.com/github/vscode-codeql/pull/2332)
- Remove title actions from the query history panel that depended on history items being selected. [#2350](https://github.com/github/vscode-codeql/pull/2350)
## 1.8.2 - 12 April 2023
- Fix bug where users could end up with the mananged CodeQL CLI getting uninstalled during upgrades and not reinstalled. [#2294](https://github.com/github/vscode-codeql/pull/2294)
- Fix bug where users could end up with the managed CodeQL CLI getting uninstalled during upgrades and not reinstalled. [#2294](https://github.com/github/vscode-codeql/pull/2294)
- Fix bug that was causing code flows to not get updated when switching between results. [#2288](https://github.com/github/vscode-codeql/pull/2288)
- Restart the CodeQL language server whenever the _CodeQL: Restart Query Server_ command is invoked. This avoids bugs where the CLI version changes to support new language features, but the language server is not updated. [#2238](https://github.com/github/vscode-codeql/pull/2238)
- Avoid requiring a manual restart of the query server when the [external CLI config file](https://docs.github.com/en/code-security/codeql-cli/using-the-codeql-cli/specifying-command-options-in-a-codeql-configuration-file#using-a-codeql-configuration-file) changes. [#2289](https://github.com/github/vscode-codeql/pull/2289)
## 1.8.1 - 23 March 2023

View File

@@ -9,6 +9,7 @@ import {
} from "fs-extra";
import { resolve, join } from "path";
import { isDevBuild } from "./dev";
import type * as packageJsonType from "../package.json";
export interface DeployedPackage {
distPath: string;
@@ -46,12 +47,10 @@ async function copyPackage(
);
}
export async function deployPackage(
packageJsonPath: string,
): Promise<DeployedPackage> {
export async function deployPackage(): Promise<DeployedPackage> {
try {
const packageJson: any = JSON.parse(
await readFile(packageJsonPath, "utf8"),
const packageJson: typeof packageJsonType = JSON.parse(
await readFile(resolve(__dirname, "../package.json"), "utf8"),
);
const distDir = join(__dirname, "../../../dist");

View File

@@ -3,9 +3,7 @@ import { deployPackage } from "./deploy";
import { spawn } from "child-process-promise";
export async function packageExtension(): Promise<void> {
const deployedPackage = await deployPackage(
resolve(__dirname, "../package.json"),
);
const deployedPackage = await deployPackage();
console.log(
`Packaging extension '${deployedPackage.name}@${deployedPackage.version}'...`,
);

View File

@@ -2,7 +2,7 @@
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "../tsconfig.json",
"compilerOptions": {
"rootDir": "."
"rootDir": ".."
},
"include": ["*.ts"]
}

View File

@@ -15,9 +15,6 @@ export const config: webpack.Configuration = {
devtool: isDevBuild ? "inline-source-map" : "source-map",
resolve: {
extensions: [".js", ".ts", ".tsx", ".json"],
fallback: {
path: require.resolve("path-browserify"),
},
},
module: {
rules: [
@@ -62,18 +59,10 @@ export const config: webpack.Configuration = {
},
{
test: /\.(woff(2)?|ttf|eot)$/,
use: [
{
loader: "file-loader",
options: {
name: "[name].[ext]",
outputPath: "fonts/",
// We need this to make Webpack use the correct path for the fonts.
// Without this, the CSS file will use `url([object Module])`
esModule: false,
},
},
],
type: "asset/resource",
generator: {
filename: "fonts/[hash][ext][query]",
},
},
],
},

View File

@@ -30,5 +30,5 @@
"end": "^\\s*//\\s*#?endregion\\b"
}
},
"wordPattern": "(-?\\d*\\.\\d\\w*)|([^\\~\\!\\@\\#\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\.\\<\\>\\/\\?\\s]+)"
"wordPattern": "(-?\\d*\\.\\d\\w*)|([^\\~\\!\\@\\#\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\.\\<\\>\\/\\?\\s\\,]+)"
}

View File

@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" fill="none"
viewBox="0 0 432 432" style="enable-background:new 0 0 432 432;" xml:space="preserve">
<g>
<g>
<g>
<polygon points="234.24,9.067 183.893,59.413 284.587,59.413" fill="#C5C5C5"/>
<polygon points="301.44,304.32 427.947,120.853 427.947,93.973 250.88,93.973 250.88,128.107 376.32,128.107 250.027,310.72
250.027,338.24 432,338.24 432,304.32" fill="#C5C5C5"/>
<polygon points="234.24,422.933 283.947,373.227 184.533,373.227" fill="#C5C5C5"/>
<path d="M226.773,338.24L130.987,93.76H96L0,338.24h39.253l19.627-52.267h109.013l19.627,52.267H226.773z M71.893,250.987
L113.28,140.48l41.387,110.507H71.893z" fill="#C5C5C5"/>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 953 B

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7 2L6 3V6H7V3H14V5.45306L14.2071 5.29286L15 6.08576V3L14 2H7ZM8 4H10V6H8V4ZM5 9H3V11H5V9ZM2 7L1 8V13L2 14H9L10 13V8L9 7H2ZM2 13V8H9V13H2ZM8 10H6V12H8V10ZM13 4H12V7.86388L10.818 6.68192L10.1109 7.38903L12.1465 9.42454L12.8536 9.42454L14.889 7.38908L14.1819 6.68197L13 7.86388V4Z" fill="#C5C5C5"/>
</svg>

Before

Width:  |  Height:  |  Size: 449 B

View File

@@ -0,0 +1 @@
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M4 2h8v4c.341.035.677.112 1 .23V1H3v8.48l1-1.75V2zm2.14 8L5 8 4 9.75 3.29 11 1 15h8l-2.29-4-.57-1zm-3.42 4l1.72-3L5 10l.56 1 1.72 3H2.72zm6.836-6.41a3.5 3.5 0 1 1 3.888 5.82 3.5 3.5 0 0 1-3.888-5.82zm.555 4.989a2.5 2.5 0 1 0 2.778-4.157 2.5 2.5 0 0 0-2.778 4.157z" fill="#C5C5C5"/></svg>

After

Width:  |  Height:  |  Size: 431 B

View File

@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 432 432" style="enable-background:new 0 0 432 432;" xml:space="preserve">
<g>
<g>
<g>
<polygon points="234.24,9.067 183.893,59.413 284.587,59.413 "/>
<polygon points="301.44,304.32 427.947,120.853 427.947,93.973 250.88,93.973 250.88,128.107 376.32,128.107 250.027,310.72
250.027,338.24 432,338.24 432,304.32 "/>
<polygon points="234.24,422.933 283.947,373.227 184.533,373.227 "/>
<path d="M226.773,338.24L130.987,93.76H96L0,338.24h39.253l19.627-52.267h109.013l19.627,52.267H226.773z M71.893,250.987
L113.28,140.48l41.387,110.507H71.893z"/>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 894 B

View File

@@ -1,3 +0,0 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7 2L6 3V6H7V3H14V5.45306L14.2071 5.29286L15 6.08576V3L14 2H7ZM8 4H10V6H8V4ZM5 9H3V11H5V9ZM2 7L1 8V13L2 14H9L10 13V8L9 7H2ZM2 13V8H9V13H2ZM8 10H6V12H8V10ZM13 4H12V7.86388L10.818 6.68192L10.1109 7.38903L12.1465 9.42454L12.8536 9.42454L14.889 7.38908L14.1819 6.68197L13 7.86388V4Z" fill="#424242"/>
</svg>

Before

Width:  |  Height:  |  Size: 449 B

View File

@@ -0,0 +1 @@
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M4 2h8v4c.341.035.677.112 1 .23V1H3v8.48l1-1.75V2zm2.14 8L5 8 4 9.75 3.29 11 1 15h8l-2.29-4-.57-1zm-3.42 4l1.72-3L5 10l.56 1 1.72 3H2.72zm6.836-6.41a3.5 3.5 0 1 1 3.888 5.82 3.5 3.5 0 0 1-3.888-5.82zm.555 4.989a2.5 2.5 0 1 0 2.778-4.157 2.5 2.5 0 0 0-2.778 4.157z" fill="#424242"/></svg>

After

Width:  |  Height:  |  Size: 431 B

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -25,7 +25,7 @@ index 1ac28d5..f91f216 100644
await super.setup();
await (0, load_pnp_1.default)();
diff --git a/node_modules/jest-runner-vscode/dist/child/runner.js b/node_modules/jest-runner-vscode/dist/child/runner.js
index 0663c5c..4991663 100644
index 0663c5c..bdf4a8b 100644
--- a/node_modules/jest-runner-vscode/dist/child/runner.js
+++ b/node_modules/jest-runner-vscode/dist/child/runner.js
@@ -18,10 +18,13 @@ async function run() {
@@ -43,6 +43,16 @@ index 0663c5c..4991663 100644
const options = JSON.parse(PARENT_JEST_OPTIONS);
const jestOptions = [
...options.args,
@@ -39,6 +42,9 @@ async function run() {
...(argv.projects?.map(project => path_1.default.resolve(project)) || []),
options.workspacePath,
]);
+ const testPaths = new Set(argv._.map(testPath => path_1.default.resolve(testPath)));
+ argv._ = [...testPaths];
+
await (0, core_1.runCLI)(argv, [...projects]);
}
catch (error) {
diff --git a/node_modules/jest-runner-vscode/dist/public-types.d.ts b/node_modules/jest-runner-vscode/dist/public-types.d.ts
index 57716e5..d8614af 100644
--- a/node_modules/jest-runner-vscode/dist/public-types.d.ts

View File

@@ -14,21 +14,26 @@
import { pathExists, readJson, writeJson } from "fs-extra";
import { resolve, relative } from "path";
import { Octokit, type RestEndpointMethodTypes } from "@octokit/rest";
import { Octokit } from "@octokit/core";
import { type RestEndpointMethodTypes } from "@octokit/rest";
import { throttling } from "@octokit/plugin-throttling";
import { getFiles } from "./util/files";
import type { GitHubApiRequest } from "../src/mocks/gh-api-request";
import { isGetVariantAnalysisRequest } from "../src/mocks/gh-api-request";
import type { GitHubApiRequest } from "../src/common/mock-gh-api/gh-api-request";
import { isGetVariantAnalysisRequest } from "../src/common/mock-gh-api/gh-api-request";
import { VariantAnalysis } from "../src/variant-analysis/gh-api/variant-analysis";
import { RepositoryWithMetadata } from "../src/variant-analysis/gh-api/repository";
import { AppOctokit } from "../src/common/octokit";
const extensionDirectory = resolve(__dirname, "..");
const scenariosDirectory = resolve(extensionDirectory, "src/mocks/scenarios");
const scenariosDirectory = resolve(
extensionDirectory,
"src/common/mock-gh-api/scenarios",
);
// Make sure we don't run into rate limits by automatically waiting until we can
// make another request.
const MyOctokit = Octokit.plugin(throttling);
const MyOctokit = AppOctokit.plugin(throttling);
const auth = process.env.GITHUB_TOKEN;

View File

@@ -0,0 +1,48 @@
import { basename, join, relative, resolve } from "path";
import analyzeTsConfig from "ts-unused-exports";
import { containsPath, pathsEqual } from "../src/common/files";
import { exit } from "process";
function ignoreFile(file: string): boolean {
return (
containsPath("gulpfile.ts", file) ||
containsPath(".storybook", file) ||
containsPath(join("src", "stories"), file) ||
pathsEqual(
join("test", "vscode-tests", "jest-runner-installed-extensions.ts"),
file,
) ||
basename(file) === "jest.config.ts" ||
basename(file) === "index.tsx" ||
basename(file) === "index.ts"
);
}
function main() {
const repositoryRoot = resolve(join(__dirname, ".."));
const result = analyzeTsConfig("tsconfig.deadcode.json");
let foundUnusedExports = false;
for (const [filepath, exportNameAndLocations] of Object.entries(result)) {
const relativeFilepath = relative(repositoryRoot, filepath);
if (ignoreFile(relativeFilepath)) {
continue;
}
foundUnusedExports = true;
console.log(relativeFilepath);
for (const exportNameAndLocation of exportNameAndLocations) {
console.log(` ${exportNameAndLocation.exportName}`);
}
console.log();
}
if (foundUnusedExports) {
exit(1);
}
}
main();

View File

@@ -20,7 +20,10 @@ if (process.argv.length !== 3) {
const scenarioName = process.argv[2];
const extensionDirectory = resolve(__dirname, "..");
const scenariosDirectory = resolve(extensionDirectory, "src/mocks/scenarios");
const scenariosDirectory = resolve(
extensionDirectory,
"src/common/mock-gh-api/scenarios",
);
const scenarioDirectory = resolve(scenariosDirectory, scenarioName);
async function fixScenarioFiles() {

View File

@@ -0,0 +1,72 @@
import { createGenerator } from "ts-json-schema-generator";
import { join, resolve } from "path";
import { outputFile } from "fs-extra";
import { format, resolveConfig } from "prettier";
const extensionDirectory = resolve(__dirname, "..");
const schemas = [
{
path: join(
extensionDirectory,
"src",
"model-editor",
"extension-pack-metadata.ts",
),
type: "ExtensionPackMetadata",
schemaPath: join(
extensionDirectory,
"src",
"model-editor",
"extension-pack-metadata.schema.json",
),
},
{
path: join(
extensionDirectory,
"src",
"model-editor",
"model-extension-file.ts",
),
type: "ModelExtensionFile",
schemaPath: join(
extensionDirectory,
"src",
"model-editor",
"model-extension-file.schema.json",
),
},
];
async function generateSchema(
schemaDefinition: (typeof schemas)[number],
): Promise<void> {
const schema = createGenerator({
path: schemaDefinition.path,
tsconfig: resolve(extensionDirectory, "tsconfig.json"),
type: schemaDefinition.type,
skipTypeCheck: true,
topRef: true,
additionalProperties: true,
}).createSchema(schemaDefinition.type);
const schemaJson = JSON.stringify(schema, null, 2);
const prettierOptions = await resolveConfig(schemaDefinition.schemaPath);
const formattedSchemaJson = await format(schemaJson, {
...prettierOptions,
filepath: schemaDefinition.schemaPath,
});
await outputFile(schemaDefinition.schemaPath, formattedSchemaJson);
}
async function generateSchemas() {
await Promise.all(schemas.map(generateSchema));
}
generateSchemas().catch((e: unknown) => {
console.error(e);
process.exit(2);
});

View File

@@ -8,13 +8,19 @@ import { getFiles } from "./util/files";
const extensionDirectory = resolve(__dirname, "..");
const rootDirectory = resolve(extensionDirectory, "../..");
const scenariosDirectory = resolve(extensionDirectory, "src/mocks/scenarios");
const scenariosDirectory = resolve(
extensionDirectory,
"src/common/mock-gh-api/scenarios",
);
const debug = process.env.RUNNER_DEBUG || process.argv.includes("--debug");
async function lintScenarios() {
const schema = createGenerator({
path: resolve(extensionDirectory, "src/mocks/gh-api-request.ts"),
path: resolve(
extensionDirectory,
"src/common/mock-gh-api/gh-api-request.ts",
),
tsconfig: resolve(extensionDirectory, "tsconfig.json"),
type: "GitHubApiRequest",
skipTypeCheck: true,

View File

@@ -115,21 +115,35 @@ async function extractSourceMap() {
}
if (stacktrace.includes("at")) {
const rawSourceMaps = new Map<string, RawSourceMap>();
const rawSourceMaps = new Map<string, RawSourceMap | null>();
const mappedStacktrace = await replaceAsync(
stacktrace,
stackLineRegex,
async (match, name, file, line, column) => {
if (!rawSourceMaps.has(file)) {
const rawSourceMap: RawSourceMap = await readJSON(
resolve(sourceMapsDirectory, `${basename(file)}.map`),
);
rawSourceMaps.set(file, rawSourceMap);
try {
const rawSourceMap: RawSourceMap = await readJSON(
resolve(sourceMapsDirectory, `${basename(file)}.map`),
);
rawSourceMaps.set(file, rawSourceMap);
} catch (e: unknown) {
// If the file is not found, we will not decode it and not try reading this source map again
if (e instanceof Error && "code" in e && e.code === "ENOENT") {
rawSourceMaps.set(file, null);
} else {
throw e;
}
}
}
const sourceMap = rawSourceMaps.get(file);
if (!sourceMap) {
return match;
}
const originalPosition = await SourceMapConsumer.with(
rawSourceMaps.get(file) as RawSourceMap,
sourceMap,
null,
async function (consumer) {
return consumer.originalPositionFor({

View File

@@ -0,0 +1,55 @@
import { AppCommandManager } from "../common/commands";
import { Uri, workspace } from "vscode";
import { join } from "path";
import { pathExists } from "fs-extra";
import { isCodespacesTemplate } from "../config";
import { showBinaryChoiceDialog } from "../common/vscode/dialog";
import { extLogger } from "../common/logging/vscode";
/**
* Check if the current workspace is the CodeTour and open the workspace folder.
* Without this, we can't run the code tour correctly.
**/
export async function prepareCodeTour(
commandManager: AppCommandManager,
): Promise<void> {
if (workspace.workspaceFolders?.length) {
const currentFolder = workspace.workspaceFolders[0].uri.fsPath;
const tutorialWorkspacePath = join(
currentFolder,
"tutorial.code-workspace",
);
const toursFolderPath = join(currentFolder, ".tours");
/** We're opening the tutorial workspace, if we detect it.
* This will only happen if the following three conditions are met:
* - the .tours folder exists
* - the tutorial.code-workspace file exists
* - the CODESPACES_TEMPLATE setting doesn't exist (it's only set if the user has already opened
* the tutorial workspace so it's a good indicator that the user is in the folder but has ignored
* the prompt to open the workspace)
*/
if (
(await pathExists(tutorialWorkspacePath)) &&
(await pathExists(toursFolderPath)) &&
!isCodespacesTemplate()
) {
const answer = await showBinaryChoiceDialog(
"We've detected you're in the CodeQL Tour repo. We will need to open the workspace file to continue. Reload?",
);
if (!answer) {
return;
}
const tutorialWorkspaceUri = Uri.file(tutorialWorkspacePath);
void extLogger.log(
`In prepareCodeTour() method, going to open the tutorial workspace file: ${tutorialWorkspacePath}`,
);
await commandManager.execute("vscode.openFolder", tutorialWorkspaceUri);
}
}
}

View File

@@ -1,7 +1,7 @@
import * as semver from "semver";
import { runCodeQlCliCommand } from "./cli";
import { Logger } from "./common";
import { getErrorMessage } from "./pure/helpers-pure";
import { Logger } from "../common/logging";
import { getErrorMessage } from "../common/helpers-pure";
/**
* Get the version of a CodeQL CLI.

View File

@@ -6,29 +6,31 @@ import { dirname, join, delimiter } from "path";
import * as sarif from "sarif";
import { SemVer } from "semver";
import { Readable } from "stream";
import { StringDecoder } from "string_decoder";
import tk from "tree-kill";
import { promisify } from "util";
import { CancellationToken, Disposable, Uri } from "vscode";
import { BQRSInfo, DecodedBqrsChunk } from "./pure/bqrs-cli-types";
import { allowCanaryQueryServer, CliConfig } from "./config";
import { BQRSInfo, DecodedBqrsChunk } from "../common/bqrs-cli-types";
import { allowCanaryQueryServer, CliConfig } from "../config";
import {
DistributionProvider,
FindDistributionResultKind,
} from "./distribution";
import {
assertNever,
getChildProcessErrorMessage,
getErrorMessage,
getErrorStack,
} from "./pure/helpers-pure";
import { QueryMetadata, SortDirection } from "./pure/interface-types";
import { Logger, ProgressReporter } from "./common";
import { CompilationMessage } from "./pure/legacy-messages";
import { sarifParser } from "./sarif-parser";
import { walkDirectory } from "./helpers";
import { App } from "./common/app";
import { QueryLanguage } from "./common/query-language";
} from "../common/helpers-pure";
import { walkDirectory } from "../common/files";
import { QueryMetadata, SortDirection } from "../common/interface-types";
import { BaseLogger, Logger } from "../common/logging";
import { ProgressReporter } from "../common/logging/vscode";
import { CompilationMessage } from "../query-server/legacy-messages";
import { sarifParser } from "../common/sarif-parser";
import { App } from "../common/app";
import { QueryLanguage } from "../common/query-language";
import { LINE_ENDINGS, splitStreamAtSeparators } from "../common/split-stream";
/**
* The version of the SARIF format that we are using.
@@ -107,6 +109,30 @@ export type MlModelInfo = {
/** The expected output of `codeql resolve ml-models`. */
export type MlModelsInfo = { models: MlModelInfo[] };
/** Information about a data extension predicate, as resolved by `codeql resolve extensions`. */
export type DataExtensionResult = {
predicate: string;
file: string;
index: number;
};
/** The expected output of `codeql resolve extensions`. */
export type ResolveExtensionsResult = {
models: MlModelInfo[];
data: {
[path: string]: DataExtensionResult[];
};
};
export type GenerateExtensiblePredicateMetadataResult = {
// There are other properties in this object, but they are
// not relevant for its use in the extension, so we omit them.
extensible_predicates: Array<{
// pack relative path
path: string;
}>;
};
/**
* The expected output of `codeql resolve qlref`.
*/
@@ -119,6 +145,11 @@ export interface SourceInfo {
sourceLocationPrefix: string;
}
/**
* The expected output of `codeql resolve queries`.
*/
export type ResolvedQueries = string[];
/**
* The expected output of `codeql resolve tests`.
*/
@@ -134,6 +165,7 @@ export interface TestCompleted {
compilationMs: number;
evaluationMs: number;
expected: string;
actual?: string;
diff: string[] | undefined;
failureDescription?: string;
failureStage?: string;
@@ -155,6 +187,8 @@ export type OnLineCallback = (
line: string,
) => Promise<string | undefined> | string | undefined;
type VersionChangedListener = (newVersion: SemVer | undefined) => void;
/**
* This class manages a cli server started by `codeql execute cli-server` to
* run commands without the overhead of starting a new java
@@ -172,7 +206,9 @@ export class CodeQLCliServer implements Disposable {
nullBuffer: Buffer;
/** Version of current cli, lazily computed by the `getVersion()` method */
private _version: Promise<SemVer> | undefined;
private _version: SemVer | undefined;
private _versionChangedListeners: VersionChangedListener[] = [];
/**
* The languages supported by the current version of the CLI, computed by `getSupportedLanguages()`.
@@ -193,7 +229,7 @@ export class CodeQLCliServer implements Disposable {
private readonly app: App,
private distributionProvider: DistributionProvider,
private cliConfig: CliConfig,
private logger: Logger,
public readonly logger: Logger,
) {
this.commandQueue = [];
this.commandInProcess = false;
@@ -305,6 +341,7 @@ export class CodeQLCliServer implements Disposable {
commandArgs: string[],
description: string,
onLine?: OnLineCallback,
silent?: boolean,
): Promise<string> {
const stderrBuffers: Buffer[] = [];
if (this.commandInProcess) {
@@ -324,7 +361,12 @@ export class CodeQLCliServer implements Disposable {
// Compute the full args array
const args = command.concat(LOGGING_FLAGS).concat(commandArgs);
const argsString = args.join(" ");
void this.logger.log(`${description} using CodeQL CLI: ${argsString}...`);
// If we are running silently, we don't want to print anything to the console.
if (!silent) {
void this.logger.log(
`${description} using CodeQL CLI: ${argsString}...`,
);
}
try {
await new Promise<void>((resolve, reject) => {
// Start listening to stdout
@@ -370,24 +412,30 @@ export class CodeQLCliServer implements Disposable {
const fullBuffer = Buffer.concat(stdoutBuffers);
// Make sure we remove the terminator;
const data = fullBuffer.toString("utf8", 0, fullBuffer.length - 1);
void this.logger.log("CLI command succeeded.");
if (!silent) {
void this.logger.log("CLI command succeeded.");
}
return data;
} catch (err) {
// Kill the process if it isn't already dead.
this.killProcessIfRunning();
// Report the error (if there is a stderr then use that otherwise just report the error cod or nodejs error)
// Report the error (if there is a stderr then use that otherwise just report the error code or nodejs error)
const newError =
stderrBuffers.length === 0
? new Error(`${description} failed: ${err}`)
? new Error(
`${description} failed with args:${EOL} ${argsString}${EOL}${err}`,
)
: new Error(
`${description} failed: ${Buffer.concat(stderrBuffers).toString(
"utf8",
)}`,
`${description} failed with args:${EOL} ${argsString}${EOL}${Buffer.concat(
stderrBuffers,
).toString("utf8")}`,
);
newError.stack += getErrorStack(err);
throw newError;
} finally {
void this.logger.log(Buffer.concat(stderrBuffers).toString("utf8"));
if (!silent) {
void this.logger.log(Buffer.concat(stderrBuffers).toString("utf8"));
}
// Remove the listeners we set up.
process.stdout.removeAllListeners("data");
process.stderr.removeAllListeners("data");
@@ -424,7 +472,7 @@ export class CodeQLCliServer implements Disposable {
command: string[],
commandArgs: string[],
cancellationToken?: CancellationToken,
logger?: Logger,
logger?: BaseLogger,
): AsyncGenerator<string, void, unknown> {
// Add format argument first, in case commandArgs contains positional parameters.
const args = [...command, "--format", "jsonz", ...commandArgs];
@@ -432,6 +480,11 @@ export class CodeQLCliServer implements Disposable {
// Spawn the CodeQL process
const codeqlPath = await this.getCodeQlPath();
const childPromise = spawn(codeqlPath, args);
// Avoid a runtime message about unhandled rejection.
childPromise.catch(() => {
/**/
});
const child = childPromise.childProcess;
let cancellationRegistration: Disposable | undefined = undefined;
@@ -482,7 +535,7 @@ export class CodeQLCliServer implements Disposable {
logger,
}: {
cancellationToken?: CancellationToken;
logger?: Logger;
logger?: BaseLogger;
} = {},
): AsyncGenerator<EventType, void, unknown> {
for await (const event of this.runAsyncCodeQlCliCommandInternal(
@@ -495,9 +548,7 @@ export class CodeQLCliServer implements Disposable {
yield JSON.parse(event) as EventType;
} catch (err) {
throw new Error(
`Parsing output of ${description} failed: ${
(err as any).stderr || getErrorMessage(err)
}`,
`Parsing output of ${description} failed: ${getErrorMessage(err)}`,
);
}
}
@@ -519,9 +570,11 @@ export class CodeQLCliServer implements Disposable {
{
progressReporter,
onLine,
silent = false,
}: {
progressReporter?: ProgressReporter;
onLine?: OnLineCallback;
silent?: boolean;
} = {},
): Promise<string> {
if (progressReporter) {
@@ -537,6 +590,7 @@ export class CodeQLCliServer implements Disposable {
commandArgs,
description,
onLine,
silent,
).then(resolve, reject);
} catch (err) {
reject(err);
@@ -570,10 +624,12 @@ export class CodeQLCliServer implements Disposable {
addFormat = true,
progressReporter,
onLine,
silent = false,
}: {
addFormat?: boolean;
progressReporter?: ProgressReporter;
onLine?: OnLineCallback;
silent?: boolean;
} = {},
): Promise<OutputType> {
let args: string[] = [];
@@ -584,14 +640,13 @@ export class CodeQLCliServer implements Disposable {
const result = await this.runCodeQlCliCommand(command, args, description, {
progressReporter,
onLine,
silent,
});
try {
return JSON.parse(result) as OutputType;
} catch (err) {
throw new Error(
`Parsing output of ${description} failed: ${
(err as any).stderr || getErrorMessage(err)
}`,
`Parsing output of ${description} failed: ${getErrorMessage(err)}`,
);
}
}
@@ -670,6 +725,7 @@ export class CodeQLCliServer implements Disposable {
async resolveLibraryPath(
workspaces: string[],
queryPath: string,
silent = false,
): Promise<QuerySetup> {
const subcommandArgs = [
"--query",
@@ -680,6 +736,7 @@ export class CodeQLCliServer implements Disposable {
["resolve", "library-path"],
subcommandArgs,
"Resolving library paths",
{ silent },
);
}
@@ -706,6 +763,25 @@ export class CodeQLCliServer implements Disposable {
);
}
/**
* Finds all available queries in a given directory.
* @param queryDir Root of directory tree to search for queries.
* @param silent If true, don't print logs to the CodeQL extension log.
* @returns The list of queries that were found.
*/
public async resolveQueries(
queryDir: string,
silent?: boolean,
): Promise<ResolvedQueries> {
const subcommandArgs = [queryDir];
return await this.runJsonCodeQlCliCommand<ResolvedQueries>(
["resolve", "queries"],
subcommandArgs,
"Resolving queries",
{ silent },
);
}
/**
* Finds all available QL tests in a given directory.
* @param testPath Root of directory tree to search for tests.
@@ -761,7 +837,7 @@ export class CodeQLCliServer implements Disposable {
logger,
}: {
cancellationToken?: CancellationToken;
logger?: Logger;
logger?: BaseLogger;
},
): AsyncGenerator<TestCompleted, void, unknown> {
const subcommandArgs = this.cliConfig.additionalTestArguments.concat([
@@ -1006,6 +1082,7 @@ export class CodeQLCliServer implements Disposable {
resultsPath: string,
interpretedResultsPath: string,
sourceInfo?: SourceInfo,
args?: string[],
): Promise<sarif.Log> {
const additionalArgs = [
// TODO: This flag means that we don't group interpreted results
@@ -1013,6 +1090,7 @@ export class CodeQLCliServer implements Disposable {
// interpretation with and without this flag, or do some
// grouping client-side.
"--no-group-results",
...(args ?? []),
];
await this.runInterpretCommand(
@@ -1192,6 +1270,29 @@ export class CodeQLCliServer implements Disposable {
);
}
/**
* Gets information about available extensions
* @param suite The suite to resolve.
* @param additionalPacks A list of directories to search for qlpacks.
* @returns An object containing the list of models and extensions
*/
async resolveExtensions(
suite: string,
additionalPacks: string[],
): Promise<ResolveExtensionsResult> {
const args = this.getAdditionalPacksArg(additionalPacks);
args.push(suite);
return this.runJsonCodeQlCliCommand<ResolveExtensionsResult>(
["resolve", "extensions"],
args,
"Resolving extensions",
{
addFormat: false,
},
);
}
/**
* Gets information about the available languages.
* @returns A dictionary mapping language name to the directory it comes from
@@ -1333,21 +1434,13 @@ export class CodeQLCliServer implements Disposable {
async packPacklist(dir: string, includeQueries: boolean): Promise<string[]> {
const args = includeQueries ? [dir] : ["--no-include-queries", dir];
// since 2.7.1, packlist returns an object with a "paths" property that is a list of packs.
// previous versions return a list of packs.
const results: { paths: string[] } | string[] =
await this.runJsonCodeQlCliCommand(
["pack", "packlist"],
args,
"Generating the pack list",
);
const results: { paths: string[] } = await this.runJsonCodeQlCliCommand(
["pack", "packlist"],
args,
"Generating the pack list",
);
// Once we no longer need to support 2.7.0 or earlier, we can remove this and assume all versions return an object.
if ("paths" in results) {
return results.paths;
} else {
return results;
}
return results.paths;
}
async packResolveDependencies(
@@ -1371,17 +1464,56 @@ export class CodeQLCliServer implements Disposable {
);
}
async generateExtensiblePredicateMetadata(
packRoot: string,
): Promise<GenerateExtensiblePredicateMetadataResult> {
return await this.runJsonCodeQlCliCommand(
["generate", "extensible-predicate-metadata"],
[packRoot],
"Generating extensible predicate metadata",
{ addFormat: false },
);
}
public async getVersion() {
if (!this._version) {
this._version = this.refreshVersion();
// this._version is only undefined upon config change, so we reset CLI-based context key only when necessary.
await this.app.commands.execute(
"setContext",
"codeql.supportsEvalLog",
await this.cliConstraints.supportsPerQueryEvalLog(),
);
try {
const newVersion = await this.refreshVersion();
this._version = newVersion;
this._versionChangedListeners.forEach((listener) =>
listener(newVersion),
);
// this._version is only undefined upon config change, so we reset CLI-based context key only when necessary.
await this.app.commands.execute(
"setContext",
"codeql.supportsQuickEvalCount",
newVersion.compare(
CliVersionConstraint.CLI_VERSION_WITH_QUICK_EVAL_COUNT,
) >= 0,
);
await this.app.commands.execute(
"setContext",
"codeql.supportsTrimCache",
newVersion.compare(
CliVersionConstraint.CLI_VERSION_WITH_TRIM_CACHE,
) >= 0,
);
} catch (e) {
this._versionChangedListeners.forEach((listener) =>
listener(undefined),
);
throw e;
}
}
return await this._version;
return this._version;
}
public addVersionChangedListener(listener: VersionChangedListener) {
if (this._version) {
listener(this._version);
}
this._versionChangedListeners.push(listener);
}
private async refreshVersion() {
@@ -1456,10 +1588,23 @@ export function spawnServer(
);
}
let lastStdout: any = undefined;
child.stdout!.on("data", (data) => {
lastStdout = data;
});
// Set up event listeners.
child.on("close", (code) =>
logger.log(`Child process exited with code ${code}`),
);
child.on("close", async (code, signal) => {
if (code !== null)
void logger.log(`Child process exited with code ${code}`);
if (signal)
void logger.log(
`Child process exited due to receipt of signal ${signal}`,
);
// If the process exited abnormally, log the last stdout message,
// It may be from the jvm.
if (code !== 0 && lastStdout !== undefined)
void logger.log(`Last stdout was "${lastStdout.toString()}"`);
});
child.stderr!.on("data", stderrListener);
if (stdoutListener !== undefined) {
child.stdout!.on("data", stdoutListener);
@@ -1506,155 +1651,49 @@ export async function runCodeQlCliCommand(
return result.stdout;
} catch (err) {
throw new Error(
`${description} failed: ${(err as any).stderr || getErrorMessage(err)}`,
`${description} failed: ${getChildProcessErrorMessage(err)}`,
);
}
}
/**
* Buffer to hold state used when splitting a text stream into lines.
*/
class SplitBuffer {
private readonly decoder = new StringDecoder("utf8");
private readonly maxSeparatorLength: number;
private buffer = "";
private searchIndex = 0;
constructor(private readonly separators: readonly string[]) {
this.maxSeparatorLength = separators
.map((s) => s.length)
.reduce((a, b) => Math.max(a, b), 0);
}
/**
* Append new text data to the buffer.
* @param chunk The chunk of data to append.
*/
public addChunk(chunk: Buffer): void {
this.buffer += this.decoder.write(chunk);
}
/**
* Signal that the end of the input stream has been reached.
*/
public end(): void {
this.buffer += this.decoder.end();
this.buffer += this.separators[0]; // Append a separator to the end to ensure the last line is returned.
}
/**
* A version of startsWith that isn't overriden by a broken version of ms-python.
*
* The definition comes from
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
* which is CC0/public domain
*
* See https://github.com/github/vscode-codeql/issues/802 for more context as to why we need it.
*/
private static startsWith(
s: string,
searchString: string,
position: number,
): boolean {
const pos = position > 0 ? position | 0 : 0;
return s.substring(pos, pos + searchString.length) === searchString;
}
/**
* Extract the next full line from the buffer, if one is available.
* @returns The text of the next available full line (without the separator), or `undefined` if no
* line is available.
*/
public getNextLine(): string | undefined {
while (this.searchIndex <= this.buffer.length - this.maxSeparatorLength) {
for (const separator of this.separators) {
if (SplitBuffer.startsWith(this.buffer, separator, this.searchIndex)) {
const line = this.buffer.slice(0, this.searchIndex);
this.buffer = this.buffer.slice(this.searchIndex + separator.length);
this.searchIndex = 0;
return line;
}
}
this.searchIndex++;
}
return undefined;
}
}
/**
* Splits a text stream into lines based on a list of valid line separators.
* @param stream The text stream to split. This stream will be fully consumed.
* @param separators The list of strings that act as line separators.
* @returns A sequence of lines (not including separators).
*/
async function* splitStreamAtSeparators(
stream: Readable,
separators: string[],
): AsyncGenerator<string, void, unknown> {
const buffer = new SplitBuffer(separators);
for await (const chunk of stream) {
buffer.addChunk(chunk);
let line: string | undefined;
do {
line = buffer.getNextLine();
if (line !== undefined) {
yield line;
}
} while (line !== undefined);
}
buffer.end();
let line: string | undefined;
do {
line = buffer.getNextLine();
if (line !== undefined) {
yield line;
}
} while (line !== undefined);
}
/**
* Standard line endings for splitting human-readable text.
*/
const lineEndings = ["\r\n", "\r", "\n"];
/**
* Log a text stream to a `Logger` interface.
* @param stream The stream to log.
* @param logger The logger that will consume the stream output.
*/
async function logStream(stream: Readable, logger: Logger): Promise<void> {
for await (const line of splitStreamAtSeparators(stream, lineEndings)) {
async function logStream(stream: Readable, logger: BaseLogger): Promise<void> {
for await (const line of splitStreamAtSeparators(stream, LINE_ENDINGS)) {
// Await the result of log here in order to ensure the logs are written in the correct order.
await logger.log(line);
}
}
export function shouldDebugIdeServer() {
function isEnvTrue(name: string): boolean {
return (
"IDE_SERVER_JAVA_DEBUG" in process.env &&
process.env.IDE_SERVER_JAVA_DEBUG !== "0" &&
process.env.IDE_SERVER_JAVA_DEBUG?.toLocaleLowerCase() !== "false"
name in process.env &&
process.env[name] !== "0" &&
// Use en-US since we expect the value to be either "false" or "FALSE", not a localized version.
process.env[name]?.toLocaleLowerCase("en-US") !== "false"
);
}
export function shouldDebugIdeServer() {
return isEnvTrue("IDE_SERVER_JAVA_DEBUG");
}
export function shouldDebugQueryServer() {
return (
"QUERY_SERVER_JAVA_DEBUG" in process.env &&
process.env.QUERY_SERVER_JAVA_DEBUG !== "0" &&
process.env.QUERY_SERVER_JAVA_DEBUG?.toLocaleLowerCase() !== "false"
);
return isEnvTrue("QUERY_SERVER_JAVA_DEBUG");
}
export function shouldDebugCliServer() {
return (
"CLI_SERVER_JAVA_DEBUG" in process.env &&
process.env.CLI_SERVER_JAVA_DEBUG !== "0" &&
process.env.CLI_SERVER_JAVA_DEBUG?.toLocaleLowerCase() !== "false"
);
return isEnvTrue("CLI_SERVER_JAVA_DEBUG");
}
export class CliVersionConstraint {
// The oldest version of the CLI that we support. This is used to determine
// whether to show a warning about the CLI being too old on startup.
public static OLDEST_SUPPORTED_CLI_VERSION = new SemVer("2.9.4");
/**
* CLI version where building QLX packs for remote queries is supported.
* (The options were _accepted_ by a few earlier versions, but only from
@@ -1670,21 +1709,9 @@ export class CliVersionConstraint {
);
/**
* CLI version where the `--evaluator-log` and related options to the query server were introduced,
* on a per-query server basis.
* CLI version where the `resolve extensions` subcommand exists.
*/
public static CLI_VERSION_WITH_STRUCTURED_EVAL_LOG = new SemVer("2.8.2");
/**
* CLI version that supports rotating structured logs to produce one per query.
*
* Note that 2.8.4 supports generating the evaluation logs and summaries,
* but 2.9.0 includes a new option to produce the end-of-query summary logs to
* the query server console. For simplicity we gate all features behind 2.9.0,
* but if a user is tied to the 2.8 release, we can enable evaluator logs
* and summaries for them.
*/
public static CLI_VERSION_WITH_PER_QUERY_EVAL_LOG = new SemVer("2.9.0");
public static CLI_VERSION_WITH_RESOLVE_EXTENSIONS = new SemVer("2.10.2");
/**
* CLI version that supports the `--sourcemap` option for log generation.
@@ -1713,6 +1740,34 @@ export class CliVersionConstraint {
"2.12.4",
);
public static CLI_VERSION_GLOBAL_CACHE = new SemVer("2.12.4");
/**
* CLI version where the query server supports quick-eval count mode.
*/
public static CLI_VERSION_WITH_QUICK_EVAL_COUNT = new SemVer("2.13.3");
/**
* CLI version where the `generate extensible-predicate-metadata`
* command was implemented.
*/
public static CLI_VERSION_WITH_EXTENSIBLE_PREDICATE_METADATA = new SemVer(
"2.14.3",
);
/**
* CLI version where the langauge server supports visisbility change notifications.
*/
public static CLI_VERSION_WITH_VISIBILITY_NOTIFICATIONS = new SemVer(
"2.14.0",
);
/**
* CLI version where the query server supports the `evaluation/trimCache` method
* with `codeql database cleanup --mode=trim` semantics.
*/
public static CLI_VERSION_WITH_TRIM_CACHE = new SemVer("2.15.1");
constructor(private readonly cli: CodeQLCliServer) {
/**/
}
@@ -1731,15 +1786,9 @@ export class CliVersionConstraint {
);
}
async supportsStructuredEvalLog() {
async supportsResolveExtensions() {
return this.isVersionAtLeast(
CliVersionConstraint.CLI_VERSION_WITH_STRUCTURED_EVAL_LOG,
);
}
async supportsPerQueryEvalLog() {
return this.isVersionAtLeast(
CliVersionConstraint.CLI_VERSION_WITH_PER_QUERY_EVAL_LOG,
CliVersionConstraint.CLI_VERSION_WITH_RESOLVE_EXTENSIONS,
);
}
@@ -1782,4 +1831,26 @@ export class CliVersionConstraint {
CliVersionConstraint.CLI_VERSION_WITH_ADDITIONAL_PACKS_INSTALL,
);
}
async usesGlobalCompilationCache() {
return this.isVersionAtLeast(CliVersionConstraint.CLI_VERSION_GLOBAL_CACHE);
}
async supportsVisibilityNotifications() {
return this.isVersionAtLeast(
CliVersionConstraint.CLI_VERSION_WITH_VISIBILITY_NOTIFICATIONS,
);
}
async supportsQuickEvalCount() {
return this.isVersionAtLeast(
CliVersionConstraint.CLI_VERSION_WITH_QUICK_EVAL_COUNT,
);
}
async supportsGenerateExtensiblePredicateMetadata() {
return this.isVersionAtLeast(
CliVersionConstraint.CLI_VERSION_WITH_EXTENSIBLE_PREDICATE_METADATA,
);
}
}

View File

@@ -3,24 +3,29 @@ import { pathExists, mkdtemp, createWriteStream, remove } from "fs-extra";
import { tmpdir } from "os";
import { delimiter, dirname, join } from "path";
import * as semver from "semver";
import { parse } from "url";
import { URL } from "url";
import { ExtensionContext, Event } from "vscode";
import { DistributionConfig } from "./config";
import {
InvocationRateLimiter,
InvocationRateLimiterResultKind,
showAndLogErrorMessage,
showAndLogWarningMessage,
} from "./helpers";
import { extLogger } from "./common";
import { DistributionConfig } from "../config";
import { extLogger } from "../common/logging/vscode";
import { getCodeQlCliVersion } from "./cli-version";
import { ProgressCallback, reportStreamProgress } from "./progress";
import {
ProgressCallback,
reportStreamProgress,
} from "../common/vscode/progress";
import {
codeQlLauncherName,
deprecatedCodeQlLauncherName,
extractZipArchive,
getRequiredAssetName,
} from "./pure/distribution";
} from "../common/distribution";
import {
InvocationRateLimiter,
InvocationRateLimiterResultKind,
} from "../common/invocation-rate-limiter";
import {
showAndLogErrorMessage,
showAndLogWarningMessage,
} from "../common/logging";
/**
* distribution.ts
@@ -73,7 +78,7 @@ export class DistributionManager implements DistributionProvider {
extensionContext,
);
this.updateCheckRateLimiter = new InvocationRateLimiter(
extensionContext,
extensionContext.globalState,
"extensionSpecificDistributionUpdateCheck",
() =>
this.extensionSpecificDistributionManager.checkForUpdatesToDistribution(),
@@ -155,6 +160,7 @@ export class DistributionManager implements DistributionProvider {
if (this.config.customCodeQlPath) {
if (!(await pathExists(this.config.customCodeQlPath))) {
void showAndLogErrorMessage(
extLogger,
`The CodeQL executable path is specified as "${this.config.customCodeQlPath}" ` +
"by a configuration setting, but a CodeQL executable could not be found at that path. Please check " +
"that a CodeQL executable exists at the specified path or remove the setting.",
@@ -502,7 +508,7 @@ class ExtensionSpecificDistributionManager {
0,
) || "";
return join(
this.extensionContext.globalStoragePath,
this.extensionContext.globalStorageUri.fsPath,
ExtensionSpecificDistributionManager._currentDistributionFolderBaseName +
distributionFolderIndex,
);
@@ -667,7 +673,7 @@ export class ReleasesApiConsumer {
redirectUrl &&
redirectCount < ReleasesApiConsumer._maxRedirects
) {
const parsedRedirectUrl = parse(redirectUrl);
const parsedRedirectUrl = new URL(redirectUrl);
if (parsedRedirectUrl.protocol !== "https:") {
throw new Error("Encountered a non-https redirect, rejecting");
}
@@ -712,7 +718,7 @@ export enum DistributionKind {
PathEnvironmentVariable,
}
export interface Distribution {
interface Distribution {
codeQlPath: string;
kind: DistributionKind;
}
@@ -770,22 +776,22 @@ type DistributionUpdateCheckResult =
| InvalidLocationResult
| UpdateAvailableResult;
export interface AlreadyCheckedRecentlyResult {
interface AlreadyCheckedRecentlyResult {
kind: DistributionUpdateCheckResultKind.AlreadyCheckedRecentlyResult;
}
export interface AlreadyUpToDateResult {
interface AlreadyUpToDateResult {
kind: DistributionUpdateCheckResultKind.AlreadyUpToDate;
}
/**
* The distribution could not be installed or updated because it is not managed by the extension.
*/
export interface InvalidLocationResult {
interface InvalidLocationResult {
kind: DistributionUpdateCheckResultKind.InvalidLocation;
}
export interface UpdateAvailableResult {
interface UpdateAvailableResult {
kind: DistributionUpdateCheckResultKind.UpdateAvailable;
updatedRelease: Release;
}
@@ -847,6 +853,7 @@ export async function getExecutableFromDirectory(
function warnDeprecatedLauncher() {
void showAndLogWarningMessage(
extLogger,
`The "${deprecatedCodeQlLauncherName()!}" launcher has been deprecated and will be removed in a future version. ` +
`Please use "${codeQlLauncherName()}" instead. It is recommended to update to the latest CodeQL binaries.`,
);
@@ -855,7 +862,7 @@ function warnDeprecatedLauncher() {
/**
* A release on GitHub.
*/
export interface Release {
interface Release {
assets: ReleaseAsset[];
/**
@@ -877,7 +884,7 @@ export interface Release {
/**
* An asset corresponding to a release on GitHub.
*/
export interface ReleaseAsset {
interface ReleaseAsset {
/**
* The id associated with the asset on GitHub.
*/
@@ -947,7 +954,10 @@ export interface GithubReleaseAsset {
}
export class GithubApiError extends Error {
constructor(public status: number, public body: string) {
constructor(
public status: number,
public body: string,
) {
super(`API call failed with status code ${status}, body: ${body}`);
}
}

View File

@@ -0,0 +1,80 @@
import { CodeQLCliServer } from "./cli";
import { Uri, window } from "vscode";
import { isQueryLanguage, QueryLanguage } from "../common/query-language";
import { getOnDiskWorkspaceFolders } from "../common/vscode/workspace-folders";
import { extLogger } from "../common/logging/vscode";
import { UserCancellationException } from "../common/vscode/progress";
import { showAndLogErrorMessage } from "../common/logging";
/**
* Finds the language that a query targets.
* If it can't be autodetected, prompt the user to specify the language manually.
*/
export async function findLanguage(
cliServer: CodeQLCliServer,
queryUri: Uri | undefined,
): Promise<QueryLanguage | undefined> {
const uri = queryUri || window.activeTextEditor?.document.uri;
if (uri !== undefined) {
try {
const queryInfo = await cliServer.resolveQueryByLanguage(
getOnDiskWorkspaceFolders(),
uri,
);
const language = Object.keys(queryInfo.byLanguage)[0];
void extLogger.log(`Detected query language: ${language}`);
if (isQueryLanguage(language)) {
return language;
}
void extLogger.log(
"Query language is unsupported. Select language manually.",
);
} catch (e) {
void extLogger.log(
"Could not autodetect query language. Select language manually.",
);
}
}
// will be undefined if user cancels the quick pick.
return await askForLanguage(cliServer, false);
}
export async function askForLanguage(
cliServer: CodeQLCliServer,
throwOnEmpty = true,
): Promise<QueryLanguage | undefined> {
const language = await window.showQuickPick(
await cliServer.getSupportedLanguages(),
{
placeHolder: "Select target language for your query",
ignoreFocusOut: true,
},
);
if (!language) {
// This only happens if the user cancels the quick pick.
if (throwOnEmpty) {
throw new UserCancellationException("Cancelled.");
} else {
void showAndLogErrorMessage(
extLogger,
"Language not found. Language must be specified manually.",
);
}
return undefined;
}
if (!isQueryLanguage(language)) {
void showAndLogErrorMessage(
extLogger,
`Language '${language}' is not supported. Only languages ${Object.values(
QueryLanguage,
).join(", ")} are supported.`,
);
return undefined;
}
return language;
}

View File

@@ -0,0 +1,22 @@
import { CodeQLCliServer } from "./cli";
import { QueryMetadata } from "../common/interface-types";
import { extLogger } from "../common/logging/vscode";
/**
* Gets metadata for a query, if it exists.
* @param cliServer The CLI server.
* @param queryPath The path to the query.
* @returns A promise that resolves to the query metadata, if available.
*/
export async function tryGetQueryMetadata(
cliServer: CodeQLCliServer,
queryPath: string,
): Promise<QueryMetadata | undefined> {
try {
return await cliServer.resolveMetadata(queryPath);
} catch (e) {
// Ignore errors and provide no metadata.
void extLogger.log(`Couldn't resolve metadata for ${queryPath}: ${e}`);
return;
}
}

View File

@@ -1,14 +1,16 @@
import { Credentials } from "./authentication";
import { Disposable } from "../pure/disposable-object";
import { Disposable } from "./disposable-object";
import { AppEventEmitter } from "./events";
import { Logger } from "./logging";
import { NotificationLogger } from "./logging";
import { Memento } from "./memento";
import { AppCommandManager } from "./commands";
import { AppTelemetry } from "./telemetry";
export interface App {
createEventEmitter<T>(): AppEventEmitter<T>;
readonly mode: AppMode;
readonly logger: Logger;
readonly logger: NotificationLogger;
readonly telemetry?: AppTelemetry;
readonly subscriptions: Disposable[];
readonly extensionPath: string;
readonly globalStoragePath: string;
@@ -16,6 +18,7 @@ export interface App {
readonly workspaceState: Memento;
readonly credentials: Credentials;
readonly commands: AppCommandManager;
readonly environment: EnvironmentContext;
}
export enum AppMode {
@@ -23,3 +26,7 @@ export enum AppMode {
Development = 2,
Test = 3,
}
export interface EnvironmentContext {
language: string;
}

View File

@@ -1,5 +1,3 @@
export const PAGE_SIZE = 1000;
/**
* The single-character codes used in the bqrs format for the the kind
* of a result column. This namespace is intentionally not an enum, see
@@ -15,7 +13,7 @@ export namespace ColumnKindCode {
export const ENTITY = "e";
}
export type ColumnKind =
type ColumnKind =
| typeof ColumnKindCode.FLOAT
| typeof ColumnKindCode.INTEGER
| typeof ColumnKindCode.STRING
@@ -46,7 +44,7 @@ export function getResultSetSchema(
}
return undefined;
}
export interface PaginationInfo {
interface PaginationInfo {
"step-size": number;
offsets: number[];
}
@@ -115,7 +113,7 @@ export type BqrsKind =
| "Entity";
interface BqrsColumn {
name: string;
name?: string;
kind: BqrsKind;
}
export interface DecodedBqrsChunk {

View File

@@ -4,7 +4,7 @@ import {
LineColumnLocation,
WholeFileLocation,
} from "./bqrs-cli-types";
import { createRemoteFileRef } from "./location-link-utils";
import { createRemoteFileRef } from "../common/location-link-utils";
/**
* The CodeQL filesystem libraries use this pattern in `getURL()` predicates
@@ -142,5 +142,7 @@ export function tryGetRemoteLocation(
fileLink,
resolvableLocation.startLine,
resolvableLocation.endLine,
resolvableLocation.startColumn,
resolvableLocation.endColumn,
);
}

View File

@@ -1,30 +1,53 @@
import type { CommandManager } from "../packages/commands";
import type { Uri, Range, TextDocumentShowOptions } from "vscode";
import type { AstItem } from "../astViewer";
import type { AstItem } from "../language-support";
import type { DbTreeViewItem } from "../databases/ui/db-tree-view-item";
import type { DatabaseItem } from "../local-databases";
import type { DatabaseItem } from "../databases/local-databases";
import type { QueryHistoryInfo } from "../query-history/query-history-info";
import type { RepositoriesFilterSortStateWithIds } from "../pure/variant-analysis-filter-sort";
import type { TestTreeNode } from "../test-tree-node";
import type { TestTreeNode } from "../query-testing/test-tree-node";
import type {
VariantAnalysis,
VariantAnalysisScannedRepository,
VariantAnalysisScannedRepositoryResult,
} from "../variant-analysis/shared/variant-analysis";
import type { QLDebugConfiguration } from "../debugger/debug-configuration";
import type { QueryTreeViewItem } from "../queries-panel/query-tree-view-item";
import type { LanguageSelectionTreeViewItem } from "../language-selection-panel/language-selection-data-provider";
import type { Method, Usage } from "../model-editor/method";
// A command function matching the signature that VS Code calls when
// a command on a selection is invoked.
export type SelectionCommandFunction<Item> = (
// a command is invoked from a context menu on a TreeView with
// canSelectMany set to true.
//
// singleItem will always be defined and corresponds to the item that
// was hovered or right-clicked. If precisely one item was selected then
// multiSelect will be undefined. If more than one item is selected then
// multiSelect will contain all selected items, including singleItem.
export type TreeViewContextMultiSelectionCommandFunction<Item> = (
singleItem: Item,
multiSelect: Item[],
multiSelect: Item[] | undefined,
) => Promise<void>;
// A command function matching the signature that VS Code calls when
// a command on a selection is invoked when canSelectMany is false.
export type SingleSelectionCommandFunction<Item> = (
// a command is invoked from a context menu on a TreeView with
// canSelectMany set to false.
//
// It is guaranteed that precisely one item will be selected.
export type TreeViewContextSingleSelectionCommandFunction<Item> = (
singleItem: Item,
) => Promise<void>;
// A command function matching the signature that VS Code calls when
// a command is invoked from a context menu on the file explorer.
//
// singleItem corresponds to the item that was right-clicked.
// multiSelect will always been defined and non-empty and contains
// all selected items, including singleItem.
export type ExplorerSelectionCommandFunction<Item> = (
singleItem: Item,
multiSelect: Item[],
) => Promise<void>;
/**
* Contains type definitions for all commands used by the extension.
*
@@ -34,10 +57,11 @@ export type SingleSelectionCommandFunction<Item> = (
// Builtin commands where the implementation is provided by VS Code and not by this extension.
// See https://code.visualstudio.com/api/references/commands
export type BuiltInVsCodeCommands = {
type BuiltInVsCodeCommands = {
// The codeQLDatabases.focus command is provided by VS Code because we've registered the custom view
"codeQLDatabases.focus": () => Promise<void>;
"markdown.showPreviewToSide": (uri: Uri) => Promise<void>;
"workbench.action.closeActiveEditor": () => Promise<void>;
revealFileInOS: (uri: Uri) => Promise<void>;
setContext: (
key: `${"codeql" | "codeQL"}${string}`,
@@ -52,6 +76,16 @@ export type BuiltInVsCodeCommands = {
) => Promise<void>;
"vscode.open": (uri: Uri) => Promise<void>;
"vscode.openFolder": (uri: Uri) => Promise<void>;
revealInExplorer: (uri: Uri) => Promise<void>;
// We type the `config` property specifically as a CodeQL debug configuration, since that's the
// only kinds we specify anyway.
"workbench.action.debug.start": (options?: {
config?: Partial<QLDebugConfiguration>;
noDebug?: boolean;
}) => Promise<void>;
"workbench.action.debug.stepInto": () => Promise<void>;
"workbench.action.debug.stepOver": () => Promise<void>;
"workbench.action.debug.stepOut": () => Promise<void>;
};
// Commands that are available before the extension is fully activated.
@@ -71,6 +105,7 @@ export type BaseCommands = {
"codeQL.restartQueryServer": () => Promise<void>;
"codeQL.restartQueryServerOnConfigChange": () => Promise<void>;
"codeQL.restartLegacyQueryServerOnConfigChange": () => Promise<void>;
"codeQL.restartQueryServerOnExternalConfigChange": () => Promise<void>;
};
// Commands used when working with queries in the editor
@@ -83,6 +118,10 @@ export type QueryEditorCommands = {
selectedQuery: Uri,
) => Promise<void>;
"codeQL.previewQueryHelp": (selectedQuery: Uri) => Promise<void>;
"codeQL.previewQueryHelpContextEditor": (selectedQuery: Uri) => Promise<void>;
"codeQL.previewQueryHelpContextExplorer": (
selectedQuery: Uri,
) => Promise<void>;
};
// Commands used for running local queries
@@ -93,11 +132,30 @@ export type LocalQueryCommands = {
"codeQL.runQueryOnMultipleDatabasesContextEditor": (
uri?: Uri,
) => Promise<void>;
"codeQL.runQueries": SelectionCommandFunction<Uri>;
"codeQLQueries.runLocalQueryFromQueriesPanel": TreeViewContextSingleSelectionCommandFunction<QueryTreeViewItem>;
"codeQLQueries.runLocalQueryContextMenu": TreeViewContextSingleSelectionCommandFunction<QueryTreeViewItem>;
"codeQLQueries.runLocalQueriesContextMenu": TreeViewContextSingleSelectionCommandFunction<QueryTreeViewItem>;
"codeQLQueries.runLocalQueriesFromPanel": TreeViewContextSingleSelectionCommandFunction<QueryTreeViewItem>;
"codeQLQueries.createQuery": () => Promise<void>;
"codeQL.runLocalQueryFromFileTab": (uri: Uri) => Promise<void>;
"codeQL.runQueries": ExplorerSelectionCommandFunction<Uri>;
"codeQL.quickEval": (uri: Uri) => Promise<void>;
"codeQL.quickEvalCount": (uri: Uri) => Promise<void>;
"codeQL.quickEvalContextEditor": (uri: Uri) => Promise<void>;
"codeQL.codeLensQuickEval": (uri: Uri, range: Range) => Promise<void>;
"codeQL.quickQuery": () => Promise<void>;
"codeQL.getCurrentQuery": () => Promise<string>;
"codeQL.createQuery": () => Promise<void>;
};
// Debugger commands
export type DebuggerCommands = {
"codeQL.debugQuery": (uri: Uri | undefined) => Promise<void>;
"codeQL.debugQueryContextEditor": (uri: Uri) => Promise<void>;
"codeQL.startDebuggingSelection": () => Promise<void>;
"codeQL.startDebuggingSelectionContextEditor": () => Promise<void>;
"codeQL.continueDebuggingSelection": () => Promise<void>;
"codeQL.continueDebuggingSelectionContextEditor": () => Promise<void>;
};
export type ResultsViewCommands = {
@@ -117,33 +175,38 @@ export type QueryHistoryCommands = {
"codeQLQueryHistory.sortByCount": () => Promise<void>;
// Commands in the context menu or in the hover menu
"codeQLQueryHistory.openQueryTitleMenu": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.openQueryContextMenu": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.removeHistoryItemTitleMenu": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.removeHistoryItemContextMenu": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.removeHistoryItemContextInline": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.renameItem": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.compareWith": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.showEvalLog": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.showEvalLogSummary": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.showEvalLogViewer": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.showQueryLog": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.showQueryText": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.openQueryDirectory": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.cancel": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.exportResults": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.viewCsvResults": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.viewCsvAlerts": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.viewSarifAlerts": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.viewDil": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.itemClicked": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.openOnGithub": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.copyRepoList": SelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.openQueryContextMenu": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.removeHistoryItemContextMenu": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.removeHistoryItemContextInline": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.renameItem": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.compareWith": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.showEvalLog": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.showEvalLogSummary": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.showEvalLogViewer": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.showQueryLog": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.showQueryText": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.openQueryDirectory": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.cancel": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.exportResults": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.viewCsvResults": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.viewCsvAlerts": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.viewSarifAlerts": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.viewDil": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.itemClicked": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.openOnGithub": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
"codeQLQueryHistory.copyRepoList": TreeViewContextMultiSelectionCommandFunction<QueryHistoryInfo>;
// Commands in the command palette
"codeQL.exportSelectedVariantAnalysisResults": () => Promise<void>;
};
// Commands user for the language selector panel
export type LanguageSelectionCommands = {
"codeQLLanguageSelection.setSelectedItem": (
item: LanguageSelectionTreeViewItem,
) => Promise<void>;
};
// Commands used for the local databases panel
export type LocalDatabasesCommands = {
// Command palette commands
@@ -153,6 +216,7 @@ export type LocalDatabasesCommands = {
"codeQL.chooseDatabaseGithub": () => Promise<void>;
"codeQL.upgradeCurrentDatabase": () => Promise<void>;
"codeQL.clearCache": () => Promise<void>;
"codeQL.trimCache": () => Promise<void>;
// Explorer context menu
"codeQL.setCurrentDatabase": (uri: Uri) => Promise<void>;
@@ -163,6 +227,7 @@ export type LocalDatabasesCommands = {
"codeQLDatabases.chooseDatabaseInternet": () => Promise<void>;
"codeQLDatabases.chooseDatabaseGithub": () => Promise<void>;
"codeQLDatabases.sortByName": () => Promise<void>;
"codeQLDatabases.sortByLanguage": () => Promise<void>;
"codeQLDatabases.sortByDateAdded": () => Promise<void>;
// Database panel context menu
@@ -171,17 +236,18 @@ export type LocalDatabasesCommands = {
) => Promise<void>;
// Database panel selection commands
"codeQLDatabases.removeDatabase": SelectionCommandFunction<DatabaseItem>;
"codeQLDatabases.upgradeDatabase": SelectionCommandFunction<DatabaseItem>;
"codeQLDatabases.renameDatabase": SelectionCommandFunction<DatabaseItem>;
"codeQLDatabases.openDatabaseFolder": SelectionCommandFunction<DatabaseItem>;
"codeQLDatabases.addDatabaseSource": SelectionCommandFunction<DatabaseItem>;
"codeQLDatabases.removeDatabase": TreeViewContextMultiSelectionCommandFunction<DatabaseItem>;
"codeQLDatabases.upgradeDatabase": TreeViewContextMultiSelectionCommandFunction<DatabaseItem>;
"codeQLDatabases.renameDatabase": TreeViewContextMultiSelectionCommandFunction<DatabaseItem>;
"codeQLDatabases.openDatabaseFolder": TreeViewContextMultiSelectionCommandFunction<DatabaseItem>;
"codeQLDatabases.addDatabaseSource": TreeViewContextMultiSelectionCommandFunction<DatabaseItem>;
// Codespace template commands
"codeQL.setDefaultTourDatabase": () => Promise<void>;
// Internal commands
"codeQLDatabases.removeOrphanedDatabases": () => Promise<void>;
"codeQL.getCurrentDatabase": () => Promise<string | undefined>;
};
// Commands tied to variant analysis
@@ -190,10 +256,6 @@ export type VariantAnalysisCommands = {
scannedRepo: VariantAnalysisScannedRepository,
variantAnalysisSummary: VariantAnalysis,
) => Promise<void>;
"codeQL.copyVariantAnalysisRepoList": (
variantAnalysisId: number,
filterSort?: RepositoriesFilterSortStateWithIds,
) => Promise<void>;
"codeQL.loadVariantAnalysisRepoResults": (
variantAnalysisId: number,
repositoryFullName: string,
@@ -204,6 +266,9 @@ export type VariantAnalysisCommands = {
"codeQL.monitorRehydratedVariantAnalysis": (
variantAnalysis: VariantAnalysis,
) => Promise<void>;
"codeQL.monitorReauthenticatedVariantAnalysis": (
variantAnalysis: VariantAnalysis,
) => Promise<void>;
"codeQL.openVariantAnalysisLogs": (
variantAnalysisId: number,
) => Promise<void>;
@@ -212,6 +277,7 @@ export type VariantAnalysisCommands = {
) => Promise<void>;
"codeQL.runVariantAnalysis": (uri?: Uri) => Promise<void>;
"codeQL.runVariantAnalysisContextEditor": (uri?: Uri) => Promise<void>;
"codeQLQueries.runVariantAnalysisContextMenu": TreeViewContextSingleSelectionCommandFunction<QueryTreeViewItem>;
};
export type DatabasePanelCommands = {
@@ -220,11 +286,12 @@ export type DatabasePanelCommands = {
"codeQLVariantAnalysisRepositories.addNewList": () => Promise<void>;
"codeQLVariantAnalysisRepositories.setupControllerRepository": () => Promise<void>;
"codeQLVariantAnalysisRepositories.setSelectedItem": SingleSelectionCommandFunction<DbTreeViewItem>;
"codeQLVariantAnalysisRepositories.setSelectedItemContextMenu": SingleSelectionCommandFunction<DbTreeViewItem>;
"codeQLVariantAnalysisRepositories.openOnGitHubContextMenu": SingleSelectionCommandFunction<DbTreeViewItem>;
"codeQLVariantAnalysisRepositories.renameItemContextMenu": SingleSelectionCommandFunction<DbTreeViewItem>;
"codeQLVariantAnalysisRepositories.removeItemContextMenu": SingleSelectionCommandFunction<DbTreeViewItem>;
"codeQLVariantAnalysisRepositories.setSelectedItem": TreeViewContextSingleSelectionCommandFunction<DbTreeViewItem>;
"codeQLVariantAnalysisRepositories.setSelectedItemContextMenu": TreeViewContextSingleSelectionCommandFunction<DbTreeViewItem>;
"codeQLVariantAnalysisRepositories.openOnGitHubContextMenu": TreeViewContextSingleSelectionCommandFunction<DbTreeViewItem>;
"codeQLVariantAnalysisRepositories.renameItemContextMenu": TreeViewContextSingleSelectionCommandFunction<DbTreeViewItem>;
"codeQLVariantAnalysisRepositories.removeItemContextMenu": TreeViewContextSingleSelectionCommandFunction<DbTreeViewItem>;
"codeQLVariantAnalysisRepositories.importFromCodeSearch": TreeViewContextSingleSelectionCommandFunction<DbTreeViewItem>;
};
export type AstCfgCommands = {
@@ -246,8 +313,14 @@ export type PackagingCommands = {
"codeQL.downloadPacks": () => Promise<void>;
};
export type DataExtensionsEditorCommands = {
"codeQL.openDataExtensionsEditor": () => Promise<void>;
export type ModelEditorCommands = {
"codeQL.openModelEditor": () => Promise<void>;
"codeQL.openModelEditorFromModelingPanel": () => Promise<void>;
"codeQLModelEditor.jumpToMethod": (
method: Method,
usage: Usage,
databaseItem: DatabaseItem,
) => Promise<void>;
};
export type EvalLogViewerCommands = {
@@ -256,11 +329,15 @@ export type EvalLogViewerCommands = {
export type SummaryLanguageSupportCommands = {
"codeQL.gotoQL": () => Promise<void>;
"codeQL.gotoQLContextEditor": () => Promise<void>;
};
export type TestUICommands = {
"codeQLTests.showOutputDifferences": (node: TestTreeNode) => Promise<void>;
"codeQLTests.acceptOutput": (node: TestTreeNode) => Promise<void>;
"codeQLTests.acceptOutputContextTestItem": (
node: TestTreeNode,
) => Promise<void>;
};
export type MockGitHubApiServerCommands = {
@@ -276,13 +353,15 @@ export type AllExtensionCommands = BaseCommands &
QueryEditorCommands &
ResultsViewCommands &
QueryHistoryCommands &
LanguageSelectionCommands &
LocalDatabasesCommands &
DebuggerCommands &
VariantAnalysisCommands &
DatabasePanelCommands &
AstCfgCommands &
AstViewerCommands &
PackagingCommands &
DataExtensionsEditorCommands &
ModelEditorCommands &
EvalLogViewerCommands &
SummaryLanguageSupportCommands &
Partial<TestUICommands> &

View File

@@ -1,25 +1,38 @@
import { DisposableObject } from "./pure/disposable-object";
import { extLogger } from "./common";
import { getErrorMessage } from "./pure/helpers-pure";
import { DisposableObject } from "./disposable-object";
import { getErrorMessage } from "./helpers-pure";
import { Logger } from "./logging";
/**
* Base class for "discovery" operations, which scan the file system to find specific kinds of
* files. This class automatically prevents more than one discovery operation from running at the
* same time.
*/
export abstract class Discovery<T> extends DisposableObject {
private retry = false;
private discoveryInProgress = false;
export abstract class Discovery extends DisposableObject {
private restartWhenFinished = false;
private currentDiscoveryPromise: Promise<void> | undefined;
constructor(private readonly name: string) {
constructor(
protected readonly name: string,
private readonly logger: Logger,
) {
super();
}
/**
* Returns the promise of the currently running refresh operation, if one is in progress.
* Otherwise returns a promise that resolves immediately.
*/
public waitForCurrentRefresh(): Promise<void> {
return this.currentDiscoveryPromise ?? Promise.resolve();
}
/**
* Force the discovery process to run. Normally invoked by the derived class when a relevant file
* system change is detected.
*
* Returns a promise that resolves when the refresh is complete, including any retries.
*/
public refresh(): void {
public refresh(): Promise<void> {
// We avoid having multiple discovery operations in progress at the same time. Otherwise, if we
// got a storm of refresh requests due to, say, the copying or deletion of a large directory
// tree, we could potentially spawn a separate simultaneous discovery operation for each
@@ -36,14 +49,16 @@ export abstract class Discovery<T> extends DisposableObject {
// other change notifications that might be coming along. However, this would create more
// latency in the common case, in order to save a bit of latency in the uncommon case.
if (this.discoveryInProgress) {
if (this.currentDiscoveryPromise !== undefined) {
// There's already a discovery operation in progress. Tell it to restart when it's done.
this.retry = true;
this.restartWhenFinished = true;
} else {
// No discovery in progress, so start one now.
this.discoveryInProgress = true;
this.launchDiscovery();
this.currentDiscoveryPromise = this.launchDiscovery().finally(() => {
this.currentDiscoveryPromise = undefined;
});
}
return this.currentDiscoveryPromise;
}
/**
@@ -51,46 +66,28 @@ export abstract class Discovery<T> extends DisposableObject {
* discovery operation completes, the `update` function will be invoked with the results of the
* discovery.
*/
private launchDiscovery(): void {
const discoveryPromise = this.discover();
discoveryPromise
.then((results) => {
if (!this.retry) {
// Update any listeners with the results of the discovery.
this.discoveryInProgress = false;
this.update(results);
}
})
private async launchDiscovery(): Promise<void> {
try {
await this.discover();
} catch (err) {
void this.logger.log(
`${this.name} failed. Reason: ${getErrorMessage(err)}`,
);
}
.catch((err: unknown) => {
void extLogger.log(
`${this.name} failed. Reason: ${getErrorMessage(err)}`,
);
})
.finally(() => {
if (this.retry) {
// Another refresh request came in while we were still running a previous discovery
// operation. Since the discovery results we just computed are now stale, we'll launch
// another discovery operation instead of updating.
// Note that by doing this inside of `finally`, we will relaunch discovery even if the
// initial discovery operation failed.
this.retry = false;
this.launchDiscovery();
}
});
if (this.restartWhenFinished) {
// Another refresh request came in while we were still running a previous discovery
// operation. Since the discovery results we just computed are now stale, we'll launch
// another discovery operation instead of updating.
// We want to relaunch discovery regardless of if the initial discovery operation
// succeeded or failed.
this.restartWhenFinished = false;
await this.launchDiscovery();
}
}
/**
* Overridden by the derived class to spawn the actual discovery operation, returning the results.
*/
protected abstract discover(): Promise<T>;
/**
* Overridden by the derived class to atomically update the `Discovery` object with the results of
* the discovery operation, and to notify any listeners that the discovery results may have
* changed.
* @param results The discovery results returned by the `discover` function.
*/
protected abstract update(results: T): void;
protected abstract discover(): Promise<void>;
}

View File

@@ -9,10 +9,16 @@ export type DisposeHandler = (disposable: Disposable) => void;
/**
* Base class to make it easier to implement a `Disposable` that owns other disposable object.
*/
export abstract class DisposableObject implements Disposable {
export class DisposableObject implements Disposable {
private disposables: Disposable[] = [];
private tracked?: Set<Disposable> = undefined;
constructor(...dispoables: Disposable[]) {
for (const d of dispoables) {
this.push(d);
}
}
/**
* Adds `obj` to a list of objects to dispose when `this` is disposed. Objects added by `push` are
* disposed in reverse order of being added.

View File

@@ -22,6 +22,14 @@ export class RedactableError extends Error {
.join("");
}
public get fullMessageWithStack(): string {
if (!this.stack) {
return this.fullMessage;
}
return `${this.fullMessage}\n${this.stack}`;
}
public get redactedMessage(): string {
return this.strings
.map((s, i) => s + (this.hasValue(i) ? this.getRedactedValue(i) : ""))

View File

@@ -1,10 +1,10 @@
import { Disposable } from "../pure/disposable-object";
import { Disposable } from "./disposable-object";
export interface AppEvent<T> {
(listener: (event: T) => void): Disposable;
}
export interface AppEventEmitter<T> {
export interface AppEventEmitter<T> extends Disposable {
event: AppEvent<T>;
fire(data: T): void;
}

View File

@@ -0,0 +1,122 @@
import { basename, dirname, join } from "path";
import { EnvironmentContext } from "./app";
/**
* A node in the tree of files. This will be either a `FileTreeDirectory` or a `FileTreeLeaf`.
*/
export abstract class FileTreeNode<T = undefined> {
constructor(
private _path: string,
private _name: string,
private _data?: T,
) {}
public get path(): string {
return this._path;
}
public get name(): string {
return this._name;
}
public get data(): T | undefined {
return this._data;
}
public abstract get children(): ReadonlyArray<FileTreeNode<T>>;
public abstract finish(): void;
}
/**
* A directory containing one or more files or other directories.
*/
export class FileTreeDirectory<T = undefined> extends FileTreeNode<T> {
constructor(
_path: string,
_name: string,
protected readonly env: EnvironmentContext,
private _children: Array<FileTreeNode<T>> = [],
) {
super(_path, _name);
}
public get children(): ReadonlyArray<FileTreeNode<T>> {
return this._children;
}
public addChild(child: FileTreeNode<T>): void {
this._children.push(child);
}
public createDirectory(relativePath: string): FileTreeDirectory<T> {
if (relativePath === ".") {
return this;
}
const dirName = dirname(relativePath);
if (dirName === ".") {
return this.createChildDirectory(relativePath);
} else {
const parent = this.createDirectory(dirName);
return parent.createDirectory(basename(relativePath));
}
}
public finish(): void {
// remove empty directories
this._children.filter(
(child) => child instanceof FileTreeLeaf || child.children.length > 0,
);
this._children.sort((a, b) =>
a.name.localeCompare(b.name, this.env.language),
);
this._children.forEach((child, i) => {
child.finish();
if (
child.children?.length === 1 &&
child.children[0] instanceof FileTreeDirectory
) {
// collapse children
const replacement = new FileTreeDirectory<T>(
child.children[0].path,
`${child.name} / ${child.children[0].name}`,
this.env,
Array.from(child.children[0].children),
);
this._children[i] = replacement;
}
});
}
private createChildDirectory(name: string): FileTreeDirectory<T> {
const existingChild = this._children.find((child) => child.name === name);
if (existingChild !== undefined) {
return existingChild as FileTreeDirectory<T>;
} else {
const newChild = new FileTreeDirectory<T>(
join(this.path, name),
name,
this.env,
);
this.addChild(newChild);
return newChild;
}
}
}
/**
* A single file.
*/
export class FileTreeLeaf<T = undefined> extends FileTreeNode<T> {
constructor(_path: string, _name: string, _data?: T) {
super(_path, _name, _data);
}
public get children(): ReadonlyArray<FileTreeNode<T>> {
return [];
}
public finish(): void {
/**/
}
}

View File

@@ -0,0 +1,129 @@
import { pathExists, stat, readdir, opendir } from "fs-extra";
import { isAbsolute, join, relative, resolve } from "path";
import { tmpdir as osTmpdir } from "os";
/**
* Recursively finds all .ql files in this set of Uris.
*
* @param paths The list of Uris to search through
*
* @returns list of ql files and a boolean describing whether or not a directory was found/
*/
export async function gatherQlFiles(
paths: string[],
): Promise<[string[], boolean]> {
const gatheredUris: Set<string> = new Set();
let dirFound = false;
for (const nextPath of paths) {
if ((await pathExists(nextPath)) && (await stat(nextPath)).isDirectory()) {
dirFound = true;
const subPaths = await readdir(nextPath);
const fullPaths = subPaths.map((p) => join(nextPath, p));
const nestedFiles = (await gatherQlFiles(fullPaths))[0];
nestedFiles.forEach((nested) => gatheredUris.add(nested));
} else if (nextPath.endsWith(".ql")) {
gatheredUris.add(nextPath);
}
}
return [Array.from(gatheredUris), dirFound];
}
/**
* Lists the names of directories inside the given path.
* @param path The path to the directory to read.
* @returns the names of the directories inside the given path.
*/
export async function getDirectoryNamesInsidePath(
path: string,
): Promise<string[]> {
if (!(await pathExists(path))) {
throw Error(`Path does not exist: ${path}`);
}
if (!(await stat(path)).isDirectory()) {
throw Error(`Path is not a directory: ${path}`);
}
const dirItems = await readdir(path, { withFileTypes: true });
const dirNames = dirItems
.filter((dirent) => dirent.isDirectory())
.map((dirent) => dirent.name);
return dirNames;
}
export function normalizePath(path: string): string {
// On Windows, "C:/", "C:\", and "c:/" are all equivalent. We need
// to normalize the paths to ensure they all get resolved to the
// same format. On Windows, we also need to do the comparison
// case-insensitively.
path = resolve(path);
if (process.platform === "win32") {
path = path.toLowerCase();
}
return path;
}
export function pathsEqual(path1: string, path2: string): boolean {
return normalizePath(path1) === normalizePath(path2);
}
/**
* Returns true if `parent` contains `child`, or if they are equal.
*/
export function containsPath(parent: string, child: string): boolean {
const relativePath = relative(parent, child);
return (
!relativePath.startsWith("..") &&
// On windows, if the two paths are in different drives, then the
// relative path will be an absolute path to the other drive.
!isAbsolute(relativePath)
);
}
export async function readDirFullPaths(path: string): Promise<string[]> {
const baseNames = await readdir(path);
return baseNames.map((baseName) => join(path, baseName));
}
/**
* Recursively walk a directory and return the full path to all files found.
* Symbolic links are ignored.
*
* @param dir the directory to walk
*
* @return An iterator of the full path to all files recursively found in the directory.
*/
export async function* walkDirectory(
dir: string,
): AsyncIterableIterator<string> {
const seenFiles = new Set<string>();
for await (const d of await opendir(dir)) {
const entry = join(dir, d.name);
seenFiles.add(entry);
if (d.isDirectory()) {
yield* walkDirectory(entry);
} else if (d.isFile()) {
yield entry;
}
}
}
/**
* Error thrown from methods from the `fs` module.
*
* In practice, any error matching this is likely an instance of `NodeJS.ErrnoException`.
* If desired in the future, we could model more fields or use `NodeJS.ErrnoException` directly.
*/
export interface IOError {
readonly code: string;
}
export function isIOError(e: any): e is IOError {
return e.code !== undefined && typeof e.code === "string";
}
// This function is a wrapper around `os.tmpdir()` to make it easier to mock in tests.
export function tmpdir(): string {
return osTmpdir();
}

View File

@@ -1,4 +1,4 @@
import { OWNER_REGEX, REPO_REGEX } from "../pure/helpers-pure";
import { OWNER_REGEX, REPO_REGEX } from "./helpers-pure";
/**
* Checks if a string is a valid GitHub NWO.

View File

@@ -67,3 +67,26 @@ export function asError(e: unknown): Error {
return e instanceof Error ? e : new Error(String(e));
}
/**
* Get error message when the error may have come from a method from the `child_process` module.
*/
export function getChildProcessErrorMessage(e: unknown): string {
return isChildProcessError(e) ? e.stderr : getErrorMessage(e);
}
/**
* Error thrown from methods from the `child_process` module.
*/
interface ChildProcessError {
readonly stderr: string;
}
function isChildProcessError(e: unknown): e is ChildProcessError {
return (
typeof e === "object" &&
e !== null &&
"stderr" in e &&
typeof e.stderr === "string"
);
}

View File

@@ -1 +0,0 @@
export * from "./logging";

View File

@@ -5,17 +5,26 @@ import {
ResultSetSchema,
Column,
ResolvableLocationValue,
} from "./bqrs-cli-types";
} from "../common/bqrs-cli-types";
import {
VariantAnalysis,
VariantAnalysisScannedRepositoryResult,
VariantAnalysisScannedRepositoryState,
} from "../variant-analysis/shared/variant-analysis";
import { RepositoriesFilterSortStateWithIds } from "./variant-analysis-filter-sort";
import { ErrorLike } from "./errors";
import {
RepositoriesFilterSortState,
RepositoriesFilterSortStateWithIds,
} from "../variant-analysis/shared/variant-analysis-filter-sort";
import { ErrorLike } from "../common/errors";
import { DataFlowPaths } from "../variant-analysis/shared/data-flow-paths";
import { ExternalApiUsage } from "../data-extensions-editor/external-api-usage";
import { ModeledMethod } from "../data-extensions-editor/modeled-method";
import { Method } from "../model-editor/method";
import { ModeledMethod } from "../model-editor/modeled-method";
import {
MethodModelingPanelViewState,
ModelEditorViewState,
} from "../model-editor/shared/view-state";
import { Mode } from "../model-editor/shared/mode";
import { QueryLanguage } from "./query-language";
/**
* This module contains types and code that are shared between
@@ -46,6 +55,7 @@ export const RAW_RESULTS_LIMIT = 10000;
export interface DatabaseInfo {
name: string;
databaseUri: string;
language?: QueryLanguage;
}
/** Arbitrary query metadata */
@@ -71,11 +81,9 @@ export type GraphInterpretationData = {
dot: string[];
};
export type InterpretationData =
| SarifInterpretationData
| GraphInterpretationData;
type InterpretationData = SarifInterpretationData | GraphInterpretationData;
export interface InterpretationT<T> {
interface InterpretationT<T> {
sourceLocationPrefix: string;
numTruncatedResults: number;
numTotalResults: number;
@@ -101,7 +109,7 @@ export type SortedResultsMap = { [resultSet: string]: SortedResultSetInfo };
*
* As a result of receiving this message, listeners might want to display a loading indicator.
*/
export interface ResultsUpdatingMsg {
interface ResultsUpdatingMsg {
t: "resultsUpdating";
}
@@ -109,7 +117,7 @@ export interface ResultsUpdatingMsg {
* Message to set the initial state of the results view with a new
* query.
*/
export interface SetStateMsg {
interface SetStateMsg {
t: "setState";
resultsPath: string;
origResultsPaths: ResultsPaths;
@@ -138,7 +146,7 @@ export interface SetStateMsg {
* Message indicating that the results view should display interpreted
* results.
*/
export interface ShowInterpretedPageMsg {
interface ShowInterpretedPageMsg {
t: "showInterpretedPage";
interpretation: Interpretation;
database: DatabaseInfo;
@@ -168,7 +176,7 @@ export interface NavigateMsg {
* A message indicating that the results view should untoggle the
* "Show results in Problems view" checkbox.
*/
export interface UntoggleShowProblemsMsg {
interface UntoggleShowProblemsMsg {
t: "untoggleShowProblems";
}
@@ -198,7 +206,7 @@ export type FromResultsViewMsg =
* Message from the results view to open a database source
* file at the provided location.
*/
export interface ViewSourceFileMsg {
interface ViewSourceFileMsg {
t: "viewSourceFile";
loc: ResolvableLocationValue;
databaseUri: string;
@@ -207,7 +215,7 @@ export interface ViewSourceFileMsg {
/**
* Message from the results view to open a file in an editor.
*/
export interface OpenFileMsg {
interface OpenFileMsg {
t: "openFile";
/* Full path to the file to open. */
filePath: string;
@@ -269,7 +277,7 @@ export interface RawResultsSortState {
sortDirection: SortDirection;
}
export type InterpretedResultsSortColumn = "alert-message";
type InterpretedResultsSortColumn = "alert-message";
export interface InterpretedResultsSortState {
sortBy: InterpretedResultsSortColumn;
@@ -313,7 +321,7 @@ export type FromCompareViewMessage =
/**
* Message from the compare view to request opening a query.
*/
export interface OpenQueryMessage {
interface OpenQueryMessage {
readonly t: "openQuery";
readonly kind: "from" | "to";
}
@@ -401,63 +409,69 @@ export interface ParsedResultSets {
resultSet: ResultSet;
}
export interface SetVariantAnalysisMessage {
interface SetVariantAnalysisMessage {
t: "setVariantAnalysis";
variantAnalysis: VariantAnalysis;
}
interface SetFilterSortStateMessage {
t: "setFilterSortState";
filterSortState: RepositoriesFilterSortState;
}
export type VariantAnalysisState = {
variantAnalysisId: number;
};
export interface SetRepoResultsMessage {
interface SetRepoResultsMessage {
t: "setRepoResults";
repoResults: VariantAnalysisScannedRepositoryResult[];
}
export interface SetRepoStatesMessage {
interface SetRepoStatesMessage {
t: "setRepoStates";
repoStates: VariantAnalysisScannedRepositoryState[];
}
export interface RequestRepositoryResultsMessage {
interface RequestRepositoryResultsMessage {
t: "requestRepositoryResults";
repositoryFullName: string;
}
export interface OpenQueryFileMessage {
interface OpenQueryFileMessage {
t: "openQueryFile";
}
export interface OpenQueryTextMessage {
interface OpenQueryTextMessage {
t: "openQueryText";
}
export interface CopyRepositoryListMessage {
interface CopyRepositoryListMessage {
t: "copyRepositoryList";
filterSort?: RepositoriesFilterSortStateWithIds;
}
export interface ExportResultsMessage {
interface ExportResultsMessage {
t: "exportResults";
filterSort?: RepositoriesFilterSortStateWithIds;
}
export interface OpenLogsMessage {
interface OpenLogsMessage {
t: "openLogs";
}
export interface CancelVariantAnalysisMessage {
interface CancelVariantAnalysisMessage {
t: "cancelVariantAnalysis";
}
export interface ShowDataFlowPathsMessage {
interface ShowDataFlowPathsMessage {
t: "showDataFlowPaths";
dataFlowPaths: DataFlowPaths;
}
export type ToVariantAnalysisMessage =
| SetVariantAnalysisMessage
| SetFilterSortStateMessage
| SetRepoResultsMessage
| SetRepoStatesMessage;
@@ -472,7 +486,7 @@ export type FromVariantAnalysisMessage =
| CancelVariantAnalysisMessage
| ShowDataFlowPathsMessage;
export interface SetDataFlowPathsMessage {
interface SetDataFlowPathsMessage {
t: "setDataFlowPaths";
dataFlowPaths: DataFlowPaths;
}
@@ -481,58 +495,169 @@ export type ToDataFlowPathsMessage = SetDataFlowPathsMessage;
export type FromDataFlowPathsMessage = CommonFromViewMessages;
export interface SetExternalApiUsagesMessage {
t: "setExternalApiUsages";
externalApiUsages: ExternalApiUsage[];
interface SetExtensionPackStateMessage {
t: "setModelEditorViewState";
viewState: ModelEditorViewState;
}
export interface ShowProgressMessage {
t: "showProgress";
step: number;
maxStep: number;
message: string;
interface SetMethodsMessage {
t: "setMethods";
methods: Method[];
}
export interface AddModeledMethodsMessage {
t: "addModeledMethods";
modeledMethods: Record<string, ModeledMethod>;
/**
* If true, then any existing modeled methods set to "none" will be
* overwritten by the new modeled methods. Otherwise, the "none" modeled
* methods will not be overwritten, even if the new modeled methods
* contain a better model.
*/
overrideNone?: boolean;
interface SetModeledMethodsMessage {
t: "setModeledMethods";
methods: Record<string, ModeledMethod[]>;
}
export interface JumpToUsageMessage {
t: "jumpToUsage";
location: ResolvableLocationValue;
interface SetModifiedMethodsMessage {
t: "setModifiedMethods";
methodSignatures: string[];
}
export interface SetExistingModeledMethods {
t: "setExistingModeledMethods";
existingModeledMethods: Record<string, ModeledMethod>;
interface SetInProgressMethodsMessage {
t: "setInProgressMethods";
methods: string[];
}
export interface SaveModeledMethods {
interface SwitchModeMessage {
t: "switchMode";
mode: Mode;
}
interface JumpToMethodMessage {
t: "jumpToMethod";
methodSignature: string;
}
interface OpenDatabaseMessage {
t: "openDatabase";
}
interface OpenExtensionPackMessage {
t: "openExtensionPack";
}
interface RefreshMethods {
t: "refreshMethods";
}
interface SaveModeledMethods {
t: "saveModeledMethods";
externalApiUsages: ExternalApiUsage[];
modeledMethods: Record<string, ModeledMethod>;
methodSignatures?: string[];
}
export interface GenerateExternalApiMessage {
t: "generateExternalApi";
interface GenerateMethodMessage {
t: "generateMethod";
}
export type ToDataExtensionsEditorMessage =
| SetExternalApiUsagesMessage
| ShowProgressMessage
| AddModeledMethodsMessage;
interface GenerateMethodsFromLlmMessage {
t: "generateMethodsFromLlm";
packageName: string;
methodSignatures: string[];
}
export type FromDataExtensionsEditorMessage =
| ViewLoadedMsg
| JumpToUsageMessage
interface StopGeneratingMethodsFromLlmMessage {
t: "stopGeneratingMethodsFromLlm";
packageName: string;
}
interface ModelDependencyMessage {
t: "modelDependency";
}
interface HideModeledMethodsMessage {
t: "hideModeledMethods";
hideModeledMethods: boolean;
}
interface SetMultipleModeledMethodsMessage {
t: "setMultipleModeledMethods";
methodSignature: string;
modeledMethods: ModeledMethod[];
}
interface SetInModelingModeMessage {
t: "setInModelingMode";
inModelingMode: boolean;
}
interface SetInProgressMessage {
t: "setInProgress";
inProgress: boolean;
}
interface RevealMethodMessage {
t: "revealMethod";
methodSignature: string;
}
export type ToModelEditorMessage =
| SetExtensionPackStateMessage
| SetMethodsMessage
| SetModeledMethodsMessage
| SetModifiedMethodsMessage
| SetInProgressMethodsMessage
| RevealMethodMessage;
export type FromModelEditorMessage =
| CommonFromViewMessages
| SwitchModeMessage
| RefreshMethods
| OpenDatabaseMessage
| OpenExtensionPackMessage
| JumpToMethodMessage
| SaveModeledMethods
| GenerateExternalApiMessage;
| GenerateMethodMessage
| GenerateMethodsFromLlmMessage
| StopGeneratingMethodsFromLlmMessage
| ModelDependencyMessage
| HideModeledMethodsMessage
| SetMultipleModeledMethodsMessage;
interface RevealInEditorMessage {
t: "revealInModelEditor";
method: Method;
}
interface StartModelingMessage {
t: "startModeling";
}
export type FromMethodModelingMessage =
| CommonFromViewMessages
| SetMultipleModeledMethodsMessage
| RevealInEditorMessage
| StartModelingMessage;
interface SetMethodModelingPanelViewStateMessage {
t: "setMethodModelingPanelViewState";
viewState: MethodModelingPanelViewState;
}
interface SetMethodMessage {
t: "setMethod";
method: Method | undefined;
}
interface SetMethodModifiedMessage {
t: "setMethodModified";
isModified: boolean;
}
interface SetSelectedMethodMessage {
t: "setSelectedMethod";
method: Method;
modeledMethods: ModeledMethod[];
isModified: boolean;
isInProgress: boolean;
}
export type ToMethodModelingMessage =
| SetMethodModelingPanelViewStateMessage
| SetMethodMessage
| SetMultipleModeledMethodsMessage
| SetMethodModifiedMessage
| SetSelectedMethodMessage
| SetInModelingModeMessage
| SetInProgressMessage;

View File

@@ -0,0 +1,89 @@
import { Memento } from "./memento";
/**
* Provides a utility method to invoke a function only if a minimum time interval has elapsed since
* the last invocation of that function.
*/
export class InvocationRateLimiter<T> {
constructor(
private readonly globalState: Memento,
private readonly funcIdentifier: string,
private readonly func: () => Promise<T>,
private readonly createDate: (dateString?: string) => Date = (s) =>
s ? new Date(s) : new Date(),
) {}
/**
* Invoke the function if `minSecondsSinceLastInvocation` seconds have elapsed since the last invocation.
*/
public async invokeFunctionIfIntervalElapsed(
minSecondsSinceLastInvocation: number,
): Promise<InvocationRateLimiterResult<T>> {
const updateCheckStartDate = this.createDate();
const lastInvocationDate = this.getLastInvocationDate();
if (
minSecondsSinceLastInvocation &&
lastInvocationDate &&
lastInvocationDate <= updateCheckStartDate &&
lastInvocationDate.getTime() + minSecondsSinceLastInvocation * 1000 >
updateCheckStartDate.getTime()
) {
return createRateLimitedResult();
}
const result = await this.func();
await this.setLastInvocationDate(updateCheckStartDate);
return createInvokedResult(result);
}
private getLastInvocationDate(): Date | undefined {
const maybeDateString: string | undefined = this.globalState.get(
InvocationRateLimiter._invocationRateLimiterPrefix + this.funcIdentifier,
);
return maybeDateString ? this.createDate(maybeDateString) : undefined;
}
private async setLastInvocationDate(date: Date): Promise<void> {
return await this.globalState.update(
InvocationRateLimiter._invocationRateLimiterPrefix + this.funcIdentifier,
date,
);
}
private static readonly _invocationRateLimiterPrefix =
"invocationRateLimiter_lastInvocationDate_";
}
export enum InvocationRateLimiterResultKind {
Invoked,
RateLimited,
}
/**
* The function was invoked and returned the value `result`.
*/
interface InvokedResult<T> {
kind: InvocationRateLimiterResultKind.Invoked;
result: T;
}
/**
* The function was not invoked as the minimum interval since the last invocation had not elapsed.
*/
interface RateLimitedResult {
kind: InvocationRateLimiterResultKind.RateLimited;
}
type InvocationRateLimiterResult<T> = InvokedResult<T> | RateLimitedResult;
function createInvokedResult<T>(result: T): InvokedResult<T> {
return {
kind: InvocationRateLimiterResultKind.Invoked,
result,
};
}
function createRateLimitedResult(): RateLimitedResult {
return {
kind: InvocationRateLimiterResultKind.RateLimited,
};
}

View File

@@ -0,0 +1,27 @@
import { FileLink } from "../variant-analysis/shared/analysis-result";
export function createRemoteFileRef(
fileLink: FileLink,
startLine?: number,
endLine?: number,
startColumn?: number,
endColumn?: number,
): string {
if (
startColumn &&
endColumn &&
startLine &&
endLine &&
// Verify that location information is valid; otherwise highlighting might be broken
((startLine === endLine && startColumn < endColumn) || startLine < endLine)
) {
// This relies on column highlighting of new code view on GitHub
return `${fileLink.fileLinkPrefix}/${fileLink.filePath}#L${startLine}C${startColumn}-L${endLine}C${endColumn}`;
} else if (startLine && endLine && startLine < endLine) {
return `${fileLink.fileLinkPrefix}/${fileLink.filePath}#L${startLine}-L${endLine}`;
} else if (startLine) {
return `${fileLink.fileLinkPrefix}/${fileLink.filePath}#L${startLine}`;
} else {
return `${fileLink.fileLinkPrefix}/${fileLink.filePath}`;
}
}

View File

@@ -1,4 +1,4 @@
export * from "./logger";
export * from "./notification-logger";
export * from "./notifications";
export * from "./tee-logger";
export * from "./vscode/loggers";
export * from "./vscode/output-channel-logger";

View File

@@ -0,0 +1,7 @@
import { Logger } from "./logger";
export interface NotificationLogger extends Logger {
showErrorMessage(message: string): Promise<void>;
showWarningMessage(message: string): Promise<void>;
showInformationMessage(message: string): Promise<void>;
}

View File

@@ -0,0 +1,116 @@
import { NotificationLogger } from "./notification-logger";
import { AppTelemetry } from "../telemetry";
import { RedactableError } from "../errors";
interface ShowAndLogOptions {
/**
* An alternate message that is added to the log, but not displayed in the popup.
* This is useful for adding extra detail to the logs that would be too noisy for the popup.
*/
fullMessage?: string;
}
/**
* Show an error message and log it to the console
*
* @param logger The logger that will receive the message.
* @param message The message to show.
* @param options? See individual fields on `ShowAndLogOptions` type.
*
* @return A promise that resolves to the selected item or undefined when being dismissed.
*/
export async function showAndLogErrorMessage(
logger: NotificationLogger,
message: string,
options?: ShowAndLogOptions,
): Promise<void> {
return internalShowAndLog(
logger,
dropLinesExceptInitial(message),
logger.showErrorMessage,
{ fullMessage: message, ...options },
);
}
function dropLinesExceptInitial(message: string, n = 2) {
return message.toString().split(/\r?\n/).slice(0, n).join("\n");
}
/**
* Show a warning message and log it to the console
*
* @param logger The logger that will receive the message.
* @param message The message to show.
* @param options? See individual fields on `ShowAndLogOptions` type.
*
* @return A promise that resolves to the selected item or undefined when being dismissed.
*/
export async function showAndLogWarningMessage(
logger: NotificationLogger,
message: string,
options?: ShowAndLogOptions,
): Promise<void> {
return internalShowAndLog(
logger,
message,
logger.showWarningMessage,
options,
);
}
/**
* Show an information message and log it to the console
*
* @param logger The logger that will receive the message.
* @param message The message to show.
* @param options? See individual fields on `ShowAndLogOptions` type.
*
* @return A promise that resolves to the selected item or undefined when being dismissed.
*/
export async function showAndLogInformationMessage(
logger: NotificationLogger,
message: string,
options?: ShowAndLogOptions,
): Promise<void> {
return internalShowAndLog(
logger,
message,
logger.showInformationMessage,
options,
);
}
async function internalShowAndLog(
logger: NotificationLogger,
message: string,
fn: (message: string) => Promise<void>,
{ fullMessage }: ShowAndLogOptions = {},
): Promise<void> {
void logger.log(fullMessage || message);
await fn.bind(logger)(message);
}
interface ShowAndLogExceptionOptions extends ShowAndLogOptions {
/** Custom properties to include in the telemetry report. */
extraTelemetryProperties?: { [key: string]: string };
}
/**
* Show an error message, log it to the console, and emit redacted information as telemetry
*
* @param logger The logger that will receive the message.
* @param telemetry The telemetry instance to use for reporting.
* @param error The error to show. Only redacted information will be included in the telemetry.
* @param options See individual fields on `ShowAndLogExceptionOptions` type.
*
* @return A promise that resolves to the selected item or undefined when being dismissed.
*/
export async function showAndLogExceptionWithTelemetry(
logger: NotificationLogger,
telemetry: AppTelemetry | undefined,
error: RedactableError,
options: ShowAndLogExceptionOptions = {},
): Promise<void> {
telemetry?.sendError(error, options.extraTelemetryProperties);
return showAndLogErrorMessage(logger, error.fullMessageWithStack, options);
}

View File

@@ -1,6 +1,6 @@
import { appendFile, ensureFile } from "fs-extra";
import { isAbsolute } from "path";
import { getErrorMessage } from "../../pure/helpers-pure";
import { getErrorMessage } from "../helpers-pure";
import { Logger, LogOptions } from "./logger";
/**

View File

@@ -0,0 +1,2 @@
export * from "./loggers";
export * from "./output-channel-logger";

View File

@@ -1,11 +1,15 @@
import { window as Window, OutputChannel, Progress } from "vscode";
import { Logger, LogOptions } from "../logger";
import { DisposableObject } from "../../../pure/disposable-object";
import { DisposableObject } from "../../disposable-object";
import { NotificationLogger } from "../notification-logger";
/**
* A logger that writes messages to an output channel in the VS Code Output tab.
*/
export class OutputChannelLogger extends DisposableObject implements Logger {
export class OutputChannelLogger
extends DisposableObject
implements Logger, NotificationLogger
{
public readonly outputChannel: OutputChannel;
isCustomLogDirectory: boolean;
@@ -42,6 +46,30 @@ export class OutputChannelLogger extends DisposableObject implements Logger {
show(preserveFocus?: boolean): void {
this.outputChannel.show(preserveFocus);
}
async showErrorMessage(message: string): Promise<void> {
await this.showMessage(message, Window.showErrorMessage);
}
async showInformationMessage(message: string): Promise<void> {
await this.showMessage(message, Window.showInformationMessage);
}
async showWarningMessage(message: string): Promise<void> {
await this.showMessage(message, Window.showWarningMessage);
}
private async showMessage(
message: string,
show: (message: string, ...items: string[]) => Thenable<string | undefined>,
): Promise<void> {
const label = "Show Log";
const result = await show(message, label);
if (result === label) {
this.show();
}
}
}
export type ProgressReporter = Progress<{ message: string }>;

View File

@@ -1,8 +1,8 @@
import { Repository } from "../variant-analysis/gh-api/repository";
import { Repository } from "../../variant-analysis/gh-api/repository";
import {
VariantAnalysis,
VariantAnalysisRepoTask,
} from "../variant-analysis/gh-api/variant-analysis";
} from "../../variant-analysis/gh-api/variant-analysis";
// Types that represent requests/responses from the GitHub API
// that we need to mock.
@@ -13,50 +13,52 @@ export enum RequestKind {
GetVariantAnalysis = "getVariantAnalysis",
GetVariantAnalysisRepo = "getVariantAnalysisRepo",
GetVariantAnalysisRepoResult = "getVariantAnalysisRepoResult",
CodeSearch = "codeSearch",
AutoModel = "autoModel",
}
export interface BasicErorResponse {
export interface BasicErrorResponse {
message: string;
}
export interface GetRepoRequest {
interface GetRepoRequest {
request: {
kind: RequestKind.GetRepo;
};
response: {
status: number;
body: Repository | BasicErorResponse | undefined;
body: Repository | BasicErrorResponse | undefined;
};
}
export interface SubmitVariantAnalysisRequest {
interface SubmitVariantAnalysisRequest {
request: {
kind: RequestKind.SubmitVariantAnalysis;
};
response: {
status: number;
body?: VariantAnalysis | BasicErorResponse;
body?: VariantAnalysis | BasicErrorResponse;
};
}
export interface GetVariantAnalysisRequest {
interface GetVariantAnalysisRequest {
request: {
kind: RequestKind.GetVariantAnalysis;
};
response: {
status: number;
body?: VariantAnalysis | BasicErorResponse;
body?: VariantAnalysis | BasicErrorResponse;
};
}
export interface GetVariantAnalysisRepoRequest {
interface GetVariantAnalysisRepoRequest {
request: {
kind: RequestKind.GetVariantAnalysisRepo;
repositoryId: number;
};
response: {
status: number;
body?: VariantAnalysisRepoTask | BasicErorResponse;
body?: VariantAnalysisRepoTask | BasicErrorResponse;
};
}
@@ -72,12 +74,49 @@ export interface GetVariantAnalysisRepoResultRequest {
};
}
export interface CodeSearchResponse {
total_count: number;
items: Array<{
repository: Repository;
}>;
}
interface CodeSearchRequest {
request: {
kind: RequestKind.CodeSearch;
query: string;
};
response: {
status: number;
body?: CodeSearchResponse | BasicErrorResponse;
};
}
export interface AutoModelResponse {
models: string;
}
interface AutoModelRequest {
request: {
kind: RequestKind.AutoModel;
body?: {
candidates: string;
};
};
response: {
status: number;
body?: AutoModelResponse | BasicErrorResponse;
};
}
export type GitHubApiRequest =
| GetRepoRequest
| SubmitVariantAnalysisRequest
| GetVariantAnalysisRequest
| GetVariantAnalysisRepoRequest
| GetVariantAnalysisRepoResultRequest;
| GetVariantAnalysisRepoResultRequest
| CodeSearchRequest
| AutoModelRequest;
export const isGetRepoRequest = (
request: GitHubApiRequest,
@@ -102,3 +141,13 @@ export const isGetVariantAnalysisRepoResultRequest = (
request: GitHubApiRequest,
): request is GetVariantAnalysisRepoResultRequest =>
request.request.kind === RequestKind.GetVariantAnalysisRepoResult;
export const isCodeSearchRequest = (
request: GitHubApiRequest,
): request is CodeSearchRequest =>
request.request.kind === RequestKind.CodeSearch;
export const isAutoModelRequest = (
request: GitHubApiRequest,
): request is AutoModelRequest =>
request.request.kind === RequestKind.AutoModel;

View File

@@ -2,11 +2,11 @@ import { join, resolve } from "path";
import { pathExists } from "fs-extra";
import { setupServer, SetupServer } from "msw/node";
import { DisposableObject } from "../pure/disposable-object";
import { DisposableObject } from "../disposable-object";
import { Recorder } from "./recorder";
import { createRequestHandlers } from "./request-handlers";
import { getDirectoryNamesInsidePath } from "../pure/files";
import { getDirectoryNamesInsidePath } from "../files";
/**
* Enables mocking of the GitHub API server via HTTP interception, using msw.
@@ -129,9 +129,12 @@ export class MockGitHubApiServer extends DisposableObject {
public async getDefaultScenariosPath(): Promise<string | undefined> {
// This should be the directory where package.json is located
const rootDirectory = resolve(__dirname, "../..");
const rootDirectory = resolve(__dirname, "../../..");
const scenariosPath = resolve(rootDirectory, "src/mocks/scenarios");
const scenariosPath = resolve(
rootDirectory,
"src/common/mock-gh-api/scenarios",
);
if (await pathExists(scenariosPath)) {
return scenariosPath;
}

View File

@@ -1,30 +1,33 @@
import { ensureDir, writeFile } from "fs-extra";
import { join } from "path";
import { MockedRequest } from "msw";
import { SetupServer } from "msw/node";
import { IsomorphicResponse } from "@mswjs/interceptors";
import { Headers } from "headers-polyfill";
import fetch from "node-fetch";
import { SetupServer } from "msw/node";
import { DisposableObject } from "../pure/disposable-object";
import { DisposableObject } from "../disposable-object";
import { gzipDecode } from "../zlib";
import {
AutoModelResponse,
BasicErrorResponse,
CodeSearchResponse,
GetVariantAnalysisRepoResultRequest,
GitHubApiRequest,
RequestKind,
} from "./gh-api-request";
import {
VariantAnalysis,
VariantAnalysisRepoTask,
} from "../../variant-analysis/gh-api/variant-analysis";
import { Repository } from "../../variant-analysis/gh-api/repository";
export class Recorder extends DisposableObject {
private readonly allRequests = new Map<string, MockedRequest>();
private currentRecordedScenario: GitHubApiRequest[] = [];
private _isRecording = false;
constructor(private readonly server: SetupServer) {
super();
this.onRequestStart = this.onRequestStart.bind(this);
this.onResponseBypass = this.onResponseBypass.bind(this);
}
@@ -45,7 +48,6 @@ export class Recorder extends DisposableObject {
this.clear();
this.server.events.on("request:start", this.onRequestStart);
this.server.events.on("response:bypass", this.onResponseBypass);
}
@@ -56,13 +58,11 @@ export class Recorder extends DisposableObject {
this._isRecording = false;
this.server.events.removeListener("request:start", this.onRequestStart);
this.server.events.removeListener("response:bypass", this.onResponseBypass);
}
public clear() {
this.currentRecordedScenario = [];
this.allRequests.clear();
}
public async save(scenariosPath: string, name: string): Promise<string> {
@@ -91,7 +91,7 @@ export class Recorder extends DisposableObject {
let bodyFileLink = undefined;
if (writtenRequest.response.body) {
await writeFile(bodyFilePath, writtenRequest.response.body || "");
await writeFile(bodyFilePath, writtenRequest.response.body);
bodyFileLink = `file:${bodyFileName}`;
}
@@ -112,33 +112,18 @@ export class Recorder extends DisposableObject {
return scenarioDirectory;
}
private onRequestStart(request: MockedRequest): void {
private async onResponseBypass(
response: Response,
request: Request,
_requestId: string,
): Promise<void> {
if (request.headers.has("x-vscode-codeql-msw-bypass")) {
return;
}
this.allRequests.set(request.id, request);
}
private async onResponseBypass(
response: IsomorphicResponse,
requestId: string,
): Promise<void> {
const request = this.allRequests.get(requestId);
this.allRequests.delete(requestId);
if (!request) {
return;
}
if (response.body === undefined) {
return;
}
const gitHubApiRequest = await createGitHubApiRequest(
request.url.toString(),
response.status,
response.body,
response.headers,
request.url,
response,
);
if (!gitHubApiRequest) {
return;
@@ -150,14 +135,14 @@ export class Recorder extends DisposableObject {
async function createGitHubApiRequest(
url: string,
status: number,
body: string,
headers: Headers,
response: Response,
): Promise<GitHubApiRequest | undefined> {
if (!url) {
return undefined;
}
const status = response.status;
if (url.match(/\/repos\/[a-zA-Z0-9-_.]+\/[a-zA-Z0-9-_.]+$/)) {
return {
request: {
@@ -165,7 +150,9 @@ async function createGitHubApiRequest(
},
response: {
status,
body: JSON.parse(body),
body: await jsonResponseBody<
Repository | BasicErrorResponse | undefined
>(response),
},
};
}
@@ -179,7 +166,9 @@ async function createGitHubApiRequest(
},
response: {
status,
body: JSON.parse(body),
body: await jsonResponseBody<
VariantAnalysis | BasicErrorResponse | undefined
>(response),
},
};
}
@@ -195,7 +184,9 @@ async function createGitHubApiRequest(
},
response: {
status,
body: JSON.parse(body),
body: await jsonResponseBody<
VariantAnalysis | BasicErrorResponse | undefined
>(response),
},
};
}
@@ -211,7 +202,9 @@ async function createGitHubApiRequest(
},
response: {
status,
body: JSON.parse(body),
body: await jsonResponseBody<
VariantAnalysisRepoTask | BasicErrorResponse | undefined
>(response),
},
};
}
@@ -238,9 +231,43 @@ async function createGitHubApiRequest(
repositoryId: parseInt(repoDownloadMatch.groups.repositoryId, 10),
},
response: {
status,
status: response.status,
body: responseBuffer,
contentType: headers.get("content-type") ?? "application/octet-stream",
contentType:
response.headers.get("content-type") ?? "application/octet-stream",
},
};
}
const codeSearchMatch = url.match(/\/search\/code\?q=(?<query>.*)$/);
if (codeSearchMatch?.groups?.query) {
return {
request: {
kind: RequestKind.CodeSearch,
query: codeSearchMatch?.groups?.query,
},
response: {
status,
body: await jsonResponseBody<
CodeSearchResponse | BasicErrorResponse | undefined
>(response),
},
};
}
const autoModelMatch = url.match(
/\/repos\/github\/codeql\/code-scanning\/codeql\/auto-model/,
);
if (autoModelMatch) {
return {
request: {
kind: RequestKind.AutoModel,
},
response: {
status,
body: await jsonResponseBody<
BasicErrorResponse | AutoModelResponse | undefined
>(response),
},
};
}
@@ -248,6 +275,26 @@ async function createGitHubApiRequest(
return undefined;
}
async function responseBody(response: Response): Promise<Uint8Array> {
const body = await response.arrayBuffer();
const view = new Uint8Array(body);
if (view[0] === 0x1f && view[1] === 0x8b) {
// Response body is gzipped, so we need to un-gzip it.
return await gzipDecode(view);
} else {
return view;
}
}
async function jsonResponseBody<T>(response: Response): Promise<T> {
const body = await responseBody(response);
const text = new TextDecoder("utf-8").decode(body);
return JSON.parse(text);
}
function shouldWriteBodyToFile(
request: GitHubApiRequest,
): request is GetVariantAnalysisRepoResultRequest {

View File

@@ -1,8 +1,10 @@
import { join } from "path";
import { readdir, readJson, readFile } from "fs-extra";
import { DefaultBodyType, MockedRequest, rest, RestHandler } from "msw";
import { RequestHandler, rest } from "msw";
import {
GitHubApiRequest,
isAutoModelRequest,
isCodeSearchRequest,
isGetRepoRequest,
isGetVariantAnalysisRepoRequest,
isGetVariantAnalysisRepoResultRequest,
@@ -12,7 +14,19 @@ import {
const baseUrl = "https://api.github.com";
export type RequestHandler = RestHandler<MockedRequest<DefaultBodyType>>;
const jsonResponse = <T>(
body: T,
init?: ResponseInit,
contentType = "application/json",
): Response => {
return new Response(JSON.stringify(body), {
...init,
headers: {
"Content-Type": contentType,
...init?.headers,
},
});
};
export async function createRequestHandlers(
scenarioDirPath: string,
@@ -25,6 +39,8 @@ export async function createRequestHandlers(
createGetVariantAnalysisRequestHandler(requests),
createGetVariantAnalysisRepoRequestHandler(requests),
createGetVariantAnalysisRepoResultRequestHandler(requests),
createCodeSearchRequestHandler(requests),
createAutoModelRequestHandler(requests),
];
return handlers;
@@ -78,11 +94,10 @@ function createGetRepoRequestHandler(
const getRepoRequest = getRepoRequests[0];
return rest.get(`${baseUrl}/repos/:owner/:name`, (_req, res, ctx) => {
return res(
ctx.status(getRepoRequest.response.status),
ctx.json(getRepoRequest.response.body),
);
return rest.get(`${baseUrl}/repos/:owner/:name`, () => {
return jsonResponse(getRepoRequest.response.body, {
status: getRepoRequest.response.status,
});
});
}
@@ -101,11 +116,10 @@ function createSubmitVariantAnalysisRequestHandler(
return rest.post(
`${baseUrl}/repositories/:controllerRepoId/code-scanning/codeql/variant-analyses`,
(_req, res, ctx) => {
return res(
ctx.status(getRepoRequest.response.status),
ctx.json(getRepoRequest.response.body),
);
() => {
return jsonResponse(getRepoRequest.response.body, {
status: getRepoRequest.response.status,
});
},
);
}
@@ -123,7 +137,7 @@ function createGetVariantAnalysisRequestHandler(
// request, so keep an index of the request and return the appropriate response.
return rest.get(
`${baseUrl}/repositories/:controllerRepoId/code-scanning/codeql/variant-analyses/:variantAnalysisId`,
(_req, res, ctx) => {
() => {
const request = getVariantAnalysisRequests[requestIndex];
if (requestIndex < getVariantAnalysisRequests.length - 1) {
@@ -131,10 +145,9 @@ function createGetVariantAnalysisRequestHandler(
requestIndex++;
}
return res(
ctx.status(request.response.status),
ctx.json(request.response.body),
);
return jsonResponse(request.response.body, {
status: request.response.status,
});
},
);
}
@@ -148,18 +161,17 @@ function createGetVariantAnalysisRepoRequestHandler(
return rest.get(
`${baseUrl}/repositories/:controllerRepoId/code-scanning/codeql/variant-analyses/:variantAnalysisId/repositories/:repoId`,
(req, res, ctx) => {
({ request, params }) => {
const scenarioRequest = getVariantAnalysisRepoRequests.find(
(r) => r.request.repositoryId.toString() === req.params.repoId,
(r) => r.request.repositoryId.toString() === params.repoId,
);
if (!scenarioRequest) {
throw Error(`No scenario request found for ${req.url}`);
throw Error(`No scenario request found for ${request.url}`);
}
return res(
ctx.status(scenarioRequest.response.status),
ctx.json(scenarioRequest.response.body),
);
return jsonResponse(scenarioRequest.response.body, {
status: scenarioRequest.response.status,
});
},
);
}
@@ -173,23 +185,73 @@ function createGetVariantAnalysisRepoResultRequestHandler(
return rest.get(
"https://objects-origin.githubusercontent.com/codeql-query-console/codeql-variant-analysis-repo-tasks/:variantAnalysisId/:repoId/*",
(req, res, ctx) => {
({ request, params }) => {
const scenarioRequest = getVariantAnalysisRepoResultRequests.find(
(r) => r.request.repositoryId.toString() === req.params.repoId,
(r) => r.request.repositoryId.toString() === params.repoId,
);
if (!scenarioRequest) {
throw Error(`No scenario request found for ${req.url}`);
throw Error(`No scenario request found for ${request.url}`);
}
if (scenarioRequest.response.body) {
return res(
ctx.status(scenarioRequest.response.status),
ctx.set("Content-Type", scenarioRequest.response.contentType),
ctx.body(scenarioRequest.response.body),
);
return new Response(scenarioRequest.response.body, {
status: scenarioRequest.response.status,
headers: {
"Content-Type": scenarioRequest.response.contentType,
},
});
} else {
return res(ctx.status(scenarioRequest.response.status));
return new Response(null, { status: scenarioRequest.response.status });
}
},
);
}
function createCodeSearchRequestHandler(
requests: GitHubApiRequest[],
): RequestHandler {
const codeSearchRequests = requests.filter(isCodeSearchRequest);
let requestIndex = 0;
// During a code search, there are multiple request to get pages of results. We
// need to return different responses for each request, so keep an index of the
// request and return the appropriate response.
return rest.get(`${baseUrl}/search/code`, () => {
const request = codeSearchRequests[requestIndex];
if (requestIndex < codeSearchRequests.length - 1) {
// If there are more requests to come, increment the index.
requestIndex++;
}
return jsonResponse(request.response.body, {
status: request.response.status,
});
});
}
function createAutoModelRequestHandler(
requests: GitHubApiRequest[],
): RequestHandler {
const autoModelRequests = requests.filter(isAutoModelRequest);
let requestIndex = 0;
// During automodeling there can be multiple API requests for each batch
// of candidates we want to model. We need to return different responses for each request,
// so keep an index of the request and return the appropriate response.
return rest.post(
`${baseUrl}/repos/github/codeql/code-scanning/codeql/auto-model`,
() => {
const request = autoModelRequests[requestIndex];
if (requestIndex < autoModelRequests.length - 1) {
// If there are more requests to come, increment the index.
requestIndex++;
}
return jsonResponse(request.response.body, {
status: request.response.status,
});
},
);
}

View File

@@ -0,0 +1,11 @@
{
"request": {
"kind": "autoModel"
},
"response": {
"status": 200,
"body": {
"models": "extensions:\n- addsTo: {extensible: sinkModel, pack: codeql/java-all}\n data:\n - [javax.servlet.http, HttpServletResponse, true, sendRedirect, (String), '', 'Argument[this]',\n request-forgery, ai-generated]\n - [javax.servlet.http, HttpServletResponse, true, sendRedirect, (String), '', 'Argument[0]',\n request-forgery, ai-generated]\n"
}
}
}

View File

@@ -0,0 +1,11 @@
{
"request": {
"kind": "autoModel"
},
"response": {
"status": 200,
"body": {
"models": "extensions:\n- addsTo: {extensible: sinkModel, pack: codeql/java-all}\n data:\n - [javax.servlet, MultipartConfigElement, true, MultipartConfigElement, (String),\n '', 'Argument[0]', request-forgery, ai-generated]\n"
}
}
}

View File

@@ -0,0 +1 @@
This scenario is best when modeling the `javax.servlet-api` package.

View File

@@ -0,0 +1,13 @@
{
"request": {
"kind": "codeSearch",
"query": "org%3Adotnet+project+language%3Acsharp&per_page=100&page=10"
},
"response": {
"status": 403,
"body": {
"message": "API rate limit exceeded for user ID 311693.",
"documentation_url": "https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"
}
}
}

View File

@@ -0,0 +1,13 @@
{
"request": {
"kind": "codeSearch",
"query": "org%3Adotnet+project+language%3Acsharp&per_page=100&page=10"
},
"response": {
"status": 403,
"body": {
"message": "API rate limit exceeded for user ID 311693.",
"documentation_url": "https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"
}
}
}

Some files were not shown because too many files have changed in this diff Show More