fix: include export mode when retrieving import statements VSCODE-440 #677
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The
getImports
transpiler method expects two argumentsmode: 'Pipeline' | 'Query' | 'Delete Query' | 'Update Query'
driverSyntax: boolean
source: https://github.com/mongodb-js/compass/blob/92f267e369d188c5f11c2450f3d65f73725558e4/packages/bson-transpilers/codegeneration/CodeGenerationVisitor.js#L94
In VSCode we have only two modes:
The main fix is sending two arguments (which allows for the second to be read correctly).
As far as I can tell, the exact mode only matters for Java. Given that the method applied is a wild guess, user might need to adjust the import together with the code anyway, but at least the imports now match the code.
Steps to reproduce:
Current behaviour:
The import statements are only
After the fix:
If you've selected an array, you'll also see -
And for an object -
Checklist
Motivation and Context
Open Questions
I feel weird about the test placement, but this was the best I found.
I made an attempt to at least separate the test into three smaller pieces. I thought it would work since mocha runs the tests sequentially, but it didn't work and I gave up 😅 . I haven't worked with mocha for a long time, so maybe I'm missing something
Types of changes