madskristensen / Tweakster

A Visual Studio extension
Apache License 2.0
240 stars 23 forks source link

Copy/Paste Doesn't work for CSHTML Files #43

Closed CTGreg closed 3 years ago

CTGreg commented 3 years ago
  1. Create or open an existing C# Asp.Net MVC project
  2. Open a CSHTML view
  3. Copy a bit of code from the view
  4. Paste it anywhere
  5. Get unexpected result like this: image
CTGreg commented 3 years ago

Here is the version image

stefanloerwald commented 3 years ago

I'm experiencing this issue too with .razor files.

Dragonsangel commented 3 years ago

This issue is also appearing in aspx and asmx files for me. From what I have been able to figure out from what is copied, it seems that is copying the generated backend code. Example: The top part of my aspx site contains there lines:

<%@ Page Language="VB" %>
<%@ Import Namespace = "System"%>
<%@ Import Namespace = "System.ComponentModel"%>
<%@ Import Namespace = "System.Diagnostics"%>
<%@ Import Namespace = "System.Web.Services"%>
<%@ Import Namespace = "System.Web.Services.Protocols"%>
<%@ Import Namespace = "System.Xml.Serialization"%>

When I copy text that is further down, the text that is copied looks like this:

Imports System
Imports System.ComponentModel
duncansmart commented 3 years ago

Per https://developercommunity.visualstudio.com/content/problem/1193868/copy-and-paste-is-broken-in-razor-cshtml-files.html a workaround is to turn off the "Copy without indentation" feature in Tools > Options > Environment > Tweaks

gpshonik commented 3 years ago

Ended up here via https://developercommunity.visualstudio.com/content/problem/1201185/visual-studio-2019-v1674-copy-paste-not-working-co.html

madskristensen commented 3 years ago

This is now fixed in the latest version