vectorgrp / vector-vscode-vcast

A VectorCAST test adapter for VS Code
Other
8 stars 2 forks source link

Update ct support for tst #170 #193

Open Den1552 opened 2 months ago

Den1552 commented 2 months ago

Summary

Updates script editing to support coded tests and resolves #170.

Added

Den1552 commented 2 months ago

Currently working on Note:

In file tstCompletions.ts, comment: // TBD will need to change how this is done during the fix for issue #170 The way I get the completion for TEST.SUBPROGRAM is a little bit of a hack and will need to change Currently, I send a fake TEST.VALUE:unit. line to get the list of subprograms But currently, the Python strips coded_tests_driver in function: getFunctionList()

-- > Check how to get autocompletion for TEST.SUBPROGRAM without hardcoding it & get correct autocompletion items.

Problem is: I need the unit. So either:

Some ideas / brainstorming:

1) Retrieve unit with getNearestin ts and add it as an additional param --> Additional param --> Very specific (what if we need in future more than just the unit in python?) --> Send JSON?

2) Save tst to temp file and send abs path as additional param and retrieve the unit in python --> Would be on an "logical level" the correct place imo --> Good if we need the whole tst for later stuff --> - Additional read/write, even though we read it already in ts

3) Get Unit with getNearestin ts, concatit as TEST.SUBPROGRAM:<unit> and send it to get autocompletion --> No big implementation changes since getFunctionList gets called here --> Just add <<INIT>> and <<COMPOUND>> at the end --> But is weird, since TEST.SUBPROGRAM:<unit> is wrong and maintainability would suffer since you do not expect that it works that way.

--> Will do 1) first, as I think that additional params can just be added in the json if needed.

Zbigor commented 2 months ago

Currently working on Note:

In file tstCompletions.ts, comment: // TBD will need to change how this is done during the fix for issue #170 The way I get the completion for TEST.SUBPROGRAM is a little bit of a hack and will need to change Currently, I send a fake TEST.VALUE:unit. line to get the list of subprograms But currently, the Python strips coded_tests_driver in function: getFunctionList()

-- > Check how to get autocompletion for TEST.SUBPROGRAM without hardcoding it & get correct autocompletion items.

Problem is: I need the unit. So either:

Some ideas / brainstorming:

1) Retrieve unit with getNearestin ts and add it as an additional param --> Additional param --> Very specific (what if we need in future more than just the unit in python?) --> Send JSON?

2) Save tst to temp file and send abs path as additional param and retrieve the unit in python --> Would be on an "logical level" the correct place imo --> Good if we need the whole tst for later stuff

3) Get Unit with getNearestin ts, concatit as TEST.SUBPROGRAM:<unit> and send it to get autocompletion --> No big implementation changes since getFunctionList gets called here --> Just add <<INIT>> and <<COMPOUND>> at the end --> But is weird, since TEST.SUBPROGRAM:<unit> is wrong and maintainability would suffer since you do not expect that it works that way.

--> Will do 1) first, as I think that additional params can just be added in the json if needed.

Can you elaborate on the 2? Where and what would actually be implemented (python/ts, which function)? Could you pass around some string instead of having a tempfile? Whichever option you implement should be in a separate branch off of this branch

Den1552 commented 2 months ago

Can you elaborate on the 2? Where and what would actually be implemented (python/ts, which function)? Could you pass around some string instead of having a tempfile? Whichever option you implement should be in a separate branch off of this branch

Currently working on Note:

In file tstCompletions.ts, comment: // TBD will need to change how this is done during the fix for issue #170 The way I get the completion for TEST.SUBPROGRAM is a little bit of a hack and will need to change Currently, I send a fake TEST.VALUE:unit. line to get the list of subprograms But currently, the Python strips coded_tests_driver in function: getFunctionList()

-- > Check how to get autocompletion for TEST.SUBPROGRAM without hardcoding it & get correct autocompletion items. Problem is: I need the unit. So either: Some ideas / brainstorming: 1) Retrieve unit with getNearestin ts and add it as an additional param --> Additional param --> Very specific (what if we need in future more than just the unit in python?) --> Send JSON? 2) Save tst to temp file and send abs path as additional param and retrieve the unit in python --> Would be on an "logical level" the correct place imo --> Good if we need the whole tst for later stuff 3) Get Unit with getNearestin ts, concatit as TEST.SUBPROGRAM:<unit> and send it to get autocompletion --> No big implementation changes since getFunctionList gets called here --> Just add <<INIT>> and <<COMPOUND>> at the end --> But is weird, since TEST.SUBPROGRAM:<unit> is wrong and maintainability would suffer since you do not expect that it works that way. --> Will do 1) first, as I think that additional params can just be added in the json if needed.

Can you elaborate on the 2? Where and what would actually be implemented (python/ts, which function)? Could you pass around some string instead of having a tempfile? Whichever option you implement should be in a separate branch off of this branch

Here the idea was to basically have the whole tst document in python ready. And the easiest way to have the whole document ready would be probably to save it in a temp file and then load it again in python.

Your idea of parsing a string is basically idea 1). Just that I do not want to parse the whole tst string as it will get executed in a command line.

https://github.com/vectorgrp/vector-vscode-vcast/blob/e643e928f318589fa5b34902ac4c544d04f4cfe3/server/pythonUtilities.ts#L67

If the file becomes too large, it could lead to issues (I think).

The idea is to create an object (like JSON) that carries the necessary parameters. For example, currently, I would have {params: {unit: "moo"}}. If more parameters are needed later, they can be easily added.

sonarcloud[bot] commented 1 month ago

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarCloud