Support more terminators for parsing jsdoc filepaths
This commit is contained in:
parent
b902a71e5f
commit
30aad9db8d
|
@ -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);
|
||||
|
||||
|
|
|
@ -5,13 +5,27 @@
|
|||
//// * @returns {module:@nodefuel/web~Webserver~wsServer#hello} Websocket server object
|
||||
//// */
|
||||
////function foo() { }
|
||||
////foo(''/**/);
|
||||
////foo(''/*foo*/);
|
||||
////
|
||||
/////**
|
||||
//// * @type {module:xxxxx} */
|
||||
//// */
|
||||
////function bar() { }
|
||||
////bar(''/*bar*/);
|
||||
|
||||
|
||||
verify.signatureHelp({
|
||||
marker: "",
|
||||
marker: "foo",
|
||||
text: "foo(): any",
|
||||
docComment: "",
|
||||
tags: [
|
||||
{ name: "returns", text: "Websocket server object" },
|
||||
{ name: "returns", text: "Websocket server object" },
|
||||
],
|
||||
});
|
||||
|
||||
verify.signatureHelp({
|
||||
marker: "bar",
|
||||
text: "bar(): void",
|
||||
docComment: "",
|
||||
tags: [],
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue