Handle whitespace and putting Neovide front and center#5
Open
mrstruijk wants to merge 10 commits into
Open
Conversation
…ore interpolating into the AppleScript string
There was a problem hiding this comment.
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
authormetadata inpackage.json. - Escape spaces in
${filePath}template substitution. - Add PID reuse guard and platform-specific foreground activation (Windows via
SetForegroundWindow, macOS viaosascript).
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, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.