Files
Rintaro Ishizaki 4fa1b30d52 Add SymbolLocation.lspPosition, lspLocation, and make documentUri optional
Add computed properties to `SymbolLocation` that centralise the
index-to-LSP coordinate conversion:

- `uri: DocumentURI?` — returns nil when `path` is empty.
- `lspPosition: Position` — converts the 1-based line/utf8Column to a
  0-based LSP Position, using UTF-8 column as a UTF-16 approximation.
- `lspLocation: Location?` — wraps `documentUri` + `lspPosition` into
  an LSP Location, returning nil when `path` is empty.

Update all call sites.
2026-04-28 06:56:55 -07:00

58 lines
1.6 KiB
CMake

add_library(SourceKitLSP STATIC
CapabilityRegistry.swift
DocumentManager.swift
DocumentSnapshot+FromFileContents.swift
DocumentSnapshot+PositionConversions.swift
DefinitionLocations.swift
EntryPointManager.swift
GeneratedInterfaceDocumentURLData.swift
Hooks.swift
IndexProgressManager.swift
IndexStoreDB+MainFilesProvider.swift
LanguageService.swift
LanguageServiceRegistry.swift
LogMessageNotification+representingStructureUsingEmojiPrefixIfNecessary.swift
MacroExpansionReferenceDocumentURLData.swift
MessageHandlingDependencyTracker.swift
OnDiskDocumentManager.swift
PlaygroundDiscovery.swift
ReferenceDocumentURL.swift
Rename.swift
SemanticTokensLegend+SourceKitLSPLegend.swift
SharedWorkDoneProgressManager.swift
SourceKitIndexDelegate.swift
SourceKitLSPCommandMetadata.swift
SourceKitLSPServer.swift
SymbolLocation+LSPConversions.swift
SyntacticIndex.swift
TestDiscovery.swift
TextEdit+IsNoop.swift
Workspace.swift
)
set_target_properties(SourceKitLSP PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY}
)
target_link_libraries(SourceKitLSP PUBLIC
SwiftToolsProtocols::BuildServerProtocol
BuildServerIntegration
SwiftToolsProtocols::LanguageServerProtocol
LanguageServerProtocolExtensions
SemanticIndex
SKOptions
SKUtilities
SwiftExtensions
SwiftToolsProtocols::ToolsProtocolsSwiftExtensions
ToolchainRegistry
IndexStoreDB
SwiftSyntax::SwiftSyntax
)
target_link_libraries(SourceKitLSP PRIVATE
SwiftToolsProtocols::LanguageServerProtocolTransport
SwiftToolsProtocols::SKLogging
SourceKitD
TSCExtensions
$<$<NOT:$<PLATFORM_ID:Darwin>>:FoundationXML>
)