Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VSCode hangs when using (recursive?) JSDoc @typedef s #23958

Closed
dcodeIO opened this issue Apr 5, 2017 · 3 comments
Closed

VSCode hangs when using (recursive?) JSDoc @typedef s #23958

dcodeIO opened this issue Apr 5, 2017 · 3 comments
Assignees
Labels
freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues javascript JavaScript support issues typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)

Comments

@dcodeIO
Copy link

dcodeIO commented Apr 5, 2017

  • VSCode Version: 1.10.2
  • OS Version: Win10

Steps to Reproduce:

  1. Copy the following to a new file but-typedefs.js and open it in VSCode:
/**
 * @typedef EnumDescriptor
 * @type {Object}
 * @property {Object.<string,number>} values Enum values
 * @property {Object.<string,*>} [options] Enum options
 */

/**
 * @typedef TypeDescriptor
 * @type {Object}
 * @property {Object.<string,*>} [options] Message type options
 * @property {Object.<string,OneOfDescriptor>} [oneofs] Oneof descriptors
 * @property {Object.<string,FieldDescriptor>} fields Field descriptors
 * @property {number[][]} [extensions] Extension ranges
 * @property {number[][]} [reserved] Reserved ranges
 * @property {boolean} [group=false] Whether a legacy group or not
 * @property {Object.<string,AnyNestedDescriptor>} [nested] Nested object descriptors
 */

/**
 * @typedef FieldDescriptor
 * @type {Object}
 * @property {string} [rule="optional"] Field rule
 * @property {string} type Field type
 * @property {number} id Field id
 * @property {Object.<string,*>} [options] Field options
 */

/**
 * @typedef ExtensionFieldDescriptor
 * @type {Object}
 * @property {string} [rule="optional"] Field rule
 * @property {string} type Field type
 * @property {number} id Field id
 * @property {string} extend Extended type
 * @property {Object.<string,*>} [options] Field options
 */

/**
 * @typedef MapFieldDescriptor
 * @type {Object}
 * @property {string} keyType Key type
 * @property {string} type Value type
 * @property {number} id Field id
 * @property {Object.<string,*>} [options] Field options
 */

/**
 * @typedef ExtensionMapFieldDescriptor
 * @type {Object}
 * @property {string} keyType Key type
 * @property {string} type Value type
 * @property {number} id Field id
 * @property {string} extend Extended type
 * @property {Object.<string,*>} [options] Field options
 */

/**
 * @typedef OneOfDescriptor
 * @type {Object}
 * @property {Array.<string>} oneof Oneof field names
 * @property {Object.<string,*>} [options] Oneof options
 */

/**
 * @typedef ServiceDescriptor
 * @type {Object}
 * @property {Object.<string,*>} [options] Service options
 * @property {Object.<string,MethodDescriptor>} methods Method descriptors
 * @property {Object.<string,AnyNestedDescriptor>} [nested] Nested object descriptors
 */

/**
 * @typedef MethodDescriptor
 * @type {Object}
 * @property {string} [type="rpc"] Method type
 * @property {string} requestType Request type
 * @property {string} responseType Response type
 * @property {boolean} [requestStream=false] Whether requests are streamed
 * @property {boolean} [responseStream=false] Whether responses are streamed
 * @property {Object.<string,*>} [options] Method options
 */

/**
 * @typedef NamespaceDescriptor
 * @type {Object}
 * @property {Object.<string,*>} [options] Namespace options
 * @property {Object.<string,AnyNestedDescriptor>} nested Nested object descriptors
 */

// VSCode hangs if the following typedef contains more than 5 types (at 5 it just lags a bit):

/**
 * Any nested object descriptor.
 * @typedef AnyNestedDescriptor
 * @type {EnumDescriptor|TypeDescriptor|ServiceDescriptor|ExtensionFieldDescriptor|ExtensionMapFieldDescriptor|NamespaceDescriptor}
 */
  1. Get a coffee and come back later.

Profile:

I uninstalled all extensions to be sure, but I must admit that I haven't managed to test this on another machine, yet.

@mjbvz mjbvz added javascript JavaScript support issues typescript Typescript support issues labels Apr 5, 2017
@mjbvz
Copy link
Collaborator

mjbvz commented Apr 5, 2017

Thanks @dcodeIO

I'm able to reproduce this in 1.11 by copy and pasting in the provided string. From the trace, it looks like an issue with either the TypeScript grammar or with our vscode-textmate engine and not with the TSServer directly. The TSServer trace also seems to suggest this but I'll confirm. Adding @alexandrudima to see if he has any thoughts here

@mjbvz mjbvz added the freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues label Apr 5, 2017
@alexdima
Copy link
Member

alexdima commented Apr 6, 2017

TypeScript TM Grammar catastrophic backtracking regex. I can look up the issue I made on their repo ~ last week.

@mjbvz mjbvz added the upstream Issue identified as 'upstream' component related (exists outside of VS Code) label Apr 7, 2017
@mjbvz
Copy link
Collaborator

mjbvz commented Apr 7, 2017

Thanks @alexandrudima! Looks like this is a duplicate of microsoft/TypeScript-TmLanguage#435

@mjbvz mjbvz closed this as completed Apr 7, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues javascript JavaScript support issues typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

3 participants