[PR #15073] [MERGED] launch/vscode: prefer known vs code paths over code on PATH #20275

Closed
opened 2026-04-16 07:32:04 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15073
Author: @hoyyeva
Created: 3/26/2026
Status: Merged
Merged: 3/26/2026
Merged by: @hoyyeva

Base: mainHead: hoyyeva/vscode-code-fix


📝 Commits (5)

📊 Changes

1 file changed (+1 additions, -4 deletions)

View changed files

📝 cmd/launch/vscode.go (+1 -4)

📄 Description

When launching VS Code, findBinary() previously checked for code on PATH first. This could silently launch
Cursor or another VS Code fork if their CLI was registered as code.

This PR flips the lookup order and adds validation:

  1. Check platform-specific paths first — /Applications/Visual Studio Code.app on macOS, Microsoft VS Code\bin\code.cmd on Windows, /usr/bin/code or /snap/bin/code on Linux
  2. Fall back to code on PATH only if it's actually vscode — resolve the symlink and check that the real path points to a vscode installation (e.g. contains Visual Studio Code or Microsoft VS Code)
  3. Handle wrapper scripts — if code is a small shell script (not a symlink), read its content and check for vscode references

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/15073 **Author:** [@hoyyeva](https://github.com/hoyyeva) **Created:** 3/26/2026 **Status:** ✅ Merged **Merged:** 3/26/2026 **Merged by:** [@hoyyeva](https://github.com/hoyyeva) **Base:** `main` ← **Head:** `hoyyeva/vscode-code-fix` --- ### 📝 Commits (5) - [`63f3612`](https://github.com/ollama/ollama/commit/63f3612ed97602c24b36bf3bb1847903e24f2159) launch/vscode: prefer known vs code paths over `code` on PATH - [`71c2dd8`](https://github.com/ollama/ollama/commit/71c2dd8330681e08ba5525d2dc3e0ec7b9256ccd) add test - [`6f85086`](https://github.com/ollama/ollama/commit/6f85086cde87a1ef286b4ef73331f1217a586b71) address comment - [`28b3db3`](https://github.com/ollama/ollama/commit/28b3db3fee9d5ed9d4b9be3202e28978c527848e) Revert "address comment" - [`07baff1`](https://github.com/ollama/ollama/commit/07baff1ce3590ebfc7e0e2a913ebc90203776aca) address comment ### 📊 Changes **1 file changed** (+1 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `cmd/launch/vscode.go` (+1 -4) </details> ### 📄 Description When launching VS Code, findBinary() previously checked for code on PATH first. This could silently launch Cursor or another VS Code fork if their CLI was registered as code. This PR flips the lookup order and adds validation: 1. Check platform-specific paths first — `/Applications/Visual Studio Code.app` on macOS, `Microsoft VS Code\bin\code.cmd` on Windows, `/usr/bin/code` or `/snap/bin/code` on Linux 2. Fall back to `code` on PATH only if it's actually vscode — resolve the symlink and check that the real path points to a vscode installation (e.g. contains `Visual Studio Code` or `Microsoft VS Code`) 3. Handle wrapper scripts — if `code` is a small shell script (not a symlink), read its content and check for vscode references --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-16 07:32:04 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#20275