Skip to content

Commit

Permalink
Add comments to loadFilesFromGist
Browse files Browse the repository at this point in the history
  • Loading branch information
magland committed Jun 27, 2024
1 parent 0ce27c0 commit a5c5a6f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion gui/src/app/SPAnalysis/loadFilesFromGist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,19 @@ const loadFilesFromGist = async (gistUri: string): Promise<{ files: { [key: stri
if (!file) continue
let content = file.content
if (content === undefined) continue
// gists do not support empty files or whitespace-only files
// Gists do not support empty files or whitespace-only files. This
// provides a workaround for that by allowing the user to specify an
// empty file by starting the content with the string '<<empty>>'. This
// is then removed from the content.
if (content.startsWith('<<empty>>')) {
const x = content.slice('<<empty>>'.length)
if (x.trim() === '') {
content = x
}
}
// Gists do not support directories This is a placeholder for the future
// where we may want a subdirectory structure for project files. Here we
// replace the '|' character with '/' to simulate a directory structure.
const fname2 = replaceBarsWithSlashes(fname)
files[fname2] = content
}
Expand Down

0 comments on commit a5c5a6f

Please sign in to comment.