about summary refs log tree commit diff
path: root/docs/dev
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-01-03 09:03:15 +0000
committerGitHub <noreply@github.com>2021-01-03 09:03:15 +0000
commit1cc73d60bbd7149773f2eb57296d5611cbe941b1 (patch)
tree631a683b73784e633baf84c826a81903922095a7 /docs/dev
parent520b8a5a4dde032ba6118efb02801611191acc4e (diff)
parentee7c3f79e29bf140fe6faaf52bee63dba2fc29b1 (diff)
downloadrust-1cc73d60bbd7149773f2eb57296d5611cbe941b1.tar.gz
rust-1cc73d60bbd7149773f2eb57296d5611cbe941b1.zip
Merge #7068
7068: Add VSCode command to view the hir of a function body r=theotherphil a=theotherphil

Will fix https://github.com/rust-analyzer/rust-analyzer/issues/7061. Very rough initial version just to work out where I needed to wire everything up.

@matklad would you be happy merging a hir visualiser of some kind? If so, do you have any thoughts on what you'd like it show, and how?

I've spent very little time on this thus far, so I'm fine with throwing away the contents of this PR, but I want to avoid taking the time to make this more polished/interactive/useful only to discover that no-one else has any interest in this functionality.

![image](https://user-images.githubusercontent.com/1974256/103236081-bb58f700-493b-11eb-9d12-55ae1b870f8f.png)


Co-authored-by: Phil Ellison <phil.j.ellison@gmail.com>
Diffstat (limited to 'docs/dev')
-rw-r--r--docs/dev/README.md2
-rw-r--r--docs/dev/lsp-extensions.md13
2 files changed, 14 insertions, 1 deletions
diff --git a/docs/dev/README.md b/docs/dev/README.md
index 4a2f9feb369..55527bab0aa 100644
--- a/docs/dev/README.md
+++ b/docs/dev/README.md
@@ -227,6 +227,8 @@ There are also two VS Code commands which might be of interest:
 
 * `Rust Analyzer: Syntax Tree` shows syntax tree of the current file/selection.
 
+* `Rust Analyzer: View Hir` shows the HIR expressions within the function containing the cursor.
+
   You can hover over syntax nodes in the opened text file to see the appropriate
   rust code that it refers to and the rust editor will also highlight the proper
   text range.
diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md
index 8c01db07c84..78d86f060a6 100644
--- a/docs/dev/lsp-extensions.md
+++ b/docs/dev/lsp-extensions.md
@@ -1,5 +1,5 @@
 <!---
-lsp_ext.rs hash: 203fdf79b21b5987
+lsp_ext.rs hash: 91f2c62457e0a20f
 
 If you need to change the above hash to make the test pass, please check if you
 need to adjust this doc as well and ping this  issue:
@@ -449,6 +449,17 @@ interface SyntaxTeeParams {
 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.
 
+## View Hir
+
+**Method:** `rust-analyzer/viewHir`
+
+**Request:** `TextDocumentPositionParams`
+
+**Response:** `string`
+
+Returns a textual representation of the HIR of the function containing the cursor.
+For debugging or when working on rust-analyzer itself.
+
 ## Expand Macro
 
 **Method:** `rust-analyzer/expandMacro`