Add test for goto def

This commit is contained in:
Mohamed Hegazy 2015-02-12 16:31:08 -08:00
parent 93aa3f161d
commit 99373dbd89
4 changed files with 21 additions and 3 deletions

View file

@ -420,6 +420,9 @@ module FourSlash {
this.activeFile = fileToOpen;
var fileName = fileToOpen.fileName.replace(Harness.IO.directoryName(fileToOpen.fileName), '').substr(1);
this.scenarioActions.push('<OpenFile FileName="" SrcFileId="' + fileName + '" FileId="' + fileName + '" />');
// Let the host know that this file is now open
this.languageServiceAdapterHost.openFile(fileToOpen.fileName);
}
public verifyErrorExistsBetweenMarkers(startMarkerName: string, endMarkerName: string, negative: boolean) {

View file

@ -154,6 +154,9 @@ module Harness.LanguageService {
throw new Error("No script with name '" + fileName + "'");
}
public openFile(fileName: string): void {
}
/**
* @param line 1 based index
* @param col 1 based index
@ -442,8 +445,8 @@ module Harness.LanguageService {
this.client = client;
}
addScript(fileName: string, content: string): void {
super.addScript(fileName, content);
openFile(fileName: string): void {
super.openFile(fileName);
this.client.openFile(fileName);
}

View file

@ -65,7 +65,7 @@ module ts.server {
}
stat(path: string, callback?: (err: any, stats: any) => any) {
throw new Error("Not implemented Yet.");
return 0;
}
lineColToPosition(fileName: string, line: number, col: number): number {

View file

@ -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');