Coder Social home page Coder Social logo

folke / neodev.nvim Goto Github PK

View Code? Open in Web Editor NEW
2.0K 12.0 58.0 19.53 MB

πŸ’» Neovim setup for init.lua and plugin development with full signature help, docs and completion for the nvim lua API.

License: Apache License 2.0

Lua 100.00%
neovim neovim-plugin neovim-lsp lua

neodev.nvim's Introduction

πŸ’» neodev.nvim

Warning

Development of neodev.nvim is now EOL. If you're on Neovim >= 0.10, then I highly suggest you to use lazydev.nvim It's a much faster and better replacement for neodev.


Neovim setup for init.lua and plugin development with full signature help, docs and completion for the nvim lua API.

image

✨ Features

  • Automatically configures lua-language-server for your Neovim config, Neovim runtime and plugin directories
  • Annotations for completion, hover and signatures of:
    • Vim functions
    • Neovim api functions
    • vim.opt
    • vim.loop
  • properly configures the require path.
  • adds all plugins in opt and start to the workspace so you get completion for all installed plugins
  • properly configure the vim runtime

⚑️ Requirements

  • Neovim >= 0.7.0
  • completion plugin like nvim-cmp

πŸ“¦ Installation

Install the plugin with your preferred package manager:

{ "folke/neodev.nvim", opts = {} }
Plug 'folke/neodev.nvim'

βš™οΈ Configuration

neodev comes with the following defaults:

{
  library = {
    enabled = true, -- when not enabled, neodev will not change any settings to the LSP server
    -- these settings will be used for your Neovim config directory
    runtime = true, -- runtime path
    types = true, -- full signature, docs and completion of vim.api, vim.treesitter, vim.lsp and others
    plugins = true, -- installed opt or start plugins in packpath
    -- you can also specify the list of plugins to make available as a workspace library
    -- plugins = { "nvim-treesitter", "plenary.nvim", "telescope.nvim" },
  },
  setup_jsonls = true, -- configures jsonls to provide completion for project specific .luarc.json files
  -- for your Neovim config directory, the config.library settings will be used as is
  -- for plugin directories (root_dirs having a /lua directory), config.library.plugins will be disabled
  -- for any other directory, config.library.enabled will be set to false
  override = function(root_dir, options) end,
  -- With lspconfig, Neodev will automatically setup your lua-language-server
  -- If you disable this, then you have to set {before_init=require("neodev.lsp").before_init}
  -- in your lsp start options
  lspconfig = true,
  -- much faster, but needs a recent built of lua-language-server
  -- needs lua-language-server >= 3.6.0
  pathStrict = true,
}

πŸš€ Setup

neodev will ONLY change the lua_ls settings for:

  • your Neovim config directory
  • your Neovim runtime directory
  • any plugin directory (this is an lsp root_dir that contains a /lua directory)

For any other root_dir, neodev will NOT change any settings.

TIP with neoconf.nvim, you can easily set project local Neodev settings. See the example .neoconf.json file in this repository

-- IMPORTANT: make sure to setup neodev BEFORE lspconfig
require("neodev").setup({
  -- add any options here, or leave empty to use the default settings
})

-- then setup your lsp server as usual
local lspconfig = require('lspconfig')

-- example to setup lua_ls and enable call snippets
lspconfig.lua_ls.setup({
  settings = {
    Lua = {
      completion = {
        callSnippet = "Replace"
      }
    }
  }
})
Example for setting up **neodev** that overrides the settings for `/etc/nixos`
-- You can override the default detection using the override function
-- EXAMPLE: If you want a certain directory to be configured differently, you can override its settings
require("neodev").setup({
  override = function(root_dir, library)
    if root_dir:find("/etc/nixos", 1, true) == 1 then
      library.enabled = true
      library.plugins = true
    end
  end,
})

It's possible to setup Neodev without lspconfig, by configuring the before_init of the options passed to vim.lsp.start.

