Compare commits

...

1089 Commits

Author SHA1 Message Date
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
Koen Vlaswinkel
4cf67ef799 Fix disposing in ResultsView 2023-09-29 12:00:26 +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
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
552a4f6eb3 Merge pull request #2873 from github/starcke/language-context-store
Add language context store.
2023-09-29 09:24:31 +02: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
Charis Kyriakou
27a7474f2b Add modeling indicator to method usages panel (#2876) 2023-09-28 15:33:46 +01: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
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
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
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
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
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
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
711 changed files with 115526 additions and 54706 deletions

View File

@@ -2,9 +2,8 @@
* @name Unwanted dependency on vscode API
* @kind path-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".
* @id vscode-codeql/assert-no-vscode-dependency
* @description The modules stored under `common` should not have dependencies on the VS Code API
*/
import javascript
@@ -13,12 +12,9 @@ class VSCodeImport extends ImportDeclaration {
VSCodeImport() { this.getImportedPath().getValue() = "vscode" }
}
class PureFile extends File {
PureFile() {
(
this.getRelativePath().regexpMatch(".*/src/pure/.*") or
this.getRelativePath().regexpMatch(".*/src/common/.*")
) and
class CommonFile extends File {
CommonFile() {
this.getRelativePath().regexpMatch(".*/src/common/.*") and
not this.getRelativePath().regexpMatch(".*/vscode/.*")
}
}
@@ -34,7 +30,8 @@ query predicate edges(AstNode a, AstNode b) {
from Module m, VSCodeImport v
where
m.getFile() instanceof PureFile and
m.getFile() instanceof CommonFile and
edges+(m, v)
select m, m, v,
"This module is not pure: it has a transitive dependency on the vscode API imported $@", v, "here"
"This module is in the 'common' directory but 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: '16.17.1'
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,7 +16,7 @@ jobs:
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1
@@ -53,28 +53,12 @@ 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
@@ -110,6 +94,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: '16.17.1'
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,7 +143,7 @@ jobs:
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1
@@ -152,7 +177,7 @@ jobs:
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1
@@ -193,36 +218,36 @@ 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:
@@ -242,23 +267,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,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:

View File

@@ -1,5 +1,5 @@
**/* @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
**/model-editor/ @github/code-scanning-secexp-reviewers
**/queries-panel/ @github/code-scanning-secexp-reviewers

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

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

@@ -0,0 +1,29 @@
# 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:
- `.github/workflows/cli-test.yml` - the "node-version: '[VERSION]'" setting
- `.github/workflows/main.yml` - all the "node-version: '[VERSION]'" settings
- `.github/workflows/release.yml` - the "node-version: '[VERSION]'" setting
- `extensions/ql-vscode/.nvmrc` - this will enable nvm to automatically switch to the correct node version when you're in the project folder
- `extensions/ql-vscode/package-lock.json` - the "engines.node: '[VERSION]'" setting
- `extensions/ql-vscode/package.json` - the "engines.node: '[VERSION]'" setting
## 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. You can find this info by seleting "About Visual Studio Code" from the top menu. If it doesn't match, 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

@@ -44,23 +44,23 @@ choose to go through some of the Optional Test Cases.
#### Test case 2: Running a 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).
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-probem query and viewing results
#### 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 alert locations can be clicked on
- Check that result locations can be clicked on
#### Test case 3: Can use AST viewer
#### 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"
@@ -143,6 +143,41 @@ 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.
### CodeQL Model Editor
#### 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.
#### Test Case 2: Model methods
1. Expand one of the libraries.
- Change the model type and check that the other dropdowns change.
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
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
@@ -318,7 +353,6 @@ This requires running a MRVA query and seeing the results view.
1. Alphabetically
2. By number of results
3. By popularity
4. By most recent commit
9. Can filter repos
10. Shows correct statistics
1. Total number of results
@@ -378,6 +412,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/variant-analysis/github-api/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,10 +65,6 @@ 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",

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)"],
@@ -8,13 +8,13 @@ const config: StorybookConfig = {
"@storybook/addon-interactions",
"./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,5 +1,48 @@
# CodeQL for Visual Studio Code: Changelog
## 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)

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: [

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

@@ -18,15 +18,15 @@ import { Octokit, type RestEndpointMethodTypes } from "@octokit/rest";
import { throttling } from "@octokit/plugin-throttling";
import { getFiles } from "./util/files";
import type { GitHubApiRequest } from "../src/variant-analysis/gh-api/mocks/gh-api-request";
import { isGetVariantAnalysisRequest } from "../src/variant-analysis/gh-api/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";
const extensionDirectory = resolve(__dirname, "..");
const scenariosDirectory = resolve(
extensionDirectory,
"src/variant-analysis/gh-api/mocks/scenarios",
"src/common/mock-gh-api/scenarios",
);
// Make sure we don't run into rate limits by automatically waiting until we can

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

@@ -22,7 +22,7 @@ const scenarioName = process.argv[2];
const extensionDirectory = resolve(__dirname, "..");
const scenariosDirectory = resolve(
extensionDirectory,
"src/variant-analysis/gh-api/mocks/scenarios",
"src/common/mock-gh-api/scenarios",
);
const scenarioDirectory = resolve(scenariosDirectory, scenarioName);

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

@@ -10,7 +10,7 @@ const extensionDirectory = resolve(__dirname, "..");
const rootDirectory = resolve(extensionDirectory, "../..");
const scenariosDirectory = resolve(
extensionDirectory,
"src/variant-analysis/gh-api/mocks/scenarios",
"src/common/mock-gh-api/scenarios",
);
const debug = process.env.RUNNER_DEBUG || process.argv.includes("--debug");
@@ -19,7 +19,7 @@ async function lintScenarios() {
const schema = createGenerator({
path: resolve(
extensionDirectory,
"src/variant-analysis/gh-api/mocks/gh-api-request.ts",
"src/common/mock-gh-api/gh-api-request.ts",
),
tsconfig: resolve(extensionDirectory, "tsconfig.json"),
type: "GitHubApiRequest",

View File

@@ -1,10 +1,10 @@
import { AppCommandManager } from "./common/commands";
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";
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.

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,12 +6,11 @@ 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 { BQRSInfo, DecodedBqrsChunk } from "../common/bqrs-cli-types";
import { allowCanaryQueryServer, CliConfig } from "../config";
import {
DistributionProvider,
@@ -19,16 +18,19 @@ import {
} from "./distribution";
import {
assertNever,
getChildProcessErrorMessage,
getErrorMessage,
getErrorStack,
} from "../pure/helpers-pure";
import { walkDirectory } from "../pure/files";
import { QueryMetadata, SortDirection } from "../pure/interface-types";
import { BaseLogger, Logger, ProgressReporter } from "../common";
import { CompilationMessage } from "../pure/legacy-messages";
} 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.
@@ -122,6 +124,15 @@ export type ResolveExtensionsResult = {
};
};
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`.
*/
@@ -537,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)}`,
);
}
}
@@ -637,9 +646,7 @@ export class CodeQLCliServer implements Disposable {
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)}`,
);
}
}
@@ -718,6 +725,7 @@ export class CodeQLCliServer implements Disposable {
async resolveLibraryPath(
workspaces: string[],
queryPath: string,
silent = false,
): Promise<QuerySetup> {
const subcommandArgs = [
"--query",
@@ -728,6 +736,7 @@ export class CodeQLCliServer implements Disposable {
["resolve", "library-path"],
subcommandArgs,
"Resolving library paths",
{ silent },
);
}
@@ -1425,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(
@@ -1463,6 +1464,17 @@ 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) {
try {
@@ -1475,9 +1487,9 @@ export class CodeQLCliServer implements Disposable {
// 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",
"codeql.supportsQuickEvalCount",
newVersion.compare(
CliVersionConstraint.CLI_VERSION_WITH_PER_QUERY_EVAL_LOG,
CliVersionConstraint.CLI_VERSION_WITH_QUICK_EVAL_COUNT,
) >= 0,
);
} catch (e) {
@@ -1632,125 +1644,18 @@ 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: BaseLogger): Promise<void> {
for await (const line of splitStreamAtSeparators(stream, lineEndings)) {
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);
}
@@ -1780,7 +1685,7 @@ export function shouldDebugCliServer() {
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.7.6");
public static OLDEST_SUPPORTED_CLI_VERSION = new SemVer("2.9.4");
/**
* CLI version where building QLX packs for remote queries is supported.
@@ -1797,21 +1702,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.
@@ -1842,6 +1735,26 @@ export class CliVersionConstraint {
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",
);
constructor(private readonly cli: CodeQLCliServer) {
/**/
}
@@ -1860,15 +1773,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,
);
}
@@ -1915,4 +1822,22 @@ export class CliVersionConstraint {
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

@@ -6,7 +6,7 @@ import * as semver from "semver";
import { URL } from "url";
import { ExtensionContext, Event } from "vscode";
import { DistributionConfig } from "../config";
import { extLogger } from "../common";
import { extLogger } from "../common/logging/vscode";
import { getCodeQlCliVersion } from "./cli-version";
import {
ProgressCallback,
@@ -17,7 +17,7 @@ import {
deprecatedCodeQlLauncherName,
extractZipArchive,
getRequiredAssetName,
} from "../pure/distribution";
} from "../common/distribution";
import {
InvocationRateLimiter,
InvocationRateLimiterResultKind,
@@ -25,7 +25,7 @@ import {
import {
showAndLogErrorMessage,
showAndLogWarningMessage,
} from "../common/vscode/log";
} from "../common/logging";
/**
* distribution.ts
@@ -160,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.",
@@ -717,7 +718,7 @@ export enum DistributionKind {
PathEnvironmentVariable,
}
export interface Distribution {
interface Distribution {
codeQlPath: string;
kind: DistributionKind;
}
@@ -775,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;
}
@@ -852,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.`,
);
@@ -860,7 +862,7 @@ function warnDeprecatedLauncher() {
/**
* A release on GitHub.
*/
export interface Release {
interface Release {
assets: ReleaseAsset[];
/**
@@ -882,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.
*/
@@ -952,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

@@ -2,9 +2,9 @@ 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";
import { extLogger } from "../common/logging/vscode";
import { UserCancellationException } from "../common/vscode/progress";
import { showAndLogErrorMessage } from "../common/vscode/log";
import { showAndLogErrorMessage } from "../common/logging";
/**
* Finds the language that a query targets.
@@ -59,6 +59,7 @@ export async function askForLanguage(
throw new UserCancellationException("Cancelled.");
} else {
void showAndLogErrorMessage(
extLogger,
"Language not found. Language must be specified manually.",
);
}
@@ -67,6 +68,7 @@ export async function askForLanguage(
if (!isQueryLanguage(language)) {
void showAndLogErrorMessage(
extLogger,
`Language '${language}' is not supported. Only languages ${Object.values(
QueryLanguage,
).join(", ")} are supported.`,

View File

@@ -1,6 +1,6 @@
import { CodeQLCliServer } from "./cli";
import { QueryMetadata } from "../pure/interface-types";
import { extLogger } from "../common";
import { QueryMetadata } from "../common/interface-types";
import { extLogger } from "../common/logging/vscode";
/**
* Gets metadata for a query, if it exists.

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;

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[];
}

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

@@ -4,7 +4,6 @@ import type { AstItem } from "../language-support";
import type { DbTreeViewItem } from "../databases/ui/db-tree-view-item";
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 "../query-testing/test-tree-node";
import type {
VariantAnalysis,
@@ -12,6 +11,8 @@ import type {
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 { Method, Usage } from "../model-editor/method";
// A command function matching the signature that VS Code calls when
// a command is invoked from a context menu on a TreeView with
@@ -55,10 +56,11 @@ export type ExplorerSelectionCommandFunction<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}`,
@@ -129,8 +131,15 @@ export type LocalQueryCommands = {
"codeQL.runQueryOnMultipleDatabasesContextEditor": (
uri?: Uri,
) => Promise<void>;
"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>;
@@ -210,6 +219,24 @@ export type LocalDatabasesCommands = {
"codeQLDatabases.chooseDatabaseGithub": () => Promise<void>;
"codeQLDatabases.sortByName": () => Promise<void>;
"codeQLDatabases.sortByDateAdded": () => Promise<void>;
"codeQLDatabases.displayAllLanguages": () => Promise<void>;
"codeQLDatabases.displayCpp": () => Promise<void>;
"codeQLDatabases.displayCsharp": () => Promise<void>;
"codeQLDatabases.displayGo": () => Promise<void>;
"codeQLDatabases.displayJava": () => Promise<void>;
"codeQLDatabases.displayJavascript": () => Promise<void>;
"codeQLDatabases.displayPython": () => Promise<void>;
"codeQLDatabases.displayRuby": () => Promise<void>;
"codeQLDatabases.displaySwift": () => Promise<void>;
"codeQLDatabases.displayAllLanguagesSelected": () => Promise<void>;
"codeQLDatabases.displayCppSelected": () => Promise<void>;
"codeQLDatabases.displayCsharpSelected": () => Promise<void>;
"codeQLDatabases.displayGoSelected": () => Promise<void>;
"codeQLDatabases.displayJavaSelected": () => Promise<void>;
"codeQLDatabases.displayJavascriptSelected": () => Promise<void>;
"codeQLDatabases.displayPythonSelected": () => Promise<void>;
"codeQLDatabases.displayRubySelected": () => Promise<void>;
"codeQLDatabases.displaySwiftSelected": () => Promise<void>;
// Database panel context menu
"codeQLDatabases.setCurrentDatabase": (
@@ -237,10 +264,6 @@ export type VariantAnalysisCommands = {
scannedRepo: VariantAnalysisScannedRepository,
variantAnalysisSummary: VariantAnalysis,
) => Promise<void>;
"codeQL.copyVariantAnalysisRepoList": (
variantAnalysisId: number,
filterSort?: RepositoriesFilterSortStateWithIds,
) => Promise<void>;
"codeQL.loadVariantAnalysisRepoResults": (
variantAnalysisId: number,
repositoryFullName: string,
@@ -262,6 +285,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 = {
@@ -297,8 +321,13 @@ export type PackagingCommands = {
"codeQL.downloadPacks": () => Promise<void>;
};
export type DataExtensionsEditorCommands = {
"codeQL.openDataExtensionsEditor": () => Promise<void>;
export type ModelEditorCommands = {
"codeQL.openModelEditor": () => Promise<void>;
"codeQLModelEditor.jumpToUsageLocation": (
method: Method,
usage: Usage,
databaseItem: DatabaseItem,
) => Promise<void>;
};
export type EvalLogViewerCommands = {
@@ -338,7 +367,7 @@ export type AllExtensionCommands = BaseCommands &
AstCfgCommands &
AstViewerCommands &
PackagingCommands &
DataExtensionsEditorCommands &
ModelEditorCommands &
EvalLogViewerCommands &
SummaryLanguageSupportCommands &
Partial<TestUICommands> &

View File

@@ -1,5 +1,5 @@
import { DisposableObject } from "../pure/disposable-object";
import { getErrorMessage } from "../pure/helpers-pure";
import { DisposableObject } from "./disposable-object";
import { getErrorMessage } from "./helpers-pure";
import { Logger } from "./logging";
/**
@@ -7,11 +7,14 @@ import { Logger } from "./logging";
* files. This class automatically prevents more than one discovery operation from running at the
* same time.
*/
export abstract class Discovery<T> extends DisposableObject {
export abstract class Discovery extends DisposableObject {
private restartWhenFinished = false;
private currentDiscoveryPromise: Promise<void> | undefined;
constructor(private readonly name: string, private readonly logger: Logger) {
constructor(
protected readonly name: string,
private readonly logger: Logger,
) {
super();
}
@@ -64,14 +67,12 @@ export abstract class Discovery<T> extends DisposableObject {
* discovery.
*/
private async launchDiscovery(): Promise<void> {
let results: T | undefined;
try {
results = await this.discover();
await this.discover();
} catch (err) {
void this.logger.log(
`${this.name} failed. Reason: ${getErrorMessage(err)}`,
);
results = undefined;
}
if (this.restartWhenFinished) {
@@ -82,24 +83,11 @@ export abstract class Discovery<T> extends DisposableObject {
// succeeded or failed.
this.restartWhenFinished = false;
await this.launchDiscovery();
} else {
// If the discovery was successful, then update any listeners with the results.
if (results !== undefined) {
this.update(results);
}
}
}
/**
* 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

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

View File

@@ -1,5 +1,6 @@
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.
@@ -51,7 +52,7 @@ export async function getDirectoryNamesInsidePath(
return dirNames;
}
function normalizePath(path: string): string {
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
@@ -107,3 +108,22 @@ export async function* walkDirectory(
}
}
}
/**
* 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,7 +5,7 @@ import {
ResultSetSchema,
Column,
ResolvableLocationValue,
} from "./bqrs-cli-types";
} from "../common/bqrs-cli-types";
import {
VariantAnalysis,
VariantAnalysisScannedRepositoryResult,
@@ -14,12 +14,13 @@ import {
import {
RepositoriesFilterSortState,
RepositoriesFilterSortStateWithIds,
} from "./variant-analysis-filter-sort";
import { ErrorLike } from "./errors";
} 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 { DataExtensionEditorViewState } from "../data-extensions-editor/shared/view-state";
import { Method, Usage } from "../model-editor/method";
import { ModeledMethod } from "../model-editor/modeled-method";
import { ModelEditorViewState } from "../model-editor/shared/view-state";
import { Mode } from "../model-editor/shared/mode";
/**
* This module contains types and code that are shared between
@@ -75,11 +76,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;
@@ -105,7 +104,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";
}
@@ -113,7 +112,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;
@@ -142,7 +141,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;
@@ -172,7 +171,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";
}
@@ -202,7 +201,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;
@@ -211,7 +210,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;
@@ -273,7 +272,7 @@ export interface RawResultsSortState {
sortDirection: SortDirection;
}
export type InterpretedResultsSortColumn = "alert-message";
type InterpretedResultsSortColumn = "alert-message";
export interface InterpretedResultsSortState {
sortBy: InterpretedResultsSortColumn;
@@ -317,7 +316,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";
}
@@ -405,12 +404,12 @@ export interface ParsedResultSets {
resultSet: ResultSet;
}
export interface SetVariantAnalysisMessage {
interface SetVariantAnalysisMessage {
t: "setVariantAnalysis";
variantAnalysis: VariantAnalysis;
}
export interface SetFilterSortStateMessage {
interface SetFilterSortStateMessage {
t: "setFilterSortState";
filterSortState: RepositoriesFilterSortState;
}
@@ -419,48 +418,48 @@ 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;
}
@@ -482,7 +481,7 @@ export type FromVariantAnalysisMessage =
| CancelVariantAnalysisMessage
| ShowDataFlowPathsMessage;
export interface SetDataFlowPathsMessage {
interface SetDataFlowPathsMessage {
t: "setDataFlowPaths";
dataFlowPaths: DataFlowPaths;
}
@@ -491,76 +490,137 @@ export type ToDataFlowPathsMessage = SetDataFlowPathsMessage;
export type FromDataFlowPathsMessage = CommonFromViewMessages;
export interface SetExtensionPackStateMessage {
t: "setDataExtensionEditorViewState";
viewState: DataExtensionEditorViewState;
interface SetExtensionPackStateMessage {
t: "setModelEditorViewState";
viewState: ModelEditorViewState;
}
export interface SetExternalApiUsagesMessage {
t: "setExternalApiUsages";
externalApiUsages: ExternalApiUsage[];
interface SetMethodsMessage {
t: "setMethods";
methods: Method[];
}
export interface ShowProgressMessage {
t: "showProgress";
step: number;
maxStep: number;
message: string;
interface SetModeledMethodsMessage {
t: "setModeledMethods";
methods: Record<string, ModeledMethod>;
}
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 SetModifiedMethodsMessage {
t: "setModifiedMethods";
methodSignatures: string[];
}
export interface JumpToUsageMessage {
interface SetInProgressMethodsMessage {
t: "setInProgressMethods";
packageName: string;
inProgressMethods: string[];
}
interface SwitchModeMessage {
t: "switchMode";
mode: Mode;
}
interface JumpToUsageMessage {
t: "jumpToUsage";
location: ResolvableLocationValue;
method: Method;
usage: Usage;
}
export interface OpenExtensionPackMessage {
interface OpenDatabaseMessage {
t: "openDatabase";
}
interface OpenExtensionPackMessage {
t: "openExtensionPack";
}
export interface OpenModelFileMessage {
t: "openModelFile";
interface RefreshMethods {
t: "refreshMethods";
}
export interface SaveModeledMethods {
interface SaveModeledMethods {
t: "saveModeledMethods";
externalApiUsages: ExternalApiUsage[];
methods: Method[];
modeledMethods: Record<string, ModeledMethod>;
}
export interface GenerateExternalApiMessage {
t: "generateExternalApi";
interface GenerateMethodMessage {
t: "generateMethod";
}
export interface GenerateExternalApiFromLlmMessage {
t: "generateExternalApiFromLlm";
externalApiUsages: ExternalApiUsage[];
interface GenerateMethodsFromLlmMessage {
t: "generateMethodsFromLlm";
packageName: string;
methods: Method[];
modeledMethods: Record<string, ModeledMethod>;
}
export type ToDataExtensionsEditorMessage =
interface StopGeneratingMethodsFromLlmMessage {
t: "stopGeneratingMethodsFromLlm";
packageName: string;
}
interface ModelDependencyMessage {
t: "modelDependency";
}
interface HideModeledMethodsMessage {
t: "hideModeledMethods";
hideModeledMethods: boolean;
}
interface SetModeledMethodMessage {
t: "setModeledMethod";
method: ModeledMethod;
}
export type ToModelEditorMessage =
| SetExtensionPackStateMessage
| SetExternalApiUsagesMessage
| ShowProgressMessage
| AddModeledMethodsMessage;
| SetMethodsMessage
| SetModeledMethodsMessage
| SetModifiedMethodsMessage
| SetInProgressMethodsMessage;
export type FromDataExtensionsEditorMessage =
export type FromModelEditorMessage =
| ViewLoadedMsg
| OpenModelFileMessage
| SwitchModeMessage
| RefreshMethods
| OpenDatabaseMessage
| OpenExtensionPackMessage
| JumpToUsageMessage
| SaveModeledMethods
| GenerateExternalApiMessage
| GenerateExternalApiFromLlmMessage;
| GenerateMethodMessage
| GenerateMethodsFromLlmMessage
| StopGeneratingMethodsFromLlmMessage
| ModelDependencyMessage
| HideModeledMethodsMessage
| SetModeledMethodMessage;
export type FromMethodModelingMessage =
| TelemetryMessage
| UnhandledErrorMessage
| SetModeledMethodMessage;
interface SetMethodMessage {
t: "setMethod";
method: Method;
}
interface SetMethodModifiedMessage {
t: "setMethodModified";
isModified: boolean;
}
interface SetSelectedMethodMessage {
t: "setSelectedMethod";
method: Method;
modeledMethod: ModeledMethod;
isModified: boolean;
}
export type ToMethodModelingMessage =
| SetMethodMessage
| SetModeledMethodMessage
| SetMethodModifiedMessage
| SetSelectedMethodMessage;

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

@@ -1,18 +1,8 @@
import { window } from "vscode";
import { RedactableError } from "../../pure/errors";
import { telemetryListener } from "../../telemetry";
import { extLogger, OutputChannelLogger } from "../logging";
interface ShowAndLogExceptionOptions extends ShowAndLogOptions {
/** Custom properties to include in the telemetry report. */
extraTelemetryProperties?: { [key: string]: string };
}
import { NotificationLogger } from "./notification-logger";
import { AppTelemetry } from "../telemetry";
import { RedactableError } from "../errors";
interface ShowAndLogOptions {
/** The output logger that will receive the message. */
outputLogger?: OutputChannelLogger;
/** A set of items that will be rendered as actions in the message. */
items?: string[];
/**
* 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.
@@ -20,37 +10,24 @@ interface ShowAndLogOptions {
fullMessage?: string;
}
/**
* Show an error message, log it to the console, and emit redacted information as telemetry
*
* @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(
error: RedactableError,
options: ShowAndLogExceptionOptions = {},
): Promise<string | undefined> {
telemetryListener?.sendError(error, options.extraTelemetryProperties);
return showAndLogErrorMessage(error.fullMessage, options);
}
/**
* 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.
* @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<string | undefined> {
): Promise<void> {
return internalShowAndLog(
logger,
dropLinesExceptInitial(message),
window.showErrorMessage,
logger.showErrorMessage,
{ fullMessage: message, ...options },
);
}
@@ -62,48 +39,78 @@ function dropLinesExceptInitial(message: string, n = 2) {
/**
* 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.
* @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<string | undefined> {
return internalShowAndLog(message, window.showWarningMessage, options);
): 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.
* @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<string | undefined> {
return internalShowAndLog(message, window.showInformationMessage, options);
): Promise<void> {
return internalShowAndLog(
logger,
message,
logger.showInformationMessage,
options,
);
}
type ShowMessageFn = (
message: string,
...items: string[]
) => Thenable<string | undefined>;
async function internalShowAndLog(
logger: NotificationLogger,
message: string,
fn: ShowMessageFn,
{ items = [], outputLogger = extLogger, fullMessage }: ShowAndLogOptions = {},
): Promise<string | undefined> {
const label = "Show Log";
void outputLogger.log(fullMessage || message);
const result = await fn(message, label, ...items);
if (result === label) {
outputLogger.show();
}
return result;
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.fullMessage, 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,5 +1,8 @@
import { Repository } from "../repository";
import { VariantAnalysis, VariantAnalysisRepoTask } from "../variant-analysis";
import { Repository } from "../../variant-analysis/gh-api/repository";
import {
VariantAnalysis,
VariantAnalysisRepoTask,
} from "../../variant-analysis/gh-api/variant-analysis";
// Types that represent requests/responses from the GitHub API
// that we need to mock.
@@ -10,13 +13,15 @@ export enum RequestKind {
GetVariantAnalysis = "getVariantAnalysis",
GetVariantAnalysisRepo = "getVariantAnalysisRepo",
GetVariantAnalysisRepoResult = "getVariantAnalysisRepoResult",
CodeSearch = "codeSearch",
AutoModel = "autoModel",
}
export interface BasicErorResponse {
interface BasicErorResponse {
message: string;
}
export interface GetRepoRequest {
interface GetRepoRequest {
request: {
kind: RequestKind.GetRepo;
};
@@ -26,7 +31,7 @@ export interface GetRepoRequest {
};
}
export interface SubmitVariantAnalysisRequest {
interface SubmitVariantAnalysisRequest {
request: {
kind: RequestKind.SubmitVariantAnalysis;
};
@@ -36,7 +41,7 @@ export interface SubmitVariantAnalysisRequest {
};
}
export interface GetVariantAnalysisRequest {
interface GetVariantAnalysisRequest {
request: {
kind: RequestKind.GetVariantAnalysis;
};
@@ -46,7 +51,7 @@ export interface GetVariantAnalysisRequest {
};
}
export interface GetVariantAnalysisRepoRequest {
interface GetVariantAnalysisRepoRequest {
request: {
kind: RequestKind.GetVariantAnalysisRepo;
repositoryId: number;
@@ -69,12 +74,47 @@ export interface GetVariantAnalysisRepoResultRequest {
};
}
interface CodeSearchRequest {
request: {
kind: RequestKind.CodeSearch;
query: string;
};
response: {
status: number;
body?: {
total_count?: number;
items?: Array<{
repository: Repository;
}>;
};
message?: string;
};
}
interface AutoModelRequest {
request: {
kind: RequestKind.AutoModel;
body?: {
candidates: string;
};
};
response: {
status: number;
body?: {
models: string;
};
message?: string;
};
}
export type GitHubApiRequest =
| GetRepoRequest
| SubmitVariantAnalysisRequest
| GetVariantAnalysisRequest
| GetVariantAnalysisRepoRequest
| GetVariantAnalysisRepoResultRequest;
| GetVariantAnalysisRepoResultRequest
| CodeSearchRequest
| AutoModelRequest;
export const isGetRepoRequest = (
request: GitHubApiRequest,
@@ -99,3 +139,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,11 +129,11 @@ 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/variant-analysis/gh-api/mocks/scenarios",
"src/common/mock-gh-api/scenarios",
);
if (await pathExists(scenariosPath)) {
return scenariosPath;

View File

@@ -8,7 +8,7 @@ import { IsomorphicResponse } from "@mswjs/interceptors";
import { Headers } from "headers-polyfill";
import fetch from "node-fetch";
import { DisposableObject } from "../../../pure/disposable-object";
import { DisposableObject } from "../disposable-object";
import {
GetVariantAnalysisRepoResultRequest,
@@ -245,6 +245,35 @@ async function createGitHubApiRequest(
};
}
const codeSearchMatch = url.match(/\/search\/code\?q=(?<query>.*)$/);
if (codeSearchMatch?.groups?.query) {
return {
request: {
kind: RequestKind.CodeSearch,
query: codeSearchMatch?.groups?.query,
},
response: {
status,
body: JSON.parse(body),
},
};
}
const autoModelMatch = url.match(
/\/repos\/github\/codeql\/code-scanning\/codeql\/auto-model/,
);
if (autoModelMatch) {
return {
request: {
kind: RequestKind.AutoModel,
},
response: {
status,
body: JSON.parse(body),
},
};
}
return undefined;
}

View File

@@ -3,6 +3,8 @@ import { readdir, readJson, readFile } from "fs-extra";
import { DefaultBodyType, MockedRequest, rest, RestHandler } from "msw";
import {
GitHubApiRequest,
isAutoModelRequest,
isCodeSearchRequest,
isGetRepoRequest,
isGetVariantAnalysisRepoRequest,
isGetVariantAnalysisRepoResultRequest,
@@ -12,7 +14,7 @@ import {
const baseUrl = "https://api.github.com";
export type RequestHandler = RestHandler<MockedRequest<DefaultBodyType>>;
type RequestHandler = RestHandler<MockedRequest<DefaultBodyType>>;
export async function createRequestHandlers(
scenarioDirPath: string,
@@ -25,6 +27,8 @@ export async function createRequestHandlers(
createGetVariantAnalysisRequestHandler(requests),
createGetVariantAnalysisRepoRequestHandler(requests),
createGetVariantAnalysisRepoResultRequestHandler(requests),
createCodeSearchRequestHandler(requests),
createAutoModelRequestHandler(requests),
];
return handlers;
@@ -193,3 +197,54 @@ function createGetVariantAnalysisRepoResultRequestHandler(
},
);
}
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?q=*`, (_req, res, ctx) => {
const request = codeSearchRequests[requestIndex];
if (requestIndex < codeSearchRequests.length - 1) {
// If there are more requests to come, increment the index.
requestIndex++;
}
return res(
ctx.status(request.response.status),
ctx.json(request.response.body),
);
});
}
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`,
(_req, res, ctx) => {
const request = autoModelRequests[requestIndex];
if (requestIndex < autoModelRequests.length - 1) {
// If there are more requests to come, increment the index.
requestIndex++;
}
return res(
ctx.status(request.response.status),
ctx.json(request.response.body),
);
},
);
}

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