Change the meaning of useNonAdjustedStartPosition

Old: getFullStart
New: getStart
Impact: only used in tests
Reason: symmetry with useNonAdjustedEndPosition - both now effectively
mean "exclude trivia from range"
This commit is contained in:
Andrew Casey
2018-02-08 15:28:59 -08:00
parent 6435d26510
commit 8d6e48a2ec
10 changed files with 33 additions and 9 deletions

View File

@@ -28,9 +28,11 @@ namespace ts.textChanges {
}
export interface ConfigurableStart {
/** True to use getStart() (NB, not getFullStart()) without adjustment. */
useNonAdjustedStartPosition?: boolean;
}
export interface ConfigurableEnd {
/** True to use getEnd() without adjustment. */
useNonAdjustedEndPosition?: boolean;
}
@@ -132,7 +134,7 @@ namespace ts.textChanges {
export function getAdjustedStartPosition(sourceFile: SourceFile, node: Node, options: ConfigurableStart, position: Position) {
if (options.useNonAdjustedStartPosition) {
return node.getFullStart();
return node.getStart();
}
const fullStart = node.getFullStart();
const start = node.getStart(sourceFile);

View File

@@ -9,4 +9,8 @@ var z = 3; // comment 4
===MODIFIED===
var x = 1;var z = 3; // comment 4
var x = 1; // some comment - 1
/**
* comment 2
*/
var z = 3; // comment 4

View File

@@ -9,5 +9,9 @@ var z = 3; // comment 4
===MODIFIED===
var x = 1; // comment 3
var x = 1; // some comment - 1
/**
* comment 2
*/
// comment 3
var z = 3; // comment 4

View File

@@ -11,5 +11,7 @@ var a = 4; // comment 7
===MODIFIED===
// comment 1
var x = 1;// comment 6
var x = 1; // comment 2
// comment 3
// comment 6
var a = 4; // comment 7

View File

@@ -11,6 +11,8 @@ var a = 4; // comment 7
===MODIFIED===
// comment 1
var x = 1; // comment 5
var x = 1; // comment 2
// comment 3
// comment 5
// comment 6
var a = 4; // comment 7

View File

@@ -10,7 +10,9 @@ var a = 4; // comment 7
===MODIFIED===
// comment 1
var x = 1;
var x = 1; // comment 2
// comment 3
public class class1 implements interface1
{
property1: boolean;

View File

@@ -10,7 +10,9 @@ var a = 4; // comment 7
===MODIFIED===
// comment 1
var x = 1;public class class1 implements interface1
var x = 1; // comment 2
// comment 3
public class class1 implements interface1
{
property1: boolean;
} // comment 4

View File

@@ -8,6 +8,8 @@ var z = 3; // comment 5
// comment 6
var a = 4; // comment 7
===MODIFIED===
// comment 1
public class class1 implements interface1
{
property1: boolean;

View File

@@ -10,7 +10,9 @@ var a = 4; // comment 7
===MODIFIED===
// comment 1
var x = 1;
var x = 1; // comment 2
// comment 3
public class class1 implements interface1
{
property1: boolean;

View File

@@ -10,7 +10,9 @@ var a = 4; // comment 7
===MODIFIED===
// comment 1
var x = 1;public class class1 implements interface1
var x = 1; // comment 2
// comment 3
public class class1 implements interface1
{
property1: boolean;
} // comment 5