Example without lspconfig
-- dont run neodev.setup
vim.lsp.start({
  name = "lua-language-server",
  cmd = { "lua-language-server" },
  before_init = require("neodev.lsp").before_init,
  root_dir = vim.fn.getcwd(),
  settings = { Lua = {} },
})

neodev.nvim's People

Contributors

folke avatar github-actions[bot] avatar jopemachine avatar krapjost avatar kylo252 avatar laytan avatar lewis6991 avatar mrcjkb avatar nguyenvukhang avatar polyzen avatar registergen avatar ryota2357 avatar smjonas avatar t-727 avatar uga-rosa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

neodev.nvim's Issues

Feature request: turn it approachable for other LSP clients?

Hi, thanks for this project. What about making its interface/docs more approachable to non nvim-lsp clients? After analyzing the source code I realized how to hack a fairly simple coc-lua configuration:

local lua_settings = require('lua-dev').setup().settings.Lua
lua_settings.workspace.library = require('lua-dev.sumneko').library()
lua_settings.workspace.library['/usr/share/nvim/runtime'] = nil
vim.fn['coc#config']('Lua', lua_settings)

Missing functions

At the moments quite some functions are missing:
vim.keymap. ...
the autocommand functions
the user_command functions
vim.loop. ...

could you add this @folke ?

Make use of generics

Hello, thank you for this plugin, it really helps with vim plugin development.
I think it will be great if you make more use of generics, so the types will not be lost when using built-in vim functions.
For example, tbl_filter could be generic and take a function that takes a type of T. Same for values, etc.

For example:

-- Filter a table using a predicate function
---@generic T
--- @param func fun(arg: T): boolean
--- @param t T[]
--- @return T[]
function vim.tbl_filter(func, t) end

How to configure

I am new to this plugin.
In past I have had lua sumneko server install using lspinstall and configured using the standard config found at the lspinstall site.

