From a6633a88a8b2c580aa1aa38354aa858236dfc17e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 23 May 2021 23:32:24 +0300 Subject: fix: reveal snippets --- editors/code/src/snippets.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/editors/code/src/snippets.ts b/editors/code/src/snippets.ts index 9561aa345..58f7aa128 100644 --- a/editors/code/src/snippets.ts +++ b/editors/code/src/snippets.ts @@ -56,6 +56,9 @@ export async function applySnippetTextEdits(editor: vscode.TextEditor, edits: vs } }); if (selections.length > 0) editor.selections = selections; + if (selections.length === 1) { + editor.revealRange(selections[0], vscode.TextEditorRevealType.InCenterIfOutsideViewport); + } } function parseSnippet(snip: string): [string, [number, number]] | undefined { -- cgit v1.2.3 From 8d5f59e0f120ed32f92a0c99c780d28af4eab879 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 23 May 2021 23:37:07 +0300 Subject: minor: align import style with styleguide --- crates/ide_db/src/ty_filter.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/ide_db/src/ty_filter.rs b/crates/ide_db/src/ty_filter.rs index 00678bf3e..766d8c628 100644 --- a/crates/ide_db/src/ty_filter.rs +++ b/crates/ide_db/src/ty_filter.rs @@ -4,7 +4,7 @@ use std::iter; -use hir::{Adt, Semantics, Type}; +use hir::Semantics; use syntax::ast::{self, make}; use crate::RootDatabase; @@ -20,9 +20,9 @@ impl TryEnum { const ALL: [TryEnum; 2] = [TryEnum::Option, TryEnum::Result]; /// Returns `Some(..)` if the provided type is an enum that implements `std::ops::Try`. - pub fn from_ty(sema: &Semantics, ty: &Type) -> Option { + pub fn from_ty(sema: &Semantics, ty: &hir::Type) -> Option { let enum_ = match ty.as_adt() { - Some(Adt::Enum(it)) => it, + Some(hir::Adt::Enum(it)) => it, _ => return None, }; TryEnum::ALL.iter().find_map(|&var| { -- cgit v1.2.3