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 {
|
function parseJSDocType(): TypeNode {
|
||||||
scanner.setInJSDocType(true);
|
scanner.setInJSDocType(true);
|
||||||
const dotdotdot = parseOptionalToken(SyntaxKind.DotDotDotToken);
|
|
||||||
const moduleSpecifier = parseOptionalToken(SyntaxKind.ModuleKeyword);
|
const moduleSpecifier = parseOptionalToken(SyntaxKind.ModuleKeyword);
|
||||||
let type = parseTypeOrTypePredicate();
|
|
||||||
scanner.setInJSDocType(false);
|
|
||||||
if (moduleSpecifier) {
|
if (moduleSpecifier) {
|
||||||
const moduleTag = createNode(SyntaxKind.JSDocNamepathType, moduleSpecifier.pos) as JSDocNamepathType;
|
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();
|
nextTokenJSDoc();
|
||||||
}
|
}
|
||||||
type = finishNode(moduleTag);
|
return finishNode(moduleTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const dotdotdot = parseOptionalToken(SyntaxKind.DotDotDotToken);
|
||||||
|
let type = parseTypeOrTypePredicate();
|
||||||
|
scanner.setInJSDocType(false);
|
||||||
if (dotdotdot) {
|
if (dotdotdot) {
|
||||||
const variadic = createNode(SyntaxKind.JSDocVariadicType, dotdotdot.pos) as JSDocVariadicType;
|
const variadic = createNode(SyntaxKind.JSDocVariadicType, dotdotdot.pos) as JSDocVariadicType;
|
||||||
variadic.type = type;
|
variadic.type = type;
|
||||||
|
|
|
@ -1983,7 +1983,7 @@ namespace ts {
|
||||||
// First non-whitespace character on this line.
|
// First non-whitespace character on this line.
|
||||||
let firstNonWhitespace = 0;
|
let firstNonWhitespace = 0;
|
||||||
// These initial values are special because the first line is:
|
// 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) {
|
while (pos < end) {
|
||||||
char = text.charCodeAt(pos);
|
char = text.charCodeAt(pos);
|
||||||
|
|
|
@ -1268,6 +1268,10 @@ namespace FourSlash {
|
||||||
|
|
||||||
private verifySignatureHelpWorker(options: FourSlashInterface.VerifySignatureHelpOptions) {
|
private verifySignatureHelpWorker(options: FourSlashInterface.VerifySignatureHelpOptions) {
|
||||||
const help = this.getSignatureHelp({ triggerReason: options.triggerReason })!;
|
const help = this.getSignatureHelp({ triggerReason: options.triggerReason })!;
|
||||||
|
if (!help) {
|
||||||
|
this.raiseError("Could not get a help signature");
|
||||||
|
}
|
||||||
|
|
||||||
const selectedItem = help.items[help.selectedItemIndex];
|
const selectedItem = help.items[help.selectedItemIndex];
|
||||||
// Argument index may exceed number of parameters
|
// Argument index may exceed number of parameters
|
||||||
const currentParameter = selectedItem.parameters[help.argumentIndex] as ts.SignatureHelpParameter | undefined;
|
const currentParameter = selectedItem.parameters[help.argumentIndex] as ts.SignatureHelpParameter | undefined;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
namespace ts {
|
namespace ts {
|
||||||
|
/** The classifier is used for syntactic highlighting in editors via the TSServer */
|
||||||
export function createClassifier(): Classifier {
|
export function createClassifier(): Classifier {
|
||||||
const scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ false);
|
const scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ false);
|
||||||
|
|
||||||
|
|
|
@ -5,13 +5,27 @@
|
||||||
//// * @returns {module:@nodefuel/web~Webserver~wsServer#hello} Websocket server object
|
//// * @returns {module:@nodefuel/web~Webserver~wsServer#hello} Websocket server object
|
||||||
//// */
|
//// */
|
||||||
////function foo() { }
|
////function foo() { }
|
||||||
////foo(''/**/);
|
////foo(''/*foo*/);
|
||||||
|
////
|
||||||
|
/////**
|
||||||
|
//// * @type {module:xxxxx} */
|
||||||
|
//// */
|
||||||
|
////function bar() { }
|
||||||
|
////bar(''/*bar*/);
|
||||||
|
|
||||||
|
|
||||||
verify.signatureHelp({
|
verify.signatureHelp({
|
||||||
marker: "",
|
marker: "foo",
|
||||||
text: "foo(): any",
|
text: "foo(): any",
|
||||||
docComment: "",
|
docComment: "",
|
||||||
tags: [
|
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