Add HTML Documentation API (#1758)

Add support for the HTML documentation chunks
This commit is contained in:
Dmitry Bushev 2021-06-01 15:43:22 +03:00 committed by GitHub
parent 1661832c95
commit d67f7a2b31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 131 additions and 14 deletions

View File

@ -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)
@ -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)
@ -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.
@ -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.
@ -1371,6 +1441,7 @@ a given execution context.
#### Enables
- [`search/suggestionsDatabaseUpdate`](#suggestionsdatabaseupdate)
- [`search/suggestionsOrderDatabaseUpdate`](#suggestionsorderdatabaseupdate)
#### Disables
@ -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.

View File

@ -20,6 +20,7 @@ ordering the results.
- [Runtime Inspection](#runtime-inspection)
- [Search Indexes](#search-indexes)
- [Results Ranking](#results-ranking)
- [Implementation](#implementation)
<!-- /MarkdownTOC -->
@ -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
@ -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`)

View File

@ -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)
@ -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()