mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
Merge pull request #2612 from ahmad-farid/OCNoTest2
Adding outlining for comments to allow collapsing in VS #698
This commit is contained in:
105
tests/cases/fourslash/getOutliningForBlockComments.ts
Normal file
105
tests/cases/fourslash/getOutliningForBlockComments.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
////[|/*
|
||||
//// Block comment at the beginning of the file before module:
|
||||
//// line one of the comment
|
||||
//// line two of the comment
|
||||
//// line three
|
||||
//// line four
|
||||
//// line five
|
||||
////*/|]
|
||||
////module Sayings[| {
|
||||
//// [|/*
|
||||
//// Comment before class:
|
||||
//// line one of the comment
|
||||
//// line two of the comment
|
||||
//// line three
|
||||
//// line four
|
||||
//// line five
|
||||
//// */|]
|
||||
//// export class Greeter[| {
|
||||
//// [|/*
|
||||
//// Comment before a string identifier
|
||||
//// line two of the comment
|
||||
//// */|]
|
||||
//// greeting: string;
|
||||
//// [|/*
|
||||
//// constructor
|
||||
//// parameter message as a string
|
||||
//// */|]
|
||||
////
|
||||
//// [|/*
|
||||
//// Multiple comments should be collapsed individually
|
||||
//// */|]
|
||||
//// constructor(message: string /* do not collapse this */)[| {
|
||||
//// this.greeting = message;
|
||||
//// }|]
|
||||
//// [|/*
|
||||
//// method of a class
|
||||
//// */|]
|
||||
//// greet()[| {
|
||||
//// return "Hello, " + this.greeting;
|
||||
//// }|]
|
||||
//// }|]
|
||||
////}|]
|
||||
////
|
||||
////[|/*
|
||||
//// Block comment for interface. The ending can be on the same line as the declaration.
|
||||
////*/|]interface IFoo[| {
|
||||
//// [|/*
|
||||
//// Multiple block comments
|
||||
//// */|]
|
||||
////
|
||||
//// [|/*
|
||||
//// should be collapsed
|
||||
//// */|]
|
||||
////
|
||||
//// [|/*
|
||||
//// individually
|
||||
//// */|]
|
||||
////
|
||||
//// [|/*
|
||||
//// this comment has trailing space before /* and after *-/ signs
|
||||
//// */|]
|
||||
////
|
||||
//// [|/**
|
||||
//// *
|
||||
//// *
|
||||
//// *
|
||||
//// */|]
|
||||
////
|
||||
//// [|/*
|
||||
//// */|]
|
||||
////
|
||||
//// [|/*
|
||||
//// */|]
|
||||
//// // single line comments in the middle should not have an effect
|
||||
//// [|/*
|
||||
//// */|]
|
||||
////
|
||||
//// [|/*
|
||||
//// */|]
|
||||
////
|
||||
//// [|/*
|
||||
//// this block comment ends
|
||||
//// on the same line */|] [|/* where the following comment starts
|
||||
//// should be collapsed separately
|
||||
//// */|]
|
||||
////
|
||||
//// getDist(): number;
|
||||
////}|]
|
||||
////
|
||||
////var x =[|{
|
||||
//// a:1,
|
||||
//// b: 2,
|
||||
//// [|/*
|
||||
//// Over a function in an object literal
|
||||
//// */|]
|
||||
//// get foo()[| {
|
||||
//// return 1;
|
||||
//// }|]
|
||||
////}|]
|
||||
|
||||
verify.outliningSpansInCurrentFile(test.ranges());
|
||||
|
||||
|
||||
78
tests/cases/fourslash/getOutliningForSingleLineComments.ts
Normal file
78
tests/cases/fourslash/getOutliningForSingleLineComments.ts
Normal file
@@ -0,0 +1,78 @@
|
||||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
////[|// Single line comments at the start of the file
|
||||
////// line 2
|
||||
////// line 3
|
||||
////// line 4|]
|
||||
////module Sayings[| {
|
||||
////
|
||||
//// [|/*
|
||||
//// */|]
|
||||
//// [|// A sequence of
|
||||
//// // single line|]
|
||||
//// [|/*
|
||||
//// and block
|
||||
//// */|]
|
||||
//// [|// comments
|
||||
//// //|]
|
||||
//// export class Sample[| {
|
||||
//// }|]
|
||||
////}|]
|
||||
////
|
||||
////interface IFoo[| {
|
||||
//// [|// all consecutive single line comments should be in one block regardless of their number or empty lines/spaces inbetween
|
||||
////
|
||||
//// // comment 2
|
||||
//// // comment 3
|
||||
////
|
||||
//// //comment 4
|
||||
//// /// comment 5
|
||||
//// ///// comment 6
|
||||
////
|
||||
//// //comment 7
|
||||
//// ///comment 8
|
||||
//// // comment 9
|
||||
//// // //comment 10
|
||||
////
|
||||
////
|
||||
////
|
||||
////
|
||||
////
|
||||
////
|
||||
////
|
||||
////
|
||||
////
|
||||
////
|
||||
////
|
||||
////
|
||||
////
|
||||
////
|
||||
////
|
||||
////
|
||||
////
|
||||
////
|
||||
////
|
||||
////
|
||||
//// // // //comment 11
|
||||
//// // comment 12
|
||||
//// // comment 13
|
||||
//// // comment 14
|
||||
//// // comment 15
|
||||
////
|
||||
//// // comment 16
|
||||
//// // comment 17
|
||||
//// // comment 18
|
||||
//// // comment 19
|
||||
//// // comment 20
|
||||
//// // comment 21|]
|
||||
////
|
||||
//// getDist(): number; // One single line comment should not be collapsed
|
||||
////}|]
|
||||
////
|
||||
////// One single line comment should not be collapsed
|
||||
////class WithOneSingleLineComment[| {
|
||||
////}|]
|
||||
|
||||
verify.outliningSpansInCurrentFile(test.ranges());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user