From dbd2460d181f9a7c4b430bdfd0e14c2821328878 Mon Sep 17 00:00:00 2001 From: Jannik Buhr Date: Fri, 28 Jun 2024 20:33:10 +0200 Subject: [PATCH] wip --- init.lua | 6 ++-- lua/plugins/lsp.lua | 65 +++++++++++++++++++++++++++++++----------- lua/plugins/quarto.lua | 2 +- lua/plugins/ui.lua | 10 +------ 4 files changed, 53 insertions(+), 30 deletions(-) diff --git a/init.lua b/init.lua index 20e0803..18be247 100644 --- a/init.lua +++ b/init.lua @@ -10,6 +10,6 @@ -- (may be outdated with newer versions of the plugins, -- check for yourself if you're interested in using them) -require 'config.global' -require 'config.lazy' -require 'config.autocommands' +require("config.global") +require("config.lazy") +require("config.autocommands") diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index c002579..87e4bed 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -1,9 +1,10 @@ return { + { -- for lsp features in code cells / embedded code 'jmbuhr/otter.nvim', - dev = false, + dev = true, dependencies = { { 'neovim/nvim-lspconfig', @@ -37,7 +38,31 @@ return { enabled = false, opts = {}, }, - { 'folke/neodev.nvim', opts = {}, enabled = true }, + { + { + 'folke/lazydev.nvim', + ft = 'lua', -- only load on lua files + opts = { + library = { + -- See the configuration section for more details + -- Load luvit types when the `vim.uv` word is found + { path = 'luvit-meta/library', words = { 'vim%.uv' } }, + }, + }, + }, + { 'Bilal2453/luvit-meta', lazy = true }, -- optional `vim.uv` typings + { -- optional completion source for require statements and module annotations + 'hrsh7th/nvim-cmp', + opts = function(_, opts) + opts.sources = opts.sources or {} + table.insert(opts.sources, { + name = 'lazydev', + group_index = 0, -- set group index to 0 to skip loading LuaLS completions + }) + end, + }, + -- { "folke/neodev.nvim", enabled = false }, -- make sure to uninstall or disable neodev.nvim + }, { 'folke/neoconf.nvim', opts = {}, enabled = false }, }, config = function() @@ -73,13 +98,13 @@ return { ---@diagnostic disable-next-line: inject-field client.server_capabilities.document_formatting = true - map('gS', telescope.lsp_document_symbols, '[g]o so [S]ymbols') - map('gD', telescope.lsp_type_definitions, '[g]o to type [D]efinition') - map('gd', telescope.lsp_definitions, '[g]o to [d]efinition') - map('K', 'lua vim.lsp.buf.hover()', '[K] hover documentation') - map('gh', 'lua vim.lsp.buf.signature_help()', '[g]o to signature [h]elp') - map('gI', telescope.lsp_implementations, '[g]o to [I]mplementation') - map('gr', telescope.lsp_references, '[g]o to [r]eferences') + map('gS', vim.lsp.buf.document_symbol, '[g]o so [S]ymbols') + map('gD', vim.lsp.buf.type_definition, '[g]o to type [D]efinition') + map('gd', vim.lsp.buf.definition, '[g]o to [d]efinition') + map('K', vim.lsp.buf.hover, '[K] hover documentation') + map('gh', vim.lsp.buf.signature_help, '[g]o to signature [h]elp') + map('gI', vim.lsp.buf.implementation, '[g]o to [I]mplementation') + map('gr', vim.lsp.buf.references, '[g]o to [r]eferences') map('[d', vim.diagnostic.goto_prev, 'previous [d]iagnostic ') map(']d', vim.diagnostic.goto_next, 'next [d]iagnostic ') map('ll', vim.lsp.codelens.run, '[l]ens run') @@ -93,8 +118,12 @@ return { allow_incremental_sync = true, debounce_text_changes = 150, } + + local telescope_builtin = require 'telescope.builtin' vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, { border = require('misc.style').border }) vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = require('misc.style').border }) + -- TODO: handle this + vim.lsp.handlers['textDocument/references'] = telescope_builtin.lsp_references local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities()) @@ -104,11 +133,11 @@ return { -- $home/.config/marksman/config.toml : -- [core] -- markdown.file_extensions = ["md", "markdown", "qmd"] - lspconfig.marksman.setup { - capabilities = capabilities, - filetypes = { 'markdown', 'quarto' }, - root_dir = util.root_pattern('.git', '.marksman.toml', '_quarto.yml'), - } + -- lspconfig.marksman.setup { + -- capabilities = capabilities, + -- filetypes = { 'markdown', 'quarto' }, + -- root_dir = util.root_pattern('.git', '.marksman.toml', '_quarto.yml'), + -- } lspconfig.r_language_server.setup { capabilities = capabilities, @@ -201,16 +230,18 @@ return { }, runtime = { version = 'LuaJIT', - plugin = lua_plugin_paths, + -- plugin = lua_plugin_paths, }, diagnostics = { - globals = { 'vim', 'quarto', 'pandoc', 'io', 'string', 'print', 'require', 'table' }, disable = { 'trailing-space' }, }, workspace = { - library = lua_library_files, + -- library = lua_library_files, checkThirdParty = false, }, + doc = { + privateName = { '^_' }, + }, telemetry = { enable = false, }, diff --git a/lua/plugins/quarto.lua b/lua/plugins/quarto.lua index 7b33333..4489c3f 100644 --- a/lua/plugins/quarto.lua +++ b/lua/plugins/quarto.lua @@ -4,7 +4,7 @@ return { -- for complete functionality (language features) 'quarto-dev/quarto-nvim', ft = { 'quarto' }, - dev = false, + dev = true, opts = { lspFeatures = { languages = { 'r', 'python', 'julia', 'bash', 'lua', 'html', 'dot', 'javascript', 'typescript', 'ojs' }, diff --git a/lua/plugins/ui.lua b/lua/plugins/ui.lua index 9b8fcd8..76c538a 100644 --- a/lua/plugins/ui.lua +++ b/lua/plugins/ui.lua @@ -333,15 +333,6 @@ return { enabled = true, dev = false, ft = { 'markdown', 'quarto', 'vimwiki' }, - dependencies = { - { - 'vhyrro/luarocks.nvim', - priority = 1001, -- this plugin needs to run before anything else - opts = { - rocks = { 'magick' }, - }, - }, - }, config = function() -- Requirements -- https://github.com/3rd/image.nvim?tab=readme-ov-file#requirements @@ -350,6 +341,7 @@ return { -- sudo apt install imagemagick -- sudo apt install libmagickwand-dev -- sudo apt install liblua5.1-0-dev + -- sudo apt install lua5.1 -- sudo apt installl luajit local image = require 'image'