MCPcopy Index your code
hub / github.com/nodejs/node / getDisplayPartWriter

Function getDisplayPartWriter

test/fixtures/snapshot/typescript.js:128366–128454  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

128364 ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter;
128365 var displayPartWriter = getDisplayPartWriter();
128366 function getDisplayPartWriter() {
128367 var absoluteMaximumLength = ts.defaultMaximumTruncationLength * 10; // A hard cutoff to avoid overloading the messaging channel in worst-case scenarios
128368 var displayParts;
128369 var lineStart;
128370 var indent;
128371 var length;
128372 resetWriter();
128373 var unknownWrite = function (text) { return writeKind(text, ts.SymbolDisplayPartKind.text); };
128374 return {
128375 displayParts: function () {
128376 var finalText = displayParts.length && displayParts[displayParts.length - 1].text;
128377 if (length > absoluteMaximumLength && finalText && finalText !== "...") {
128378 if (!ts.isWhiteSpaceLike(finalText.charCodeAt(finalText.length - 1))) {
128379 displayParts.push(displayPart(" ", ts.SymbolDisplayPartKind.space));
128380 }
128381 displayParts.push(displayPart("...", ts.SymbolDisplayPartKind.punctuation));
128382 }
128383 return displayParts;
128384 },
128385 writeKeyword: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.keyword); },
128386 writeOperator: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.operator); },
128387 writePunctuation: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.punctuation); },
128388 writeTrailingSemicolon: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.punctuation); },
128389 writeSpace: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.space); },
128390 writeStringLiteral: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.stringLiteral); },
128391 writeParameter: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.parameterName); },
128392 writeProperty: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.propertyName); },
128393 writeLiteral: function (text) { return writeKind(text, ts.SymbolDisplayPartKind.stringLiteral); },
128394 writeSymbol: writeSymbol,
128395 writeLine: writeLine,
128396 write: unknownWrite,
128397 writeComment: unknownWrite,
128398 getText: function () { return ""; },
128399 getTextPos: function () { return 0; },
128400 getColumn: function () { return 0; },
128401 getLine: function () { return 0; },
128402 isAtStartOfLine: function () { return false; },
128403 hasTrailingWhitespace: function () { return false; },
128404 hasTrailingComment: function () { return false; },
128405 rawWrite: ts.notImplemented,
128406 getIndent: function () { return indent; },
128407 increaseIndent: function () { indent++; },
128408 decreaseIndent: function () { indent--; },
128409 clear: resetWriter,
128410 trackSymbol: function () { return false; },
128411 reportInaccessibleThisError: ts.noop,
128412 reportInaccessibleUniqueSymbolError: ts.noop,
128413 reportPrivateInBaseOfClassExpression: ts.noop,
128414 };
128415 function writeIndent() {
128416 if (length > absoluteMaximumLength)
128417 return;
128418 if (lineStart) {
128419 var indentString = ts.getIndentString(indent);
128420 if (indentString) {
128421 length += indentString.length;
128422 displayParts.push(displayPart(indentString, ts.SymbolDisplayPartKind.space));
128423 }

Callers 1

typescript.jsFile · 0.85

Calls 4

resetWriterFunction · 0.85
displayPartFunction · 0.85
writeKindFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…