mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Merge pull request #2666 from Microsoft/occurrencesOnServer
Support getOccurrences on the TS Server
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/// <reference path="fourslash.ts"/>
|
||||
/// <reference path="../fourslash.ts"/>
|
||||
|
||||
//////curly braces
|
||||
////module Foo [|{
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
/// <reference path="../fourslash.ts"/>
|
||||
|
||||
////var x: string[] = [];
|
||||
////x.forEach(function (y) { y/*1*/
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
/// <reference path="../fourslash.ts"/>
|
||||
|
||||
////class Foo {
|
||||
////}
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
/// <reference path="../fourslash.ts"/>
|
||||
|
||||
// @Filename: b.ts
|
||||
////import n = require('a/*1*/');
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
/// <reference path="../fourslash.ts"/>
|
||||
|
||||
/////**/module Default{var x= ( { } ) ;}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
/// <reference path="../fourslash.ts"/>
|
||||
|
||||
////switch (1) {
|
||||
//// case 1:
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path="fourslash.ts"/>
|
||||
/// <reference path="../fourslash.ts"/>
|
||||
|
||||
////// Interface
|
||||
////{| "itemName": "IPoint", "kind": "interface", "parentName": "" |}interface IPoint {
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path="fourslash.ts"/>
|
||||
/// <reference path="../fourslash.ts"/>
|
||||
|
||||
/////// Module
|
||||
////{| "itemName": "MyShapes", "kind": "module", "parentName": "", "matchKind": "substring" |}module MyShapes {
|
||||
22
tests/cases/fourslash/server/occurrences01.ts
Normal file
22
tests/cases/fourslash/server/occurrences01.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/// <reference path="../fourslash.ts"/>
|
||||
|
||||
////foo: [|switch|] (10) {
|
||||
//// [|case|] 1:
|
||||
//// [|case|] 2:
|
||||
//// [|case|] 3:
|
||||
//// [|break|];
|
||||
//// [|break|] foo;
|
||||
//// continue;
|
||||
//// continue foo;
|
||||
////}
|
||||
|
||||
let ranges = test.ranges();
|
||||
|
||||
for (let r of ranges) {
|
||||
goTo.position(r.start);
|
||||
verify.occurrencesAtPositionCount(ranges.length);
|
||||
|
||||
for (let range of ranges) {
|
||||
verify.occurrencesAtPositionContains(range, /*isWriteAccess*/ false);
|
||||
}
|
||||
}
|
||||
16
tests/cases/fourslash/server/occurrences02.ts
Normal file
16
tests/cases/fourslash/server/occurrences02.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
/// <reference path="../fourslash.ts"/>
|
||||
|
||||
////function [|f|](x: typeof [|f|]) {
|
||||
//// [|f|]([|f|]);
|
||||
////}
|
||||
|
||||
let ranges = test.ranges();
|
||||
|
||||
for (let r of ranges) {
|
||||
goTo.position(r.start);
|
||||
verify.occurrencesAtPositionCount(ranges.length);
|
||||
|
||||
for (let range of ranges) {
|
||||
verify.occurrencesAtPositionContains(range);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path="fourslash.ts"/>
|
||||
/// <reference path="../fourslash.ts"/>
|
||||
|
||||
////interface One {
|
||||
//// commonProperty: number;
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
/// <reference path="../fourslash.ts"/>
|
||||
|
||||
// Global class reference.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
/// <reference path="../fourslash.ts"/>
|
||||
|
||||
///////<reference path="./Bar.ts" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path="fourslash.ts"/>
|
||||
/// <reference path="../fourslash.ts"/>
|
||||
|
||||
////function foo(data: number) {
|
||||
////}
|
||||
Reference in New Issue
Block a user