Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
189 changes: 94 additions & 95 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -151,103 +151,102 @@ MD043: false
# MD044/proper-names - Proper names should have the correct capitalization
MD044:
# List of proper names
names: [

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had some dprint issues and it was easier to make this a normal yaml list.

names:
# Companies/Organizations/Products
"ACR",
"AKS",
"Amazon",
"Anthos",
"Auth0",
"AWS",
"Azure",
"Bitbucket",
"CIS",
"CloudFormation",
"CNCF",
"DAS",
"DDB",
"Docker",
"DSS",
"DynamoDB",
"EKS",
"Elasticsearch",
"Envoy",
"GCP",
"GitHub",
"GKE",
"Gmail",
"Google",
"HashiCorp",
"Helm",
"Istio",
"JavaScript",
"Kafka",
"KMS",
"Kong",
"Kubernetes",
"Kuma",
"Linux",
"macOS",
"Microsoft",
"MITRE",
"NGNIX",
"Okta",
"OPA",
"OpenAPI",
"OpenShift",
"PCI",
"Postgres",
"PostgreSQL",
"MySQL",
"RDS",
"RHEL",
"S3",
"Terraform",
"WebAssembly",
- ACR
- AKS
- Amazon
- Anthos
- Auth0
- AWS
- Azure
- Bitbucket
- CIS
- CloudFormation
- CNCF
- DAS
- DDB
- Docker
- DSS
- DynamoDB
- EKS
- Elasticsearch
- Envoy
- GCP
- GitHub
- GKE
- Gmail
- Google
- HashiCorp
- Helm
- Istio
- JavaScript
- Kafka
- KMS
- Kong
- Kubernetes
- Kuma
- Linux
- macOS
- Microsoft
- MITRE
- NGNIX
- Okta
- OPA
- OpenAPI
- OpenShift
- PCI
- Postgres
- PostgreSQL
- MySQL
- RDS
- RHEL
- S3
- Terraform
- WebAssembly
# Terms
"ABAC",
"API",
"CI/CD",
"CLI",
"DevOps",
"DevSecOps",
"DNS",
"FAQ",
"GDPR",
"gRPC",
"GUI",
"HMAC",
"HTML",
"HTTP",
"HTTPS",
"IAM",
"IP",
"IRSA",
"JSON",
"JWT",
"LDAP",
"MFPA",
"mTLS",
"PAM",
"RBAC",
"REPL",
"SaaS",
"SASL",
"SCIM",
"SDK",
"SLA",
"SLP",
"SMTP",
"SSH",
"SSL",
"SSO",
"TLS",
"URL",
"vCPU",
"VPC",
"vscode-opa",
"YAML",
]
- ABAC
- API
- CI/CD
- CLI
- DevOps
- DevSecOps
- DNS
- FAQ
- GDPR
- gRPC
- GUI
- HMAC
- HTML
- HTTP
- HTTPS
- IAM
- IP
- IRSA
- JSON
- JWT
- LDAP
- MFPA
- mTLS
- PAM
- RBAC
- REPL
- SaaS
- SASL
- SCIM
- SDK
- SLA
- SLP
- SMTP
- SSH
- SSL
- SSO
- TLS
- URL
- vCPU
- VPC
- vscode-opa
- YAML
# Ignore code blocks
code_blocks: false
html_elements: false
Expand Down
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,23 @@
"PATH": "${env:PATH}"
}
},
{
"name": "Extension (no debugger attached)",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"noDebug": true,
"preLaunchTask": {
"type": "npm",
"script": "watch"
},
"env": {
"VSCODE_DEBUG_MODE": "true",
"PATH": "${env:PATH}"
}
},
{
"name": "Extension Tests",
"type": "extensionHost",
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
- Highlight the `and` and `or` keywords [#482](https://github.com/open-policy-agent/vscode-opa/pull/482)
- For dependency updates, please see [full change log](https://github.com/open-policy-agent/vscode-opa/compare/v0.24.1...v0.25.0)


## 0.24.1

Updates to dependencies only, missed in 0.24.0.


## 0.24.0

- Allow connecting to running Debug Adapter Protocol service [#465](https://github.com/open-policy-agent/vscode-opa/pull/465)
Expand Down
1 change: 1 addition & 0 deletions cspell.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ words:
ignoreWords:
- tjons # OPA contributor GH handle
- dprint
- Ledford
3 changes: 2 additions & 1 deletion src/da/activate.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as vscode from "vscode";

import { REGAL_CONFIG, resolveBinary } from "../binaries";
import { existsSync, getInputPath, opaOutputChannel } from "../extension";
import { existsSync, getInputPath } from "../extension";
import { opaOutputChannel } from "../output";
import * as opa from "./../opa";

const minimumSupportedRegalVersion = "0.26.0";
Expand Down
48 changes: 48 additions & 0 deletions src/eval.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import * as vscode from "vscode";

import { opaOutputShowError } from "./output";

let lastEvalSelectionRange: { fileName: string; startRow: number; endRow: number } | undefined;

export function consumeEvalSelectionCoverageFilter(): (fileName: string, ranges: any[]) => any[] {
const range = lastEvalSelectionRange;
lastEvalSelectionRange = undefined;

return (fileName: string, ranges: any[]) => {
if (!range || !range.fileName.endsWith(fileName)) {
return ranges;
}

// Coverage inside the evaluated selection reflects the ad-hoc query, not the file, so
// drop it rather than show it as covered or not covered.
return ranges.filter((r: any) => !(r.start.row <= range.endRow && r.end.row >= range.startRow));
};
}

export async function evalSelection(editor: vscode.TextEditor) {
const selection = editor.selection;
let lastLine = selection.end.line;
if (selection.end.character === 0 && lastLine > selection.start.line) {
lastLine -= 1;
}

const args = {
target: editor.document.uri.toString(),
// "path" is the regal.eval command's field for the query text, not a file path. It can
// hold a plain query as well as a rule reference.
path: editor.document.getText(selection),
row: lastLine + 1,
};

lastEvalSelectionRange = {
fileName: editor.document.fileName,
startRow: selection.start.line + 1,
endRow: lastLine + 1,
};

try {
await vscode.commands.executeCommand("regal.eval", JSON.stringify(args));
} catch (error) {
opaOutputShowError(error instanceof Error ? error.message : String(error));
}
}
Loading
Loading