Skip to content

Handle whitespace and putting Neovide front and center#5

Open
mrstruijk wants to merge 10 commits into
FREEZX:masterfrom
mrstruijk:dev
Open

Handle whitespace and putting Neovide front and center#5
mrstruijk wants to merge 10 commits into
FREEZX:masterfrom
mrstruijk:dev

Conversation

@mrstruijk

Copy link
Copy Markdown

Hi!

Below are some additions made to the nvim / neovide Unity integration.
I also added your name in the manifest, so that it shows up in Unity package manager.

I hope there are useful to you.

Copilot AI review requested due to automatic review settings July 7, 2026 09:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Unity ↔ Neovim/Neovide external code editor integration to better handle paths with whitespace and to bring the Neovide window to the foreground when reusing an existing process, plus updates package metadata for Unity Package Manager.

Changes:

  • Bump package version and add author metadata in package.json.
  • Escape spaces in ${filePath} template substitution.
  • Add PID reuse guard and platform-specific foreground activation (Windows via SetForegroundWindow, macOS via osascript).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
package.json Version bump and adds author metadata for UPM display.
Editor/NvimScriptEditor.cs Improves path handling and adds “bring-to-front” behavior for Neovide/clients.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 149 to 155
public string ReplaceTemplate(String templateStr, String pipePath, String path, int line, int column)
{
templateStr = templateStr.Replace("${pipePath}", pipePath);
templateStr = templateStr.Replace("${filePath}", path);
templateStr = templateStr.Replace("${filePath}", path.Replace(" ", "\\ "));
templateStr = templateStr.Replace("${line}", Math.Max(line, 1).ToString());
templateStr = templateStr.Replace("${column}", Math.Max(column, 0).ToString());
return templateStr;
Comment on lines +290 to +291
// Guard agains PID recycling issues (when a PID is reused for another app, then the below still checks that the app getting opened is Neovide, and not something else)
Process process = Process.GetProcesses().FirstOrDefault(x => x.Id == EditorPid && x.ProcessName.IndexOf("neovide", StringComparison.OrdinalIgnoreCase) >= 0);
Comment on lines +438 to +446
var psi = new ProcessStartInfo
{
FileName = "osascript",
Arguments = $"-e 'tell application \"{appName}\" to activate'",
CreateNoWindow = true,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants