Skip to content
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

feat: Move getActiveEditorContent function to utils #929

Merged
merged 2 commits into from
May 8, 2024

Conversation

amitjoshi438
Copy link
Contributor

The code changes add a new function called getActiveEditorContent to the Utils module. This function retrieves the content and parameters of the active editor in Visual Studio Code.
This pull request primarily involves changes to the src/common/Utils.ts and src/common/copilot/PowerPagesCopilot.ts files. The main changes include the addition of new imports in Utils.ts, the creation of a new function getActiveEditorContent() in Utils.ts, and the removal of the getActiveEditorContent() method from PowerPagesCopilot.ts to use the newly created function from Utils.ts.

Additions and modifications in src/common/Utils.ts:

  • Added new imports from ./copilot/constants and ./copilot/model to include DataverseEntityNameMap, EntityFieldMap, FieldTypeMap, and IActiveFileData, IActiveFileParams respectively.
  • Created a new function getActiveEditorContent(). This function retrieves the content of the active editor and returns an object of type IActiveFileData. The object includes the content of the active file and parameters related to the active file such as dataverseEntity, entityField, and fieldType.

Changes in src/common/copilot/PowerPagesCopilot.ts:

  • Replaced the import of getLastThreePartsOfFileName with getActiveEditorContent from ../Utils.
  • Replaced the call to this.getActiveEditorContent() with getActiveEditorContent() in the PowerPagesCopilot class. This change reflects the move of the getActiveEditorContent() function to Utils.ts.
  • Removed the getActiveEditorContent() method from the PowerPagesCopilot class as it is now located in Utils.ts.

…r data

The code changes add a new function called getActiveEditorContent to the Utils module. This function retrieves the content and parameters of the active editor in Visual Studio Code. It is used in the PowerPagesCopilot module to get the active file content and its associated parameters.

Co-authored-by: amitjoshi <[email protected]>
@amitjoshi438 amitjoshi438 requested review from a team as code owners May 3, 2024 12:24
@amitjoshi438 amitjoshi438 enabled auto-merge (squash) May 8, 2024 08:43
@amitjoshi438 amitjoshi438 merged commit 5f16f62 into main May 8, 2024
4 checks passed
@amitjoshi438 amitjoshi438 deleted the user/amitjoshi/getActiveFileInfoToUtils branch May 8, 2024 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants