mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
@@ -1616,6 +1616,7 @@ declare module "typescript" {
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
|
||||
PlaceOpenBraceOnNewLineForFunctions: boolean;
|
||||
PlaceOpenBraceOnNewLineForControlBlocks: boolean;
|
||||
[s: string]: boolean | number | string;
|
||||
}
|
||||
interface DefinitionInfo {
|
||||
fileName: string;
|
||||
|
||||
@@ -5227,6 +5227,9 @@ declare module "typescript" {
|
||||
|
||||
PlaceOpenBraceOnNewLineForControlBlocks: boolean;␍
|
||||
>PlaceOpenBraceOnNewLineForControlBlocks : boolean
|
||||
|
||||
[s: string]: boolean | number | string;␍
|
||||
>s : string
|
||||
}␍
|
||||
interface DefinitionInfo {␍
|
||||
>DefinitionInfo : DefinitionInfo
|
||||
|
||||
@@ -1647,6 +1647,7 @@ declare module "typescript" {
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
|
||||
PlaceOpenBraceOnNewLineForFunctions: boolean;
|
||||
PlaceOpenBraceOnNewLineForControlBlocks: boolean;
|
||||
[s: string]: boolean | number | string;
|
||||
}
|
||||
interface DefinitionInfo {
|
||||
fileName: string;
|
||||
|
||||
@@ -5371,6 +5371,9 @@ declare module "typescript" {
|
||||
|
||||
PlaceOpenBraceOnNewLineForControlBlocks: boolean;␍
|
||||
>PlaceOpenBraceOnNewLineForControlBlocks : boolean
|
||||
|
||||
[s: string]: boolean | number | string;␍
|
||||
>s : string
|
||||
}␍
|
||||
interface DefinitionInfo {␍
|
||||
>DefinitionInfo : DefinitionInfo
|
||||
|
||||
@@ -1648,6 +1648,7 @@ declare module "typescript" {
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
|
||||
PlaceOpenBraceOnNewLineForFunctions: boolean;
|
||||
PlaceOpenBraceOnNewLineForControlBlocks: boolean;
|
||||
[s: string]: boolean | number | string;
|
||||
}
|
||||
interface DefinitionInfo {
|
||||
fileName: string;
|
||||
|
||||
@@ -5323,6 +5323,9 @@ declare module "typescript" {
|
||||
|
||||
PlaceOpenBraceOnNewLineForControlBlocks: boolean;␍
|
||||
>PlaceOpenBraceOnNewLineForControlBlocks : boolean
|
||||
|
||||
[s: string]: boolean | number | string;␍
|
||||
>s : string
|
||||
}␍
|
||||
interface DefinitionInfo {␍
|
||||
>DefinitionInfo : DefinitionInfo
|
||||
|
||||
@@ -1685,6 +1685,7 @@ declare module "typescript" {
|
||||
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean;
|
||||
PlaceOpenBraceOnNewLineForFunctions: boolean;
|
||||
PlaceOpenBraceOnNewLineForControlBlocks: boolean;
|
||||
[s: string]: boolean | number | string;
|
||||
}
|
||||
interface DefinitionInfo {
|
||||
fileName: string;
|
||||
|
||||
@@ -5496,6 +5496,9 @@ declare module "typescript" {
|
||||
|
||||
PlaceOpenBraceOnNewLineForControlBlocks: boolean;␍
|
||||
>PlaceOpenBraceOnNewLineForControlBlocks : boolean
|
||||
|
||||
[s: string]: boolean | number | string;␍
|
||||
>s : string
|
||||
}␍
|
||||
interface DefinitionInfo {␍
|
||||
>DefinitionInfo : DefinitionInfo
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @Filename: b.ts
|
||||
////import n = require('a/*1*/');
|
||||
////var x = new n.Foo();
|
||||
|
||||
// @Filename: a.ts
|
||||
//// /*2*/export class Foo {}
|
||||
|
||||
goTo.marker('1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('2');
|
||||
@@ -0,0 +1,43 @@
|
||||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
//////curly braces
|
||||
////module Foo [|{
|
||||
//// class Bar [|{
|
||||
//// private f() [|{
|
||||
//// }|]
|
||||
////
|
||||
//// private f2() [|{
|
||||
//// if (true) [|{ }|] [|{ }|];
|
||||
//// }|]
|
||||
//// }|]
|
||||
////}|]
|
||||
////
|
||||
//////parenthesis
|
||||
////class FooBar {
|
||||
//// private f[|()|] {
|
||||
//// return [|([|(1 + 1)|])|];
|
||||
//// }
|
||||
////
|
||||
//// private f2[|()|] {
|
||||
//// if [|(true)|] { }
|
||||
//// }
|
||||
////}
|
||||
////
|
||||
//////square brackets
|
||||
////class Baz {
|
||||
//// private f() {
|
||||
//// var a: any[|[]|] = [|[[|[1, 2]|], [|[3, 4]|], 5]|];
|
||||
//// }
|
||||
////}
|
||||
////
|
||||
////// angular brackets
|
||||
////class TemplateTest [|<T1, T2 extends Array>|] {
|
||||
//// public foo(a, b) {
|
||||
//// return [|<any>|] a;
|
||||
//// }
|
||||
////}
|
||||
|
||||
test.ranges().forEach((range) => {
|
||||
verify.matchingBracePositionInCurrentFile(range.start, range.end - 1);
|
||||
verify.matchingBracePositionInCurrentFile(range.end - 1, range.start);
|
||||
});
|
||||
@@ -0,0 +1,17 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////var x: string[] = [];
|
||||
////x.forEach(function (y) { y/*1*/
|
||||
////x.forEach(y => y/*2*/
|
||||
|
||||
goTo.marker('1');
|
||||
edit.insert('.');
|
||||
verify.memberListContains('trim');
|
||||
verify.memberListCount(20);
|
||||
edit.insert('});'); // need the following lines to not have parse errors in order for completion list to appear
|
||||
|
||||
goTo.marker('2');
|
||||
edit.insert('.');
|
||||
verify.memberListContains('trim');
|
||||
verify.memberListCount(20);
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
////class Foo {
|
||||
////}
|
||||
////module Foo {
|
||||
//// export var x: number;
|
||||
////}
|
||||
////Foo./**/
|
||||
|
||||
goTo.marker("");
|
||||
verify.completionListContains("x");
|
||||
|
||||
// Make an edit
|
||||
edit.insert("a");
|
||||
edit.backspace();
|
||||
|
||||
// Checking for completion details after edit should work too
|
||||
verify.completionEntryDetailIs("x", "(var) Foo.x: number");
|
||||
@@ -0,0 +1,12 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @Filename: b.ts
|
||||
////import n = require('a/*1*/');
|
||||
////var x = new n.Foo();
|
||||
|
||||
// @Filename: a.ts
|
||||
//// /*2*/export class Foo {}
|
||||
|
||||
goTo.marker('1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('2');
|
||||
@@ -0,0 +1,8 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
/////**/module Default{var x= ( { } ) ;}
|
||||
|
||||
|
||||
format.document();
|
||||
goTo.marker();
|
||||
verify.currentLineContentIs('module Default { var x = ({}); }');
|
||||
@@ -0,0 +1,12 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////switch (1) {
|
||||
//// case 1:
|
||||
//// {
|
||||
//// /*1*/
|
||||
//// break;
|
||||
////}
|
||||
|
||||
goTo.marker("1");
|
||||
edit.insert("}");
|
||||
verify.currentLineContentIs(" }");
|
||||
@@ -0,0 +1,52 @@
|
||||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
////// Interface
|
||||
////{| "itemName": "IPoint", "kind": "interface", "parentName": "" |}interface IPoint {
|
||||
//// {| "itemName": "getDist", "kind": "method", "parentName": "IPoint" |}getDist(): number;
|
||||
//// {| "itemName": "new()", "kind": "construct", "parentName": "IPoint" |}new(): IPoint;
|
||||
//// {| "itemName": "()", "kind": "call", "parentName": "IPoint" |}(): any;
|
||||
//// {| "itemName": "[]", "kind": "index", "parentName": "IPoint" |}[x:string]: number;
|
||||
//// {| "itemName": "prop", "kind": "property", "parentName": "IPoint" |}prop: string;
|
||||
////}
|
||||
////
|
||||
/////// Module
|
||||
////{| "itemName": "Shapes", "kind": "module", "parentName": "" |}module Shapes {
|
||||
////
|
||||
//// // Class
|
||||
//// {| "itemName": "Point", "kind": "class", "parentName": "Shapes" |}export class Point implements IPoint {
|
||||
//// {| "itemName": "constructor", "kind": "constructor", "parentName": "Shapes.Point" |}constructor (public x: number, public y: number) { }
|
||||
////
|
||||
//// // Instance member
|
||||
//// {| "itemName": "getDist", "kind": "method", "parentName": "Shapes.Point" |}getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); }
|
||||
////
|
||||
//// // Getter
|
||||
//// {| "itemName": "value", "kind": "getter", "parentName": "Shapes.Point" |}get value(): number { return 0; }
|
||||
////
|
||||
//// // Setter
|
||||
//// {| "itemName": "value", "kind": "setter", "parentName": "Shapes.Point" |}set value(newValue: number) { return; }
|
||||
////
|
||||
//// // Static member
|
||||
//// {| "itemName": "origin", "kind": "property", "parentName": "Shapes.Point" |}static origin = new Point(0, 0);
|
||||
////
|
||||
//// // Static method
|
||||
//// {| "itemName": "getOrigin", "kind": "method", "parentName": "Shapes.Point" |}private static getOrigin() { return Point.origin;}
|
||||
//// }
|
||||
////
|
||||
//// {| "itemName": "Values", "kind": "enum", "parentName": "Shapes" |}enum Values {
|
||||
//// value1,
|
||||
//// {| "itemName": "value2", "kind": "property", "parentName": "Shapes.Values" |}value2,
|
||||
//// value3,
|
||||
//// }
|
||||
////}
|
||||
////
|
||||
////// Local variables
|
||||
////{| "itemName": "p", "kind": "var", "parentName": "" |}var p: IPoint = new Shapes.Point(3, 4);
|
||||
////{| "itemName": "dist", "kind": "var", "parentName": "" |}var dist = p.getDist();
|
||||
|
||||
test.markers().forEach((marker) => {
|
||||
if (marker.data) {
|
||||
verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName);
|
||||
}
|
||||
});
|
||||
|
||||
verify.getScriptLexicalStructureListCount(23);
|
||||
@@ -0,0 +1,28 @@
|
||||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
/////// Module
|
||||
////{| "itemName": "Shapes", "kind": "module", "parentName": "", "matchKind": "substring" |}module Shapes {
|
||||
////
|
||||
//// // Class
|
||||
//// {| "itemName": "Point", "kind": "class", "parentName": "Shapes", "matchKind": "substring" |}export class Point {
|
||||
//// // Instance member
|
||||
//// {| "itemName": "originPointAttheHorizon", "kind": "property", "parentName": "Point", "matchKind": "substring"|}private originPointAttheHorizon = 0.0;
|
||||
////
|
||||
//// // Getter
|
||||
//// {| "itemName": "distanceFromOrigin", "kind": "getter", "parentName": "Point", "matchKind": "substring" |}get distanceFromOrigin(): number { return 0; }
|
||||
////
|
||||
//// }
|
||||
////}
|
||||
////
|
||||
////// Local variables
|
||||
////{| "itemName": "myPointThatIJustInitiated", "kind": "var", "parentName": "", "matchKind": "substring"|}var myPointThatIJustInitiated = new Shapes.Point();
|
||||
|
||||
//// Testing for substring matching of navigationItems
|
||||
//var searchValue = "FromOrigin horizon INITIATED Shape Point";
|
||||
|
||||
test.markers().forEach((marker) => {
|
||||
if (marker.data) {
|
||||
var name = marker.data.itemName;
|
||||
verify.navigationItemsListContains(name, marker.data.kind, name.substr(1), marker.data.matchKind, marker.fileName, marker.data.parentName);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,27 @@
|
||||
/// <reference path="fourslash.ts"/>
|
||||
|
||||
////interface One {
|
||||
//// commonProperty: number;
|
||||
//// commonFunction(): number;
|
||||
////}
|
||||
////
|
||||
////interface Two {
|
||||
//// commonProperty: string
|
||||
//// commonFunction(): number;
|
||||
////}
|
||||
////
|
||||
////var /*1*/x : One | Two;
|
||||
////
|
||||
////x./*2*/commonProperty;
|
||||
////x./*3*/commonFunction;
|
||||
|
||||
|
||||
goTo.marker("1");
|
||||
verify.quickInfoIs('(var) x: One | Two');
|
||||
|
||||
|
||||
goTo.marker("2");
|
||||
verify.quickInfoIs('(property) commonProperty: string | number');
|
||||
|
||||
goTo.marker("3");
|
||||
verify.quickInfoIs('(method) commonFunction(): number');
|
||||
@@ -0,0 +1,18 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// Global class reference.
|
||||
|
||||
// @Filename: referencesForGlobals_1.ts
|
||||
////class /*2*/globalClass {
|
||||
//// public f() { }
|
||||
////}
|
||||
|
||||
// @Filename: referencesForGlobals_2.ts
|
||||
///////<reference path="referencesForGlobals_1.ts" />
|
||||
////var c = /*1*/globalClass();
|
||||
|
||||
goTo.marker("1");
|
||||
verify.referencesCountIs(2);
|
||||
|
||||
goTo.marker("2");
|
||||
verify.referencesCountIs(2);
|
||||
@@ -0,0 +1,11 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
///////<reference path="./Bar.ts" />
|
||||
|
||||
////function /**/[|Bar|]() {
|
||||
//// // This is a reference to [|Bar|] in a comment.
|
||||
//// "this is a reference to [|Bar|] in a string"
|
||||
////}
|
||||
|
||||
goTo.marker();
|
||||
verify.renameLocations(/*findInStrings:*/ true, /*findInComments:*/ true);
|
||||
Reference in New Issue
Block a user