microsoft / TypeScript-TmLanguage

TextMate grammar files for TypeScript for VS Code, Sublime Text, and Atom.
MIT License
412 stars 126 forks source link

JSDoc grammar highlights @return {@link ...} as type #877

Open meganrogge opened 3 years ago

meganrogge commented 3 years ago

With the following code, TS claims that {@link TreeItem} is incorrect

export interface TreeDataProvider<T> {
/**
 * @return {@link TreeItem} representation of the element
*/
 getTreeItem(element: T): TreeItem;
}

adding a character between returnand {@link TreeItem} resolves it.

mjbvz commented 3 years ago

I believe that the root cause is that we are highlighting {@link ...} as if was a type. When looking for types, we probably need a look ahead for the { to make sure it is not followed by @