Set<TextMateAutoClosingPair> (@Nullable TextMateScope currentScope) { if (currentScope == null) { return Constants.DEFAULT_SMART_TYPING_BRACE_PAIRS; } List<Preferences> preferencesForSelector = TextMateService.getInstance().getPreferenceRegistry().getPreferences(currentScope); final HashSet<TextMateAutoClosingPair> result = new HashSet<>(); for (Preferences preferences : preferencesForSelector) { final @Nullable Set<TextMateAutoClosingPair> smartTypingPairs = preferences.getSmartTypingPairs(); if (smartTypingPairs != null) { if (smartTypingPairs.isEmpty()) { // smart typing pairs defined in preferences and can be empty (in order to disable smart typing completely) return Collections.emptySet(); } result.addAll(smartTypingPairs); } } return result; }