File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -1567,14 +1567,20 @@ module ts {
1567
1567
/// Completion
1568
1568
function getValidCompletionEntryDisplayName ( displayName : string , target : ScriptTarget ) : string {
1569
1569
if ( displayName && displayName . length > 0 ) {
1570
- var firstChar = displayName . charCodeAt ( 0 ) ;
1571
- if ( firstChar === TypeScript . CharacterCodes . singleQuote || firstChar === TypeScript . CharacterCodes . doubleQuote ) {
1570
+ var firstCharCode = displayName . charCodeAt ( 0 ) ;
1571
+ if ( displayName && displayName . length >= 2 && firstCharCode === displayName . charCodeAt ( displayName . length - 1 ) &&
1572
+ ( firstCharCode === CharacterCodes . singleQuote || firstCharCode === CharacterCodes . doubleQuote ) ) {
1572
1573
// If the user entered name for the symbol was quoted, removing the quotes is not enough, as the name could be an
1573
1574
// invalid identifer name. We need to check if whatever was inside the quotes is actually a valid identifier name.
1574
- displayName = TypeScript . stripStartAndEndQuotes ( displayName ) ;
1575
+ displayName = displayName . substring ( 1 , displayName . length - 1 ) ;
1575
1576
}
1576
1577
1577
- if ( TypeScript . Scanner . isValidIdentifier ( TypeScript . SimpleText . fromString ( displayName ) , target ) ) {
1578
+ var isValid = isIdentifierStart ( displayName . charCodeAt ( 0 ) , target ) ;
1579
+ for ( var i = 1 , n = displayName . length ; isValid && i < n ; i ++ ) {
1580
+ isValid = isValid && isIdentifierPart ( displayName . charCodeAt ( i ) , target ) ;
1581
+ }
1582
+
1583
+ if ( isValid ) {
1578
1584
return displayName ;
1579
1585
}
1580
1586
}
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ verify.completionListContains("bar");
19
19
verify . completionListContains ( "break" ) ;
20
20
verify . completionListContains ( "any" ) ;
21
21
verify . completionListContains ( "$" ) ;
22
- verify . completionListContains ( "\\u0062 " ) ;
22
+ verify . completionListContains ( "b " ) ;
23
23
24
24
// Nothing else should show up
25
25
verify . memberListCount ( 5 ) ;
You can’t perform that action at this time.
0 commit comments