It uses Roslyn
instead of omnisharp
.
After you have all the below done, before developing your game you will have to initialise nvim with:
gnvim
Instead of nvim
, for example. By the way, this gnvim
is whatever alias you set in the Create an alias
section.
- Create an alias in your
*rc
(.bashrc, .zshrc) file:
alias gnvim='nvim --listen /tmp/godot.pipe'
You can name it whatever you want, obviously.
-
In Godot editor, go to "Editor Settings" (
CMD ,
), search for "External" (under "Text Editor") and set:- Exec path: to your nvim path (
which nvim
). Example:/opt/homebrew/bin/nvim
- Exec flags:
--server /tmp/godot.pipe --remote-send "<esc>:n {file}<CR>:call cursor({line},{col})<CR>"
- Use external editor: checked ✅
- Exec path: to your nvim path (
Note
Also be sure to have the .NET installed. Check the Godot Docs for more info.
-
In Godot editor, go to "Editor Settings" (
CMD ,
), search for "External" (under "Dotnet") and set:- External editor: Custom
- Custom Exec path: to your nvim path (
which nvim
). Example:/opt/homebrew/bin/nvim
- Custom Exec path arguments:
--server /tmp/godot.pipe --remote-send "<esc>:n {file}<CR>:call cursor({line},{col})<CR>"
-
Add this to your config file (
.bashrc
,.zshrc
, others):
export DOTNET_ROOT=/usr/local/share/dotnet
export PATH=$PATH:$DOTNET_ROOT
In your lspconfig.lua config:
-- GDScript
require('lspconfig')['gdscript'].setup {
name = 'godot',
-- This info exists in the Editor Settings > Network > Language server
cmd = vim.lsp.rpc.connect('127.0.0.1', 6005),
}
lspconfig.lua file.
First, add a new registry to Mason:
{
'mason-org/mason.nvim',
opts = {
registries = {
'github:mason-org/mason-registry',
'github:Crashdummyy/mason-registry', -- <- This
},
},
}
Then, access the Mason with the command :Mason
and install roslyn
.
After that, add also this:
-- C#
{
'seblyng/roslyn.nvim',
ft = 'cs',
---@module 'roslyn.config'
---@type RoslynNvimConfig
opts = { },
},
Add this snippet to your dap
(mfussenegger/nvim-dap) plugin
-- This info exists in the Editor Settings > Network > Debug adapter
dap.adapters.godot = {
type = 'server',
host = '127.0.0.1',
port = 6006,
}
Additionally:
dap.configurations.gdscript = {
{
type = 'godot',
request = 'launch',
name = 'Launch scene',
project = '${workspaceFolder}',
launch_scene = true,
},
}
Additionally:
-- C#
dap.configurations.cs = {
{
type = 'godot',
request = 'launch',
name = 'Launch scene',
project = '${workspaceFolder}',
launch_scene = true,
},
}
Ensure installed:
ensure_installed = {
-- others,
'gdscript', 'godot_resource', 'gdshader', 'c_sharp'
}
Optional, but useful. Ignore some godot files. Here's my config:
require('telescope').setup {
pickers = {
live_grep = {
additional_args = function()
return {
'--hidden',
'--no-ignore',
-- others,
'-g',
'!.godot', -- <- Godot related
'-g',
'!.uid', -- <- Godot related
}
end,
},
},
extensions = {
['ui-select'] = {
require('telescope.themes').get_dropdown(),
},
},
defaults = {
file_ignore_patterns = {
-- others,
'.godot', 'server.pipe', '.uid'
},
},
}
Optional.
formatters_by_ft = {
cs = { 'csharpier' },
},
formatters = {
csharpier = {
command = 'dotnet-csharpier',
args = { '--write-stdout' },
},
},