-
Notifications
You must be signed in to change notification settings - Fork 2
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
New implementation for TEST.SUBPROGRAM autocompletion #195
base: update_ct_support_170
Are you sure you want to change the base?
New implementation for TEST.SUBPROGRAM autocompletion #195
Conversation
## Summary Enhanced `launch.json.example` by adding a new debugger configuration for VectorCAST unit tests.
## Summary Added tests to get back to 100% coverage. ## Changed - Added exports to functions in `vcast-server-test.ts `to enable testing - Enhanced test for `transmitCommand()`
moved some of the common functions and global objects there.
when we ping. Now that we have this version, we check that the extension vcast version matches the server when we initialize. Made the extension version computation a stand-alone function Only compute the extension version once on startup and when the extension option for vcast installation changes. Only missing piece is to send the update the LSP with the server state
enviro data server and not. This allows the auto-complete stuff to work seemlessly
## Summary `serverIsAlive()` now requires a `text` field in the response. Since we mock the server fetch, I added a text field including `clicast-path` so that the split operation does not fail. https://github.com/vectorgrp/vector-vscode-vcast/blob/3d64e64ad7b1c88837de7b48c19666e102c60ac7/src-common/vcastServer.ts#L143
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.
Some very quick comments ...
Seems like some improvements could be made!
Thanks.
python/testEditorInterface.py
Outdated
@@ -33,7 +33,7 @@ def main(): | |||
# We get here when the user types a "." or ":" | |||
|
|||
# argv has the name of the script as arg 1 and then user args | |||
if len(sys.argv) == 4: | |||
if ((len(sys.argv) == 4) or (len(sys.argv) == 5)): |
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.
@aytey
These are very quick comments, as it is the end of the day and I don't have time to look at this thoroughly
This is not good, the check for 4 was to validate that the number of args was correct for the call, just slapping 5 here makes no sense, and also invalidates the else below which says 3 args are expected.
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.
Refactored to argument parser in 78bf51f .
python/testEditorInterface.py
Outdated
additionalParams = None | ||
|
||
if(len(sys.argv) == 5): | ||
# Additional autocompletion params |
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.
Do not write comments like this, what is saved in arg5?
python/testEditorInterface.py
Outdated
@@ -52,7 +58,7 @@ def main(): | |||
choiceData = choiceDataType() | |||
|
|||
elif mode == "choiceList-tst": | |||
choiceData = processTstLine(enviroName, inputLine) | |||
choiceData = processTstLine(enviroName, inputLine, additionalParams) |
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.
I don't even understand what is being done here yet but adding a new parameter cannot be the best way to do this
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.
I thought this would be the best way since
- I need the
unit
to get all the functions for the TEST.SUBPROGRAM withgetFunctions()
. - The changes are not really huge
I brainstormed some ideas in the notes here:
#193
I initially implemented Idea 1) because I believed it was the best option. However, if you'd like, I can review it again.
python/tstUtilities.py
Outdated
@@ -417,6 +417,29 @@ def processRequirementLines(api, pieces, triggerCharacter): | |||
|
|||
return returnData | |||
|
|||
def processSubprogramLines(api, pieces, triggerCharacter, additionalParams): |
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 so if you are only using this to pass the unit name, then change all of the parameter names etc to unitName, not additionalParams. Additionally additionalParams is a bad name because there is only one right?
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.
At the moment, we would only need the <unit>
, but I thought to make it as an object so that for future implementations I can simply add new params to this JSON.
I changed it now to be only unit
. In case we will need more, I could enhance it.
python/testEditorInterface.py
Outdated
@@ -43,6 +43,12 @@ def main(): | |||
# Contents of the line from the editor so far |
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.
You probably did not want to tear this completely apart but I would probably convert this to use argparse now and have named parameters like --mode, --enviroName, --inputLine, --unit etc. and make unit optional, the others required.
(if it turns out we need unitName ... which it might)
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.
Refactored to argument parser in 78bf51f .
const { stdout } = await execAsync(getCodedTestsSupportCommand, { | ||
cwd: enviroPath, | ||
}); | ||
const { stdout, stderr } = await execAsync(getCodedTestsSupportCommand, { |
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.
Add a (meaningful) comment
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.
Added in c73e858 .
server/tstCompletion.ts
Outdated
); | ||
console.log("++++++++++++++++++++++++++++++"); |
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.
Remove
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.
Removed in 78bf51f.
server/tstCompletion.ts
Outdated
returnData.extraText = choiceData.extraText; | ||
returnData.messages = choiceData.messages; | ||
choiceKind = choiceData.choiceKind; | ||
// append actual choices to the default INIT and COMPOUND | ||
choiceArray = choiceArray.concat(choiceData.choiceList); | ||
// choiceArray = choiceArray.concat(choiceData.choiceList); |
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.
Why iis this commented out?
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.
I am sorry it was only a Draft so I didn't delete pieces of the "old" code in case you do not like my idea how I solved it. Removed in 78bf51f .
server/tstCompletion.ts
Outdated
// <<GLOBAL>> is valid on VALUE lines but not as a function name! | ||
choiceArray = filterArray(choiceArray, "<<GLOBAL>>"); | ||
// choiceArray = filterArray(choiceArray, "<<GLOBAL>>"); |
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.
Same
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.
Removed in 78bf51f .
Summary:
This implementation should provide an autocompletion list for
TEST.SUBPROGRAM
without using the fakeTEST.VALUE
line described in #170.Explanation:
TEST.SUBPROGRAM
, we need the<unit>
fromTEST.UNIT
.getNearest()
intstCompletion.ts
.<unit>
is sent as an additional parameter to the Python logic.processSubprogramLines()
(tstUtilities.py), we use this<unit>
to retrieve, withgetFunctions()
, theautocompletion
list of all the functions in this unit from theDataAPI
.<<INIT>>, <<COMPOUND>>, <<coded_tests_driver>>
.Basically, the implementation works. However, we need to answer some questions:
Questions:
Passing this argument into
getChoiceDataFromPython
is straightforward, but how about the "server-side" autocompletion retrieval ingetChoiceDataFromServer()
?vector-vscode-vcast/server/pythonUtilities.ts
Line 101 in 2992c9e
What about the SUBPROGRAM-specific autocompletions (
<<INIT>>, <<COMPOUND>>, coded_tests_driver
)?Is it all right to add them like that in
processSubprogramLines()
, or should this also be retrieved from the DataAPI somehow?