-- TypeScript tools configuration (replaces nvim-lsp-ts-utils)

local status_ok, ts_tools = pcall(require, "typescript-tools")
if not status_ok then
    vim.notify("typescript-tools.nvim not found — run :PackerSync", vim.log.levels.WARN)
    return
end

ts_tools.setup({
    on_attach = function(client, bufnr)
        -- Disable formatting via tsserver, use none-ls instead
        client.server_capabilities.documentFormattingProvider = false
        client.server_capabilities.documentRangeFormattingProvider = false
    end,
    settings = {
        -- Import on completion
        complete_function_calls = true,
        -- Include "this" in auto-imports
        include_completions_with_insert_text = true,
        -- Enable/disable spawning of tsserver instances
        separate_diagnostic_server = true,
        -- Path to tsserver (auto-detected from Mason if not set)
        tsserver_path = nil,
    },
})
