-
Notifications
You must be signed in to change notification settings - Fork 43
Update to NB-25 #382
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
Update to NB-25 #382
Conversation
…enerate sha256 as the temp license name so that it doesn't create too long file names
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @Achal1607 for upgrading the LS to NB25.
vscode/src/debugger/debugger.ts
Outdated
@@ -237,7 +237,11 @@ class RunConfigurationProvider implements vscode.DebugConfigurationProvider { | |||
if (vmArgs) { | |||
if (!config.vmArgs) { | |||
config.vmArgs = vmArgs; | |||
} else if (Array.isArray(config.vmArgs)) { | |||
let cfg: string[] = config.vmArgs; | |||
cfg.push(vmArgs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the vmArgs
be treated conditionally, just like config.vmArgs
?
i.e. check whether it is an array
or a string
. If there is a mismatch between the types of both, then the vmArgs
needs to be converted to the type of the config.vmArgs
. Right?
In case vmArgs
is a string
and is to be pushed into an array, then we should perhaps split using quote-aware whitespace-delimiters into an array before pushing. That would ensure that downstream usage of config.vmArgs
does not cause the double-quoting of multiple args into a single arg, which would not be understood by the JVM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vmArgs
is always a string since it comes from the settings.json
. In package.json you can find:
"jdk.runConfig.vmOptions": {
"type": "string",
"default": "",
"description": "%jdk.configuration.vmOptions.description%"
}
So, we don't need to do any string manipulation there IMO.
launch.json can have array
of vmArgs
. For example:
{
"version": "0.2.0",
"configurations": [
{
"type": "jdk",
"request": "launch",
"name": "Launch Java App",
"vmArgs": ["-Xms256m"]
}
]
}
But the side panel can only have string
type of vmOptions
as it comes from the settings.json
.
In future can also convert settings.json
configuration to take input as array
as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Then we would need to do just the following:
In case vmArgs is a string and is to be pushed into an array, then we should perhaps split using quote-aware whitespace-delimiters into an array before pushing. That would ensure that downstream usage of config.vmArgs does not cause the double-quoting of multiple args into a single arg, which would not be understood by the JVM.
@sid-srini I have addressed all the review comments. Please review it again. Thanks |
vscode/src/utils.ts
Outdated
while (i < input.length && f) { | ||
current += input[i]; | ||
if (input[i] === quoteType && input[i - 1] != "\\") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typically, this will be functionally correct, although the performance maybe improved by storing a regex reference and performing a search
followed by concat
of substr
. However, in certain corner cases this may not give the correct result. For e.g. when there are a balanced number of escape backslashes which indicate a literal backslash instead:
"abc \\" def
should become 2 strings; whereas the current code would retain it as a single string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing out this edge case, will update the method.
b8bd745
to
ce36fc5
Compare
@sid-srini Addressed review comments. Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Achal1607 for completing the upgrade to NB25 and also improving the implementation of some of the new functionality. LGTM 👍
while (i < input.length && f) { | ||
current += input[i]; | ||
const isEscapingSomethingElse = (i > 1 && input[i - 1] == "\\" && input[i - 2] == "\\"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: an index out-of-bounds error may occur with the unchecked i-1
or i-2
index access. Safety or performance-wise, it may be better to add a separate else-if block for keeping track of number of continuous occurrences of char == '\\'
i.e. isEscapingActive
and just check that during quote handling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR aims to update LS to NB-25.