Giter Club home page Giter Club logo

nestedcommentsvscode's Introduction

Nested Comments

Visual Studio Marketplace [Visual Studio Marketplace] license

About

If your code contains a comment, and you want to add a new comment to temporarily disable a block or portion of code, the built in commenting functionality does not actually place the comment tags in expected locations. If an existing comment is included in the content being commented out, the first instance of a --> or */ closing comment tag will end the entire comment.

This extension will convert pre-existing comments to safe characters, allowing a new block comment that includes the original comment. It also reverses the effect to uncomment the same block of code.

Features

If you need to comment out a portion of your code that includes pre-existing comments, the native commenting functionality will not comment properly or preserve your existing comments. This extension will maintain your original comments and allow you to quickly toggle comments on sections of code.

Examples

HTML Syntax

HTML example

<main>
  <div class="container">
    <h2>Hello World</h2>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
    <!-- <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit.</p> -->
  </div>
</main>

Becomes:

<!-- <main>
  <div class="container">
    <h2>Hello World</h2>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
    <!~~ <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit.</p> ~~>
  </div>
</main> -->

CSS Syntax

CSS example

.example {
  /* display: flex; */
  transition: all 0.5s;
  /* user-select: none; */
  background: linear-gradient(to bottom, white, black);
}

Becomes:

/*.example {
  /~ display: flex; ~/
  transition: all 0.5s;
  /~ user-select: none; ~/
  background: linear-gradient(to bottom, white, black);
}*/

JSX Syntax

JSX example

This commenting style will work for JSX content in .js and .ts files. Make sure to set the language mode of the file to javascriptreact/typescriptreact rather than using standard JavaScript for files using JSX.

<React.Fragment>
  <div className="footer" id="footer" ref={this.props.reference}>
    <footer role="contentinfo">
      <nav>
        {/* <FooterPrev prev={this.props.pageNav.prev} /> */}
        <FooterNext next={this.props.pageNav.next} />
      </nav>
    </footer>
  </div>
</React.Fragment>

Becomes:

<React.Fragment>
  {/*<div className="footer" id="footer" ref={this.props.reference}>
    <footer role="contentinfo">
      <nav>
        {/~ <FooterPrev prev={this.props.pageNav.prev} /> ~/}
        <FooterNext next={this.props.pageNav.next} />
      </nav>
    </footer>
  </div>*/}
</React.Fragment>

Usage

To trigger the extension, highlight the text that should be commented/uncommented.

Default Keybindings

  • Mac: cmd + alt + /
  • Windows: ctrl + alt + /

Extension Settings

The following languages are supported:

  • asp
  • cfm
  • css
  • htm
  • html
  • jsx
  • md
  • njk
  • php
  • svelte
  • svg
  • tsx
  • twig
  • vue
  • xml
  • xsl

Known Issues

None at this time ๐Ÿ˜ƒ

Release Notes

Full release notes are available in the CHANGELOG file.

nestedcommentsvscode's People

Contributors

dependabot[bot] avatar laverdet avatar mikecmeli avatar philsinatra avatar veteranovis avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.