Skip to content

Commit ce133ec

Browse files
author
Armando Aguirre
committed
Fixed issue for navbar when having multiline string literals
1 parent 9d404b4 commit ce133ec

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/services/navigationBar.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ namespace ts.NavigationBar {
194194
// Handle named bindings in imports e.g.:
195195
// import * as NS from "mod";
196196
// import {a, b as B} from "mod";
197-
const {namedBindings} = importClause;
197+
const { namedBindings } = importClause;
198198
if (namedBindings) {
199199
if (namedBindings.kind === SyntaxKind.NamespaceImport) {
200200
addLeafNode(namedBindings);
@@ -660,7 +660,16 @@ namespace ts.NavigationBar {
660660
else if (isCallExpression(parent)) {
661661
const name = getCalledExpressionName(parent.expression);
662662
if (name !== undefined) {
663-
const args = mapDefined(parent.arguments, a => isStringLiteralLike(a) ? a.getText(curSourceFile) : undefined).join(", ");
663+
const args = mapDefined(parent.arguments, a => {
664+
if (isStringLiteralLike(a)) {
665+
const line = curSourceFile.getLineAndCharacterOfPosition(a.pos).line;
666+
const endOfLine = getEndLinePosition(line, curSourceFile);
667+
668+
return a.getText(curSourceFile).substring(0, endOfLine - a.pos);
669+
}
670+
671+
return undefined;
672+
}).join(", ");
664673
return `${name}(${args}) callback`;
665674
}
666675
}

0 commit comments

Comments
 (0)