open-policy-agent / vscode-opa

An extension for VS Code which provides support for OPA and the Rego policy language
https://openpolicyagent.org
Apache License 2.0
110 stars 31 forks source link

command 'opa.test.workspace' not found #115

Closed ericjkao closed 5 months ago

ericjkao commented 5 months ago

Repro steps:

  1. mkdir case1 && cd case1
  2. echo 'package main' >> rules.rego
  3. echo 'test_1 {true}' >> rules.rego
  4. Open folder case1 in vscode.
  5. Open the command palette and run OPA: Test Workspace

Expected behavior: the test runs Actual behavior: error dialogue box showing command 'opa.test.workspace' not found image

Very strangely, creating the exact same rego file within vscode makes the whole thing work. It's so strange that I fear it's a dumb user mistake on my part. But I tried many times with many variations and get the same result.

Screen capture videos:

First showing the buggy behavior https://github.com/open-policy-agent/vscode-opa/assets/13672872/da69a9d5-fff3-4119-9b32-6edcbc14f39b

Then showing it working correctly https://github.com/open-policy-agent/vscode-opa/assets/13672872/7f5bbb0f-4c36-4a20-a86d-5efba349051a

Environment:

Extension 0.13.4 image

VSCode Version: 1.87.2 (Universal) Commit: 863d2581ecda6849923a2118d93a088b0745d9d6 Date: 2024-03-08T15:21:31.043Z Electron: 27.3.2 ElectronBuildId: 26836302 Chromium: 118.0.5993.159 Node.js: 18.17.1 V8: 11.8.172.18-electron.0 OS: Darwin x64 21.6.0

anderseknert commented 5 months ago

Thanks for reporting that @ericjkao 👍 I fixed some other issues in the code this evening, so I took a shot at this too, and that PR linked fixes the issue, or at least I'm unable to reproduce it after.

ericjkao commented 5 months ago

Awesome. Thank you! I'll retry after the fix is released.

anderseknert commented 5 months ago

@ericjkao fix is released :)