mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Support more terminators for parsing jsdoc filepaths
This commit is contained in:
@@ -2428,17 +2428,19 @@ namespace ts {
|
||||
|
||||
function parseJSDocType(): TypeNode {
|
||||
scanner.setInJSDocType(true);
|
||||
const dotdotdot = parseOptionalToken(SyntaxKind.DotDotDotToken);
|
||||
const moduleSpecifier = parseOptionalToken(SyntaxKind.ModuleKeyword);
|
||||
let type = parseTypeOrTypePredicate();
|
||||
scanner.setInJSDocType(false);
|
||||
if (moduleSpecifier) {
|
||||
const moduleTag = createNode(SyntaxKind.JSDocNamepathType, moduleSpecifier.pos) as JSDocNamepathType;
|
||||
while (token() !== SyntaxKind.CloseBraceToken && token() !== SyntaxKind.EndOfFileToken) {
|
||||
const terminators = [SyntaxKind.CloseBraceToken, SyntaxKind.EndOfFileToken, SyntaxKind.CommaToken, SyntaxKind.CloseParenToken];
|
||||
while (terminators.indexOf(token()) < 0) {
|
||||
nextTokenJSDoc();
|
||||
}
|
||||
type = finishNode(moduleTag);
|
||||
return finishNode(moduleTag);
|
||||
}
|
||||
|
||||
const dotdotdot = parseOptionalToken(SyntaxKind.DotDotDotToken);
|
||||
let type = parseTypeOrTypePredicate();
|
||||
scanner.setInJSDocType(false);
|
||||
if (dotdotdot) {
|
||||
const variadic = createNode(SyntaxKind.JSDocVariadicType, dotdotdot.pos) as JSDocVariadicType;
|
||||
variadic.type = type;
|
||||
|
||||
@@ -1983,7 +1983,7 @@ namespace ts {
|
||||
// First non-whitespace character on this line.
|
||||
let firstNonWhitespace = 0;
|
||||
// These initial values are special because the first line is:
|
||||
// firstNonWhitespace = 0 to indicate that we want leading whitspace,
|
||||
// firstNonWhitespace = 0 to indicate that we want leading whitespace,
|
||||
|
||||
while (pos < end) {
|
||||
char = text.charCodeAt(pos);
|
||||
|
||||
@@ -1268,6 +1268,10 @@ namespace FourSlash {
|
||||
|
||||
private verifySignatureHelpWorker(options: FourSlashInterface.VerifySignatureHelpOptions) {
|
||||
const help = this.getSignatureHelp({ triggerReason: options.triggerReason })!;
|
||||
if (!help) {
|
||||
this.raiseError("Could not get a help signature");
|
||||
}
|
||||
|
||||
const selectedItem = help.items[help.selectedItemIndex];
|
||||
// Argument index may exceed number of parameters
|
||||
const currentParameter = selectedItem.parameters[help.argumentIndex] as ts.SignatureHelpParameter | undefined;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
namespace ts {
|
||||
/** The classifier is used for syntactic highlighting in editors via the TSServer */
|
||||
export function createClassifier(): Classifier {
|
||||
const scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user