Skip to content

Commit

Permalink
Move the todo comments and doc tests
Browse files Browse the repository at this point in the history
add a recorded gif of related-tests and a textual description of
what the gif demonstrates
  • Loading branch information
petr-tik committed May 3, 2021
1 parent 082a82f commit a6f05c2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
11 changes: 5 additions & 6 deletions clients/lsp-rust.el
Original file line number Diff line number Diff line change
Expand Up @@ -974,13 +974,13 @@ responds with Runnable[], while relatedTests responds with TestInfo[], which is
over runnable. Also, this method doesn't set the `lsp-rust-analyzer--last-runnable' variable"
(-if-let* ((resp (lsp-rust-analyzer--related-tests))
(runnables (mapcar (lambda (runnable) (gethash "runnable" runnable)) resp)))
;; TODO use dolist or some other iterator to extract all of them
;; since the endpoint returns a list of hash tables that
;; stores &rust-analyzer:Runnable as a value under key
;; "runnable"
;; we need to unpack them first
(lsp--completing-read
"Select test: "
;; since the endpoint returns a list of hash tables that
;; stores &rust-analyzer:Runnable as a value under key
;; "runnable"
;; we need to unpack them first
;; TODO if no tests are found lsp--info with "No tests are related to this position"
runnables
(-lambda ((&rust-analyzer:Runnable :label)) label))))

Expand All @@ -995,6 +995,5 @@ https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/dev/lsp-extensio
(lsp--info "There are no tests related to the symbol at point")))



(provide 'lsp-rust)
;;; lsp-rust.el ends here
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 5 additions & 4 deletions docs/manual-language-docs/lsp-rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,11 @@ Corresponds to [the rust-analyzer LSP extension](https://github.com/rust-analyze

Corresponds to [the rust-analyzer LSP extension](https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/dev/lsp-extensions.md#related-tests)

TODO record and create a gif
+ finding obviously relevant tests
+ calling the function on a position that has no related tests
![](./manual-language-docs/lsp-rust-analyzer-related-tests.gif)
In the example below, first you see that
+ On the left, the function `check_infer` is defined, on the right another file is opened with many test functions, some of which call `check_infer`. With the cursor on `check_infer`, call `lsp-rust-analyzer-related-tests` and select `infer_pattern_match_slice` with fuzzy matching. The test is executed on the right with compilation major mode
+ Move the cursor to `fn ellipsize` and attempt to find related tests to no avail. Confirm that the function is indeed untested by using swiper and finding one place in the file, where the function is called

![](./manual-language-docs/lsp-rust-analyzer-find-related-tests.gif)

### Caveats

Expand Down

0 comments on commit a6f05c2

Please sign in to comment.