7799: Related tests r=matklad a=vsrs

![tests](https://user-images.githubusercontent.com/62505555/109397453-a9013680-7947-11eb-8b11-ac03079f7645.gif)
This adds an ability to look for tests for the item under the cursor: function, constant, data type, etc

The LSP part is bound to change. But the feature itself already works and I'm looking for a feedback :)



Co-authored-by: vsrs <vit@conrlab.com>
This commit is contained in:
bors[bot]
2021-03-13 13:50:35 +00:00
committed by GitHub
13 changed files with 471 additions and 28 deletions

View File

@@ -838,11 +838,10 @@ pub(crate) fn resolved_code_action(
pub(crate) fn runnable(
snap: &GlobalStateSnapshot,
file_id: FileId,
runnable: Runnable,
) -> Result<lsp_ext::Runnable> {
let config = snap.config.runnables();
let spec = CargoTargetSpec::for_file(snap, file_id)?;
let spec = CargoTargetSpec::for_file(snap, runnable.nav.file_id)?;
let workspace_root = spec.as_ref().map(|it| it.workspace_root.clone());
let target = spec.as_ref().map(|s| s.target.clone());
let (cargo_args, executable_args) =
@@ -875,7 +874,7 @@ pub(crate) fn code_lens(
let annotation_range = range(&line_index, annotation.range);
let action = run.action();
let r = runnable(&snap, run.nav.file_id, run)?;
let r = runnable(&snap, run)?;
let command = if debug {
command::debug_single(&r)