File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Core/Sources/SuggestionService Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 11import Foundation
2- import UserDefaultsObserver
32import Preferences
43import SuggestionModel
4+ import UserDefaultsObserver
55
66public protocol SuggestionServiceType {
77 func getSuggestions(
@@ -42,7 +42,7 @@ public final class SuggestionService: SuggestionServiceType {
4242 public init ( projectRootURL: URL , onServiceLaunched: @escaping ( SuggestionServiceType ) -> Void ) {
4343 self . projectRootURL = projectRootURL
4444 self . onServiceLaunched = onServiceLaunched
45-
45+
4646 providerChangeObserver. onChange = { [ weak self] in
4747 guard let self else { return }
4848 suggestionProvider = buildService ( )
@@ -75,7 +75,14 @@ public extension SuggestionService {
7575 usesTabsForIndentation: Bool ,
7676 ignoreSpaceOnlySuggestions: Bool
7777 ) async throws -> [ SuggestionModel . CodeSuggestion ] {
78- try await suggestionProvider. getSuggestions (
78+ let language = languageIdentifierFromFileURL ( fileURL)
79+ if UserDefaults . shared. value ( for: \. suggestionFeatureDisabledLanguageList)
80+ . contains ( where: { $0 == language. rawValue } )
81+ {
82+ return [ ]
83+ }
84+
85+ return try await suggestionProvider. getSuggestions (
7986 fileURL: fileURL,
8087 content: content,
8188 cursorPosition: cursorPosition,
You can’t perform that action at this time.
0 commit comments