nushell / integrations

A place to gather data required for packaging Nushell and other integrations.
MIT License
6 stars 3 forks source link

⚡ feat: add neovim config #3

Closed melMass closed 6 months ago

melMass commented 7 months ago

wip, I will edit this message better a bit later, but roughly: image

image

melMass commented 7 months ago

cc @amtoine if you can stress test it I'm sure you'll find issues :)

fdncred commented 7 months ago

I'm not seeing nu --lsp in the code. What am I missing?

melMass commented 7 months ago

The config is less then 150 lines of code so that it can be read...

It's inside the lspconfig config step, this commit show the removal: https://github.com/nushell/integrations/commit/96627b1178cb801a799a17c6fb0a3f242175755a

I think we can remove all the custom lsp plugins and just rely on neovim core lsp but I'm still a bit lost as to which does what between core lsp and lspconfig

melMass commented 7 months ago

Also you can literally test it in seconds if you follow the readme

fdncred commented 7 months ago

I can't get this to work the way I thought it would. The syntax highlighting and nushell lsp seem to work fine (congrats!), but I think it's loading cached files because even though I followed the readme, I still have my lunarvim colors. I wonder if there are some other env vars that it may be using or other folders?

My lunarvim setup does this

$env.XDG_DATA_HOME = $env.APPDATA
$env.XDG_CONFIG_HOME = $env.LOCALAPPDATA
$env.XDG_CACHE_HOME = $env.TEMP

$env.LUNARVIM_RUNTIME_DIR = $'($env.XDG_DATA_HOME)\lunarvim'
$env.LUNARVIM_CONFIG_DIR = $'($env.XDG_CONFIG_HOME)\lvim'
$env.LUNARVIM_CACHE_DIR = $'($env.XDG_CACHE_HOME)\lvim'
$env.LUNARVIM_BASE_DIR = $'($env.LUNARVIM_RUNTIME_DIR)\lvim'

Lastly, I still don't understand how it even knows about nu --lsp since you removed it from the init.lua. This is part of the reason why neovim is a pain for me.

melMass commented 7 months ago

I can't get this to work the way I thought it would.

If you use APPNAME it should use a separate dir for both the config file and the data so it's pretty strange, if you did not use APPNAME that's normal your data folder already has your old plugs and it create strange conflicts like this

Lastly, I still don't understand how it even knows about nu --lsp since you removed it from the init.lua. This is part of the reason why neovim is a pain for me.

Let me correct that to make it clearer it relies on too much magic currently. I've since fully switched to neovim, something clicked

fdncred commented 7 months ago

I followed the readme with NVIM_APPNAME=nvim-nu nvim

melMass commented 7 months ago

That should have created an isolated nvim-nu-data directory for you in LOCAPAPPDATA (or XDG on Unix)

fdncred commented 7 months ago

That should have created an isolated nvim-nu-data directory for you in LOCAPAPPDATA (or XDG on Unix)

It did but there's also a C:\Temp\nvim-nu and a C:\Users\username\AppData\Roaming\nvim-nu-data and my regular lvim/lunarvim folders

melMass commented 7 months ago

I think this should instead be a markdown documentation of just the relevant bits. I will propose something later this week.

fdncred commented 6 months ago

Let's go with this for now. We can always change it later if we don't like it. At least there is much less magic going on now. Thanks @melMass!

melMass commented 6 months ago

Small note for windows users:

Because of how the os lock files, TSUpdate will fail if you have an opened buffer using the lang compiled ts definition. For instance, updating TreeSitter-nu with a nushell file open will result in this:

image

solution: close nvim, reopen it without any file/session, TS should fire on its own, if not run :TSUpdate

fdncred commented 6 months ago

would be good to have that in the readme for this functionality.