mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
Document some rust-analyzer specific protocol extensions
This commit is contained in:
parent
9342273616
commit
dec4ba8023
2 changed files with 70 additions and 7 deletions
|
@ -38,13 +38,6 @@ pub struct SyntaxTreeParams {
|
||||||
pub range: Option<Range>,
|
pub range: Option<Range>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Serialize, Debug)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct ExpandedMacro {
|
|
||||||
pub name: String,
|
|
||||||
pub expansion: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub enum ExpandMacro {}
|
pub enum ExpandMacro {}
|
||||||
|
|
||||||
impl Request for ExpandMacro {
|
impl Request for ExpandMacro {
|
||||||
|
@ -60,6 +53,14 @@ pub struct ExpandMacroParams {
|
||||||
pub position: Option<Position>,
|
pub position: Option<Position>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Serialize, Debug)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct ExpandedMacro {
|
||||||
|
pub name: String,
|
||||||
|
pub expansion: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
pub enum MatchingBrace {}
|
pub enum MatchingBrace {}
|
||||||
|
|
||||||
impl Request for MatchingBrace {
|
impl Request for MatchingBrace {
|
||||||
|
|
|
@ -217,3 +217,65 @@ Moreover, it would be cool if editors didn't need to implement even basic langua
|
||||||
* Should we return a a nested brace structure, to allow paredit-like actions of jump *out* of the current brace pair?
|
* Should we return a a nested brace structure, to allow paredit-like actions of jump *out* of the current brace pair?
|
||||||
This is how `SelectionRange` request works.
|
This is how `SelectionRange` request works.
|
||||||
* Alternatively, should we perhaps flag certain `SelectionRange`s as being brace pairs?
|
* Alternatively, should we perhaps flag certain `SelectionRange`s as being brace pairs?
|
||||||
|
|
||||||
|
## Analyzer Status
|
||||||
|
|
||||||
|
**Method:** `rust-analyzer/analyzerStatus`
|
||||||
|
|
||||||
|
**Request:** `null`
|
||||||
|
|
||||||
|
**Response:** `string`
|
||||||
|
|
||||||
|
Returns internal status message, mostly for debugging purposes.
|
||||||
|
|
||||||
|
## Collect Garbage
|
||||||
|
|
||||||
|
**Method:** `rust-analyzer/collectGarbage`
|
||||||
|
|
||||||
|
**Request:** `null`
|
||||||
|
|
||||||
|
**Response:** `null`
|
||||||
|
|
||||||
|
Frees some caches. For internal use, and is mostly broken at the moment.
|
||||||
|
|
||||||
|
## Syntax Tree
|
||||||
|
|
||||||
|
**Method:** `rust-analyzer/syntaxTree`
|
||||||
|
|
||||||
|
**Request:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
interface SyntaxTeeParams {
|
||||||
|
textDocument: TextDocumentIdentifier,
|
||||||
|
range?: Range,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:** `string`
|
||||||
|
|
||||||
|
Returns textual representation of a parse tree for the file/selected region.
|
||||||
|
Primarily for debugging, but very useful for all people working on rust-analyzer itself.
|
||||||
|
|
||||||
|
## Expand Macro
|
||||||
|
|
||||||
|
**Method:** `rust-analyzer/expandMacro`
|
||||||
|
|
||||||
|
**Request:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
interface ExpandMacroParams {
|
||||||
|
textDocument: TextDocumentIdentifier,
|
||||||
|
position?: Position,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
interface ExpandedMacro {
|
||||||
|
name: string,
|
||||||
|
expansion: string,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Expands macro call at a given position.
|
||||||
|
|
Loading…
Reference in a new issue