Closed marchyman closed 1 month ago
What your detailed logs? You can get it by run LSP with environment SOURCEKIT_LOGGING=3.
Also, have you compiled?xcode-build-server get correctly Logs from compiled Logs
I installed xcode-build-server using brew. Running with SOURCEKIT_LOGGING=3. I cut out the leading [ERROR][2024-10-17 20:xx:yy] .../vim/lsp/rpc.lua:770 "rpc" "/usr/bin/sourcekit-lsp" "stderr"
from each line.
'INFO:root:# xcode build server with python 3.9.6 (default, Aug 9 2024, 14:24:13) \n[Clang 16.0.0 (clang-1600.0.26.3)]]\nINFO:server:Xcode Build Server Startup\nDEBUG:server:Req --> {"jsonrpc":"2.0","id":1,"method":"build\\/initialize","params":{"capabilities":{"languageIds":["c","cpp","objective-c","objective-cpp","swift"]},"version":"1.0","rootUri":"file:\\/\\/\\/Users\\/marc\\/src\\/Read\\/","displayName":"SourceKit-LSP","bspVersion":"2.0"}}\nDEBUG:server:Res <-- {"jsonrpc": "2.0", "id": 1, "result": {"displayName": "xcode build server", "version": "0.1", "bspVersion": "2.0", "rootUri": "file:///Users/marc/src/Read/", "capabilities": {"languageIds": ["c", "cpp", "objective-c", "objective-cpp", "swift"]}, "data": {"indexDatabasePath": "/Users/marc/Library/Caches/xcode-build-server/-Users-marc-src-Read/indexDatabasePath-5daf767609ab6e9ad21e4a7b9f8a5966", "indexStorePath": "/Users/marc/src/Read/Index.noindex/DataStore"}}}\nDEBUG:server:Req --> {"jsonrpc":"2.0","params":{},"method":"build\\/initialized"}\n'
"sourcekit: [2:sourcekitd_initialize:8707: 0.0000] initializing\n"
'DEBUG:server:Req --> {"params":{"action":"register","uri":"file:\\/\\/\\/Users\\/marc\\/src\\/Read\\/Read\\/Book.swift"},"jsonrpc":"2.0","id":2,"method":"textDocument\\/registerForChanges"}\n'
'DEBUG:server:Res <-- {"jsonrpc": "2.0", "id": 2, "result": null}\n'
'DEBUG:root:infer root: /Users/marc/src/Read, None\nDEBUG:server:Res <-- {"jsonrpc": "2.0", "method": "build/sourceKitOptionsChanged", "params": {"uri": "file:///Users/marc/src/Read/Read/Book.swift", "updatedOptions": {"options": ["/Users/marc/src/Read/Read/Book.swift", "-sdk", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/"], "workingDirectory": "/Users/marc/src/Read"}}}\n'
'sourcekit: [2:sourcekitd_send_request-before:7427: 0.2237] {\n key.request: source.request.editor.open,\n key.name: "/Users/marc/src/Read/Read/Book.swift",\n key.enablesyntaxmap: 0,\n key.enablesubstructure: 0,\n key.enablediagnostics: 0,\n key.syntactic_only: 1,\n key.compilerargs: [\n "-sdk",\n "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk",\n "/Users/marc/src/Read/Read/Book.swift"\n ],\n key.sourcetext: "//\\n// Book.swift\\n// Read\\n//\\n// Created by Marco S Hyman on 11/6/23.\\n//\\n\\nimport Foundation\\nimport SwiftData\\n\\n@Model\\nfinal class Book {\\n var added: Date = Date.now\\n var release: Date?\\n var title: String = \\"Unknown\\"\\n @Relationship(deleteRule: .nullify, inverse: \\\\Author.books)\\n var authors: [Author]!\\n @Relationship(deleteRule: .nullify, inverse: \\\\Series.books)\\n var series: Series?\\n var seriesOrder: Int?\\n\\n init(title: String, release: Date? = nil) {\\n self.title = title\\n self.release = release\\n self.authors = []\\n }\\n}\\n"\n}\n'
"sourcekit: [4:handleInternalUIDRequest:8707: 0.2569] service queried UID for: source.request.enable_request_barriers\n"
"sourcekit: [4:handleInternalUIDRequest:8707: 0.2570] service queried UID for: source.request.configuration.global\n"
"sourcekit: [4:handleInternalUIDRequest:8707: 0.2570] service queried UID for: source.request.protocol_version\n"
"sourcekit: [4:handleInternalUIDRequest:8707: 0.2571] service queried UID for: source.request.compiler_version\n"
"sourcekit: [4:handleInternalUIDRequest:8707: 0.2571] service queried UID for: source.request.crash_exit\nsourcekit: [4:handleInternalUIDRequest:8707: 0.2571] service queried UID for: source.request.test_notification\n"
"sourcekit: [4:handleInternalUIDRequest:8707: 0.2572] service queried UID for: source.request.statistics\n"
"sourcekit: [4:handleInternalUIDRequest:8707: 0.2572] service queried UID for: source.request.demangle\n"
"sourcekit: [4:handleInternalUIDRequest:8707: 0.2572] service queried UID for: source.request.mangle_simple_class\n"
"sourcekit: [4:handleInternalUIDRequest:8707: 0.2573] service queried UID for: source.request.enable-compile-notifications\n"
"sourcekit: [4:handleInternalUIDRequest:8707: 0.2573] service queried UID for: source.request.buildsettings.register\n"
"sourcekit: [4:handleInternalUIDRequest:8707: 0.2573] service queried UID for: source.request.dependency_updated\n"
"sourcekit: [4:handleInternalUIDRequest:8707: 0.2574] service queried UID for: source.request.docinfo\n"
"sourcekit: [4:handleInternalUIDRequest:8707: 0.2574] service queried UID for: source.request.editor.open\n"
"sourcekit: [2:sourcekitd_send_request-after:8707: 0.2598] {\n}\n"
'sourcekit: [2:sourcekitd_send_request-before:15883: 0.2612] {\n key.request: source.request.semantic_tokens,\n key.sourcefile: "/Users/marc/src/Read/Read/Book.swift",\n key.compilerargs: [\n "/Users/marc/src/Read/Read/Book.swift",\n "-sdk",\n "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/",\n "-working-directory",\n "/Users/marc/src/Read"\n ]\n}\n'
"sourcekit: [4:handleInternalUIDRequest:15883: 0.2613] service queried UID for: source.request.editor.close\n"
"sourcekit: [4:handleInternalUIDRequest:15883: 0.2613] service queried UID for: source.request.editor.replacetext\n"
"sourcekit: [4:handleInternalUIDRequest:15883: 0.2613] service queried UID for: source.request.editor.formattext\n"
"sourcekit: [4:handleInternalUIDRequest:15883: 0.2613] service queried UID for: source.request.editor.expand_placeholder\nsourcekit: [4:handleInternalUIDRequest:15883: 0.2614] service queried UID for: source.request.editor.open.interface\nsourcekit: [4:handleInternalUIDRequest:15883: 0.2614] service queried UID for: source.request.editor.open.interface.header\nsourcekit: [4:handleInternalUIDRequest:15883: 0.2614] service queried UID for: source.request.editor.open.interface.swiftsource\nsourcekit: [4:handleInternalUIDRequest:15883: 0.2614] service queried UID for: source.request.editor.open.interface.swifttype\nsourcekit: [4:handleInternalUIDRequest:15883: 0.2615] service queried UID for: source.request.editor.extract.comment\nsourcekit: [4:handleInternalUIDRequest:15883: 0.2615] service queried UID for: source.request.convert.markup.xml\nsourcekit: [4:handleInternalUIDRequest:15883: 0.2615] service queried UID for: source.request.editor.find_usr\nsourcekit: [4:handleInternalUIDRequest:15883: 0.2615] service queried UID for: source.request.editor.find_interface_doc\nsourcekit: [4:handleInternalUIDRequest:15883: 0.2615] service queried UID for: source.request.module.groups\nsourcekit: [4:handleInternalUIDRequest:15883: 0.2616] service queried UID for: source.request.find-syntactic-rename-ranges\nsourcekit: [4:handleInternalUIDRequest:10499: 0.2616] service queried UID for: source.request.codecomplete.close\nsourcekit: [4:handleInternalUIDRequest:10499: 0.2616] service queried UID for: source.request.codecomplete.cache.ondisk\nsourcekit: [4:handleInternalUIDRequest:10499: 0.2616] service queried UID for: source.request.codecomplete.setpopularapi\nsourcekit: [4:handleInternalUIDRequest:10499: 0.2617] service queried UID for: source.request.codecomplete.setcustom\nsourcekit: [4:handleInternalUIDRequest:10499: 0.2617] service queried UID for: source.request.compile\nsourcekit: [4:handleInternalUIDRequest:10499: 0.2617] service queried UID for: source.request.compile.close\nsourcekit: [4:handleInternalUIDRequest:10499: 0.2617] service queried UID for: source.request.codecomplete\nsourcekit: [4:handleInternalUIDRequest:10499: 0.2618] service queried UID for: source.request.codecomplete.open\nsourcekit: [4:handleInternalUIDRequest:10499: 0.2618] service queried UID for: source.request.codecomplete.update\nsourcekit: [4:handleInternalUIDRequest:10499: 0.2618] service queried UID for: source.request.typecontextinfo\nsourcekit: [4:handleInternalUIDRequest:10499: 0.2618] service queried UID for: source.request.conformingmethods\nsourcekit: [4:handleInternalUIDRequest:10499: 0.2618] service queried UID for: source.request.indexsource\nsourcekit: [4:handleInternalUIDRequest:10499: 0.2618] service queried UID for: source.request.index_to_store\n"
"sourcekit: [4:handleInternalUIDRequest:10499: 0.2619] service queried UID for: source.request.cursorinfo\nsourcekit: [4:handleInternalUIDRequest:10499: 0.2619] service queried UID for: source.request.rangeinfo\nsourcekit: [4:handleInternalUIDRequest:10499: 0.2619] service queried UID for: source.request.semantic.refactoring\nsourcekit: [4:handleInternalUIDRequest:10499: 0.2619] service queried UID for: source.request.expression.type\nsourcekit: [4:handleInternalUIDRequest:10499: 0.2619] service queried UID for: source.request.variable.type\nsourcekit: [4:handleInternalUIDRequest:10499: 0.2620] service queried UID for: source.request.find-local-rename-ranges\nsourcekit: [4:handleInternalUIDRequest:10499: 0.2620] service queried UID for: source.request.name.translation\nsourcekit: [4:handleInternalUIDRequest:10499: 0.2620] service queried UID for: source.request.relatedidents\nsourcekit: [4:handleInternalUIDRequest:10499: 0.2620] service queried UID for: source.request.activeregions\nsourcekit: [4:handleInternalUIDRequest:10499: 0.2620] service queried UID for: source.request.diagnostics\nsourcekit: [4:handleInternalUIDRequest:10499: 0.2621] service queried UID for: source.request.semantic_tokens\n"
"sourcekit: [4:handleInternalUIDRequest:10499: 0.4378] service queried UID for: source.lang.swift.ref.macro\n"
"sourcekit: [4:handleInternalUIDRequest:10499: 0.4378] service queried UID for: source.lang.swift.ref.struct\nsourcekit: [4:handleInternalUIDRequest:10499: 0.4379] service queried UID for: source.lang.swift.ref.var.class\n"
"sourcekit: [4:handleInternalUIDRequest:10499: 0.4379] service queried UID for: source.lang.swift.ref.var.instance\nsourcekit: [4:handleInternalUIDRequest:10499: 0.4379] service queried UID for: source.lang.swift.ref.var.local\n"
"sourcekit: [2:sourcekitd_send_request-after:10499: 0.4380] {\n key.semantic_tokens: [\n {\n key.kind: source.lang.swift.ref.macro,\n key.offset: 112,\n key.length: 5,\n key.is_system: 1\n },\n {\n key.kind: source.lang.swift.ref.struct,\n key.offset: 152,\n key.length: 4,\n key.is_system: 1\n },\n {\n key.kind: source.lang.swift.ref.struct,\n key.offset: 159,\n key.length: 4,\n key.is_system: 1\n },\n {\n key.kind: source.lang.swift.ref.var.class,\n key.offset: 164,\n key.length: 3,\n key.is_system: 1\n },\n {\n key.kind: source.lang.swift.ref.struct,\n key.offset: 185,\n key.length: 4,\n key.is_system: 1\n },\n {\n key.kind: source.lang.swift.ref.struct,\n key.offset: 206,\n key.length: 6,\n key.is_system: 1\n },\n {\n key.kind: source.lang.swift.ref.struct,\n key.offset: 425,\n key.length: 3,\n key.is_system: 1\n },\n {\n key.kind: source.lang.swift.ref.struct,\n key.offset: 447,\n key.length: 6,\n key.is_system: 1\n },\n {\n key.kind: source.lang.swift.ref.struct,\n key.offset: 464,\n key.length: 4,\n key.is_system: 1\n },\n {\n key.kind: source.lang.swift.ref.var.instance,\n key.offset: 492,\n key.length: 5\n },\n {\n key.kind: source.lang.swift.ref.var.local,\n key.offset: 500,\n key.length: 5\n },\n {\n key.kind: source.lang.swift.ref.var.instance,\n key.offset: 519,\n key.length: 7\n },\n {\n key.kind: source.lang.swift.ref.var.local,\n key.offset: 529,\n key.length: 7\n }\n ]\n}\n"
'sourcekit: [2:sourcekitd_send_request-before:12559: 0.4392] {\n key.request: source.request.editor.close,\n key.name: "/Users/marc/src/Read/Read/Book.swift",\n key.cancel_builds: 0\n}\n'
"sourcekit: [2:sourcekitd_send_request-after:12559: 0.4393] {\n}\n"
'sourcekit: [2:sourcekitd_send_request-before:15883: 0.4394] {\n key.request: source.request.editor.open,\n key.name: "/Users/marc/src/Read/Read/Book.swift",\n key.enablesyntaxmap: 0,\n key.enablesubstructure: 0,\n key.enablediagnostics: 0,\n key.syntactic_only: 1,\n key.compilerargs: [\n "/Users/marc/src/Read/Read/Book.swift",\n "-sdk",\n "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/",\n "-working-directory",\n "/Users/marc/src/Read"\n ],\n key.sourcetext: "//\\n// Book.swift\\n// Read\\n//\\n// Created by Marco S Hyman on 11/6/23.\\n//\\n\\nimport Foundation\\nimport SwiftData\\n\\n@Model\\nfinal class Book {\\n var added: Date = Date.now\\n var release: Date?\\n var title: String = \\"Unknown\\"\\n @Relationship(deleteRule: .nullify, inverse: \\\\Author.books)\\n var authors: [Author]!\\n @Relationship(deleteRule: .nullify, inverse: \\\\Series.books)\\n var series: Series?\\n var seriesOrder: Int?\\n\\n init(title: String, release: Date? = nil) {\\n self.title = title\\n self.release = release\\n self.authors = []\\n }\\n}\\n"\n}\n'
"sourcekit: [2:sourcekitd_send_request-after:8707: 0.4398] {\n}\n"
'sourcekit: [2:sourcekitd_send_request-before:12559: 2.5539] {\n key.request: source.request.diagnostics,\n key.sourcefile: "/Users/marc/src/Read/Read/Book.swift",\n key.compilerargs: [\n "/Users/marc/src/Read/Read/Book.swift",\n "-sdk",\n "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/",\n "-working-directory",\n "/Users/marc/src/Read"\n ]\n}\n'
"sourcekit: [4:handleInternalUIDRequest:12559: 2.6622] service queried UID for: source.diagnostic.severity.error\n"
"sourcekit: [4:handleInternalUIDRequest:12559: 2.6623] service queried UID for: source.diagnostic.severity.note\n"
"sourcekit: [2:sourcekitd_send_request-after:12559: 2.6624] {\n key.generated_buffers: [\n {\n key.buffer_text: \"@Transient\\nprivate var _$backingData: any SwiftData.BackingData<Book> = Book.createBackingData()\\n\\npublic var persistentBackingData: any SwiftData.BackingData<Book> {\\n get {\\n _$backingData\\n }\\n set {\\n _$backingData = newValue\\n }\\n}\\n\\nstatic var schemaMetadata: [SwiftData.Schema.PropertyMetadata] {\\n return [\\n SwiftData.Schema.PropertyMetadata(name: \\\"added\\\", keypath: \\\\Book.added, defaultValue: Date.now, metadata: nil),\\n SwiftData.Schema.PropertyMetadata(name: \\\"release\\\", keypath: \\\\Book.release, defaultValue: nil, metadata: nil),\\n SwiftData.Schema.PropertyMetadata(name: \\\"title\\\", keypath: \\\\Book.title, defaultValue: \\\"Unknown\\\", metadata: nil),\\n SwiftData.Schema.PropertyMetadata(name: \\\"authors\\\", keypath: \\\\Book.authors, defaultValue: nil, metadata: SwiftData.Schema.Relationship(deleteRule: .nullify, inverse: \\\\Author.books)),\\n SwiftData.Schema.PropertyMetadata(name: \\\"series\\\", keypath: \\\\Book.series, defaultValue: nil, metadata: SwiftData.Schema.Relationship(deleteRule: .nullify, inverse: \\\\Series.books)),\\n SwiftData.Schema.PropertyMetadata(name: \\\"seriesOrder\\\", keypath: \\\\Book.seriesOrder, defaultValue: nil, metadata: nil)\\n ]\\n}\\n\\ninit(backingData: any SwiftData.BackingData<Book>) {\\n _added = _SwiftDataNoType()\\n _release = _SwiftDataNoType()\\n _title = _SwiftDataNoType()\\n _authors = _SwiftDataNoType()\\n _series = _SwiftDataNoType()\\n _seriesOrder = _SwiftDataNoType()\\n self.persistentBackingData = backingData\\n}\\n\\n@Transient private let _$observationRegistrar = Observation.ObservationRegistrar()\\n\\ninternal nonisolated func access<Member>(\\n keyPath: KeyPath<Book, Member>\\n) {\\n _$observationRegistrar.access(self, keyPath: keyPath)\\n}\\n\\ninternal nonisolated func withMutation<Member, MutationResult>(\\n keyPath: KeyPath<Book, Member>,\\n _ mutation: () throws -> MutationResult\\n) rethrows -> MutationResult {\\n try _$observationRegistrar.withMutation(of: self, keyPath: keyPath, mutation)\\n}\\n\\nstruct _SwiftDataNoType {\\n}\",\n key.original_location: {\n key.offset: 569,\n key.length: 0,\n key.buffer_name: \"/Users/marc/src/Read/Read/Book.swift\"\n },\n key.buffer_name: \"@__swiftmacro_4BookAA5ModelfMm_.swift\"\n }\n ],\n key.diagnostics: [\n {\n key.line: 16,\n key.column: 51,\n key.filepath: \"/Users/marc/src/Read/Read/Book.swift\",\n key.severity: source.diagnostic.severity.error,\n key.id: \"cannot_find_in_scope\",\n key.description: \"cannot find 'Author' in scope\",\n key.ranges: [\n {\n key.offset: 275,\n key.length: 6\n }\n ]\n },\n {\n key.line: 16,\n key.column: 51,\n key.filepath: \"/Users/marc/src/Read/Read/Book.swift\",\n key.severity: source.diagnostic.severity.error,\n key.id: \"expr_swift_keypath_invalid_component\",\n key.description: \"invalid component of Swift key path\"\n },\n {\n key.line: 17,\n key.column: 19,\n key.filepath: \"/Users/marc/src/Read/Read/Book.swift\",\n key.severity: source.diagnostic.severity.error,\n key.id: \"cannot_find_type_in_scope\",\n key.description: \"cannot find type 'Author' in scope\",\n key.ranges: [\n {\n key.offset: 307,\n key.length: 6\n }\n ]\n },\n {\n key.line: 18,\n key.column: 51,\n key.filepath: \"/Users/marc/src/Read/Read/Book.swift\",\n key.severity: source.diagnostic.severity.error,\n key.id: \"cannot_find_in_scope\",\n key.description: \"cannot find 'Series' in scope\",\n key.ranges: [\n {\n key.offset: 366,\n key.length: 6\n }\n ]\n },\n {\n key.line: 18,\n key.column: 51,\n key.filepath: \"/Users/marc/src/Read/Read/Book.swift\",\n key.severity: source.diagnostic.severity.error,\n key.id: \"expr_swift_keypath_invalid_component\",\n key.description: \"invalid component of Swift key path\"\n },\n {\n key.line: 19,\n key.column: 17,\n key.filepath: \"/Users/marc/src/Read/Read/Book.swift\",\n key.severity: source.diagnostic.severity.error,\n key.id: \"cannot_find_type_in_scope\",\n key.description: \"cannot find type 'Series' in scope\",\n key.ranges: [\n {\n key.offset: 396,\n key.length: 6\n }\n ]\n },\n {\n key.line: 18,\n key.column: 171,\n key.filepath: \"@__swiftmacro_4BookAA5ModelfMm_.swift\",\n key.severity: source.diagnostic.severity.error,\n key.id: \"cannot_find_in_scope\",\n key.description: \"cannot find 'Author' in scope\",\n key.ranges: [\n {\n key.offset: 847,\n key.length: 6\n }\n ],\n key.diagnostics: [\n {\n key.line: 11,\n key.column: 1,\n key.filepath: \"/Users/marc/src/Read/Read/Book.swift\",\n key.severity: source.diagnostic.severity.note,\n key.id: \"in_macro_expansion\",\n key.description: \"in expansion of macro 'Model' on class 'Book' here\",\n key.ranges: [\n {\n key.offset: 111,\n key.length: 459\n }\n ]\n }\n ]\n },\n {\n key.line: 18,\n key.column: 171,\n key.filepath: \"@__swiftmacro_4BookAA5ModelfMm_.swift\",\n key.severity: source.diagnostic.severity.error,\n key.id: \"expr_swift_keypath_invalid_component\",\n key.description: \"invalid component of Swift key path\",\n key.diagnostics: [\n {\n key.line: 11,\n key.column: 1,\n key.filepath: \"/Users/marc/src/Read/Read/Book.swift\",\n key.severity: source.diagnostic.severity.note,\n key.id: \"in_macro_expansion\",\n key.description: \"in expansion of macro 'Model' on class 'Book' here\",\n key.ranges: [\n {\n key.offset: 111,\n key.length: 459\n }\n ]\n }\n ]\n },\n {\n key.line: 19,\n key.column: 169,\n key.filepath: \"@__swiftmacro_4BookAA5ModelfMm_.swift\",\n key.severity: source.diagnostic.severity.error,\n key.id: \"cannot_find_in_scope\",\n key.description: \"cannot find 'Series' in scope\",\n key.ranges: [\n {\n key.offset: 1031,\n key.length: 6\n }\n ],\n key.diagnostics: [\n {\n key.line: 11,\n key.column: 1,\n key.filepath: \"/Users/marc/src/Read/Read/Book.swift\",\n key.severity: source.diagnostic.severity.note,\n key.id: \"in_macro_expansion\",\n key.description: \"in expansion of macro 'Model' on class 'Book' here\",\n key.ranges: [\n {\n key.offset: 111,\n key.length: 459\n }\n ]\n }\n ]\n },\n {\n key.line: 19,\n key.column: 169,\n key.filepath: \"@__swiftmacro_4BookAA5ModelfMm_.swift\",\n key.severity: source.diagnostic.severity.error,\n key.id: \"expr_swift_keypath_invalid_component\",\n key.description: \"invalid component of Swift key path\",\n key.diagnostics: [\n {\n key.line: 11,\n key.column: 1,\n key.filepath: \"/Users/marc/src/Read/Read/Book.swift\",\n key.severity: source.diagnostic.severity.note,\n key.id: \"in_macro_expansion\",\n key.description: \"in expansion of macro 'Model' on class 'Book' here\",\n key.ranges: [\n {\n key.offset: 111,\n key.length: 459\n }\n ]\n }\n ]\n }\n ]\n}\n"
there only seems has default flags. not get compile flags. how you config your buildServer?
if you use xcodebuildserver config, you should build it once in xcode.
I suspect my ignorance of something (hopefully simple) is showing. If by "config your buildServer" you mean creating the buildServer.json file I did that with the command xcode-build-server config -scheme Read -project *.xcodeproj
. I've built the project with Xcode several times since then. I've also re-built the json files a few times, too.
I also added a post build action to the scheme that runs /opt/homebrew/bin/xcode-build-server postaction | bash &
but it doesn't make any difference. I still get "Cannot find type 'foo' in scope" errors.
post action now dont need. you can delete and re config, and ensure buildServer kind is xcode, buildroot is the same root as your xcode build
Post action removed.
There may be something specific to my setup that is causing cross file references to not work. I tried what I think is the simplest case possible:
xcode-build-server config -scheme Test -project *.xcodeproj
in the project root directory"Cannot find 'Model' in scope".
Thanks for trying to help, but this is probably taking up more time than it is worth. I use Xcode for macOS/iOS development. I was simply annoyed by the errors when I happened to open a swift file in neovim and thought it would be easy to get rid of the errors AND still have sourcekit available.
your step seems correct. for xcode-build-server to work, it need to find flags correctly. a right buildServer.json
should shows as following:
{
"name": "xcode build server",
"version": "0.2",
"bspVersion": "2.0",
"languages": [
"c",
"cpp",
"objective-c",
"objective-cpp",
"swift"
],
"argv": [
"/usr/local/bin/xcode-build-server" // path to xcode-build-server
],
"workspace": "XXX",
"build_root": "/Users/wang/Library/Developer/Xcode/DerivedData/XXX-epawzhfeolwwatezjfcvvqwvgidx", // this path + Logs/Build/LogStoreManifest.plist should exists, this directory contains build logs when xcode builds.
"scheme": "XXX", // same schema as xcode build.
"kind": "xcode", // must be xcode, `xcode-build-server config` will set the kind to xcode.
}
as the BuilServer.json correct, your LSP logs should has a log with use flags from <XXX/Path>
, where contains the extracted flags from Log file. you can open it and it should be same as your build command.
if you set SOURCEKIT_LOGGING=3, you will see each specific flags give from xcode-build-server to LSP, and what LSP reponds. as the flags correct, it should works.
your previous not work is because the post-action write a wrong buildServer.json config. your new demo not work, I have no clue as you not upload new logs.
Ahh, I see a difference. Your example build_root:
"build_root": "/Users/wang/Library/Developer/Xcode/DerivedData/XXX-epawzhfeolwwatezjfcvvqwvgidx",
and the one in my buildServer.json as generated by xcode-build-server config ...
"build_root": "/Users/marc/src/play/Test",
Perhaps this is because I have my xcode location config set to "Relative" instead of "Default" ???
Changing the build_root to this:
"build_root": "/Users/marc/src/play/Test/DerivedData/Test",
fixes the problem. I'm going to close this issue now that I know how to make it work with my config. Thank you very much.
I'm trying to figure out what I an doing wrong. My goal is to have cross file references not flagged as errors when I happen to look at swift files in an Xcode project with neovim.
When I open a swift file LspInfo tells me sourcekit is attached to the buffer and the root directory is the Xcode project root. If I look at the neovim language client log I see "INFO: server:Xcode Build Server Startup" and no error messages so I assume all should be OK. However, any references to types defined in other files are marked as errors.
I don't use neovim with swift that often, but when I do it would be nice if lsp support worked. What should I be looking at?
If it makes any difference my "neovim swift lsp test" is on an iPad project that I built to run on my mac studio for testing.