Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Default stackTraceDepth to the value from package.json #2200

Merged
merged 1 commit into from
Dec 30, 2018

Conversation

segevfiner
Copy link
Contributor

It seems that defaults from the debugger configurationAttributes in package.json are only used for auto-complete, and won't be filled in automatically if not given.

Fixes #2187, and fixes #2196

@@ -271,7 +271,7 @@ class Delve {
} else if (typeof launchArgs['useApiV1'] === 'boolean') {
this.isApiV1 = launchArgs['useApiV1'];
}
this.stackTraceDepth = launchArgs.stackTraceDepth;
this.stackTraceDepth = launchArgs.stackTraceDepth || 50;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default value should be probably stored as const to avoid magic number problem.

Copy link
Contributor Author

@segevfiner segevfiner Dec 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure where to place the constant since there are no other such constants in the file, should it be:

  1. Somewhere at file scope? If so, where exactly?
  2. Inside the class? (private/public?)
  3. Alternatively, we can import/require/JSON.parse the package.json and get it from there. (import/require will require enabling the TypeScript setting resolveJsonModule)

It's also quite possible that there are other default values strawn around that aren't constant, but I haven't checked.

@ramya-rao-a

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's also quite possible that there are other default values strawn around that aren't constant,

Yes, right around this line of code we have set defaults for other properties of the launchArgs variable.

This looks good to me for now. I'll pick up the const issue in some later refactoring

Copy link
Contributor

@ramya-rao-a ramya-rao-a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @segevfiner!

@ramya-rao-a ramya-rao-a merged commit ae1f72b into microsoft:master Dec 30, 2018
@segevfiner segevfiner deleted the stack-trace-depth-default branch December 30, 2018 07:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shown call stack always of depth 1 with version 0.8.0 Call Stack shows only the top frame
3 participants