Skip to content
This repository was archived by the owner on Aug 7, 2023. It is now read-only.

Commit 539c63f

Browse files
wallesArcanemagus
authored andcommitted
Improve Atom's startup time (#87)
* Improve Atom's startup time Before this change, activation was done on Atom startup, whether or not you actually had any shell scripts open. With this change in place, we postpone activation until the Atom Shellscript grammar's first use. This improves startup time of my Atom by about 24ms, thus fixing one of the top startup time offenders according to TimeCop. For some frame of reference, I have 88 packages installed, and Timecop lists all packages with startup times above 5ms.
1 parent 342098c commit 539c63f

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"engines": {
99
"atom": ">=1.4.0 <2.0.0"
1010
},
11+
"activationHooks": ["language-shellscript:grammar-used"],
1112
"scripts": {
1213
"test": "apm test",
1314
"lint": "eslint ."

spec/linter-shellcheck-spec.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,18 @@ describe('The ShellCheck provider for Linter', () => {
1111
beforeEach(() => {
1212
atom.workspace.destroyActivePaneItem();
1313

14+
// Info about this beforeEach() implementation:
15+
// https://github.com/AtomLinter/Meta/issues/15
16+
const activationPromise =
17+
atom.packages.activatePackage('linter-shellcheck');
18+
1419
waitsForPromise(() =>
15-
Promise.all([
16-
atom.packages.activatePackage('linter-shellcheck'),
17-
])
20+
atom.packages.activatePackage('language-shellscript').then(() =>
21+
atom.workspace.open(cleanPath))
1822
);
23+
24+
atom.packages.triggerDeferredActivationHooks();
25+
waitsForPromise(() => activationPromise);
1926
});
2027

2128
it('finds nothing wrong with a valid file', () => {

0 commit comments

Comments
 (0)