mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-11 17:41:26 -06:00
Merge pull request #32765 from orta/debug_scanner
Adds a debugging command to the scanner
This commit is contained in:
commit
cfeebda837
@ -878,7 +878,7 @@ namespace ts {
|
||||
|
||||
setText(text, start, length);
|
||||
|
||||
return {
|
||||
const scanner: Scanner = {
|
||||
getStartPos: () => startPos,
|
||||
getTextPos: () => pos,
|
||||
getToken: () => token,
|
||||
@ -914,6 +914,17 @@ namespace ts {
|
||||
scanRange,
|
||||
};
|
||||
|
||||
if (Debug.isDebugging) {
|
||||
Object.defineProperty(scanner, "__debugShowCurrentPositionInText", {
|
||||
get: () => {
|
||||
const text = scanner.getText();
|
||||
return text.slice(0, scanner.getStartPos()) + "║" + text.slice(scanner.getStartPos());
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return scanner;
|
||||
|
||||
function error(message: DiagnosticMessage): void;
|
||||
function error(message: DiagnosticMessage, errPos: number, length: number): void;
|
||||
function error(message: DiagnosticMessage, errPos: number = pos, length?: number): void {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user