meta: Don't exclude 'loophole' or 'pegjs' packages #206
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.
Requirements for Contributing a Bug Fix (click to expand):
Identify the Bug
When trying to type a tab character in a document or file, after #201 was merged, there is an error:
Screenshot (click to expand):
Screenshot (click to expand):
Explanation as for why this happens:
There is a file
snippet-body.pegjs
which 'snippets' expects to have been compiled from .pegjs to .js. If it can't require the plain .js file successfully (it assumes this is because the .pegjs file hasn't been transpiled to plain JS yet, which is correct in our case)... then it appears to fall back on live-transpiling the .pegjs file using the 'pegjs' module.See: https://github.com/pulsar-edit/snippets/blob/388d9b63cacbc124652e9cec6ce4be6e3d6d46bf/lib/snippet-body-parser.js#L2-L12
So we need to have the 'pegjs' module (and 'loophole', whatever that is) in order to load 'snippets' package properly and restore the ability to type tab characters. (The app appears to trigger the 'snippets' package to activate every time you type a Tab? Which I understand is for code autocompletion purposes.)
Description of the Change
Don't exclude 'loophole' or 'pegjs' packages from the app bundle. Allows the 'snippets' package to work again.
Alternate Designs
We can attempt to compile the PegJS files to plain JS, like the old build scripts used to do. See: script/lib/transpile-peg-js-paths.js at Atom core repo.
At which point we apparently wouldn't need these packages.
Possible Drawbacks
Increases the final app bundle size by some 0.2 Megabytes, after compression, adds more files to the final bundle.
Verification Process
Tested CI binaries with/without these changes on my Windows 10 machine:
master
with #201: Affected by the tab bug described at the top of this PR. ❌Release Notes
Fix a bug when typing a tab character in a document or file