Skip to content

Fix text/uri-list transformation in tree view drag for remote environments#292818

Merged
alexr00 merged 4 commits intomainfrom
copilot/fix-file-does-not-exist-error
Feb 6, 2026
Merged

Fix text/uri-list transformation in tree view drag for remote environments#292818
alexr00 merged 4 commits intomainfrom
copilot/fix-file-does-not-exist-error

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 4, 2026

Dragging files from tree views (e.g., references search panel) in remote environments (WSL/Docker) fails with "File does not exist" error. The handleDrag method in TreeViewDragAndDropController was using item.asString which contains the untransformed URI, ignoring item.uriListData which contains URIs already processed by the URI transformer during RPC.

Changes

  • mainThreadTreeViews.ts: For text/uri-list mime type, reconstruct URI string from uriListData using UriList.create() and URI.revive() instead of raw asString
  • mainThreadTreeViews.test.ts: Added test verifying transformed URIs are used over untransformed strings
// Before: always used untransformed string
additionalDataTransfer.replace(type, createStringDataTransferItem(item.asString));

// After: use transformed uriListData when available
const value = type === Mimes.uriList && item.uriListData
    ? UriList.create(item.uriListData.map(part => typeof part === 'string' ? part : URI.revive(part)))
    : item.asString;

Testing

  1. Connect to a remote environment (WSL or Docker container)
  2. Open a file and find references (Alt+Shift+F12)
  3. Drag a file from the references panel to the editor
  4. File should open without "File does not exist" error
Original prompt

This section details on the original issue you should resolve

<issue_title>After searching for a reference and dragging the file, a “File does not exist” error occurs.</issue_title>
<issue_description>
Type: Bug

Behaviour

If I search for a reference and then drag the file, I get a “File does not exist” error.

This issue is likely caused by mixed file path separators (‘/’ and ‘\’).

The file opens fine when opened directly.
There are no issues even with simple searches, not just references.

This occurs $$\color{red}not\ only\ in\ Python\ but\ also\ in\ Go,\ C,\ and\ even\ Markdown$$.

(It works normally in VS Code on the host, not in WSL.)

Steps to reproduce:

  1. attach to docker container
  2. search reference (Alt + Shift+ F12)
  3. drag file to editor
  4. FILE NOT FOUND

Diagnostic data

None

Detail

Image

Image

VS Code version: Code 1.107
OS version: Windows_NT x64 10.0.19045
Modes:
Remote OS version: Linux x64 6.6.87.2-microsoft-standard-WSL2
Remote OS version: Linux x64 6.6.87.2-microsoft-standard-WSL2
Remote OS version: Linux x64 6.6.87.2-microsoft-standard-WSL2

User Settings


