Skip to content

Commit 962c4de

Browse files
committed
Address code review comments
1 parent b6f4aa9 commit 962c4de

3 files changed

Lines changed: 29 additions & 5 deletions

File tree

src/services/services.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2021,7 +2021,7 @@ module ts {
20212021
var text = sourceFile.text;
20222022
var width = comment.end - comment.pos;
20232023
// is single line comment or just /*
2024-
if (width <=2 || text.charCodeAt(comment.pos + 1) === CharacterCodes.slash) {
2024+
if (width <= 2 || text.charCodeAt(comment.pos + 1) === CharacterCodes.slash) {
20252025
return true;
20262026
}
20272027
else {
@@ -2484,9 +2484,6 @@ module ts {
24842484
}
24852485

24862486
function isInStringOrRegularExpressionLiteral(previousToken: Node): boolean {
2487-
//var token = getTouchingPropertyName(sourceFile, position);
2488-
2489-
// || token.kind === SyntaxKind.RegularExpressionLiteral
24902487
if (previousToken.kind === SyntaxKind.StringLiteral) {
24912488
// The position has to be either: 1. entirely within the token text, or
24922489
// 2. at the end position, and the string literal is not terminated
@@ -2498,7 +2495,9 @@ module ts {
24982495
else if (position === end) {
24992496
var width = end - start;
25002497
var text = previousToken.getSourceFile().text;
2501-
return width <= 1 || text.charCodeAt(start) !== text.charCodeAt(end - 1);
2498+
return width <= 1 ||
2499+
text.charCodeAt(start) !== text.charCodeAt(end - 1) ||
2500+
text.charCodeAt(end - 2) === CharacterCodes.backslash;
25022501
}
25032502
}
25042503
else if (previousToken.kind === SyntaxKind.RegularExpressionLiteral) {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
////// Outside the function expression
4+
////declare var f1: (a: number) => void; /*1*/
5+
////
6+
////declare var f1: (b: number, b2: /*2*/) => void;
7+
8+
goTo.marker("1");
9+
verify.not.completionListContains("a");
10+
11+
goTo.marker("2");
12+
verify.completionListContains("b");
13+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
////// Outside the function expression
4+
////var x1 = (a: number) => { }/*1*/;
5+
////
6+
////var x2 = (b: number) => {/*2*/ };
7+
8+
goTo.marker("1");
9+
verify.not.completionListContains("a");
10+
11+
goTo.marker("2");
12+
verify.completionListContains("b");

0 commit comments

Comments
 (0)