xbase: Configuration problem

I’m using macOS 13.3.1, M1 Pro, Xcode 14.3, lazyvim and I’m unable to make this plugin work.

I tested it on 3 projects and on all of them I get the same error. All those projects are using xcodegen for project generation.

So I installed the plugin like that: image

Then I open nvim in the root folder of my project, where project.yml is located, I open some swift file like AppDelegate.swift and I use <leader>b mapping then I always get: image

I tried to follow debug steps but there are no logs.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 21 (11 by maintainers)

Commits related to this issue

Most upvoted comments

I added feature requests mentioned in this conversation: #188, #189, #190. Thank you one more time for all the help! Great job 🎊 🚀 🔥

This is my config: image

I’ve got iPhone 14 installed, but I’m still not seeing it on the list

UPDATE: Uhh, I missed iOS = { "iPhone 14" }. Now It works!

hmmm just to confirm, you did run make install in xbase root, right? edit: also git pull

Is it possible at all to make swift LSP work properly for iOS projects? I think I read somewhere that LSP doesn’t understand project structure so it doesn’t work across multiple Swift files. Is it true?

Yes, and that’s why xbase has it’s own build server called sourcekit helper that solves these issues.

edit: my bad, for lsp to work now, you would need to remove .compile manually. It must be reading the old one (gets automatically updated on project structure change)

Great to hear! Thank you for the update. I’m glad you were able to crack it! Good job and thank you for your engagement! 🚀 🎊

@wojciech-kulik Quick update.

It turned out the project did compile successfully. However, SwiftDriver wasn’t support in xcode log parser at all. Now, in local environment I can confirm that LSP features works.

Next I’m going fix the issue with the parser seeing SwiftCompile and swift-frontend as an error 😒, which the main cause of “the decode function error” in neovim. I must’ve add catch all logic to treat any unrecognizable log as error, if that the case, … what a bad decision it was.

Finally, with new release of xclog and updating the tag in xbase it should work flawlessly.

@wojciech-kulik I just ran the https://github.com/wojciech-kulik/SwiftUI-Redux-Demo on my environment.

  • Project doesn’t compile successfully. Even though it says it did and .compile was created with empty array.
  • Trying to build the project using the picker result in build failed.
  • The errors you mentioned after first open at decode function is indeed a bug.

I’m guessing permission issues, with some parsing issues. I will build in debug and run the build command manually to see whats wrong exactly. More later

My Environment


Machine
sw_vers

Output

ProductName:            macOS
ProductVersion:         13.0.1
BuildVersion:           22A400
Xcode
system_profiler SPDeveloperToolsDataType

Output

Developer:

    Developer Tools:

      Version: 14.3 (14E222b)
      Location: /Applications/Xcode.app
      Applications:
          Xcode: 14.3 (21812)
          Instruments: 14.3 (64559.163)
      SDKs:
          DriverKit:
              22.4:
          iOS:
              16.4: (20E238)
          iOS Simulator:
              16.4: (20E238)
          macOS:
              13.3: (22E245)
          tvOS:
              16.4: (20L489)
          tvOS Simulator:
              16.4: (20L489)
          watchOS:
              9.4: (20T248)
          watchOS Simulator:
              9.4: (20T248)
      Additional SDKs:
          iOS:
              Asset Runtime SDK for macOS hosts targeting iOS 16.4: 16.4
          tvOS:
              Asset Runtime SDK for macOS hosts targeting tvOS 16.4: 16.4
          watchOS:
              Asset Runtime SDK for macOS hosts targeting watchOS 9.4: 9.4
Neovim
nvim --version

Output

NVIM v0.9.0-dev
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by _nixbld6
Features: +acl +iconv +tui

Debugging


  • After opening neovim at project root, ps aux | grep "xbase/xbase" returns two results (on for grep and xbase process.
  • After opening neovim at project root, I see project have successfully compiled and buildServer.json and .compile was created.
  • Whenever I open neovim at project root, you see that the project is registered.
XBase Logs
tail -f /tmp/xbase.log

Output

INFO SERVER STARTED
INFO Client{fd=13}: Connected
INFO Runtime{name="SwiftUI-Redux-Demo"}: [Initializing] ------------------------
INFO Broadcaster{name="SwiftUI-Redux-Demo"}: Created
INFO Runtime{name="SwiftUI-Redux-Demo"}: targets: {"ReduxDemo": TargetInfo { platform: "iOS", configurations: ["Debug", "Release"] }}
INFO Broadcaster{name="SwiftUI-Redux-Demo"}: Connected [50590]
INFO Runtime{name="ReduxDemo"}: Creating "/tmp/SwiftUI-Redux-Demo/buildServer.json"
INFO Runtime{name="ReduxDemo"}: Connected [50590]
INFO FSWatcher{name="ReduxDemo"}: Watching
INFO Runtime{name="ReduxDemo"}: [Initialized] -------------------------
XBase build server logs
tail -f /tmp/xbase-build-server.log

Output (after navigating to a file. In that case Store.swift)

 INFO xbase_sourcekit_helper: Started
 INFO xbase_sourcekit_helper: Initialized
DEBUG xbase_sourcekit_helper: [Store.swift] Querying compile_db
ERROR xbase_sourcekit_helper: Missing compile arguments for "/tmp/SwiftUI-Redux-Demo/ReduxDemo/App/Store.swift"
Neovim State
print(vim.inspect(require('xbase.state')))

Output (after the project as registred successfully)

{
  project_info = {
    ["/tmp/SwiftUI-Redux-Demo"] = {
      targets = {
        ReduxDemo = {
          configurations = { "Debug", "Release" },
          platform = "iOS"
        }
      },
      watchlist = {}
    }
  },
  runners = {
    iOS = { {
        id = "3E959A4F-AA76-4A29-A898-77112BBDD54F",
        name = "iPhone 14 Plus"
      }, {
        id = "248851A9-D935-4149-993B-62710075AFCD",
        name = "iPhone 14 Pro Max"
      }, {
        id = "AECABAC4-8498-4A82-8026-4F98775AA892",
        name = "iPhone 14 Pro"
      }, {
        id = "88F1DFDB-9195-4DB1-83FE-1CA3AF461104",
        name = "iPad Air (5th generation)"
      }, {
        id = "709AC6C8-99EA-4AD4-9C22-36871639DC97",
        name = "iPhone SE (3rd generation)"
      }, {
        id = "DD1ACCE1-65BD-4489-808D-9E41557EB3F3",
        name = "iPad (10th generation)"
      }, {
        id = "4312DA7A-0E44-4C04-B541-70D454BFE0ED",
        name = "iPhone 14"
      }, {
        id = "7394CCA8-A938-4824-9A48-6D7F5791561A",
        name = "iPad mini (6th generation)"
      }, {
        id = "37E587F6-4F8B-4599-9CDC-8E0EAB786020",
        name = "iPad Pro (12.9-inch) (6th generation)"
      }, {
        id = "5CC8B028-7040-46A5-91C4-2E221BA0C500",
        name = "iPad Pro (11-inch) (4th generation)"
      } },
    tvOS = {},
    watchOS = {}
  }
}
Neovim Server Roots
print(vim.inspect(require('xbase.server').roots))

Output (after the project as registred successfully)

{
  ["/tmp/SwiftUI-Redux-Demo"] = true
}


@wojciech-kulik Thanks so much for debugging, reaching to the root of it, and providing a repo I can use to debug further.

I will try today use the repo to debug it further and make it work.