Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
package: run lint:fix
Browse files Browse the repository at this point in the history
All of these changes we're made by `prettier` automatically
  • Loading branch information
fluvf committed Sep 22, 2020
1 parent bca4e24 commit a7dafdc
Show file tree
Hide file tree
Showing 19 changed files with 1,978 additions and 1,436 deletions.
12 changes: 6 additions & 6 deletions ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ Do you want to ask a question? Are you looking for support? The Atom message boa

### Prerequisites

* [ ] Put an X between the brackets on this line if you have done all of the following:
* Reproduced the problem in Safe Mode: http://flight-manual.atom.io/hacking-atom/sections/debugging/#using-safe-mode
* Followed all applicable steps in the debugging guide: http://flight-manual.atom.io/hacking-atom/sections/debugging/
* Checked the FAQs on the message board for common solutions: https://discuss.atom.io/c/faq
* Checked that your issue isn't already filed: https://github.com/issues?utf8=✓&q=is%3Aissue+user%3Aatom
* Checked that there is not already an Atom package that provides the described functionality: https://atom.io/packages
- [ ] Put an X between the brackets on this line if you have done all of the following:
- Reproduced the problem in Safe Mode: http://flight-manual.atom.io/hacking-atom/sections/debugging/#using-safe-mode
- Followed all applicable steps in the debugging guide: http://flight-manual.atom.io/hacking-atom/sections/debugging/
- Checked the FAQs on the message board for common solutions: https://discuss.atom.io/c/faq
- Checked that your issue isn't already filed: https://github.com/issues?utf8=✓&q=is%3Aissue+user%3Aatom
- Checked that there is not already an Atom package that provides the described functionality: https://atom.io/packages

### Description

Expand Down
4 changes: 2 additions & 2 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### Requirements

* Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
* All new code requires tests to ensure against regressions
- Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
- All new code requires tests to ensure against regressions

### Description of the Change

Expand Down
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Snippets package

