-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Move function typed properties from the SourceFile to a dedicated functions #1700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
45ac06a
c40977c
cf8c218
edc65e1
e15f934
ad42afc
288e38f
45defa8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -881,21 +881,6 @@ module ts { | |
filename: string; | ||
text: string; | ||
|
||
getLineAndCharacterFromPosition(position: number): LineAndCharacter; | ||
getPositionFromLineAndCharacter(line: number, character: number): number; | ||
getLineStarts(): number[]; | ||
|
||
// Produces a new SourceFile for the 'newText' provided. The 'textChangeRange' parameter | ||
// indicates what changed between the 'text' that this SourceFile has and the 'newText'. | ||
// The SourceFile will be created with the compiler attempting to reuse as many nodes from | ||
// this file as possible. | ||
// | ||
// Note: this function mutates nodes from this SourceFile. That means any existing nodes | ||
// from this SourceFile that are being held onto may change as a result (including | ||
// becoming detached from any SourceFile). It is recommended that this SourceFile not | ||
// be used once 'update' is called on it. | ||
update(newText: string, textChangeRange: TextChangeRange): SourceFile; | ||
|
||
amdDependencies: string[]; | ||
amdModuleName: string; | ||
referencedFiles: FileReference[]; | ||
|
@@ -907,19 +892,26 @@ module ts { | |
// missing tokens, or tokens it didn't know how to deal with). | ||
parseDiagnostics: Diagnostic[]; | ||
|
||
// Returns all syntactic diagnostics (i.e. the reference, parser and grammar diagnostics). | ||
getSyntacticDiagnostics(): Diagnostic[]; | ||
//getSyntacticDiagnostics(): Diagnostic[]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove this commented out line. |
||
|
||
// File level diagnostics reported by the binder. | ||
semanticDiagnostics: Diagnostic[]; | ||
|
||
// Returns all syntactic diagnostics (i.e. the reference, parser and grammar diagnostics). | ||
// This field should never be used directly, use getSyntacticDiagnostics function instead. | ||
syntacticDiagnostics: Diagnostic[]; | ||
|
||
hasNoDefaultLib: boolean; | ||
externalModuleIndicator: Node; // The first node that causes this file to be an external module | ||
nodeCount: number; | ||
identifierCount: number; | ||
symbolCount: number; | ||
languageVersion: ScriptTarget; | ||
identifiers: Map<string>; | ||
|
||
// Stores a line map for the file. | ||
// This field should never be used directly to obtain line map, use getLineMap function instead. | ||
lineMap: number[]; | ||
} | ||
|
||
export interface ScriptReferenceHost { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -391,7 +391,7 @@ module FourSlash { | |
this.currentCaretPosition = pos; | ||
|
||
var lineStarts = ts.computeLineStarts(this.getCurrentFileContent()); | ||
var lineCharPos = ts.getLineAndCharacterOfPosition(lineStarts, pos); | ||
var lineCharPos = ts.computeLineAndCharacterOfPosition(lineStarts, pos); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the difference between this and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
this.scenarioActions.push('<MoveCaretToLineAndChar LineNumber="' + lineCharPos.line + '" CharNumber="' + lineCharPos.character + '" />'); | ||
} | ||
|
||
|
@@ -1384,15 +1384,15 @@ module FourSlash { | |
var incrementalSourceFile = this.languageService.getSourceFile(this.activeFile.fileName); | ||
Utils.assertInvariants(incrementalSourceFile, /*parent:*/ undefined); | ||
|
||
var incrementalSyntaxDiagnostics = incrementalSourceFile.getSyntacticDiagnostics(); | ||
var incrementalSyntaxDiagnostics = ts.getSyntacticDiagnostics(incrementalSourceFile); | ||
|
||
// Check syntactic structure | ||
var snapshot = this.languageServiceShimHost.getScriptSnapshot(this.activeFile.fileName); | ||
var content = snapshot.getText(0, snapshot.getLength()); | ||
|
||
var referenceSourceFile = ts.createLanguageServiceSourceFile( | ||
this.activeFile.fileName, createScriptSnapShot(content), ts.ScriptTarget.Latest, /*version:*/ "0", /*isOpen:*/ false, /*setNodeParents:*/ false); | ||
var referenceSyntaxDiagnostics = referenceSourceFile.getSyntacticDiagnostics(); | ||
var referenceSyntaxDiagnostics = ts.getSyntacticDiagnostics(referenceSourceFile); | ||
|
||
Utils.assertDiagnosticsEquals(incrementalSyntaxDiagnostics, referenceSyntaxDiagnostics); | ||
Utils.assertStructuralEquals(incrementalSourceFile, referenceSourceFile); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For anything new functions introduced, we need to discuss where they get exported from (i.e. most will need to be exposed from
utilities.ts
).@mhegazy, this relates to the API test we need to reintroduce; Monday?
I'd also annotate the return types, but that's just me.