internal: Make exclude characters for typing assists configurable, default to None

Signed-off-by: Tarek <tareknaser360@gmail.com>
This commit is contained in:
Tarek 2024-11-17 15:25:23 +02:00
parent e6276c8b64
commit d6b701e251
5 changed files with 37 additions and 2 deletions

View file

@ -411,6 +411,7 @@ impl Analysis {
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) {
@ -419,6 +420,11 @@ impl Analysis {
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))
}