Skip to content

Latest commit

 

History

History
61 lines (49 loc) · 2.5 KB

ARCHITECTURE.md

File metadata and controls

61 lines (49 loc) · 2.5 KB

Architecture

The Cucumber Language Service library has two APIs:

The Extraction API provides data structures that are passed as input to the Language Service API.

Extraction 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.

+--------------------+       +---------------+
| Java/Ruby/         |       | Gherkin       |
| TypeScript/        |       | source code   |
| JavaScript/etc..   |       +-------+-------+
| source code        |               |
+----------+---------+               |
           |                         |
+----------v---------+       +-------v--------+
|    tree-sitter     |       | Gherkin Parser |
+----------+---------+       +-------+--------+
           |                         |
+----------v---------+       +-------v-------+
|    Expressions     |       | Gherkin Steps |
+----------+---------+       +-------+-------+
           |                         |
           +-------------+-----------+
                         |
               +---------v--------+
               | buildSuggestions |
               +---------+--------+
                         |
                  +------v------+
                  | Suggestions |
                  +------+------+
                         |
                 +-------v-------+
                 |     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.

Language Service API

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.