[![macOS Build Status](https://travis-ci.org/atom/snippets.svg?branch=master)](https://travis-ci.org/atom/snippets) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/8hlc0onofkgbxw53/branch/master?svg=true)](https://ci.appveyor.com/project/Atom/snippets/branch/master) [![Dependency Status](https://david-dm.org/atom/snippets.svg)](https://david-dm.org/atom/snippets)

Expand snippets matching the current prefix with <kbd>tab</kbd> in Atom.
Expand Down Expand Up @@ -27,23 +28,25 @@ Under each snippet name is a `prefix` that should trigger the snippet and a `bod
The above example adds a `log` snippet to JavaScript files that would expand to.

```js
console.log("crash");
console.log('crash');
```

The string `"crash"` would be initially selected and pressing tab again would place the cursor after the `;`

### Optional parameters

These parameters are meant to provide extra information about your snippet to [autocomplete-plus](https://github.com/atom/autocomplete-plus/wiki/Provider-API).

* `leftLabel` will add text to the left part of the autocomplete results box.
* `leftLabelHTML` will overwrite what's in `leftLabel` and allow you to use a bit of CSS such as `color`.
* `rightLabelHTML`. By default, in the right part of the results box you will see the name of the snippet. When using `rightLabelHTML` the name of the snippet will no longer be displayed, and you will be able to use a bit of CSS.
* `description` will add text to a description box under the autocomplete results list.
* `descriptionMoreURL` URL to the documentation of the snippet.
- `leftLabel` will add text to the left part of the autocomplete results box.
- `leftLabelHTML` will overwrite what's in `leftLabel` and allow you to use a bit of CSS such as `color`.
- `rightLabelHTML`. By default, in the right part of the results box you will see the name of the snippet. When using `rightLabelHTML` the name of the snippet will no longer be displayed, and you will be able to use a bit of CSS.
- `description` will add text to a description box under the autocomplete results list.
- `descriptionMoreURL` URL to the documentation of the snippet.

![autocomplete-description](http://i.imgur.com/cvI2lOq.png)

Example:

```coffee
'.source.js':
'console.log':
Expand All @@ -55,7 +58,7 @@ Example:

### Determining the correct scope for a snippet

The outmost key of a snippet is the "scope" that you want the descendent snippets to be available in. The key should be prefixed with a period (`text.html.basic` => `.text.html.basic`). You can find out the correct scope by opening the Settings (<kbd>cmd-,</kbd> on macOS) and selecting the corresponding *Language [xxx]* package, e.g. for *Language Html*:
The outmost key of a snippet is the "scope" that you want the descendent snippets to be available in. The key should be prefixed with a period (`text.html.basic` => `.text.html.basic`). You can find out the correct scope by opening the Settings (<kbd>cmd-,</kbd> on macOS) and selecting the corresponding _Language [xxx]_ package, e.g. for _Language Html_:

![Screenshot of Language Html settings](https://cloud.githubusercontent.com/assets/1038121/5137632/126beb66-70f2-11e4-839b-bc7e84103f67.png)

Expand All @@ -68,9 +71,9 @@ This package supports a subset of the features of TextMate snippets, [documented

The following features are not yet supported:

* Variables
* Interpolated shell code
* Conditional insertions in transformations
- Variables
- Interpolated shell code
- Conditional insertions in transformations

### Multi-line Snippet Body

Expand Down
10 changes: 5 additions & 5 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
version: "{build}"
version: '{build}'

platform: x64

branches:
only:
- master
only:
- master

clone_depth: 10

Expand All @@ -14,8 +14,8 @@ environment:
APM_TEST_PACKAGES:

matrix:
- ATOM_CHANNEL: stable
- ATOM_CHANNEL: beta
- ATOM_CHANNEL: stable
- ATOM_CHANNEL: beta

install:
- ps: Install-Product node 4
Expand Down
91 changes: 50 additions & 41 deletions lib/editor-store.js
Original file line number Diff line number Diff line change
@@ -1,73 +1,82 @@
const SnippetHistoryProvider = require('./snippet-history-provider')
const SnippetHistoryProvider = require('./snippet-history-provider');

class EditorStore {
constructor (editor) {
this.editor = editor
this.buffer = this.editor.getBuffer()
this.observer = null
this.checkpoint = null
this.expansions = []
this.existingHistoryProvider = null
constructor(editor) {
this.editor = editor;
this.buffer = this.editor.getBuffer();
this.observer = null;
this.checkpoint = null;
this.expansions = [];
this.existingHistoryProvider = null;
}

getExpansions () {
return this.expansions
getExpansions() {
return this.expansions;
}

setExpansions (list) {
this.expansions = list
setExpansions(list) {
this.expansions = list;
}

clearExpansions () {
this.expansions = []
clearExpansions() {
this.expansions = [];
}

addExpansion (snippetExpansion) {
this.expansions.push(snippetExpansion)
addExpansion(snippetExpansion) {
this.expansions.push(snippetExpansion);
}

observeHistory (delegates) {
observeHistory(delegates) {
if (this.existingHistoryProvider == null) {
this.existingHistoryProvider = this.buffer.historyProvider
this.existingHistoryProvider = this.buffer.historyProvider;
}

const newProvider = SnippetHistoryProvider(this.existingHistoryProvider, delegates)
this.buffer.setHistoryProvider(newProvider)
const newProvider = SnippetHistoryProvider(
this.existingHistoryProvider,
delegates
);
this.buffer.setHistoryProvider(newProvider);
}

stopObservingHistory (editor) {
if (this.existingHistoryProvider == null) { return }
this.buffer.setHistoryProvider(this.existingHistoryProvider)
this.existingHistoryProvider = null
stopObservingHistory(editor) {
if (this.existingHistoryProvider == null) {
return;
}
this.buffer.setHistoryProvider(this.existingHistoryProvider);
this.existingHistoryProvider = null;
}

observe (callback) {
if (this.observer != null) { this.observer.dispose() }
this.observer = this.buffer.onDidChangeText(callback)
observe(callback) {
if (this.observer != null) {
this.observer.dispose();
}
this.observer = this.buffer.onDidChangeText(callback);
}

stopObserving () {
if (this.observer == null) { return false }
this.observer.dispose()
this.observer = null
return true
stopObserving() {
if (this.observer == null) {
return false;
}
this.observer.dispose();
this.observer = null;
return true;
}

makeCheckpoint () {
const existing = this.checkpoint
makeCheckpoint() {
const existing = this.checkpoint;
if (existing) {
this.buffer.groupChangesSinceCheckpoint(existing)
this.buffer.groupChangesSinceCheckpoint(existing);
}
this.checkpoint = this.buffer.createCheckpoint()
this.checkpoint = this.buffer.createCheckpoint();
}
}

EditorStore.store = new WeakMap()
EditorStore.store = new WeakMap();
EditorStore.findOrCreate = function (editor) {
if (!this.store.has(editor)) {
this.store.set(editor, new EditorStore(editor))
this.store.set(editor, new EditorStore(editor));
}
return this.store.get(editor)
}
return this.store.get(editor);
};

module.exports = EditorStore
module.exports = EditorStore;
10 changes: 5 additions & 5 deletions lib/helpers.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/** @babel */

import path from 'path'
import path from 'path';

export function getPackageRoot() {
const {resourcePath} = atom.getLoadSettings()
const currentFileWasRequiredFromSnapshot = !path.isAbsolute(__dirname)
const { resourcePath } = atom.getLoadSettings();
const currentFileWasRequiredFromSnapshot = !path.isAbsolute(__dirname);
if (currentFileWasRequiredFromSnapshot) {
return path.join(resourcePath, 'node_modules', 'snippets')
return path.join(resourcePath, 'node_modules', 'snippets');
} else {
return path.resolve(__dirname, '..')
return path.resolve(__dirname, '..');
}
}

0 comments on commit a7dafdc

Please sign in to comment.