You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provide custom loadfilecontents and loadfilebuffer options in Template.fromDirectory()
Use Case
Loading template directories from a virtual file system where fs module cannot be used.
Example: VSCode-Web
Possible Solution
The options dictionary can accept option parameter loadFileContents and loadFileBuffer to alter the way in which file content is read from memory.
Context
A simple fix to this can be help us load Templates in VSCode Extension where only file reading logic is to be altered without altering the way in which the contents of these files are used to create the Template object.
Would you like to work on this?
Yes
The text was updated successfully, but these errors were encountered:
Currently, the logic written for loading templates from a VSCode workspace here and the logic written here is the same. The only difference is the way in which they load file contents. Where cicero-core uses fs, VSCode extension uses vscode.workspace.fs. Sometime in the future, if the logic to load templates from directories changes in cicero-core here, the same should be reflected in the logic written within VSCode extension code here.
Possible solution to prevent duplicate logic
Allow the passing an optional loadFileBuffer and loadFileContents parameter into fromDirectory method here which will let us use the same fromDirectory method from cicero-core but with different logic to read and write files.
Another way would be to mention the same in the comments above fromDirectory method in cicero-core that the logic is duplicated here. So that whenever something changes in cicero-core, the same is reflected in the code for vscode-extension.
I am not sure if the same can be achieved with the current core library itself. It would be great if you have any inputs @mttrbrts.
Feature Request 🛍️
Provide custom loadfilecontents and loadfilebuffer options in
Template.fromDirectory()
Use Case
Loading template directories from a virtual file system where
fs
module cannot be used.Example: VSCode-Web
Possible Solution
The options dictionary can accept option parameter
loadFileContents
andloadFileBuffer
to alter the way in which file content is read from memory.Context
A simple fix to this can be help us load Templates in VSCode Extension where only file reading logic is to be altered
without
altering the way in which the contents of these files are used to create theTemplate
object.Would you like to work on this?
Yes
The text was updated successfully, but these errors were encountered: