@@ -11,45 +11,41 @@ import Foundation
11
11
import LanguageClient
12
12
import LanguageServerProtocol
13
13
14
- /**
15
- `LSPService` is a service class responsible for managing the lifecycle and event handling
16
- of Language Server Protocol (LSP) clients within the CodeEdit application. It handles the initialization,
17
- communication, and termination of language servers, ensuring that code assistance features
18
- such as code completion, diagnostics, and more are available for various programming languages.
19
-
20
- This class uses Swift's concurrency model to manage background tasks and event streams
21
- efficiently. Each language server runs in its own asynchronous task, listening for events and
22
- handling them as they occur. The `LSPService` class also provides functionality to start
23
- and stop individual language servers, as well as to stop all running servers.
24
-
25
- ## Example Usage
26
- ```swift
27
- @Service var lspService
28
-
29
- try await lspService.startServer(
30
- for: .python,
31
- projectURL: projectURL,
32
- workspaceFolders: workspaceFolders
33
- )
34
- try await lspService.stopServer(for: .python)
35
- ```
36
- */
14
+ /// `LSPService` is a service class responsible for managing the lifecycle and event handling
15
+ /// of Language Server Protocol (LSP) clients within the CodeEdit application. It handles the initialization,
16
+ /// communication, and termination of language servers, ensuring that code assistance features
17
+ /// such as code completion, diagnostics, and more are available for various programming languages.
18
+ ///
19
+ /// This class uses Swift's concurrency model to manage background tasks and event streams
20
+ /// efficiently. Each language server runs in its own asynchronous task, listening for events and
21
+ /// handling them as they occur. The `LSPService` class also provides functionality to start
22
+ /// and stop individual language servers, as well as to stop all running servers.
23
+ ///
24
+ /// ## Example Usage
25
+ /// ```swift
26
+ /// @Service var lspService
27
+ ///
28
+ /// try await lspService.startServer(
29
+ /// for: .python,
30
+ /// projectURL: projectURL,
31
+ /// workspaceFolders: workspaceFolders
32
+ /// )
33
+ /// try await lspService.stopServer(for: .python)
34
+ /// ```
37
35
final class LSPService : ObservableObject {
36
+ let logger : Logger = Logger ( subsystem: Bundle . main. bundleIdentifier ?? " " , category: " LSPService " )
38
37
39
- internal let logger : Logger
40
38
/// Holds the active language clients
41
- internal var languageClients : [ LanguageIdentifier : LanguageServer ] = [ : ]
39
+ var languageClients : [ LanguageIdentifier : LanguageServer ] = [ : ]
42
40
/// Holds the language server configurations for all the installed language servers
43
- internal var languageConfigs : [ LanguageIdentifier : LanguageServerBinary ] = [ : ]
41
+ var languageConfigs : [ LanguageIdentifier : LanguageServerBinary ] = [ : ]
44
42
/// Holds all the event listeners for each active language client
45
- internal var eventListeningTasks : [ LanguageIdentifier : Task < Void , Never > ] = [ : ]
43
+ var eventListeningTasks : [ LanguageIdentifier : Task < Void , Never > ] = [ : ]
46
44
47
45
@AppSettings ( \. developerSettings. lspBinaries)
48
- internal var lspBinaries
46
+ var lspBinaries
49
47
50
48
init ( ) {
51
- self . logger = Logger ( subsystem: Bundle . main. bundleIdentifier ?? " " , category: " LSPService " )
52
-
53
49
// Load the LSP binaries from the developer menu
54
50
for binary in lspBinaries {
55
51
if let language = LanguageIdentifier ( rawValue: binary. key) {
0 commit comments