Installed Extensions
Extension Name Extension Id Version
copilot Git 1.388.0
copilot-chat Git 0.32.5
csv-to-table php 1.4.1
debugpy ms- 2025.16.0
git-graph mhu 1.30.0
gitlens eam 17.7.0
go gol 0.50.0
increase-by-1 nor 1.1.1
indent-rainbow ode 8.3.1
intellicode-api-usage-examples Vis 0.2.9
java red 1.47.0
js-debug ms- 1.105.0
jupyter ms- 2025.9.1
jupyter-renderers ms- 1.3.0
prettier-vscode esb 11.0.0
python ms- 2025.18.0
rainbow-csv mec 3.23.0
rest-client hum 0.25.1
ruff cha 2025.28.0
sql-developer Ora 25.3.1
test-adapter-converter ms- 0.2.1
vscode-ansi ili 1.1.7
vscode-eslint dba 3.0.16
vscode-gradle vsc 3.17.1
vscode-java-debug vsc 0.58.3
vscode-java-dependency vsc 0.26.4
vscode-java-pack vsc 0.30.4
vscode-java-test vsc 0.43.2
vscode-js-profile-table ms- 1.0.10
vscode-jupyter-cell-tags ms- 0.1.9
vscode-jupyter-powertoys ms- 0.1.1
vscode-jupyter-slideshow ms- 0.1.6
vscode-korean-grammar-checker moo 1.2.5
vscode-language-pack-ko MS- 1.106.2025111209
vscode-maven vsc 0.44.0
vscode-pull-request-github Git 0.120.2
vscode-pylance ms- 2025.9.1
vscode-python-envs ms- 1.12.0
vscode-sql-formatter adp 1.4.4
vscodeintellicode Vis 1.3.2
System Info
Item Value
CPUs Intel(R) Core(TM) i9-14900 (32 x 1997)
GPU Status 2d_canvas: enabled
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 63.75GB (32.81GB free)
Process Argv --crash-reporter-id 95e03ed6-959c-41c5-a78e-a005e4517316
Screen Reader no
VM 0%
Item Value
Remote 컨테이너 meritzenv:latest(meritzenv)
OS Linux x64 6.6.87.2-microsoft-standard-WSL2
CPUs Intel(R) Core(TM) i9-14900 (32 x 0)
Memory (System) 31.21GB (16.74GB free)
VM 0%
Item Value
Remote 컨테이너 meritzenv:latest(meritzenv)
OS Linux x64 6.6.87.2-microsoft-standard-WSL2
CPUs Intel(R) Core(TM) i9-14900 (32 x 0)
Memory (System) 31.21GB (16.74GB free)
VM 0%
Item Value
Remote 컨테이너 meritzenv:latest(meritzenv)
OS Linux x64 6.6.87.2-microsoft-standard-WSL2
CPUs Intel(R) Core(TM) i9-14900 (32 x 0)
Memory (System) 31.21GB (16.74GB free)
VM 0%
A/B Experiments
vsliv368cf:30146710
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
aj953862:31281341
nes-set-on:31351930
onetestforazureexp:31335613
6abeh943:31336334
aa_c:31379599
c12345:31413568
gaj49834:31404438
cloudbuttont:31379625
todos-1:31405332
qwen_all_req:31402696
control_gpt5applypatchexclusively:31412085
3efgi100_wstrepl:31403338
trigger-command-fix:31379601
auto_model_enabled:31396818
use-responses-api:31390855
9i271672:31415505
je187915:31401257
v2prompt_9f72f763:31415580
afag3459:31405348
ec5jj548:31418076
copilot-nes-oct-t:31418199
ff8f5884:31411053

Comments on the Issue (you are @copilot in this section)

@jrieken @alexr00 I am using the extension tree API and I wonder if the `TreeDragAndDropController` sends dnd data with type `text...

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 4, 2026 11:59
…e environments

Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix 'File does not exist' error when dragging files from search Fix text/uri-list transformation in tree view drag for remote environments Feb 4, 2026
Copilot AI requested a review from alexr00 February 4, 2026 12:04
@alexr00 alexr00 marked this pull request as ready for review February 6, 2026 15:31
Copilot AI review requested due to automatic review settings February 6, 2026 15:31
@alexr00 alexr00 enabled auto-merge (squash) February 6, 2026 15:31
@vs-code-engineering vs-code-engineering bot added this to the February 2026 milestone Feb 6, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 fixes a critical bug in tree view drag-and-drop functionality for remote environments (WSL/Docker containers). When dragging files from tree views (e.g., references search panel), users were encountering "File does not exist" errors. The root cause was that the handleDrag method was using the untransformed URI string (asString) instead of the transformed URIs (uriListData) that had already been processed by the URI transformer during RPC communication.

Changes:

  • Fixed TreeViewDragAndDropController.handleDrag() to prioritize uriListData over asString for text/uri-list mime types
  • Added comprehensive test validating that transformed URIs from uriListData are correctly used over untransformed strings

Reviewed changes

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

File Description
src/vs/workbench/api/browser/mainThreadTreeViews.ts Fixed handleDrag to reconstruct URI list from uriListData using UriList.create() and URI.revive(), matching the pattern from extHostTypeConverters.ts
src/vs/workbench/api/test/browser/mainThreadTreeViews.test.ts Added test case that verifies transformed URIs in uriListData are used instead of untransformed asString values

@alexr00 alexr00 merged commit f493ad3 into main Feb 6, 2026
42 of 43 checks passed
@alexr00 alexr00 deleted the copilot/fix-file-does-not-exist-error branch February 6, 2026 15:58
daviddossett pushed a commit to daviddossett/vscode that referenced this pull request Feb 7, 2026
…ments (microsoft#292818)

* Initial plan

* Fix text/uri-list transformation in tree view drag and drop for remote environments

Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>

* Improve variable naming in handleDrag test

Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Mar 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

After searching for a reference and dragging the file, a “File does not exist” error occurs.

4 participants