@@ -16,45 +16,11 @@ import SourceKitD
16
16
import SwiftExtensions
17
17
import SwiftSourceKitPluginCommon
18
18
19
- #if compiler(>=6.3)
20
- #warning("Remove sourcekitd_plugin_initialize when we no longer support toolchains that call it")
21
- #endif
22
-
23
19
/// Legacy plugin initialization logic in which sourcekitd does not inform the plugin about the sourcekitd path it was
24
20
/// loaded from.
25
21
@_cdecl ( " sourcekitd_plugin_initialize " )
26
22
public func sourcekitd_plugin_initialize( _ params: sourcekitd_api_plugin_initialize_params_t ) {
27
- #if canImport(Darwin)
28
- var dlInfo = Dl_info ( )
29
- dladdr ( #dsohandle, & dlInfo)
30
- let path = String ( cString: dlInfo. dli_fname)
31
- let clientPluginDylibUrl = URL ( fileURLWithPath: path, isDirectory: false )
32
- var url = clientPluginDylibUrl
33
- while url. pathExtension != " framework " && url. lastPathComponent != " / " {
34
- url. deleteLastPathComponent ( )
35
- }
36
- url =
37
- url
38
- . deletingLastPathComponent ( )
39
- . appendingPathComponent ( " sourcekitd.framework " )
40
- . appendingPathComponent ( " sourcekitd " )
41
- if !FileManager. default. fileExists ( at: url) ,
42
- let clientPluginDylibUrlRealpath = try ? clientPluginDylibUrl. realpath. filePath,
43
- let sourcekitdPath = ProcessInfo . processInfo. environment [
44
- " SOURCEKIT_LSP_PLUGIN_SOURCEKITD_PATH_ \( clientPluginDylibUrlRealpath) "
45
- ]
46
- {
47
- // When using a SourceKit plugin from the build directory, we can't find sourcekitd relative to the plugin.
48
- // Respect the sourcekitd path that was passed to us via an environment variable from
49
- // `SourceKitD.getOrCreate`.
50
- url = URL ( fileURLWithPath: sourcekitdPath)
51
- }
52
- try ! url. filePath. withCString { sourcekitdPath in
53
- sourcekitd_plugin_initialize_2 ( params, sourcekitdPath)
54
- }
55
- #else
56
- fatalError ( " sourcekitd_plugin_initialize is not supported on non-Darwin platforms " )
57
- #endif
23
+ fatalError ( " sourcekitd_plugin_initialize has been removed in favor of sourcekitd_plugin_initialize_2 " )
58
24
}
59
25
60
26
@_cdecl ( " sourcekitd_plugin_initialize_2 " )
0 commit comments