Skip to content

Move parts of Rego handler input to store #1832

@anderseknert

Description

@anderseknert

When calling the handlers implemented in Rego, we provide a lot of metadata from the context:

  "regal": {
    "client": {
      "capabilities": {},
      "identifier": 1,
      "init_options": {
        "enableDebugCodelens": true,
        "evalCodelensDisplayInline": true,
        "formatter": "opa-fmt"
      }
    },
    "environment": {
      "path_separator": "/",
      "web_server_base_uri": "http://127.0.0.1:5052",
      "workspace_root_path": "/Users/foo/git/opa/regal",
      "workspace_root_uri": "file:///Users/foo/git/opa/regal"
    },
    "file": {
      "abs": "",
      "content": "",
      "lines": [],
      "name": "",
      "parse_errors": [],
      "rego_version": "unknown",
      "successful_parse_count": 0,
      "uri": ""
    }
  }

Which is often needed too. But things like the workspace root or the client init option does not change from one request to the other. So we should move this data from input and into the store and have it available somewhere under data instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    language serverIssues related to Regal's language serverperformancePerformance related issues or improvements

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions