When working on a Unity-Project with Neovim and omnisharp, the LSP is not recognizing any Unity related classes/functions in a newly created file.
After writing a new *.cs
file (no according .meta file exists), following command gets executed to re-sync the solution:
"unityHome\Editor\Unity.exe" -projectPath "project_root" -batchmode -quit -nographics -executeMethod "UnityEditor.SyncVS.SyncSolution"
After that, the LSP will be restarted.
As an alternative, you can use :UnitySync
to force-sync the current solution.
- Currently only working on Windows
- Only tested with omnisharp and nvim-lspconfig
- The project root passed to the syncing command is read from the LSP-Clients
config.root_dir
property
By default, the path to the Unity installation is fetched from the UNITY_HOME environment variable, but this is customizable.
Adjust config:
require("unitysync.config").setup({
logToFile = ... --Enable/Disable logging (default true)
logPath = ... --Path to the logging folder (default XDG_DATA_HOME (if set), otherwise vim.fn.stdpath("data"))
unityHome = ... --Path to the Unity installation folder (default %UNITY_HOME%)
})
use ('Lohni/unitysync.nvim')