none
VS不能正常的格式化代码 RRS feed

  • 问题

  • 如题,VS之前可以通过CTRL+K+D的方式进行代码格式话,但是现在格式之后格式不对,请问如何恢复到之前,感激不尽,示例如下

    <div>

        <img src="xxx.jpg">

    <div>

    格式之后

    <div>

    <img src="xxx.jpg">

    <div>

    2018年6月14日 2:00

答案

全部回复

  • 如果文件没有关闭,可以Undo撤消一下,如果有源代码管理,可以恢复到前一个版本,

    除此之外,没有备份文件的话,应该没有办法。


    专注于.NET ERP/CRM开发框架,C/S架构,SQL Server + ORM(LLBL Gen Pro) + Infragistics WinForms

    2018年6月15日 0:37
  • 你好,是可以undo的,问题是现在没有办法去格式化代码,请问这个有解决方式吗 ?
    2018年6月15日 6:10
  • 你好,

    可以通过Ctrl+Z 恢复的,我使用的VS 2017, 是可以正常格式化的, 请问你使用的是什么版本的VS。 怎样才能重现你的问题。

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    2018年6月15日 6:24
    版主
  • 你好。VS的相关信息如下:另外目前这个问题只发生在aspx页面,code behind 是没有问题的,感谢你的回复~

    Microsoft Visual Studio Professional 2017
    Version 15.7.3
    VisualStudio.15.Release/15.7.3+27703.2026
    Microsoft .NET Framework
    Version 4.7.02046
    Installed Version: Professional
    Application Insights Tools for Visual Studio Package   8.12.10405.1
    Application Insights Tools for Visual Studio
    ASP.NET and Web Tools 2017   15.0.40522.0
    ASP.NET and Web Tools 2017
    ASP.NET Core Razor Language Services   15.7.31476
    Provides languages services for ASP.NET Core Razor.
    ASP.NET Web Frameworks and Tools 2017   5.2.60419.0
    For additional information, visit https://www.asp.net/
    Azure App Service Tools v3.0.0   15.0.40424.0
    Azure App Service Tools v3.0.0
    Azure Data Lake Node   1.0
    This package contains the Data Lake integration nodes for Server Explorer.
    Azure Data Lake Tools for Visual Studio   2.3.3000.2
    Microsoft Azure Data Lake Tools for Visual Studio
    Azure Stream Analytics Tools for Visual Studio   2.3.3000.2
    Microsoft Azure Stream Analytics Tools for Visual Studio
    C# Tools   2.8.3-beta6-62923-07. Commit Hash: 7aafab561e449da50712e16c9e81742b8e7a2969
    C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
    Common Azure Tools   1.10
    Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
    JavaScript Language Service   2.0
    JavaScript Language Service
    Microsoft Azure HDInsight Azure Node   2.3.3000.2
    HDInsight Node under Azure Node
    Microsoft Azure Hive Query Language Service   2.3.3000.2
    Language service for Hive query
    Microsoft Azure Stream Analytics Language Service   2.3.3000.2
    Language service for Azure Stream Analytics
    Microsoft Azure Stream Analytics Node   1.0
    Azure Stream Analytics Node under Azure Node
    Microsoft Azure Tools   2.9
    Microsoft Azure Tools for Microsoft Visual Studio 2017 - v2.9.10420.2
    Microsoft Continuous Delivery Tools for Visual Studio   0.3
    Simplifying the configuration of continuous build integration and continuous build delivery from within the Visual Studio IDE.
    Microsoft JVM Debugger   1.0
    Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
    Microsoft MI-Based Debugger   1.0
    Provides support for connecting Visual Studio to MI compatible debuggers
    Microsoft Visual Studio Tools for Containers   1.1
    Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.
    NuGet Package Manager   4.6.0
    NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.
    ProjectServicesPackage Extension   1.0
    ProjectServicesPackage Visual Studio Extension Detailed Info
    ResourcePackage Extension   1.0
    ResourcePackage Visual Studio Extension Detailed Info
    SQL Server Data Tools   15.1.61804.210
    Microsoft SQL Server Data Tools
    ToolWindowHostedEditor   1.0
    Hosting json editor into a tool window
    TypeScript Tools   15.7.20419.2003
    TypeScript Tools for Microsoft Visual Studio
    Visual Basic Tools   2.8.3-beta6-62923-07. Commit Hash: 7aafab561e449da50712e16c9e81742b8e7a2969
    Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
    Visual F# Tools 10.1 for F# 4.1   15.7.0.0.  Commit Hash: 2527e6829ecdc8281ee60d83be8cfd0fa720a648.
    Microsoft Visual F# Tools 10.1 for F# 4.1
    Visual Studio Code Debug Adapter Host Package   1.0
    Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

    2018年6月15日 8:01
  • 你好,

    根据你的描述,我新建了一个asp.net 的项目, 在.aspx的文件中,COPY 你的代码,使用Ctrl + K + D, 什么都没有发生。不会出现对齐的问题。

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    2018年6月18日 5:07
    版主
  • 最后我重新把所有的Setting重置了,就好了,虽然不知道为啥会有Setting的修改,但是算是解决问题了~~~
    2018年6月27日 8:44