Skip to content

Auto-/Force-Syncs the current Unity-Project for better LSP experience

License

Notifications You must be signed in to change notification settings

Lohni/unitysync.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

What is this trying to solve

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.

How does it work

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.

How to use

  • 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')

About

Auto-/Force-Syncs the current Unity-Project for better LSP experience

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages