Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for multi-project apps #153

Open
wojciech-kulik opened this issue Jun 17, 2024 Discussed in #152 · 4 comments
Open

Support for multi-project apps #153

wojciech-kulik opened this issue Jun 17, 2024 Discussed in #152 · 4 comments

Comments

@wojciech-kulik
Copy link
Owner

Discussed in #152

Originally posted by Almaz5200 June 14, 2024
I have a modularized project that uses Tuist to generate projects. Because of that, each feature is a project in itself. However, when I add a new file it only shows me the targets from the root projects. I can still add them using tuist generate, but it would be a lot quicker if it could detect those targets as well. Is there any way to do that?

@wojciech-kulik
Copy link
Owner Author

Partially resolved in #188

@Almaz5200
Copy link
Contributor

@wojciech-kulik I wonder what's left to fully resolve this?

For me, the only thing left is editing Project.swift and some other Tuist helper files. For that purpose I think I can detect to which project the file belongs by just checking the filepaths. Those and only those files belong to Tuist that either are named Project.swift, or are in a "Tuist" folder in the current directory.

I guess that could be implemented by allowing to have multiple settings.json and buildServer.json files, as well as two LSP instances, but is running two LSP's looking at different buildServer.json's even possible?

@Almaz5200
Copy link
Contributor

So, I've made something to fix my problem, let me know if you want some of it in the project. First, I have this function

local Path = require('plenary.path')
local builtin = require('telescope.builtin')

function CopySelectedConfigFile()
  local config_dir = vim.fn.getcwd() .. "/.nvim/configurations"
  local dest_path = vim.fn.getcwd() .. "/.nvim/xcodebuild/settings.json"

  builtin.find_files({
    prompt_title = "Select a configuration",
    cwd = config_dir,
    attach_mappings = function(_, map)
      map('i', '<CR>', function(prompt_bufnr)
        local selected_file = require('telescope.actions.state').get_selected_entry().path
        require('telescope.actions').close(prompt_bufnr)

        -- Copy the selected file to the destination
        local source_path = Path:new(selected_file)
        local dest = Path:new(dest_path)
        source_path:copy({ destination = dest, recursive = false, overwrite = true })

        print("Copied " .. selected_file .. " to " .. dest_path)

        vim.cmd("XcodebuildReloadConfiguration")
      end)
      return true
    end,
  })
end

As you can see, it just takes one of the predetermined settings.json files, copies it to the correct place and runs XcodebuildReloadConfiguration, which I've wrote.
This command just reloads configuration from settings.json and re-runs xcode-build-server command.

I feel like project switching is too crude to incorporate like that, for one it doesn't account for changes in my two configurations, but XcodebuildReloadConfiguration maybe is good enough?

@Almaz5200
Copy link
Contributor

I've made a PR for that, I feel like it's a better place to discuss that: #200

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants