Skip to content

Commit

Permalink
Add HTML Documentation API (#1758)
Browse files Browse the repository at this point in the history
Add support for the HTML documentation chunks
  • Loading branch information
4e6 authored and iamrecursion committed Jun 24, 2021
1 parent aa8e5b7 commit 050951d
Show file tree
Hide file tree
Showing 3 changed files with 131 additions and 14 deletions.
93 changes: 93 additions & 0 deletions docs/language-server/protocol-language-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ transport formats, please look [here](./protocol-architecture).
- [`SuggestionEntryType`](#suggestionentrytype)
- [`SuggestionId`](#suggestionid)
- [`SuggestionsDatabaseEntry`](#suggestionsdatabaseentry)
- [`SuggestionsOrderDatabaseEntry`](#suggestionsorderdatabaseentry)
- [`FieldAction`](#fieldaction)
- [`FieldUpdate`](#fieldupdate)
- [`SuggestionArgumentUpdate`](#suggestionargumentupdate)
- [`SuggestionsDatabaseUpdate`](#suggestionsdatabaseupdate)
- [`SuggestionsOrderDatabaseUpdate`](#suggestionsorderdatabaseupdate)
- [`Export`](#export)
- [`File`](#file)
- [`DirectoryTree`](#directorytree)
Expand Down Expand Up @@ -132,6 +134,7 @@ transport formats, please look [here](./protocol-architecture).
- [`search/invalidateSuggestionsDatabase`](#searchinvalidatesuggestionsdatabase)
- [`search/getSuggestionsDatabaseVersion`](#searchgetsuggestionsdatabaseversion)
- [`search/suggestionsDatabaseUpdate`](#searchsuggestionsdatabaseupdate)
- [`search/suggestionsOrderDatabaseUpdate`](#searchsuggestionsorderdatabaseupdate)
- [`search/completion`](#searchcompletion)
- [`search/import`](#searchimport)
- [Input/Output Operations](#inputoutput-operations)
Expand Down Expand Up @@ -484,6 +487,32 @@ interface SuggestionsDatabaseEntry {
}
```

### `SuggestionsOrderDatabaseEntry`

The entry in the suggestions order database.

#### Format

```typescript
interface SuggestionsOrderDatabaseEntry {
/**
* The unique identifier of a suggestion referring to the `id` identifier of
* the suggestions database.
*/
suggestionId: SuggestionId;

/**
* The suggestion that goes before this one in the source file.
*/
prevId?: SuggestionId;

/**
* Ths suggestion that goes after this one in the source file.
*/
nextId?: SuggestionId;
}
```

### `FieldAction`

The modifying action on a record field.
Expand Down Expand Up @@ -649,6 +678,47 @@ interface Modify {
}
```

### `SuggestionsOrderDatabaseUpdate`

The update of the suggestions order database.

#### Format

```typescript
/**
* The kind of the suggestions order database update.
*/
type SuggestionsOrderDatabaseUpdate = AddOrder | RemoveOrder | ModifyOrder;

interface AddOrder {
entry: SuggestionOrderDatabaseEntry;
}

interface RemoveOrder {
/**
* The unique identifier of a suggestion.
*/
suggestionId: SuggestionId;
}

interface ModifyOrder {
/**
* The unique identifier of a suggestion.
*/
suggestionId: SuggestionId;

/**
* The previous suggestion id to update.
*/
prevId?: FieldUpdate<SuggestionId>;

/**
* The next suggestion id to update.
*/
nextId?: FieldUpdate<SuggestionId>;
}
```

### `Export`

The info about module re-export.
Expand Down Expand Up @@ -1371,6 +1441,7 @@ a given execution context.
#### Enables

- [`search/suggestionsDatabaseUpdate`](#suggestionsdatabaseupdate)
- [`search/suggestionsOrderDatabaseUpdate`](#suggestionsorderdatabaseupdate)

#### Disables

Expand Down Expand Up @@ -3526,6 +3597,28 @@ database.

None

### `search/suggestionsOrderDatabaseUpdate`

Sent from server to the client to inform abouth the change in the suggestions
order database.

- **Type:** Notification
- **Direction:** Server -> Client
- **Connection:** Protocol
- **Visibility:** Public

#### Parameters

```typescript
{
updates: [SuggestionsOrderDatabaseUpdate];
}
```

#### Errors

None

### `search/completion`

Sent from client to the server to receive the autocomplete suggestion.
Expand Down
48 changes: 36 additions & 12 deletions docs/runtime/searcher.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ ordering the results.
- [Runtime Inspection](#runtime-inspection)
- [Search Indexes](#search-indexes)
- [Results Ranking](#results-ranking)
- [Implementation](#implementation)

<!-- /MarkdownTOC -->

Expand All @@ -45,18 +46,19 @@ directory. That way the index can be preserved between the IDE restarts.

Suggestions table stores suggestion entries.

| Column | Type | Description |
| --------------- | --------- | ------------------------------------------------------------------- |
| `id` | `INTEGER` | the unique identifier |
| `externalId` | `UUID` | the external id from the IR |
| `kind` | `INTEGER` | the type of suggestion entry, i.e. Atom, Method, Function, or Local |
| `module` | `TEXT` | the module name |
| `name` | `TEXT` | the suggestion name |
| `self_type` | `TEXT` | the self type of the Method |
| `return_type` | `TEXT` | the return type of the entry |
| `scope_start` | `INTEGER` | the start position of the definition scope |
| `scope_end` | `INTEGER` | the end position of the definition scope |
| `documentation` | `TEXT` | the documentation string |
| Column | Type | Description |
| -------------------- | --------- | ------------------------------------------------------------------- |
| `id` | `INTEGER` | the unique identifier |
| `externalId` | `UUID` | the external id from the IR |
| `kind` | `INTEGER` | the type of suggestion entry, i.e. Atom, Method, Function, or Local |
| `module` | `TEXT` | the module name |
| `name` | `TEXT` | the suggestion name |
| `self_type` | `TEXT` | the self type of the Method |
| `return_type` | `TEXT` | the return type of the entry |
| `scope_start` | `INTEGER` | the start position of the definition scope |
| `scope_end` | `INTEGER` | the end position of the definition scope |
| `documentation` | `TEXT` | the documentation string |
| `documentation_html` | `TEXT` | the documentation string rendered as HTML |

#### Arguments Table

Expand Down Expand Up @@ -92,6 +94,28 @@ Keeps track of SHA versions of the opened files.
| `path` | `TEXT` | the unique identifier of the file |
| `digest` | `BLOB` | the SHA hash of the file contents |

#### Schema Version Table

Schema version table has a single row with the current database schema version.
It is used during the application startup to check that the database schema is
up to date with the application version.

| Column | Type | Description |
| ------ | --------- | ------------------------------------------------------------------ |
| `id` | `INTEGER` | unique identifier representing the currend database schema version |

#### Suggestions Order Table

Suggestions order table stores the order of the module-level entries in the
source file. `suggestion_id` column is a foreign key that refers to the `id`
primary key in the Suggestions table.

| Column | Type | Description |
| --------------- | --------- | ---------------------------------------- |
| `suggestion_id` | `INTEGER` | the unique identifier of a suggestion |
| `prev_id` | `INTEGER` | the suggestion that goes before this one |
| `next_id` | `INTEGER` | the suggestion that goes after this one |

### Static Analysis

The database is filled by analyzing the Intermediate Representation (`IR`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class WorkspaceOperationsTest extends BaseServerTest with FlakySpec {
""")
}

"return an error when the project configuration cannot be decoded" in {
"return an error when the project configuration cannot be decoded" taggedAs Flaky in {
testYamlPath.delete()
val yamlOutStream = new FileOutputStream(testYamlPath)
yamlOutStream.write(0x00)
Expand All @@ -70,7 +70,7 @@ class WorkspaceOperationsTest extends BaseServerTest with FlakySpec {
""")
}

"return an error when the project configuration is not present" in {
"return an error when the project configuration is not present" taggedAs Flaky in {
testYamlPath.delete()

val client = getInitialisedWsClient()
Expand Down

0 comments on commit 050951d

Please sign in to comment.