Add refactoring to convert CommonJS module to ES6 module (#19916)

* Add refactoring to convert CommonJS module to ES6 module

* Code review

* includeGlobals -> excludeGlobals

* Improve handling of `module.exports = require("...")`

* Allow NoSubstitutionTemplateLiteral as argument to createLiteral
This commit is contained in:
Andy
2018-01-09 13:15:47 -08:00
committed by GitHub
parent 9aa99b90c7
commit 8bce69e6bd
41 changed files with 1170 additions and 71 deletions

View File

@@ -454,7 +454,7 @@ namespace FourSlash {
const ranges = this.getRanges();
assert(ranges.length);
for (const range of ranges) {
this.goToRangeStart(range);
this.selectRange(range);
action();
}
}
@@ -482,6 +482,11 @@ namespace FourSlash {
this.selectionEnd = end.position;
}
public selectRange(range: Range): void {
this.goToRangeStart(range);
this.selectionEnd = range.end;
}
public moveCaretRight(count = 1) {
this.currentCaretPosition += count;
this.currentCaretPosition = Math.min(this.currentCaretPosition, this.getFileContent(this.activeFile.fileName).length);
@@ -3835,6 +3840,10 @@ namespace FourSlashInterface {
public select(startMarker: string, endMarker: string) {
this.state.select(startMarker, endMarker);
}
public selectRange(range: FourSlash.Range): void {
this.state.selectRange(range);
}
}
export class VerifyNegatable {