(
server: LspServerDefinition,
context: RootUriContext,
)
| 1030 | } |
| 1031 | |
| 1032 | async #resolveRootUri( |
| 1033 | server: LspServerDefinition, |
| 1034 | context: RootUriContext, |
| 1035 | ): Promise<string | null> { |
| 1036 | if (typeof server.rootUri === "function") { |
| 1037 | try { |
| 1038 | const value = await server.rootUri(context?.uri ?? "", context); |
| 1039 | if (value) return safeString(value); |
| 1040 | } catch (error) { |
| 1041 | console.warn(`Server root resolver failed for ${server.id}`, error); |
| 1042 | } |
| 1043 | } |
| 1044 | |
| 1045 | if (context?.rootUri) return safeString(context.rootUri); |
| 1046 | |
| 1047 | if (typeof this.options.resolveRoot === "function") { |
| 1048 | try { |
| 1049 | const value = await this.options.resolveRoot(context); |
| 1050 | if (value) return safeString(value); |
| 1051 | } catch (error) { |
| 1052 | console.warn("Global LSP root resolver failed", error); |
| 1053 | } |
| 1054 | } |
| 1055 | |
| 1056 | return null; |
| 1057 | } |
| 1058 | |
| 1059 | async #resolveRuntimeTarget( |
| 1060 | server: LspServerDefinition, |
no test coverage detected