pmizio / typescript-tools.nvim

⚡ TypeScript integration NeoVim deserves ⚡
MIT License
1.45k stars 40 forks source link

A better way to separate lsp running between denols and tsserver. #248

Closed qwexvf closed 6 months ago

qwexvf commented 7 months ago

Currently i have a react app with the directory tree below

├── src
│  ├── App.css
│  ├── assets
│  ├── components
│  ├── graphql
│  ├── index.css
│  ├── lib
│  ├── main.tsx
│  ├── pages
│  ├── types
│  └── vite-env.d.ts
├── supabase
│  ├── config.toml
│  ├── functions
│  └── seed.sql
├── tsconfig.json
├── tsconfig.node.json
├── vercel.json
└── vite.config.ts

I'm trying to figure out a way to separate when editing files in supabase dir to not run tsserver. has anyone faced similar case or know a way to achieve this?

qwexvf commented 6 months ago

bump

qwexvf commented 6 months ago

for if anyone happens to have the same issue

return {
    "pmizio/typescript-tools.nvim",
    dependencies = {
        "kyoh86/climbdir.nvim",
    },
    lazy = false,
    config = function()
        require("typescript-tools").setup {
            on_attach = function(client)
                -- Disable document formatting capabilities
                client.server_capabilities.documentFormattingProvider = false
                client.server_capabilities.documentRangeFormattingProvider = false
            end,
            root_dir = function(path)
                local marker = require("climbdir.marker")
                -- Determine the root directory based on the presence of package.json or node_modules
                return require("climbdir").climb(path,
                    marker.one_of(marker.has_readable_file("package.json"), marker.has_directory("node_modules")), {
                        -- Stop the plugin if any of the specified files/folders are found
                        halt = marker.one_of(
                            marker.has_readable_file("deno.json"),
                            marker.has_readable_file("deno.jsonc"),
                            marker.has_readable_file("import_map.json"),
                            marker.has_directory("denops")
                        ),
                    })
            end,
            single_file_support = false,
        }
    end,
}