diff options
| author | christianchiarulli <[email protected]> | 2021-07-04 01:44:55 -0400 | 
|---|---|---|
| committer | christianchiarulli <[email protected]> | 2021-07-04 01:44:55 -0400 | 
| commit | e4da06abb0c229ae87997d3018d9190356fb3b08 (patch) | |
| tree | a81eff57c68105b2d21965338b51a4cbcb0d2262 | |
| parent | ca0fa9cbb238652889e14302b7c702a8ccfab437 (diff) | |
disable rust for now
| -rw-r--r-- | ftplugin/rust.lua | 138 | ||||
| -rw-r--r-- | lua/default-config.lua | 3 | 
2 files changed, 78 insertions, 63 deletions
| diff --git a/ftplugin/rust.lua b/ftplugin/rust.lua index d210cadb..2fddb982 100644 --- a/ftplugin/rust.lua +++ b/ftplugin/rust.lua @@ -1,75 +1,87 @@ -local opts = { -    tools = { -- rust-tools options -        -- automatically set inlay hints (type hints) -        -- There is an issue due to which the hints are not applied on the first -        -- opened file. For now, write to the file to trigger a reapplication of -        -- the hints or just run :RustSetInlayHints. -        -- default: true -        autoSetHints = true, - -        -- whether to show hover actions inside the hover window -        -- this overrides the default hover handler -        -- default: true -        hover_with_actions = true, - -        runnables = { -            -- whether to use telescope for selection menu or not +if O.lang.rust.rust_tools.active then +    local opts = { +        tools = { -- rust-tools options +            -- automatically set inlay hints (type hints) +            -- There is an issue due to which the hints are not applied on the first +            -- opened file. For now, write to the file to trigger a reapplication of +            -- the hints or just run :RustSetInlayHints.              -- default: true -            use_telescope = true +            autoSetHints = true, -            -- rest of the opts are forwarded to telescope -        }, - -        inlay_hints = { -            -- wheter to show parameter hints with the inlay hints or not +            -- whether to show hover actions inside the hover window +            -- this overrides the default hover handler              -- default: true -            show_parameter_hints = true, - -            -- prefix for parameter hints -            -- default: "<-" -            parameter_hints_prefix = "<-", - -            -- prefix for all the other hints (type, chaining) -            -- default: "=>" -            other_hints_prefix = "=>", - -            -- whether to align to the lenght of the longest line in the file -            max_len_align = false, - -            -- padding from the left if max_len_align is true -            max_len_align_padding = 1, - -            -- whether to align to the extreme right or not -            right_align = false, - -            -- padding from the right if right_align is true -            right_align_padding = 7 +            hover_with_actions = true, + +            runnables = { +                -- whether to use telescope for selection menu or not +                -- default: true +                use_telescope = true + +                -- rest of the opts are forwarded to telescope +            }, + +            inlay_hints = { +                -- wheter to show parameter hints with the inlay hints or not +                -- default: true +                show_parameter_hints = true, + +                -- prefix for parameter hints +                -- default: "<-" +                parameter_hints_prefix = "<-", + +                -- prefix for all the other hints (type, chaining) +                -- default: "=>" +                other_hints_prefix = "=>", + +                -- whether to align to the lenght of the longest line in the file +                max_len_align = false, + +                -- padding from the left if max_len_align is true +                max_len_align_padding = 1, + +                -- whether to align to the extreme right or not +                right_align = false, + +                -- padding from the right if right_align is true +                right_align_padding = 7 +            }, + +            hover_actions = { +                -- the border that is used for the hover window +                -- see vim.api.nvim_open_win() +                border = { +                    {"â•", "FloatBorder"}, {"─", "FloatBorder"}, +                    {"â•®", "FloatBorder"}, {"│", "FloatBorder"}, +                    {"╯", "FloatBorder"}, {"─", "FloatBorder"}, +                    {"â•°", "FloatBorder"}, {"│", "FloatBorder"} +                } +            }          }, -        hover_actions = { -            -- the border that is used for the hover window -            -- see vim.api.nvim_open_win() -            border = { -                {"â•", "FloatBorder"}, {"─", "FloatBorder"}, -                {"â•®", "FloatBorder"}, {"│", "FloatBorder"}, -                {"╯", "FloatBorder"}, {"─", "FloatBorder"}, -                {"â•°", "FloatBorder"}, {"│", "FloatBorder"} -            } -        } -    }, +        -- all the opts to send to nvim-lspconfig +        -- these override the defaults set by rust-tools.nvim +        -- see https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#rust_analyzer +        server = { +            cmd = {DATA_PATH .. "/lspinstall/rust/rust-analyzer"}, +            on_attach = require'lsp'.common_on_attach +        } -- rust-analyser options +    } +    require('rust-tools').setup(opts) + +else -    -- all the opts to send to nvim-lspconfig -    -- these override the defaults set by rust-tools.nvim -    -- see https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#rust_analyzer -    server = { +    require'lspconfig'.rust_analyzer.setup {          cmd = {DATA_PATH .. "/lspinstall/rust/rust-analyzer"}, -        on_attach = require'lsp'.common_on_attach -    } -- rust-analyser options -} +        on_attach = require'lsp'.common_on_attach, +        filetypes = {"rust"}, +        root_dir = require'lspconfig.util'.root_pattern("Cargo.toml", +                                                         "rust-project.json") +    } -require('rust-tools').setup(opts) +end --- TODO add this later +-- TODO fix these mappings  vim.api.nvim_exec([[      autocmd Filetype rust nnoremap <leader>lm <Cmd>RustExpandMacro<CR>      autocmd Filetype rust nnoremap <leader>lH <Cmd>RustToggleInlayHints<CR> diff --git a/lua/default-config.lua b/lua/default-config.lua index 7a26f242..9563ffe5 100644 --- a/lua/default-config.lua +++ b/lua/default-config.lua @@ -167,6 +167,9 @@ O = {          yaml = {},          terraform = {},          rust = { +            rust_tools = { +                active = false +            },              linter = '',              formatter = '',              autoformat = false, | 
