Skip to content

Commit 2fd9fdb

Browse files
committed
Cleanup code (by adding prettier)
1 parent e2017b4 commit 2fd9fdb

File tree

5 files changed

+31
-13
lines changed

5 files changed

+31
-13
lines changed

.prettierrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": true
4+
}

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
## 0.0.0
1+
## 0.0.2
22

3-
- Add basic go to definition
3+
- Cleanup code (by adding and running prettier).
4+
5+
## 0.0.1
6+
7+
- Go to definition using keyboard shortcut or context menu "Go to Definition".

lib/atom-ide-definitions.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,20 @@
33
import { CompositeDisposable } from 'atom';
44

55
export default {
6-
76
subscriptions: null,
87
provider: null,
98

10-
activate(state) {
9+
activate() {
1110
// Events subscribed to in atom's system can be easily cleaned up with a CompositeDisposable
1211
this.subscriptions = new CompositeDisposable();
1312

1413
// Register command that toggles this view
15-
this.subscriptions.add(atom.commands.add('atom-workspace', {
16-
'atom-ide-go-to-definition:go-to-definition': () => this.goToDefinition()
17-
}));
14+
this.subscriptions.add(
15+
atom.commands.add('atom-workspace', {
16+
'atom-ide-go-to-definition:go-to-definition': () =>
17+
this.goToDefinition(),
18+
})
19+
);
1820
},
1921

2022
deactivate() {
@@ -35,21 +37,24 @@ export default {
3537
return;
3638
}
3739

38-
const {definitions, queryRange} = result;
40+
const { definitions } = result;
3941

4042
if (!definitions || definitions.length === 0) {
4143
console.log('No definitions found.');
4244
return;
4345
}
4446

45-
const {path, position: {row, column}} = definitions[0]
47+
const {
48+
path,
49+
position: { row, column },
50+
} = definitions[0];
4651

4752
if (editor.getPath() === path) {
4853
const paneContainer = atom.workspace.paneContainerForItem(editor);
4954
paneContainer.activate();
5055

5156
editor.setCursorBufferPosition([row, column]);
52-
editor.scrollToBufferPosition([row, column], {center: true});
57+
editor.scrollToBufferPosition([row, column], { center: true });
5358
} else {
5459
await atom.workspace.open(path, {
5560
initialLine: row,
@@ -63,6 +68,5 @@ export default {
6368

6469
consumeDefinitionsService(provider) {
6570
this.provider = provider;
66-
}
67-
71+
},
6872
};

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
},
2222
"devDependencies": {
2323
"@types/atom": "^1.31.1",
24-
"@types/node": "^11.10.4"
24+
"@types/node": "^11.10.4",
25+
"prettier": "1.16.4"
2526
},
2627
"consumedServices": {
2728
"definitions": {

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ fuzzaldrin-plus@^0.6.0:
2929
resolved "https://registry.yarnpkg.com/fuzzaldrin-plus/-/fuzzaldrin-plus-0.6.0.tgz#832f6489fbe876769459599c914a670ec22947ee"
3030
integrity sha1-gy9kifvodnaUWVmckUpnDsIpR+4=
3131

32+
prettier@^1.16.4:
33+
version "1.16.4"
34+
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.16.4.tgz#73e37e73e018ad2db9c76742e2647e21790c9717"
35+
integrity sha512-ZzWuos7TI5CKUeQAtFd6Zhm2s6EpAD/ZLApIhsF9pRvRtM1RFo61dM/4MSRUA0SuLugA/zgrZD8m0BaY46Og7g==
36+
3237
3338
version "4.0.0"
3439
resolved "https://registry.yarnpkg.com/vscode-jsonrpc/-/vscode-jsonrpc-4.0.0.tgz#a7bf74ef3254d0a0c272fab15c82128e378b3be9"

0 commit comments

Comments
 (0)