Skip to content

Add an editor/language-service API to cel-js #91

@AntonPieper

Description

@AntonPieper

Editor integrations currently need to reimplement a lot of CEL intelligence outside cel-js.

I would like a first-class API on a LanguageService, for example:

import { createLanguageService } from "@marcbachmann/cel-js/language-service";

// If tree-shaking is no concern:
// const ls = env.languageService();
const ls = createLanguageService(env);

ls.complete(source, cursor, options?);
ls.hover(source, cursor, options?);
ls.diagnostics(source, options?);
ls.signatureHelp(source, cursor, options?);
ls.symbols(source, cursor, options?);

Lower-level primitives in Environment would also help, for example:

  • env.resolveAt(source, cursor)
  • env.scopeAt(...)
  • env.membersOfType(...)

The main goal is to avoid sentinel hacks, manual scope reconstruction, manual receiver inference, and custom hover/completion logic in editor consumers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions