Skip to content

Commit

Permalink
Add polarity search and type search in protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
xvw committed Sep 23, 2024
1 parent 87eeea0 commit e47a488
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions doc/dev/PROTOCOL.md
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,34 @@ The result is returned as a list of:

Returns the type of the expression when typechecked in the environment around the specified position.

### `search-by-polarity` -position <position> -query <string>

-position <position> Position to search
-query <string> The query

Returns a list (in the form of a completion list) of values matching the query. A query is defined by polarity (and does not support type parameters). Arguments are prefixed with `-` and the return type is prefixed with `+`. For example, to find a function that takes a string and returns an integer: `-string +int`. `-list +option` will returns every definition that take a list an option.

### `search-by-type` -position <position> -query <string> -limit <int>

-position <position> Position to search
-query <string> The query
-limit <int> a maximum-size of the result set

Returns a list of values matching the query. A query is a type expression, ie: `string -> int option` will search every definition that take a string and returns an option of int. It is also possible to search by polarity.

The result is returned as a list of:
```javascript
{
'file': filename, // the file where the definition is defined
'start': position,
'end': position,
'name': string, // the name of the definition
'type': string, // the type of the definition
'cost': int, // the cost/distance of the definition and the query
'doc': string | null // the docstring of the definition
}
```

### `check-configuration`


Expand Down

0 comments on commit e47a488

Please sign in to comment.