kkharji / xbase

Develop Apple software products within your favorite editor.
MIT License
533 stars 17 forks source link

xbase not started #242

Open johntheocs opened 9 months ago

johntheocs commented 9 months ago

I used lazy.nvim to manage Xbase. It has been installed successfully.

return {
  "xbase-lab/xbase",
  lazy = false,
  dependencies = {
    "neovim/nvim-lspconfig",
  },
  build = "make install",
}

When I enter ":Lazy," the following is the loaded plugins, and xbase is loaded.

Screenshot 2023-12-12 at 1 48 18 PM

However, when I open a Object C/Swift project directory, nothing happens. No Xbase related process. Also, there is no file named xbase.log in /tmp directory. Anything I missed?

Thanks

duggthangs commented 8 months ago

Hey @johntheocs, i don't see you calling the "setup" function in the Xbase config. Here is my lazy config, hopefully this can help:

{
'xbase-lab/xbase',
dependencies = {
    'neovim/nvim-lspconfig',
},
build = "make install",
config = function()
    require 'xbase'.setup {
        log_level = vim.log.levels.DEBUG,
        simctl = {
            iOS = {
                "iPhone 15 Pro"
            }
        },
        mappings = {
            build_picker = 0,
            run_picker = 0,
            watch_picker = 0,
            all_picker = 0,
            toggle_split_log_buffer = 0,
            toggle_vsplit_log_buffer = 0
        }
    }
end
},

Also, don't forget to set up sourcekit-lsp. Here is my lspconfig:

lspconfig.sourcekit.setup {
capabilities = capabilities,
on_attach = function(arg1, arg2)
    vim.keymap.set('n', '<leader>dp', require "xbase.pickers.builtin".actions, { desc = "XBase picker" })
    vim.keymap.set('n', '<leader>dl', function()
        require "xbase.logger".toggle(false, true)
        end, { desc = "XBase logger" })
    return on_attach(arg1, arg2)
end,
filetypes = { "swift" },
root_dir = lspconfig.util.root_pattern("*.xcodeproj", "*.xcworkspace", "Package.swift", ".git", "project.yml", "Project.swift"),
cmd = {
    "xcrun",
    "sourcekit-lsp",
    "--log-level",
    "debug"
}
}
johntheocs commented 8 months ago

Thank you so much. You made my day! One more question, how can I use this plugin after all this configuration?

bengidev commented 7 months ago

@duggthangs , where do you put this codes?

lspconfig.sourcekit.setup {
capabilities = capabilities,
on_attach = function(arg1, arg2)
    vim.keymap.set('n', '<leader>dp', require "xbase.pickers.builtin".actions, { desc = "XBase picker" })
    vim.keymap.set('n', '<leader>dl', function()
        require "xbase.logger".toggle(false, true)
        end, { desc = "XBase logger" })
    return on_attach(arg1, arg2)
end,
filetypes = { "swift" },
root_dir = lspconfig.util.root_pattern("*.xcodeproj", "*.xcworkspace", "Package.swift", ".git", "project.yml", "Project.swift"),
cmd = {
    "xcrun",
    "sourcekit-lsp",
    "--log-level",
    "debug"
}
}