The Cucumber Language Service library has two APIs:
- Extraction API
- Language Service API, which is used by Cucumber Language Server and Cucumber Monaco
The Extraction API provides data structures that are passed as input to the Language Service API.
The Extraction API is used to extract information from Gherkin Documents and Step Definitions. It generates data structures that are consumed by the Language Service API.
graph TD
A[Glue source code\nJava/Ruby/TypeScript/JavaScript/etc.] -->|tree-sitter| B[Expressions]
C[Gherkin source code] -->|Gherkin Parser| D[Gherkin Steps]
B --> E[buildSuggestions]
D --> E
E --> F[Suggestions]
F --> G[Index]
Cucumber Expressions and Regular Expressions are extracted from Java/Ruby/TypeScript/JavaScript/etc. source code using tree-sitter.
Gherkin steps are extracted from Gherkin source code using the Gherkin parser.
Expressions and steps are passed to buildSuggestions
to produce an array of Suggestion
, and these are used to update
a (search) Index
.
The Language Service API provides LSP services.
The expressions and index objects are used in the various getXxx
functions that provide the
"editor" API. This API is used by both Cucumber Language Server
and Cucumber Monaco.