Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide/src/lib.rs')
| -rw-r--r-- | crates/ide/src/lib.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs index d4ef9570e1..c960b88a3e 100644 --- a/crates/ide/src/lib.rs +++ b/crates/ide/src/lib.rs @@ -402,6 +402,8 @@ impl Analysis { self.with_db(|db| typing::on_enter(db, position)) } + pub const SUPPORTED_TRIGGER_CHARS: &'static str = typing::TRIGGER_CHARS; + /// Returns an edit which should be applied after a character was typed. /// /// This is useful for some on-the-fly fixups, like adding `;` to `let =` @@ -410,14 +412,16 @@ impl Analysis { &self, position: FilePosition, char_typed: char, - autoclose: bool, + chars_to_exclude: Option<String>, ) -> Cancellable<Option<SourceChange>> { // Fast path to not even parse the file. if !typing::TRIGGER_CHARS.contains(char_typed) { return Ok(None); } - if char_typed == '<' && !autoclose { - return Ok(None); + if let Some(chars_to_exclude) = chars_to_exclude { + if chars_to_exclude.contains(char_typed) { + return Ok(None); + } } self.with_db(|db| typing::on_char_typed(db, position, char_typed)) |