local lua_settings = `{`
Lua = {
	runtime = {
		-- LuaJIT in the case of Neovim
		version = "LuaJIT",
		path = vim.split(package.path, ";"),
	},
	diagnostics = {
		-- Get the language server to recognize the `vim` global
		globals = { "vim" },
	},
	workspace = {
		-- Make the server aware of Neovim runtime files
		library = {
			[vim.fn.expand("$VIMRUNTIME/lua")] = true,
			[vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true,
	},

It was kind of working and then I came upon on this plugin of yours and wanted to give it a try. I commented out the above settings and installed your setup with the default settings . I didn't deinstall the lua completion server installed through lspinstall

Now its though its running using the configs from this plugin I am getting the following message in Lspinfo. Is there something I am missing in my setup. Also does this plugin give any additional benefit over the setup I had initially

image

Omnifunc support

Thanks for the great plugin! It works amazingly well out-of-the-box.

I see that the plugin depends on a "full" completion plugin to work properly, since the built-in vim.lsp.omnifunc seems to simply return a gigantic list of all available completion options, regardless of the current context. I'm curious whether this is a fundamental limitation or whether there's any chance of getting omnifunc support. If it's the latter, I'd be happy to contribute towards getting it to work.

cmd not defined for "sumneko_lua"

Update: Apparently, I may be the only person in Neovimland who was perfectly happy with the completions from this plugin alone. But, if you do have the lua-language-server set up then the below will not impact you.

For those who find this later, this is my proper working configuration for using this plugin with lua-language-server:

local lspconfig = require "lspconfig"
local luadev = require("lua-dev").setup {
  lspconfig = {
    cmd = {
      "/Users/joel/vim-dev/sources/lua-language-server/bin/macOS/lua-language-server",
      "-E",
      "/Users/joel/vim-dev/sources/lua-language-server/main.lua",
    },
  },
}
lspconfig.sumneko_lua.setup(luadev)

Original "issue" when I was happily using this plugin without lua-language-server:

I'm not sure if this is an issue per se. But, when neovim/nvim-lspconfig#1171 landed on 2021-08-24, I began to get the message: cmd not defined for "sumneko_lua". You must manually set cmd in the setup{} call according to CONFIG.md when opening any Lua file. This makes perfect sense since the PR "unsilenced" the message. I'm using the default lua-dev setup as shown here: https://github.com/folke/lua-dev.nvim#-setup. Everything still worked perfectly fine. But, the message is distracting.

So, Instead of adding an extra conditional branch to nvim-lspconfig (locally) that ignored sumneko_lua, I decided to just set enabled to false as shown below in order to fall into this conditional branch: https://github.com/neovim/nvim-lspconfig/blob/62b9e1a27dd0c9556964b5c7a7bc144091cf9709/lua/lspconfig/util.lua#L230. This gets rid of the message and everything still works just fine.

This may not be the best solution. So, please let me know if I should be doing something different. Otherwise, I hope it helps others that may run into this.

local luadev = require("lua-dev").setup {
  -- was either this or keep local nvim-lspconfig & suppress error
  -- for sumneko_lua here:
  -- https://github.com/neovim/nvim-lspconfig/blob/62b9e1a27dd0c9556964b5c7a7bc144091cf9709/lua/lspconfig/util.lua#L233
  -- @TODOUA: watch for related changes in lua-dev and nvim-lspconfig
  lspconfig = {
    enabled = false,
  },
}

local lspconfig = require "lspconfig"
lspconfig.sumneko_lua.setup(luadev)

completion for plugin modules

I see that the readme specifies I get completion for plugins in opt and start directories, I'm not sure whether that includes auto-completions for, say, require('telescope.builtins').| so completion on the | character.

how can I get completions for plugin modules

Adding custom libraries

This might be the noobest question in git issues history, but I cant for the life of me figure out how to add libraries apart from the default.

For example, before using lua-dev I had something like this in "regular" sumneko, and it worked correctly.

settings = {
                Lua = {
                    runtime = {version = "LuaJIT", path = vim.split(package.path, ";")},
                    diagnostics = {globals = {"vim", "pd"}},
                    workspace = {
                        library = {
                            [vim.fn.expand("$VIMRUNTIME/lua")] = true,
                            [vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true,
                            ["/usr/lib/pd/extra/pdlua"] = true,
                            ["/some/other/libraries"] = true,
                        }
                    }
                }
            }

I have tried adding the same in libraries = {} section like this

 local luadev =
         require("lua-dev").setup(
         {
             libraries = {
                 ["/usr/lib/pd/extra/pdlua"] = true,
             },
             lspconfig = {
                 on_attach = custom_attach,

and I have also tried in the same's lspconfig like this

settings = {
                  Lua = {
                         runtime = {version = "LuaJIT", path = vim.split(package.path, ";")},
                         diagnostics = {globals = {"vim", "pd"}},
                         workspace = {
                             library = {
                                 ["/usr/lib/pd/extra/pdlua"] = true
                             }
                         }
                     }
                 }

But with either setup, the libraries wont get picked up. I dont get any lsp features like hover, autocompletion, nothing at all.

I am sure there is a an exceedingly simple answer to this, which once you point out I will feel too stupid to show my face on github again.
Can you please help?

module 'lspconfig' not found

Can we add an option not to use nvim-lspconfig in #39 ?
Or at least we need to note that this plugin requires nvim-lspconfig in README.

I'm using this plugin with coc.nvim. And lspconfig is not installed.

Lua diagnostic: unexpected behavior with nvim-cmp

After opening a file that configures nvim-cmp, the server shows the following message:

2022-03-01_12-00_05.mp4

Go to definition of cmp.setup opens nvim-autopairs/completion/cmp.lua

Server Setup config:

local sumneko_lua = require('lua-dev').setup {
  library = { runtime = true, plugins = true, types = true },
  runtime_path = true,
}
M.sumneko_lua = sumneko_lua

[BUG] Double Workspace Loaded on Sumneko 2.6.0

Two workspaces are loaded in the newest Sumneko lua server when using lua-dev. I can confirm this does not occur when not using lua-dev in lspconfig.

The effect of loading two workspaces is super slow startup for the lsp, and super slow autocompletes and goto definitions.

The proof of two workspaces loaded can be seen in the screenshot by using lsp_status indicator in the status line (the bottom row).

image

This is most likely caused by the new workspaces feature. Can be seen from this compare tag commits.

Add explicit warning that this changes the default of `Lua.runtime.path`

This plugin changes the default of Lua.runtime.path from { "?.lua", "?/init.lua", "?/?.lua" } to { "lua/?.lua", "lua/?/init.lua.

This caused me almost a day of frustration, as I could not get my lua completion to work correctly: LuaLS/lua-language-server#657

Looking back the readme mentions it, but understates what is being done:

properly configures the require path with lua/?.lua and lua/?/init.

I would like it to be more explicit so no one else has to struggle a day for no reason. Something like:
ATTENTION: This Plugin changes the default runtime path, if you would like to use the sumneko lua-language-server for other lua projects add the following to your config:

local luadev = require("lua-dev").setup({
    lspconfig = {
		-- cmd = {"lua-language-server"},
		settings = {
			Lua = {
				runtime = {
					path = {
						"?.lua",
						"?/?.lua",
                                                "?/init.lua",
					}
				},
			},
		},
	})

Bug with `settings.workspace.library` after latest commit

Hi! I commented on the latest commit, but I guess you didn't notice it. Therefore I'll open an issue as well with just pasting what I also commented on the latest commit:

This commit broke something for me. I also have something specified in settings.workspace.library for sumneko, and now it is not able to merge those two together.

This is because you changed from having a table where the key (path) mapped to true. This way, tbl_deep_extend are able to merge the two together, since the keys are the paths. Now, it is only a list instead, and the indexes are the keys, and the value is the path.

Since tbl_deep_extend looks at the keys for merging together, it will not work since we will both have a key of 1, and then one entry you specify for that setting in the plugin is dropped. I think we should either revert to mapping to true, or find another way to merge together the tables

Client exit with code 1

Hi thank you for this plugin. I want to try this out but it gives me client exit with code 1 when I start a lua file after I have installed by following the documentation. What can I do to further debug and find out the issue?

sumneko_lua reports usage of global function as undefined.

I've been using this for about a week now and it's been a great experience.

However, global lua functions defined in nvim/lua/... are no longer 'visible' to lsp if they are referenced in another file.

The diagnostics reports "undefined global <func>" and I've confirmed this only happens when lua-dev is loaded.

I took a look at your dotfiles to see if I had setup my environment incorrectly, and found that you have two globals defined in util.lua (dump() and profile()) but they aren't used in any other file.
AFAICT it should be reproducable for you if you did dump("hello world") in another .lua file.

Totally fine if you consider something like this a non-issue, btw.

Feature request: add only the provided plugin path to `library`

In case of working on only a few plugins, it seems unnecessary to load all of the user's plugins which could be dozens of them and that could mean that the server will have to index a lot of files.

Proposal

We could extend library.plugins key to accept a table of opt or start plugin names which should be added. So, the type for library.plugins would become boolean|table<string, string[]>:

  • true: add all the opt and start plugins
  • false: do not add any of the plugins
  • table: containing two keywords opt and start each with a list of plugin names to be added

[Issue] sumneko_lua LSP client is defined but cannot attach to buffer

Neovim version: V0.6 nightly
OS: Windows 10 x64 Pro

:LspInfo:

Configured servers: ahk_lsp, sumneko_lua, ghdl_ls, vhdl_ls, vhdl_tool, hdl_checker
Neovim logs at: C:\Users\MyUsername\AppData\Local\Temp\nvim/lsp.log

0 client(s) attached to this buffer: 

0 active client(s): 

Clients that match the filetype lua:
  
  Config: sumneko_lua
  	cmd:               lua-language-server
  	cmd is executable: True
  	identified root:   C:\Work\MEGA\Portable\Neovim\config
  	custom handlers:   

lsp.log:

[ START ] 2021-07-25T00:10:23+0200 ] LSP logging initiated
[ ERROR ] 2021-07-25T00:10:26+0200 ] ...A\Portable\Neovim\share\nvim\runtime\lua\vim\lsp\rpc.lua:462 ]	"rpc"	"lua-language-server"	"stderr"	"lua-language-server:\0stdin:1: syntax error near '-'\0"

lua-dev setup file:

local luadev = require("lua-dev").setup({
    lspconfig = {
        filetypes = {"lua"},
        cmd = {"lua-language-server"},
        sumneko_root_path = "C:/Work/Projects/Repositories/GitHub/sumneko/lua-language-server",
        sumneko_binary    = "C:/Work/Projects/Repositories/GitHub/sumneko/lua-language-server/bin/Windows/lua-language-server",
    },
})

local lspconfig = require('lspconfig')
lspconfig.sumneko_lua.setup(luadev)

Lsp functionality not working inside lua plugins

Hi @folke,

I've been using this plugin and quite enjoying it for developing my plugins. Recently though, i.e. the last good commit that is working for me cf3b028, I have not been getting diagnostics or other lsp functionality inside my lua plugins. I see some changes around a workspace plugin in 681c0fc, which is the commit that broke things for me, though I've not dug in enough to know what happened. My config for the plugins is

lspconfig = {
        settings = {
          Lua = {
            diagnostics = {
              globals = {
                'vim',
                'describe',
                'it',
                'before_each',
                'after_each',
                'pending',
                'teardown',
                'packer_plugins',
              },
            },
            completion = { keywordSnippet = 'Replace', callSnippet = 'Replace' },
          },
        },
      }

Is it necessary to have all .lua files in lua subdirectory?

Hello and thanks you for the plugin. It makes neovim configuration experience much better but I have one small question.

All the user configurations and plugins I saw had their .lua files in subdirectory called lua, like .config/nvim/lua/mappings.lua. But I always preferred to have fewer directory levels so I put my files into just .config/nvim and it worked as long as I set package.path to config/nvim/?.lua. But it seems like your plugin doesn't support this: sumneko "go to definition" doesn't work until I put file with definition in lua subdirectory. Do I really have to do that to have "go to definition" working? Or is it possible to configure something?

Also I've found this commented out line and tried to uncomment it, but it didn't help
https://github.com/folke/lua-dev.nvim/blob/4331626b02f636433b504b9ab6a8c11fb9de4a24/lua/lua-dev/sumneko.lua#L44

LSP[sumneko_lua] Your workspace is set to `/home/XYZ`. Lua language server refused to load this directory. Please check your configura tion.[learn more here](https://github.com/sumneko/lua-language-server/wiki/Why-scanning-home-folder)

Hello!

Recently every time I open up a .lua file I always get this error

LSP[sumneko_lua] Your workspace is set to '/home/zhifan'. Lua language server refused to load this directory. Please check your configura tion.[learn more here](https://github.com/sumneko/lua-language-server/wiki/Why-scanning-home-folder)

but I don't know how should I fix it.
The Language Server itself still works even if the message shows up

`lspconfig.diagnostics.globals` doesn't work

This settings doesn't work:

local lsp_settings = {
  lua = require("lua-dev").setup({
    plugins = true,
    lspconfig = {
      diagnostics = {
        globals = {"use"},
      },
    },
  })
}

local lspconfig = require('lspconfig')
lspconfig[lua].setup( lsp_settings[lua] )

I get errors Undefined global 'use' for packer use statements.

But raw settings given directly to lspconfig works:

local lsp_settings = {
  lua = {
    settings = {
      Lua = {
        diagnostics = {
          globals = {"use"},
        },
      },
    },
  }
}

local lspconfig = require('lspconfig')
lspconfig[lua].setup( lsp_settings[lua] )

from which I can make a conclusion that problem is in the plugin.

The language server seems extremely slow

My configuration can be seen here

For some reason, when editing a lua file inside a plugin, the server can't quite keep up. I have several minutes delay on diagnostics and completion is unusable (running nvim-compe).

Is there something I can do to debug this or fix this? Before I was running plain sumneko and it was fine (but without all the nice info for nvim functions)

Avoiding Snippets

Hello, I like the type definitions this plugin provides and it works well, much better than any cmp-nvim-lua.

However, it necessitates the turning on of snippets. This means when I open completion I see snippets for if, for, ipairs, etc... all of which are useless for me because I made my own snippets.

Is there anything I can do about this (e.g. any way of filtering out snippets sent by sumneko_lua while keeping those from lua-dev)?

Add "globals" option

Hi,

it would be neat if we could provide additional globals to the configuration. Currently I'm doing this:

luadev.settings.Lua.diagnostics.globals = {'vim', 'describe', 'it', 'before_each', 'after_each'}
nvim_lsp.sumneko_lua.setup(luadev)

Having top level globals that would merge into existing one would be great.
Or even making all of these a default globals value.

types/api.lua does not have vim.api.nvim_create_autocmd

nvim_create_autocmd was added in neovim version 0.7.
I saw a previous commit (6063731) with the title 'feat: updated docs to 0.7' which is why I thought the lua-dev does support the entire 0.7 neovim api.
However I dont see it in the docs (I checked types/api.lua and types/api1.lua). Is there anyway this could be added ?

Treesitter annotations incomplete

The README says:

full signature, docs and completion of vim.api, vim.treesitter, vim.lsp and others

However, it seems like vim.treesitter annotations are very spotty. I can't tell if they just haven't been done, or this is a bug. I'm inclined to think bug because the annotations look wrong, find below a screenshot of the popup for vim.treesitter.parse_query:

image

The nil.parse_query part is clearly a bug, perhaps the same bug is interfering with getting the annotation info?

[Feature Request] EmmyLua Annotation Files For LuaJIT Stdlib

First off thanks for making this plugin, even though I prefer to roll my own config your generated EmmyLua annotations are very, very, very useful. Looking around I couldn't seem to find an similar set of annotations for the LuaJIT's stdlib and was wondering if it is possible to also generate those as well.

feat: add pattern folder match

@folke

the readme states that:
properly configures the require path with lua/?.lua and lua/?/init.lua.
i'd like to have a setup overwrite for this because some of my code isn't indexed
my folder structure looks like this for instance

lua/plugins/*/*.lua

would this be possible

How to make nvim function signature work?

I installed the plugin and tried it out-of-box; it does provide completion of vim Lua APIs (e.g., vim.api.blahblah). However, unlike the demo screenshot in README, the function symbols are not accompanied by proper function signatures nor documentation.

My screenshot:

README:

What am I missing?

Don't show "diagnosing..." status

Hello, thanks for this plugin, very helpful. There's a minor inconvenience - without this plugin, I only get loading status

image

with this plugin, I get "Diagnosing <file>" status too:

image

This spams my statusline every time I make an edit, how do I disable this? (Setting settings.Lua.window.progressBar in lspconfig to false disables loading status too, although I've done this for now)

I use https://github.com/tjdevries/express_line.nvim with https://github.com/nvim-lua/lsp-status.nvim

Unwanted default opts for lspconfig setup

require("lua-dev").setup { ... } produces the following opts for lspconfig.sumneko_lua:

  Lua = {
        ...
        completion = { callSnippet = "Replace" },
        workspace = {
          -- Make the server aware of Neovim runtime files
          library = M.library(opts),
          maxPreload = 1000,
          preloadFileSize = 150,
        },
        ...
  },

Reference: https://github.com/folke/lua-dev.nvim/blob/main/lua/lua-dev/sumneko.lua#L82-L93

Personally I don't like the completion.callSnippet and workspace.maxPreload behavior. The reasons are: (i) functions will show up as snippet entries in the completion engine (rather than kind of function); (ii) When analyzing some lua files greater than the maxPreload size, an input prompt will be asked. With the default value of workspace.maxPreload nil, it won't.

I think these values are very opinionated values and should not a part of this plugin (people can have them rather in their own lsp config files). At least these could be customizable through options for lua_dev.setup { ...}.

Help: Setting up with different completion/lsp clients

I am trying to make this work with coc.nvim with no luck so far.
I have setup coc.nvim to use sumneko's LSP.
Do I have to use mentioned completions plugins (nvim-compe or completion-nvim) and nvim-lspconfig to make this work? or it's possible to feed this plugins completions to coc.nvim?

Can this configuration be loaded only when opening neovim-related files?

As the title says:

  • If I edit ~/.config/nvim/init.lua (or any other Lua file in the config directory), then I'd like the LSP started with the additional configuration parameters that makes it awesome
  • If I edit ~/.config/awesome/rc.lua or any other Lua file outside of neovim, then these settings don't apply and I'd like to use a different set.

I'm not sure how to achieve this, do you have an idea?

update function

There are always some new functions appearing
one examples I know right out of my head would be vim.keymap.*

I don't know how you create the database with the functions.
But would it be possible to automatically do this with a github action so it's always up to date? @folke

bug: renaming breaks when opening symlinked directory

As mentioned here, this breaks the LSP renaming.

Minimal repro:

  • ~/.config/nvim points to ~/dotfiles/config/nvim
  • Place the minimal.vim in ~/dotfiles/config/nvim/minimal.vim
  • Open Neovim from ~/dotfiles directory nvim --noplugin -n -u config/nvim/minimal.vim
  • :e test.lua with the following contents:
local test = "is this working?"
print(test)
  • For debugging LSP: :lua print(vim.inspect(vim.lsp.buf_get_clients()))
  • Place the cursor on test and run :lua vim.lsp.buf.rename()
Minimal config
set nocompatible hidden laststatus=2
map Q <nop>

" Download the plugin manager
if !filereadable('/tmp/plug.vim')
  silent !curl -fsSLo /tmp/plug.vim
    \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
endif

source /tmp/plug.vim

call plug#begin('/tmp/plugged')
" LSP plugin
Plug 'neovim/nvim-lspconfig'

" Plugins to test
Plug 'folke/lua-dev.nvim'
call plug#end()

autocmd VimEnter * PlugClean! | PlugUpdate --sync | close

" Load the plugins (packadd <plugin_name>)
packadd nvim-lspconfig
packadd lua-dev.nvim

" For lua only plugins
lua << EOF
local luadev = require("lua-dev").setup()
local lspconfig = require('lspconfig')

local home = vim.loop.os_homedir()

-- Place the actual path to the binary for your machine
luadev.cmd = {
  home .. "/git/lua-language-server/bin/macOS/lua-language-server",
  "-E",
  home .. "/git/lua-language-server/main.lua",
}
lspconfig.sumneko_lua.setup(luadev)
EOF
nvim --version
❯ nvim --version
NVIM v0.5.0-dev+e0a01bd-dirty
Build type: Debug
LuaJIT 2.1.0-beta3
Compilation: /Library/Developer/CommandLineTools/usr/bin/cc -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=1 -I/Users/dhruvmanilawala/git/neovim/build/config -I/Users/dhruvmanilawala/git/neovim/src -I/Users/dhruvmanilawala/git/neovim/.deps/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include -I/usr/local/opt/gettext/include -I/Users/dhruvmanilawala/git/neovim/build/src/nvim/auto -I/Users/dhruvmanilawala/git/neovim/build/include
Compiled by dhruvmanilawala@mbp

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/share/nvim"

Run :checkhealth for more info

Context:

delete root from workspace to make sure we don't trigger duplicate warnings

What I think is happening and I could be wrong, but as you mentioned the above, there are now these two paths which could be creating some clashes:

  • ~/dotfiles/config/nvim for the library key which is from vimconfig = true
  • ~/dotfiles current working directory

Plugin conflicts/debugging

Thanks for making this - from the screenshots, it looks super useful!

I'm wondering if there are any possible conflicts between this and other LSP plugins (e.g. lspsaga, lspkind, lsp-status, etc.). I have (I think) followed the setup instructions correctly, but the "documentation" I get (with nvim-compe) does not match the screenshots on this repo, so something is clearly wrong.

What I get looks something like:
documentation

So: do you know of any "gotchas" that might override or prevent lua-dev from providing its documentation as expected?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.